/*
 * CODSHIPX_AI_R63_R22_BOT_RULES_UI_FINAL
 * Knowledge + Bot Rules action group and workspace rule manager.
 */

.cx-r63-r22-knowledge-head{
  display:grid !important;
  grid-template-columns:minmax(0,1fr) auto auto !important;
  align-items:center !important;
  column-gap:12px !important;
  row-gap:12px !important;
}

.cx-r63-r22-knowledge-head > div:first-child{
  min-width:0;
}

.cx-r63-r22-add-source,
#cx-r63-r22-bot-rules-button{
  width:auto !important;
  min-width:134px !important;
  height:50px !important;
  margin:0 !important;
  padding:0 22px !important;
  border-radius:15px !important;
  font:800 14px/1 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif !important;
  letter-spacing:-.01em !important;
  white-space:nowrap !important;
  transform:translateZ(0);
  transition:
    transform .16s ease,
    box-shadow .16s ease,
    filter .16s ease !important;
}

.cx-r63-r22-add-source{
  box-shadow:0 12px 28px rgba(143,218,0,.18) !important;
}

#cx-r63-r22-bot-rules-button{
  color:#fff !important;
  border:1px solid rgba(31,126,102,.35) !important;
  background:
    linear-gradient(180deg,#176b58 0%,#0d5646 100%) !important;
  box-shadow:
    0 12px 28px rgba(13,86,70,.18),
    inset 0 1px 0 rgba(255,255,255,.12) !important;
}

.cx-r63-r22-add-source:hover,
#cx-r63-r22-bot-rules-button:hover{
  transform:translateY(-1px) !important;
  filter:brightness(1.03) !important;
}

.cx-r63-r22-add-source:active,
#cx-r63-r22-bot-rules-button:active{
  transform:translateY(0) scale(.985) !important;
}

#cx-r63-r22-rules-modal{
  position:fixed;
  inset:0;
  z-index:2147482600;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
  background:rgba(5,12,18,.62);
  backdrop-filter:blur(12px);
  -webkit-backdrop-filter:blur(12px);
}

#cx-r63-r22-rules-modal[hidden]{
  display:none !important;
}

.cx-r63-r22-modal-card{
  width:min(920px,100%);
  max-height:min(88vh,900px);
  overflow:hidden;
  display:grid;
  grid-template-rows:auto minmax(0,1fr) auto;
  color:#10233e;
  border:1px solid rgba(148,163,184,.28);
  border-radius:24px;
  background:
    radial-gradient(circle at 90% 0%,rgba(153,237,18,.08),transparent 28%),
    #fff;
  box-shadow:0 34px 90px rgba(2,12,27,.30);
}

.cx-r63-r22-modal-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:22px;
  padding:24px 26px 18px;
  border-bottom:1px solid #e8eef5;
}

.cx-r63-r22-modal-kicker{
  display:block;
  margin-bottom:5px;
  color:#65a30d;
  font-size:11px;
  font-weight:900;
  letter-spacing:.12em;
  text-transform:uppercase;
}

.cx-r63-r22-modal-head h2{
  margin:0;
  color:#0b1f3a;
  font-size:23px;
  line-height:1.15;
  letter-spacing:-.035em;
}

.cx-r63-r22-modal-head p{
  max-width:660px;
  margin:8px 0 0;
  color:#6b7f99;
  font-size:13px;
  line-height:1.55;
}

.cx-r63-r22-close{
  flex:0 0 auto;
  width:38px;
  height:38px;
  padding:0;
  border:1px solid #dbe5ef;
  border-radius:12px;
  color:#53657c;
  background:#f8fbfd;
  font-size:23px;
  line-height:1;
  cursor:pointer;
}

.cx-r63-r22-modal-body{
  overflow:auto;
  padding:22px 26px 26px;
}

.cx-r63-r22-section-title{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin:0 0 12px;
}

.cx-r63-r22-section-title strong{
  color:#122641;
  font-size:14px;
}

.cx-r63-r22-section-title span{
  color:#8192a8;
  font-size:12px;
}

.cx-r63-r22-current{
  display:grid;
  gap:10px;
  margin-bottom:22px;
}

.cx-r63-r22-empty{
  padding:18px;
  border:1px dashed #d7e2ec;
  border-radius:16px;
  color:#7b8ca2;
  background:#fbfdff;
  font-size:13px;
}

.cx-r63-r22-rule-row{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:16px;
  align-items:center;
  padding:15px 16px;
  border:1px solid #e0e8f0;
  border-radius:17px;
  background:#fbfdff;
}

.cx-r63-r22-rule-main{
  min-width:0;
}

.cx-r63-r22-rule-top{
  display:flex;
  align-items:center;
  gap:9px;
  min-width:0;
}

