/* ───────── Chat-Logs split-pane layout ───────── */
.cb-logs-split{
  display:flex; width:96vw; max-width:1000px; min-height:540px;
  background:#fff; border-radius:16px; box-shadow:0 8px 32px rgba(0,0,0,.12);
  overflow:hidden; font-family:'Inter',Arial,sans-serif; height:100%;
}

/* ---------- session list ---------- */
.cb-logs-list{flex:0 0 340px;background:#f9fafc;border-right:1.5px solid #e0e6ef;
  display:flex;flex-direction:column;height:100%;min-height:0;}
.cb-log-list-table-wrap{flex:1 1 auto;overflow-y:auto;padding-bottom:6px;}
.cb-log-table{width:100%;border-collapse:separate;border-spacing:0 9px;font-size:.98em;}
.cb-log-table th{padding:12px 10px;font-weight:600;font-size:1.03em;background:#f1f4f8;border:none;}
.cb-log-table td{padding:14px 10px;background:#fcfcfe;border:none;box-shadow:0 2px 10px rgba(60,160,140,.03);
  border-radius:8px;transition:background .15s,box-shadow .19s;}
.cb-log-table tr{cursor:pointer;background:#fcfcfe;border-radius:8px;transition:background .14s,box-shadow .16s;
  border-left:4px solid transparent;}
.cb-log-table tr:hover,
.cb-log-table tr.active{background:#e7f7f2;box-shadow:0 2px 16px rgba(44,180,156,.13);}
.cb-log-table tr.active{border-left-color:#1abc9c;box-shadow:0 2px 18px rgba(44,180,156,.16);}
.cb-log-controls{padding:14px 20px 10px;display:flex;gap:10px;}
.cb-log-controls input{flex:1;padding:7px 9px;border-radius:5px;border:1px solid #dbe5f0;background:#fff;}
.cb-log-controls select{padding:7px 8px;border-radius:5px;border:1px solid #dbe5f0;background:#fff;}
.cb-log-pager{padding:8px 0 10px;text-align:center;}
.cb-log-pager button{margin:0 5px;border:none;background:#eef2fb;border-radius:4px;padding:5px 10px;font-weight:500;}
.cb-log-pager button:disabled{opacity:.45;cursor:default;}

/* ---------- transcript pane ---------- */
.cb-log-transcript{flex:1 1 0;background:#fff;display:flex;flex-direction:column;min-width:0;height:100%;}
.cb-transcript-header{padding:16px 22px 12px;border-bottom:1px solid #e0e6ef;display:flex;align-items:center;}
.cb-transcript-title{font-weight:600;font-size:1.14em;}
.cb-transcript-body{flex:1 1 0;padding:18px 22px;overflow-y:auto;background:#f5f7fa;
  display:flex;flex-direction:column;min-height:0;gap:.4em;}
.cb-transcript-loading{color:#bbb;margin:40px auto;text-align:center;}

/* ---------- chat bubbles (stagger L/R) ---------- */
.cb-msg-bubble{
  display:inline-block; max-width:70%; padding:11px 17px; border-radius:18px;
  font-size:1.08em; line-height:1.54; box-shadow:0 2px 12px rgba(100,120,140,.05);
  word-break:break-word; position:relative;
}
.cb-msg-bubble.bot{
  background:#fff; color:#23242f; border:1.5px solid #e0e6ef;
  align-self:flex-start; margin:10px 0 0 0; border-bottom-left-radius:7px;
}
.cb-msg-bubble.user{
  background:#1abc9c; color:#fff; align-self:flex-end; margin:10px 0 0 auto;
  border-bottom-right-radius:7px;
}


/* metadata */
.cb-msg-meta{font-size:.93em;color:#888;margin-top:2px;text-align:right;}
.cb-msg-bubble.bot .cb-msg-meta{text-align:left;}

.cb-rag-badge,
.cb-fallback-badge{
  display:inline-block;font-size:.88em;font-weight:600;border-radius:5px;margin-left:8px;padding:2px 8px;
}
.cb-rag-badge{background:#e6f4fd;color:#179ae6;}
.cb-fallback-badge{background:#fee8e3;color:#d54a19;}

/* ---------- responsive ---------- */
@media(max-width:900px){
  .cb-logs-split{flex-direction:column;min-width:0;max-width:100vw;height:auto;}
  .cb-logs-list{border-right:none;border-bottom:1.5px solid #e0e6ef;}
  .cb-log-transcript{min-height:210px;}
}  and bot-editor.css just incase it has some conflicting styles: /* ───────────────────────────────────────────────
   BOT‑EDITOR  •  2025
   Responsive Modal with Sidebar / FAB Navigation
───────────────────────────────────────────────── */

/* ========= 1. OVERLAY & MODAL ========== */
.cb-modal-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(15,18,28,.60); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
}
.cb-modal.cb-editor {
  width: 90vw;
  height: 90vh;
  max-width: 1800px;
  max-height: 98vh;
  background: #fafbfd; border: 2.5px solid #bac3d1; border-radius: 20px;
  display: flex; flex-direction: column; overflow: hidden; position: relative;
  box-shadow: 0 22px 48px rgba(0,0,0,.26);
}
.cb-close-x {
  position: absolute; top: 20px; right: 24px; font-size: 1.7rem;
  color: #79808e; background: none; border: none; cursor: pointer;
  transition: color .16s,transform .16s; z-index: 3;
}
.cb-close-x:hover { color: #ff5a5f; transform: scale(1.18) }

.cb-modal-body {
  flex: 1 1 auto;
  overflow: visible !important;    /* << NO scrolling here */
  min-height: 0;
  max-height: 100%;
  padding: 0;
  display: flex;
  flex-direction: column;
  background: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}
.cb-modal-body::-webkit-scrollbar {
  width: 10px; background: #f5f7fb;
}
.cb-modal-body::-webkit-scrollbar-thumb {
  background: #e3e7ed; border-radius: 8px;
}

/* Patch: Remove extra white box/layer inside modal */
.cb-modal-body {
  background: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}

/* DEBUG: Remove problematic transform/animation/pointer-events */
.cb-modal-overlay,
.cb-modal.cb-editor,
.cb-modal-body,
.cb-tab-panel,
.cb-panel-inner {
  transform: none !important;
  animation: none !important;
  pointer-events: auto !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* ========= 2. MAIN FLEX LAYOUT ========== */
.cb-editor-layout {
  display: flex;
  height: 100%;
  width: 100%;
  min-width: 0;
  min-height: 0;
  background: transparent;
  width: 100% !important;
  min-width: 0 !important;
}

/* ========= 3. SIDEBAR ========== */
.cb-editor-nav {
  flex: 0 0 248px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  background: linear-gradient(180deg, #202840 88%, #273352 100%);
  border-right: 2px solid #1abc9c;
  min-width: 170px;
  max-width: 264px;
  padding: 36px 0 30px 0 !important;
  box-shadow: 8px 0 34px 0 #1abc9c13, 0 1px 0 #1abc9c44 !important;
  height: 100%;
  position: relative;
  z-index: 2;
  color: #f6fafd;
  border-radius: 0 !important;
}

.cb-tab-btn {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 1.07em;
  border: none;
  background: none !important;
  cursor: pointer;
  font-weight: 500;
  font-size: 1.11em;
  color: #e6faff !important;
  border-radius: 24px 0 0 24px !important;
  padding: 14px 20px 14px 36px !important;
  margin: 0 0 3px 0 !important;
  text-align: left;
  justify-content: flex-start;
  outline: none;
  letter-spacing: .01em;
  position: relative;
  transition:
    background 0.13s,
    color 0.13s,
    border-color 0.17s,
    box-shadow 0.15s;
  box-shadow: none;
  border-left: 3.5px solid transparent;
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
}
.cb-tab-btn .cb-tab-icon,
.cb-tab-btn svg {
  filter: drop-shadow(0 1px 4px #21d2b299);
  font-size: 1.27em;
  opacity: 0.93;
  margin-right: 0.12em;
}
.cb-tab-btn:not(.active):hover {
  background: linear-gradient(90deg, #26324e 78%, #1abc9c22 100%) !important;
  color: #78fbe5 !important;
  border-left: 3.5px solid #22ecc6;
  filter: brightness(1.18);
  font-weight: 600;
}
.cb-tab-btn.active {
  background: linear-gradient(90deg, #1abc9c33 80%, #70e4f590 100%) !important;
  color: #1abc9c !important;
  font-weight: 800 !important;
  border-left: 4.5px solid #1abc9c !important;
  box-shadow: 2px 0 10px 0 #1abc9c1a;
  letter-spacing: .03em;
  z-index: 2;
  border-radius: 24px 0 0 24px !important;
}
.cb-tab-btn.active:before { display: none !important; }
.cb-tab-indicator { display: none !important; }
.cb-tab-btn:focus-visible {
  outline: 2px solid #1abc9c !important;
  outline-offset: 1.5px !important;
  z-index: 3;
}

/* ========= 4. MAIN CONTENT PANEL ========== */
.cb-editor-content {
  flex: 1 1 0 !important;
  width: 100% !important;
  min-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  display: flex;
  flex-direction: column;
  padding-top: 32px;
  padding-bottom: 32px;
}
.cb-editor-tabs {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding-bottom: 96px !important;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

/* ========= 5. MAIN PANEL INNER WRAPPER ========== */
.cb-panel-inner {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  min-height: 0;
  box-sizing: border-box;
  padding: 42px 38px 36px;
  background: #fff;
  border-radius: 17px;
  box-shadow: 0 2px 22px rgba(60,120,120,.07);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  max-height: 100%;
  scrollbar-color: #e4e8f1 #f8fafd;
  scrollbar-width: thin;
}
.cb-panel-inner::-webkit-scrollbar { width: 9px; background: #f8fafd; }
.cb-panel-inner::-webkit-scrollbar-thumb { background: #e4e8f1; border-radius: 7px; }

@media (max-width: 1200px) {
  .cb-panel-inner {
    max-width: 100vw;
    padding: 28px 12px 22px;
  }
}
@media (max-width: 900px) {
  .cb-panel-inner {
    max-width: 100vw;
    padding: 18px 3vw 18px 3vw;
  }
}
@media (max-width: 600px) {
  .cb-panel-inner {
    padding: 10px 2vw 10px 2vw;
  }
}

/* ========= 6. MOBILE NAV (FAB NAV) ========== */
@media (max-width: 950px) {
  .cb-editor-layout { flex-direction: column; }
  .cb-editor-nav {
    position: fixed !important;
    left: 0; right: 0; bottom: 0 !important; top: unset;
    width: 100vw !important;
    height: 64px !important;
    border-radius: 0 !important;
    background: linear-gradient(90deg, #1abc9c 12%, #2d4261 90%);
    box-shadow: 0 -2px 24px 1px #2d426122, 0 -1px 0 #1abc9c;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: center;
    gap: 0;
    z-index: 9999;
    padding: 0 !important;
    border: none !important;
  }
  .cb-tab-btn, .cb-tab-btn.active {
    flex: 1 1 0;
    padding: 0;
    margin: 0 !important;
    border-radius: 0 !important;
    background: none !important;
    color: #e0fff9 !important;
    font-size: 1.14em;
    border-left: none !important;
    border-bottom: 4px solid transparent;
    justify-content: center;
    align-items: center;
    text-align: center;
    transition: background .12s, color .12s, border-bottom-color .13s;
  }
  .cb-tab-btn .cb-tab-icon {
    display: block;
    margin: 0 auto 2px auto;
    font-size: 1.45em;
    filter: drop-shadow(0 1px 4px #1abc9c88);
    opacity: 1;
  }
  .cb-tab-btn span {
    display: none !important;
  }
  .cb-tab-btn:not(.active):hover {
    background: linear-gradient(90deg, #1abc9c22 70%, #2d426133 100%) !important;
    color: #aef7e3 !important;
    border-bottom: 4px solid #22ecc6 !important;
    font-weight: 700;
  }
  .cb-tab-btn.active {
    background: linear-gradient(90deg, #1abc9c55 55%, #2d4261cc 100%) !important;
    color: #fff !important;
    font-weight: 900 !important;
    border-bottom: 4px solid #fff !important;
    box-shadow: 0 -2px 20px #21c99c21;
    z-index: 2;
  }
  .cb-panel-inner {
    padding-bottom: 44px !important;
  }
  .cb-editor-content, .cb-editor-tabs {
    padding-bottom: 96px !important;
  }
}
@media (max-width: 540px) {
  .cb-editor-nav {
    height: 58px;
    border-radius: 1.7em;
    width: 99vw;
    left: 0.5vw; right: 0.5vw;
    padding: 0 3px;
  }
  .cb-tab-btn {
    height: 48px;
  }
  .cb-tab-btn .cb-tab-icon {
    font-size: 1.3em;
  }
}

/* ========= 7. SETTINGS FORM ========== */
.cb-settings-form {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: #fff;
  padding: 26px 16px 12px 16px;
  border-radius: 12px;
  box-shadow: 0 2px 16px rgba(80,140,200,0.06);
  margin-bottom: 18px;
  width: 100%;
  flex: 1 0 auto;
  min-height: 0;
  margin-left: 0 !important;
  margin-right: 0 !important;
}
.cb-row-top4 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 24px;
  margin-bottom: 18px;
}
.cb-row-hdrpreview {
  display: flex;
  align-items: flex-start;
  gap: 44px;
  margin-bottom: 22px;
}
.cb-hdrcolors-col {
  flex: 1 1 400px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.cb-hdrcolors-col label.cb-form-label { width: 100%; }
.cb-hdrcolors-row {
  display: flex;
  gap: 22px;
  margin-top: 7px;
}
.cb-bot-preview-wrap {
  flex: 0 0 340px;
  min-width: 240px;
  max-width: 360px;
  display: flex;
  align-items: flex-start;
}
.cb-row-wide {
  width: 100%;
  margin-bottom: 18px;
}
.cb-row-wide:last-child { margin-bottom: 0; }
.cb-form-label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-weight: 600;
  color: #25374c;
  font-size: 1.09em;
  margin-bottom: 0;
}
.cb-field, .cb-field-color {
  border: 1.6px solid #ccd6e3;
  border-radius: 8px;
  background: #f7fafd;
  font-size: 1.05rem;
  transition: border .14s, box-shadow .14s;
  padding: 13px 16px;
  margin-top: 3px;
  margin-bottom: 0;
}
.cb-field:focus, .cb-field-color:focus {
  border-color: #1abc9c;
  box-shadow: 0 0 0 2px rgba(26,188,156,.18);
  outline: none;
}
.cb-field-color {
  width: 60px;
  height: 38px;
  padding: 0 2px;
  border-radius: 7px;
  box-shadow: 0 0 0 1.5px #d0e3e8 inset;
  cursor: pointer;
  margin-right: 12px;
  border: 1.6px solid #ccd6e3;
  background: #f7fafd;
  font-size: 1.05rem;
  transition: border .14s, box-shadow .14s;
}
.cb-field-color:hover {
  box-shadow: 0 0 0 3px #1abc9c55 inset;
}
.cb-color-wrap {
  display: flex; align-items: center; gap: 0.6em; flex: 1;
}
.cb-color-sample {
  width: 28px; height: 28px; border-radius: 4px; border: 1px solid #ccc;
  background: #1abc9c; display: inline-block; margin-left: .5em;
}
.cb-save-btn {
  background: #468ef9;
  color: #fff;
  border: none;
  padding: 16px 54px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 1.13rem;
  cursor: pointer;
  box-shadow: 0 1px 8px rgba(70,142,249,.12);
  transition: transform .15s, box-shadow .15s, filter .12s;
  display: block;
  margin: 30px auto 0 auto;
}
.cb-save-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 24px rgba(70,142,249,.17);
}
.cb-save-btn:active {
  transform: translateY(1.5px) scale(0.97);
  box-shadow: 0 2px 6px rgba(70,142,249,.07);
  filter: brightness(0.96);
}
@media (max-width: 900px) {
  .cb-row-top4 {
    grid-template-columns: 1fr 1fr;
    gap: 18px;
  }
  .cb-row-hdrpreview {
    flex-direction: column;
    gap: 18px;
  }
  .cb-bot-preview-wrap {
    max-width: 100%; width: 100%; min-width: 0;
    margin-top: 16px;
    justify-content: flex-start;
  }
}
@media (max-width: 600px) {
  .cb-row-top4 {
    grid-template-columns: 1fr;
    gap: 11px;
  }
  .cb-hdrcolors-row {
    flex-direction: column;
    gap: 11px;
  }
}

.cb-bot-preview {
  border: 1px solid #e5e9f2; border-radius: 8px;
  max-width: 320px; width: 100%;
  margin: 0 0 0 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  font-size: 14px; overflow: hidden;
  background: #fff;
}
.cb-bot-preview .cb-header {
  background: var(--header-color,#1abc9c);
  color: #fff; padding: .5rem .75rem; font-weight: 600;
}
.cb-bot-preview .cb-body {
  background: #fff;
}
.cb-bot-preview .cb-input input {
  width: 100%; border: 0; padding: .5rem .75rem; font-size: inherit;
}
.cb-bot-preview .msg {
  padding: .4rem .75rem; border-radius: 12px; margin: .3rem .75rem .3rem 1rem;
}
.cb-bot-preview .msg.bot { background: #f2f4f7 }
.cb-bot-preview .msg.user {
  background: var(--button-color,#1abc9c); color: #fff;
  margin-left: .75rem; margin-right: 1rem;
}

/* PATCH: Uniform spacing for avatar input group */
#cb-avatar-group .cb-field[type="url"] { margin-right: 6px; }
#cb-avatar-group { align-items: center; display: flex; gap: 10px; }
.cb-form-label small {
  color: #7a7d88;
  font-size: 0.97em;
  margin-top: 3px;
  display: block;
}
.cb-welcome-msg-row { margin-bottom: 14px; }
.cb-welcome-msg-input {
  width: 100%;
  border: 1.5px solid #ccd6e3;
  border-radius: 8px;
  background: #f7fafd;
  padding: 12px 16px;
  font-size: 1.05rem;
  transition: border .14s, box-shadow .14s;
}
.cb-welcome-msg-input:focus {
  border-color: #1abc9c;
  box-shadow: 0 0 0 2px rgba(26,188,156,.18);
  outline: none;
}
/* Welcome Message Field */
.cb-settings-form input[name="welcome_message"].cb-field {
  border: 1.5px solid #c3c8d1;
  border-radius: 7px;
  padding: 8px 12px;
  font-size: 1.05em;
  transition: border 0.17s;
  background: #fafbfc;
  margin-top: 4px;
  box-sizing: border-box;
}
.cb-settings-form input[name="welcome_message"].cb-field:focus {
  border-color: #1abc9c;
  background: #fff;
  outline: none;
}
/* Bot Avatar URL field */
.cb-settings-form input[name="avatar_url"].cb-field[type="url"] {
  border: 1.5px solid #c3c8d1;
  border-radius: 7px;
  padding: 8px 12px;
  font-size: 1.05em;
  background: #fafbfc;
  transition: border 0.17s;
  min-width: 0;
}
.cb-settings-form input[name="avatar_url"].cb-field[type="url"]:focus {
  border-color: #1abc9c;
  background: #fff;
  outline: none;
}
/* Default Avatar Button */
.cb-set-default-avatar {
  border: 1.5px solid #c3c8d1;
  background: #f8fafd;
  color: #166765;
  font-weight: 500;
  border-radius: 7px;
  padding: 6px 16px 6px 13px;
  font-size: 1em;
  cursor: pointer;
  transition: background 0.15s, border 0.17s, color 0.16s;
  margin-left: 2px;
  box-shadow: 0 1px 4px rgba(24,140,126,.04);
}
.cb-set-default-avatar:hover,
.cb-set-default-avatar:focus {
  background: #e2fcf6;
  border-color: #1abc9c;
  color: #138d80;
  outline: none;
}

/* PATCH: Consistent Sidebar & Content Alignment */
.cb-settings-form,
.cb-panel-inner,
.cb-tab-panel,
.cb-editor-tabs {
  margin: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  padding-left: 32px !important;
  padding-right: 32px !important;
}
@media (max-width: 700px) {
  .cb-settings-form,
  .cb-panel-inner,
  .cb-tab-panel,
  .cb-editor-tabs {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
}
.cb-tab-panel > * { margin-left: 0 !important; margin-right: 0 !important; }
.cb-settings-form {
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.cb-modal-layout {
  display: flex;
  height: 100%;
  width: 100%;
}

.cb-editor-nav {
  height: 100%;
  min-height: 0;
  align-self: stretch;
  position: relative;
  z-index: 2;
}

.cb-modal-body {
  flex: 1 1 auto;
  overflow: visible !important;    /* << NO scrolling here */
  min-height: 0;
  max-height: 100%;
  padding: 0;
  display: flex;
  flex-direction: column;
  background: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

/* Add top/bottom padding to modal content area */
.cb-editor-content,
.cb-modal-body {
  padding-top: 32px;
  padding-bottom: 32px;
}

/* ========= 8. S3 TOGGLE/NOTICE/INPUT ========== */
.cb-s3-toggle-row {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 18px;
}
.cb-switch {
  position: relative;
  display: inline-block;
  width: 46px; height: 24px;
  margin-right: 10px;
  vertical-align: middle;
}
.cb-switch input { opacity: 0; width: 0; height: 0; }
.cb-switch .slider {
  position: absolute;
  inset: 0;
  background: #ccd1dc;
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.2s;
  box-shadow: 0 0 0 1px #ddd1;
}
.cb-switch .slider:before {
  content: "";
  position: absolute;
  height: 18px; width: 18px;
  left: 4px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.22s cubic-bezier(.55,1.4,.7,1), background .17s;
  box-shadow: 0 1px 6px #0001;
}
.cb-switch input:checked + .slider {
  background: #1abc9c;
}
.cb-switch input:checked + .slider:before {
  transform: translateX(22px);
  background: #fff;
}
.cb-switch-label {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: center;
  width: 100%;
  font-weight: 500;
  vertical-align: middle;
}
.cb-s3-global-indicator {
  color: #198b52; background: #eafdf5; border-radius: 8px;
  padding: 9px 13px; margin: 10px 0 0; font-weight: 600; font-size: .97em;
  text-align: center;
}
.cb-s3-fields {
  width: 100%;
  margin: 0 auto;
  display: flex;
  justify-content: center;
}
.cb-s3-fields-inner {
  display: flex;
  flex-direction: column;
  gap: 17px;
  padding: 22px 14px 18px 14px;
  border: 1.5px solid #e5e9f2;
  border-radius: 12px;
  background: #f8fafb;
  min-width: 0;
  max-width: 390px;
  width: 100%;
  margin-top: 3px;
}
.cb-s3-fields-inner label {
  font-weight: 600;
  color: #264158;
  font-size: 1.05em;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.cb-s3-fields-inner input {
  margin-top: 2px;
  border: 1.2px solid #ccd6e3;
  border-radius: 7px;
  padding: 11px 13px;
  background: #fff;
  font-size: 1.04em;
  transition: border 0.13s;
}
.cb-s3-fields-inner input:focus {
  border: 1.5px solid #1abc9c;
  outline: none;
}
.cb-s3-save-btn {
  margin-top: 16px;
  background: #468ef9;
  color: #fff;
  border: none;
  border-radius: 9px;
  font-weight: 700;
  font-size: 1.09em;
  padding: 12px 36px;
  cursor: pointer;
  box-shadow: 0 1px 8px rgba(70,142,249,.11);
  transition: transform .15s, box-shadow .15s, filter .12s;
  align-self: flex-end;
}
.cb-s3-save-btn:hover {
  filter: brightness(1.08);
  box-shadow: 0 3px 12px rgba(70,142,249,.15);
}
.cb-s3-save-btn:active {
  transform: scale(0.97);
  box-shadow: 0 1px 3px rgba(70,142,249,.10);
  filter: brightness(0.96);
}

/* ========= 9. KNOWLEDGE CENTRE TABLE ========== */
.cb-doc-table{width:100%;border-collapse:collapse;font-size:1.01rem}
.cb-doc-table th,.cb-doc-table td{padding:12px 16px;border-bottom:1px solid #e5e8f0}
.cb-doc-table th{font-weight:600;text-align:left;color:#495666}
.cb-doc-table .cb-icon{text-align:center;font-size:1.18rem}
.cb-doc-table .cb-del{text-align:center;cursor:pointer;color:#ff5a5f}
.cb-doc-table .cb-del:hover{color:#d82f3d}

/* ========= 10. UPLOAD/BUTTONS ========== */
.cb-button-upload{
  background:#1abc9c;color:#fff;border:none;border-radius:7px;
  font-weight:700;padding:9px 19px;font-size:1.06em;cursor:pointer;
  box-shadow:0 2px 12px rgba(26,188,156,.09);
  transition:background .13s,box-shadow .13s;
}
.cb-button-upload:hover{background:#179a7c;box-shadow:0 4px 16px rgba(26,188,156,.18)}
.cb-dropzone{
  background:#f6f9fa;border:2.2px dashed #1abc9c;border-radius:9px;
  transition:border-color .15s,background .15s;margin-bottom:12px
}
.cb-dropzone-overlay{
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  height:60px;font-size:1.08em;color:#289e8b;font-weight:600;pointer-events:none
}
.cb-dropzone-hover{outline:2.5px dashed #468ef9;background:#eaf4ff}
.cb-dropzone-hint{display:none;text-align:center;color:#468ef9;font-weight:600}
.cb-upload-message {
    background-color: #f2f2f2;
    padding: 15px;
    border: 1px solid #ccc;
    margin-top: 20px;
    font-size: 14px;
    color: #f39c12;
}
.cb-api-key-status { margin-left:10px; color:#19aa5a; font-weight:600; }
.cb-field.cb-has-key { border-color: #19aa5a; }

/* ========= 11. CHAT LOGS / ANALYTICS TAB ========== */
.cb-chatlogs-tab {
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  height: 100%;
}
.cb-logs-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 36px;
  align-items: flex-start;
  margin-bottom: 24px;
  padding: 20px !important;
  background: #fff !important;
  border-radius: 16px !important;
  box-shadow: 0 1px 12px rgba(24,120,120,.07) !important;
  margin-bottom: 24px !important;
}
.cb-stat-block {
  background: #f7fafb;
  border: 1.5px solid #e0e7ef;
  border-radius: 9px;
  padding: 22px 36px 14px 36px;
  font-size: 1.15em;
  font-weight: 700;
  color: #196c56;
  min-width: 170px;
  box-shadow: 0 2px 9px rgba(30,184,140,.08);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
}
.cb-stat-block .cb-stat-label {
  font-size: .99em;
  color: #455f66;
  font-weight: 500;
  margin-top: 3px;
}
.cb-chart-wrap {
  flex: 1 1 390px;
  background: #fff;
  border-radius: 9px;
  border: 1.5px solid #e0e7ef;
  box-shadow: 0 2px 8px rgba(30,184,140,.05);
  min-height: 230px;
  max-width: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px 24px;
}
.cb-chart-wrap canvas {
  width: 100% !important;
  max-width: 100%;
  height: 280px !important;
  max-height: 340px;
}
.cb-session-table, .cb-msg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1.06em;
  margin-bottom: 18px;
  background: #fafbfd;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(70,142,249,.06);
}
.cb-session-table th, .cb-session-table td,
.cb-msg-table th, .cb-msg-table td {
  padding: 13px 16px;
  border-bottom: 1px solid #e5e8f0;
}
.cb-session-table th, .cb-msg-table th {
  font-weight: 600;
  background: #f5f9fa;
  color: #25856c;
  text-align: left;
}
.cb-session-table tr:last-child td, .cb-msg-table tr:last-child td {
  border-bottom: none;
}
.cb-msg-table .cb-msg-role {
  font-weight: 700;
  color: #138b6b;
  padding-right: 7px;
  min-width: 62px;
  display: inline-block;
}
.cb-msg-table .cb-msg-user { color: #1a6ad8; }
.cb-msg-table .cb-msg-bot  { color: #1abc9c; }
.cb-msg-table .cb-msg-rag {
  background: #e8fbe7;
  color: #176a32;
  font-size: .96em;
  border-radius: 5px;
  padding: 2px 7px 2px 7px;
  margin-left: 8px;
  font-weight: 500;
}
.cb-msg-table .cb-msg-fallback {
  background: #fff3e2;
  color: #d89317;
  font-size: .96em;
  border-radius: 5px;
  padding: 2px 7px 2px 7px;
  margin-left: 8px;
  font-weight: 500;
}
.cb-session-table tr.cb-session-row {
  cursor: pointer;
  transition: background 0.12s;
}
.cb-session-table tr.cb-session-row:hover {
  background: #eafaf4;
}
.cb-log-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.cb-log-search {
  border: 1.5px solid #ccd6e3;
  border-radius: 7px;
  padding: 8px 14px;
  font-size: 1.03em;
  background: #f8fafd;
  min-width: 170px;
}
.cb-log-sort {
  border: 1.3px solid #ccd6e3;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 1em;
  background: #fafbfd;
  color: #196c56;
}
.cb-log-pager {
  display: flex;
  gap: 7px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 6px;
}
.cb-log-pager button {
  background: #e8f9f2;
  color: #15b47b;
  border: 1px solid #c2e6da;
  border-radius: 6px;
  padding: 4px 13px;
  font-weight: 600;
  font-size: 1.04em;
  margin: 0 1px;
  cursor: pointer;
  transition: background .11s, color .11s;
}
.cb-log-pager button:disabled {
  opacity: 0.55;
  background: #f3f3f3;
  color: #a1a1a1;
  cursor: not-allowed;
}
.cb-log-pager .cb-page-info {
  margin: 0 7px;
  font-size: .98em;
  color: #557;
}
@media (max-width: 900px) {
  .cb-logs-summary {
    flex-direction: column;
    gap: 19px;
  }
  .cb-chart-wrap {
    max-width: 100%;
    min-width: 0;
    padding: 18px 3vw;
  }
}
@media (max-width: 650px) {
  .cb-chatlogs-tab {
    gap: 11px;
  }
  .cb-logs-summary, .cb-stat-block, .cb-chart-wrap {
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    width: 100%;
    max-width: 100vw;
    padding: 12px 6px;
  }
  .cb-session-table, .cb-msg-table {
    font-size: .98em;
    padding: 0 1px;
  }
}
/* === PATCH: Avatar URL input always fills row === */
#cb-avatar-group {
  display: flex !important;
  align-items: center !important;
  gap: 15px !important;
  width: 100% !important;
  flex: 1 1 0 !important;
  min-width: 0 !important;
  /* This ensures it fills its flex parent */
}
#cb-avatar-group .cb-form-label {
  width: 100% !important;
}
#cb-avatar-group > label > div,
#cb-avatar-group > .cb-form-label > div {
  display: flex !important;
  gap: 15px !important;
  align-items: center !important;
  width: 100% !important;
  flex: 1 1 0 !important;
  min-width: 0 !important;
}
#cb-avatar-group input[name="avatar_url"] {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  max-width: 100% !important;
  width: 100% !important;
  /* Ensures input takes up all available space */
}
#cb-avatar-group .cb-set-default-avatar {
  flex: 0 0 auto !important;
}
#cb-avatar-preview {
  flex: 0 0 auto !important;
  width: 40px !important;
  height: 40px !important;
}
/* ========= MOBILE OPTIMIZATION PATCH FOR BOT EDITOR ========== */

/* Hide desktop nav on mobile, show mobile nav */
@media (max-width: 950px) {
  .cb-desktop-nav {
    display: none !important;
  }
  
  .cb-mobile-nav {
    display: flex !important;
  }
  
  /* Adjust modal layout for mobile */
  .cb-modal.cb-editor {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    border: none !important;
  }
  
  .cb-modal-layout {
    flex-direction: column !important;
  }
  
  .cb-editor-content {
    padding-bottom: 90px !important; /* Account for mobile nav */
  }
}

/* Desktop: hide mobile nav, show desktop nav */
@media (min-width: 951px) {
  .cb-mobile-nav {
    display: none !important;
  }
  
  .cb-desktop-nav {
    display: flex !important;
  }
}

/* Mobile Navigation (matching main dashboard style) */
.cb-mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--cb-sidebar-bg, #181f36);
  border-top: 2.5px solid var(--cb-accent, #1abc9c);
  box-shadow: 0 -6px 24px rgba(20,30,65,0.10);
  z-index: 1001;
  justify-content: space-between;
  padding: 0 2px 0 2px;
  height: 70px;
  align-items: center;
  transition: bottom 0.18s;
}

.cb-mobile-nav-btn {
  flex: 1 1 0;
  border: none;
  background: none;
  color: #b3bacd;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5px 0 3px 0;
  font-size: 0.97em;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.17s, color 0.14s, box-shadow 0.14s;
  border-radius: 0;
  position: relative;
  outline: none;
  min-width: 58px;
}

.cb-mobile-nav-btn svg {
  margin-bottom: 2px;
  font-size: 1.45em;
  color: inherit;
  transition: color 0.14s;
}

.cb-mobile-nav-btn.active,
.cb-mobile-nav-btn:focus {
  color: var(--cb-accent, #1abc9c);
  background: rgba(26,188,156,0.09);
  box-shadow: 0 2px 12px rgba(26,188,156,0.08);
}

.cb-mobile-nav-btn:active {
  transform: scale(0.96);
}

.cb-mobile-nav-btn span {
  font-size: 0.85em;
  font-weight: 500;
  letter-spacing: 0.01em;
  margin-top: 0.5px;
  line-height: 1;
}

/* Responsive Form Improvements */
@media (max-width: 950px) {
  .cb-row-top4 {
    grid-template-columns: 1fr !important;
    gap: 18px !important;
  }
  
  .cb-responsive-row {
    flex-direction: column !important;
    gap: 18px !important;
  }
  
  .cb-responsive-field {
    flex: 1 1 auto !important;
    min-width: 100% !important;
  }
  
  .cb-responsive-preview {
    flex-direction: column !important;
    gap: 24px !important;
  }
  
  .cb-color-controls,
  .cb-launcher-controls {
    display: flex !important;
    flex-direction: row !important;
    gap: 20px !important;
    justify-content: space-around !important;
    padding: 0 !important;
    border: none !important;
    min-width: 100% !important;
  }
  
  .cb-bot-preview-wrap {
    max-width: 100% !important;
    width: 100% !important;
    min-width: 0 !important;
    display: flex !important;
    justify-content: center !important;
  }
  
  .cb-avatar-row {
    flex-direction: column !important;
    gap: 20px !important;
    align-items: flex-start !important;
  }
  
  .cb-showavatar-wrap {
    min-width: 100% !important;
  }
  
  #cb-avatar-group {
    min-width: 100% !important;
  }
  
  #cb-avatar-group .cb-form-label > div {
    flex-wrap: wrap !important;
    gap: 10px !important;
  }
  
  #cb-avatar-group input[name="avatar_url"] {
    min-width: 200px !important;
  }
}

/* Very small screens */
@media (max-width: 600px) {
  .cb-panel-inner {
    padding: 20px 12px 20px 12px !important;
  }
  
  .cb-mobile-nav {
    height: 65px !important;
  }
  
  .cb-mobile-nav-btn {
    padding: 4px 0 2px 0 !important;
    min-width: 50px !important;
  }
  
  .cb-mobile-nav-btn svg {
    font-size: 1.3em !important;
  }
  
  .cb-mobile-nav-btn span {
    font-size: 0.8em !important;
  }
  
  .cb-editor-content {
    padding-bottom: 80px !important;
  }
  
  /* Make API key input stack on very small screens */
  .cb-field-half span {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }
  
  .cb-field-half input[name="api_key"] {
    min-width: 100% !important;
  }
  
  /* Stack color controls vertically on very small screens */
  .cb-color-controls {
    flex-direction: column !important;
    gap: 15px !important;
  }
  
  .cb-launcher-controls {
    flex-direction: column !important;
    gap: 15px !important;
  }
}

/* Specific mobile table improvements */
@media (max-width: 950px) {
  .cb-doc-table,
  .cb-session-table,
  .cb-msg-table {
    font-size: 0.9em !important;
  }
  
  .cb-doc-table th,
  .cb-doc-table td,
  .cb-session-table th,
  .cb-session-table td,
  .cb-msg-table th,
  .cb-msg-table td {
    padding: 8px 6px !important;
  }
  
  .cb-log-controls {
    flex-direction: column !important;
    gap: 10px !important;
  }
  
  .cb-log-search,
  .cb-log-sort {
    width: 100% !important;
    min-width: 100% !important;
  }
  
  .cb-logs-summary {
    flex-direction: column !important;
    gap: 15px !important;
  }
  
  .cb-stat-block {
    min-width: 100% !important;
    text-align: center !important;
  }
}

/* Ensure mobile nav doesn't overlap with content */
@media (max-width: 950px) {
  body {
    padding-bottom: 75px;
  }
  
  .cb-modal-overlay {
    padding-bottom: 0 !important;
  }
}

/* Fix close button positioning on mobile */
@media (max-width: 950px) {
  .cb-close-x {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    font-size: 1.8rem !important;
    z-index: 99999 !important;
    background: rgba(255, 255, 255, 0.95) !important;
    border: 2px solid #ddd !important;
    border-radius: 50% !important;
    width: 45px !important;
    height: 45px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #666 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
    -webkit-tap-highlight-color: transparent !important;
    user-select: none !important;
  }
  
  .cb-close-x:hover,
  .cb-close-x:active {
    background: rgba(255, 255, 255, 1) !important;
    color: #ff5a5f !important;
    transform: scale(1.1) !important;
    border-color: #ff5a5f !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2) !important;
  }
}

/* Ensure close button works on very small screens too */
@media (max-width: 600px) {
  .cb-close-x {
    top: 15px !important;
    right: 15px !important;
    width: 40px !important;
    height: 40px !important;
    font-size: 1.6rem !important;
  }
}

/* Improve button spacing on mobile */
@media (max-width: 950px) {
  .cb-button-primary,
  .cb-button-danger,
  .cb-button-upload {
    padding: 12px 20px !important;
    font-size: 1em !important;
    border-radius: 8px !important;
    margin: 5px 0 !important;
  }
  
  .cb-settings-save-btn,
  .cb-layout-save-btn {
    width: 100% !important;
    margin-top: 30px !important;
  }
}

/* Fix textarea and input sizing on mobile */
@media (max-width: 950px) {
  .cb-field,
  .cb-field-color,
  textarea {
    font-size: 16px !important; /* Prevents iOS zoom */
    padding: 12px 14px !important;
  }
  
  #cb-doc-editor {
    min-height: 200px !important;
    font-size: 14px !important;
  }
  
  #cb-embed-iframe {
    min-height: 120px !important;
    font-size: 12px !important;
  }
}

/* Improve crawl section layout on mobile */
@media (max-width: 950px) {
  #cb-crawl-url {
    width: 100% !important;
    margin-bottom: 10px !important;
  }
  
  #cb-crawl-btn {
    width: 100% !important;
  }
  
  .cb-doc-save,
.cb-doc-del {
  flex: 1 !important;
  margin: 5px !important;
}
}
.cb-usage-banner div { line-height:1.4; }

/* Overlay for blocking uploads (but not delete) */
.cb-dropzone-overlay-blocked {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 3;
  background: transparent;
  pointer-events: none; /* ← allow clicks to pass through */
  /* By default, it's transparent and does NOT intercept pointer events */
}

.cb-dropzone.cb-dropzone-blocked .cb-dropzone-overlay-blocked {
  display: block;
}

.cb-doc-table .cb-doc-del {
  position: relative;
  z-index: 10; /* Stays above the overlay for clickable trash */
}

/* Ensure dropzone itself is clickable for children (remove pointer-events:none from .cb-dropzone-blocked if present) */
.cb-dropzone-blocked { pointer-events: auto !important; }
.cb-btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  font-size: 1.05em;
  border-radius: 7px;
  transition: background 0.15s, box-shadow 0.15s, color 0.13s;
}

.cb-button-primary.cb-btn-icon svg {
  color: #fff;
}

.cb-button-danger.cb-btn-icon svg {
  color: #fff;
}

.cb-btn-icon svg {
  display: inline-block;
  margin-right: 7px;
  margin-left: 0;
  height: 20px;
  width: 20px;
}
.cb-doc-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f5faff;
  border-radius: 7px;
  border: 1px solid #e1eefa;
  width: 32px;
  height: 32px;
  box-shadow: 0 1px 3px #21c99c13;
  margin-right: 2px;
}

.cb-doc-del-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff6f5;
  border: 1.5px solid #efc4c2;
  color: #d83c3c;
  border-radius: 7px;
  padding: 6px 12px 6px 10px;
  font-size: 1em;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, border 0.15s, color 0.13s;
  margin: 0 2px;
}
.cb-doc-del-btn:hover {
  background: #ffeaea;
  border-color: #d83c3c;
  color: #b11515;
  box-shadow: 0 2px 8px #fbeaea99;
}
.cb-doc-del-btn svg {
  margin: 0 0 -2px 0;
  pointer-events: none;
}
/* Chat-Logs: stop outer scrolling */
.cb-editor-content,
.cb-editor-tabs,
.cb-modal-body {
  overflow: hidden !important;   /* or visible */
}
.cb-msg-bubble.user {
  background: #1abc9c !important;
  color: #fff !important;
}
.cb-msg-bubble.bot {
  background: #eaf3ff !important;
  color: #232942 !important;
  border: 1.5px solid #dbeaff !important;
}
/* ===== Correct split-pane width (container, not viewport) ===== */
.cb-logs-split {
  width: 100%   !important;   /* fill the parent */
  max-width: 100% !important; /* no artificial cap */
  margin: 0      !important;  /* kill any leftover offset */
}
.cb-log-table tr.active {
  background: #eaf3ff !important;    /* Light blue highlight */
  border-left: 5px solid #429af8 !important; /* Strong blue bar */
  box-shadow: 0 2px 18px rgba(66,154,248,0.11) !important;
}
.cb-log-table tr.active td {
  background: #eaf3ff !important;    /* Also blue background on cells */
  color: #11559c !important;
  font-weight: 600 !important;
}

/* End new Chat Log / Analytics tab CSS */