.cx-r63-r22-rule-top strong{
  overflow:hidden;
  color:#11253f;
  font-size:14px;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.cx-r63-r22-rule-main p{
  display:-webkit-box;
  overflow:hidden;
  margin:7px 0 0;
  color:#71849d;
  font-size:12px;
  line-height:1.45;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
}

.cx-r63-r22-status{
  flex:0 0 auto;
  padding:5px 8px;
  border-radius:999px;
  font-size:10px;
  font-weight:900;
  letter-spacing:.05em;
  text-transform:uppercase;
}

.cx-r63-r22-status.active{
  color:#3f7400;
  background:#eaf8d7;
}

.cx-r63-r22-status.inactive{
  color:#65758b;
  background:#edf2f7;
}

.cx-r63-r22-rule-actions{
  display:flex;
  flex-wrap:wrap;
  justify-content:flex-end;
  gap:7px;
}

.cx-r63-r22-mini{
  height:34px;
  padding:0 11px;
  border:1px solid #d7e2ec;
  border-radius:10px;
  color:#29425f;
  background:#fff;
  font-size:12px;
  font-weight:800;
  cursor:pointer;
}

.cx-r63-r22-mini.primary{
  color:#0d5d48;
  border-color:#bee6d8;
  background:#effbf6;
}

.cx-r63-r22-mini.danger{
  color:#ba3b4a;
  border-color:#f0ccd1;
  background:#fff8f9;
}

.cx-r63-r22-editor{
  padding:18px;
  border:1px solid #dfe8f0;
  border-radius:19px;
  background:#f8fbfd;
}

.cx-r63-r22-editor-grid{
  display:grid;
  grid-template-columns:minmax(0,1fr) 220px;
  gap:12px;
}

.cx-r63-r22-field{
  display:grid;
  gap:7px;
}

.cx-r63-r22-field.wide{
  grid-column:1 / -1;
}

.cx-r63-r22-field > span{
  color:#52677f;
  font-size:12px;
  font-weight:800;
}

.cx-r63-r22-field input[type="text"],
.cx-r63-r22-field textarea,
.cx-r63-r22-filebox{
  width:100%;
  box-sizing:border-box;
  border:1px solid #d5e0ea;
  border-radius:13px;
  outline:none;
  color:#122640;
  background:#fff;
  font:500 13px/1.5 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  transition:border-color .15s ease,box-shadow .15s ease;
}

.cx-r63-r22-field input[type="text"]{
  height:44px;
  padding:0 13px;
}

.cx-r63-r22-field textarea{
  min-height:230px;
  resize:vertical;
  padding:13px;
}

.cx-r63-r22-field input[type="text"]:focus,
.cx-r63-r22-field textarea:focus{
  border-color:#90d621;
  box-shadow:0 0 0 3px rgba(144,214,33,.13);
}

.cx-r63-r22-filebox{
  position:relative;
  height:44px;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:0 12px;
  color:#36516c;
  font-size:12px;
  font-weight:800;
  cursor:pointer;
}

.cx-r63-r22-filebox input{
  position:absolute;
  inset:0;
  opacity:0;
  cursor:pointer;
}

.cx-r63-r22-hint{
  margin:9px 0 0;
  color:#8191a5;
  font-size:11px;
  line-height:1.5;
}

.cx-r63-r22-flash{
  display:none;
  margin-bottom:12px;
  padding:11px 13px;
  border-radius:12px;
  font-size:12px;
  font-weight:700;
}

.cx-r63-r22-flash.show{
  display:block;
}

.cx-r63-r22-flash.ok{
  color:#2d6500;
  background:#edf9dc;
}

.cx-r63-r22-flash.error{
  color:#a62c3e;
  background:#fff0f2;
}

.cx-r63-r22-modal-foot{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:17px 26px;
  border-top:1px solid #e8eef5;
  background:#fbfdff;
}

.cx-r63-r22-foot-note{
  color:#778a9f;
  font-size:11px;
  line-height:1.45;
}

.cx-r63-r22-foot-actions{
  display:flex;
  align-items:center;
  gap:9px;
}

.cx-r63-r22-action{
  height:42px;
  padding:0 15px;
  border:1px solid #d6e0e9;
  border-radius:12px;
  font-size:12px;
  font-weight:850;
  cursor:pointer;
}

.cx-r63-r22-action.soft{
  color:#53687f;
  background:#fff;
}

.cx-r63-r22-action.primary{
  color:#102600;
  border-color:#8bd500;
  background:linear-gradient(180deg,#a6f20d,#8dde00);
  box-shadow:0 9px 20px rgba(139,213,0,.18);
}

.cx-r63-r22-action:disabled,
.cx-r63-r22-mini:disabled{
  opacity:.55;
  cursor:not-allowed;
}

@media (max-width:760px){
  .cx-r63-r22-knowledge-head{
    grid-template-columns:minmax(0,1fr) auto auto !important;
    column-gap:8px !important;
  }

  .cx-r63-r22-add-source,
  #cx-r63-r22-bot-rules-button{
    min-width:0 !important;
    height:46px !important;
    padding:0 13px !important;
    border-radius:13px !important;
    font-size:12px !important;
  }

  #cx-r63-r22-rules-modal{
    align-items:flex-end;
    padding:10px;
  }

  .cx-r63-r22-modal-card{
    max-height:92vh;
    border-radius:21px;
  }

  .cx-r63-r22-modal-head,
  .cx-r63-r22-modal-body,
  .cx-r63-r22-modal-foot{
    padding-left:17px;
    padding-right:17px;
  }

  .cx-r63-r22-editor-grid{
    grid-template-columns:1fr;
  }

  .cx-r63-r22-field.wide{
    grid-column:auto;
  }

  .cx-r63-r22-rule-row{
    grid-template-columns:1fr;
  }

  .cx-r63-r22-rule-actions{
    justify-content:flex-start;
  }

  .cx-r63-r22-modal-foot{
    align-items:stretch;
    flex-direction:column;
  }

  .cx-r63-r22-foot-actions{
    justify-content:flex-end;
  }
}
