/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0b0b0f;
  --surface: #141418;
  --card: #1a1a20;
  --border: #2a2a35;
  --text: #f0f0f5;
  --muted: #888898;
  --brand: #8b5cf6;
  --brand-dim: rgba(139,92,246,0.12);
  --green: #22c55e;
  --red: #ef4444;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", sans-serif;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

/* ── LOGIN SCREEN ── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-logo {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
}
.login-logo span { color: var(--brand); }

.login-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: -8px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}
.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── FIELD ── */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label,
.field > span {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.field input,
.field select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  font-family: var(--font);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus,
.field select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(139,92,246,0.15);
}
.field.full-width { grid-column: 1 / -1; }
.field-hint { font-size: 12px; color: var(--muted); }
.field-error { color: var(--red); font-size: 12px; min-height: 1em; display: block; margin-top: 2px; }

/* ── BUTTONS (portal-style named) ── */
.btn-primary {
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: opacity 0.15s;
  width: 100%;
  text-align: center;
}
.btn-primary:hover { opacity: 0.88; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  font-family: var(--font);
  transition: color 0.15s, background 0.15s;
}
.btn-ghost:hover { color: var(--text); background: rgba(255,255,255,0.06); }

/* ── BUTTONS (legacy admin-style via `class="primary"` etc.) ── */
button {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 13px;
  cursor: pointer;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font-family: var(--font);
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
button:hover { background: rgba(255,255,255,0.09); border-color: rgba(255,255,255,0.15); }
button:active { transform: scale(0.98); }
button.small { padding: 6px 12px; font-size: 12px; }

button.primary {
  background: var(--brand);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}
button.primary:hover { background: #7c3aed; border-color: transparent; }

button.secondary {
  border-color: rgba(139,92,246,0.4);
  color: #c4b5fd;
  background: var(--brand-dim);
}
button.secondary:hover { border-color: var(--brand); background: rgba(139,92,246,0.2); }

button.ghost {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  padding: 4px 8px;
}
button.ghost:hover { color: var(--text); background: rgba(255,255,255,0.06); border: none; }

button.danger {
  border-color: rgba(239,68,68,0.4);
  color: #fca5a5;
  background: rgba(239,68,68,0.1);
}
button.danger:hover { background: rgba(239,68,68,0.18); }

/* ── DASHBOARD ── */
.dashboard { min-height: 100vh; }

.dash-header {
  display: flex;
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 10;
  gap: 0;
}

.dash-logo {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
  margin-right: 28px;
  white-space: nowrap;
  flex-shrink: 0;
}
.dash-logo span { color: var(--brand); }

.dash-tabs {
  display: flex;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.dash-tabs::-webkit-scrollbar { display: none; }

.dash-tab {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font);
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}
.dash-tab:hover { color: var(--text); background: var(--card); border-color: transparent; transform: none; }
.dash-tab.active { color: var(--text); background: var(--card); border-color: transparent; }

.dash-user {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

/* Status badge */
.status-badge {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.status-badge.connected {
  color: var(--green);
  background: rgba(34,197,94,0.12);
  border: 1px solid rgba(34,197,94,0.3);
}
.status-badge.disconnected {
  color: var(--red);
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.3);
}

/* ── OUTER PANELS ── */
.dash-panel { display: none; }
.dash-panel.active { display: block; }

.panel-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.panel-top h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

/* ── CARD ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}
.card-header h2 { margin: 0; font-size: 16px; font-weight: 600; }
.card-header h3 { margin: 0; font-size: 15px; font-weight: 600; }

/* ── SECTION DIVIDER ── */
.section-divider {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 12px 0 8px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

/* ── FORM GRID ── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  align-items: center;
}
.form-actions { margin-top: 8px; }

/* ── CHECKBOX ── */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}
.checkbox input { width: 16px; height: 16px; }

/* ── MODULE SETTINGS ── */
.module-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.fieldset-inline {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 0;
}
.fieldset-inline legend { padding: 0 8px; font-size: 12px; color: var(--muted); }
.checkbox-inline-group { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 6px; }

/* ── INNER TABS (client / styling / business / prompt / inbox) ── */
.tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.tab {
  padding: 8px 14px;
  border-radius: 6px 6px 0 0;
  border: 1px solid transparent;
  border-bottom: none;
  background: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
  margin-bottom: -1px;
  transition: color 0.15s, background 0.15s;
}
.tab:hover { color: var(--text); background: var(--surface); border-color: transparent; transform: none; }
.tab.active {
  background: var(--card);
  border-color: var(--border);
  border-bottom-color: var(--card);
  color: var(--text);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.tab-panel.active > * { max-width: 100%; }

.dash-panel[data-panel="config"].config-unknown-mode .tabs,
.dash-panel[data-panel="config"].config-unknown-mode .tab-panel {
  display: none;
}

.dash-panel[data-panel="config"].config-unknown-mode .tab-panel[data-panel="unknown-inbox"].active {
  display: block;
}

/* ── PANEL HEADER (inside subtab) ── */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.panel-header h3 { margin: 0; font-size: 15px; font-weight: 600; }
.panel-header h4 { margin: 0; font-size: 13px; color: var(--muted); font-weight: 500; }
.config-runtime-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.status-badge.source-persistent {
  color: #86efac;
  background: rgba(34,197,94,0.12);
  border: 1px solid rgba(34,197,94,0.28);
}
.status-badge.source-defaults {
  color: #fcd34d;
  background: rgba(245,158,11,0.12);
  border: 1px solid rgba(245,158,11,0.24);
}

/* ── CLIENT FORM ── */
.client-form { display: flex; flex-direction: column; gap: 8px; }
.client-controls { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; }
.client-controls .actions { margin-top: 0; }

.session-card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.session-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--muted);
  font-size: 12px;
}

.session-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
}

/* ── ANALYTICS TABLES ── */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
tr:last-child td { border-bottom: none; }

/* ── TEXTAREA ── */
textarea {
  width: 100%;
  min-height: 260px;
  font-family: "Fira Code", "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  resize: vertical;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 12px;
  outline: none;
  transition: border-color 0.15s;
}
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(139,92,246,0.15);
}
#snippetOutput { min-height: 90px; }
#ctaSetsEditor { min-height: 140px; }

/* ── ADVANCED JSON ── */
.advanced-json {
  margin-top: 16px;
  border-top: 1px dashed var(--border);
  padding-top: 12px;
}
.advanced-json summary {
  cursor: pointer;
  color: #c4b5fd;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}
.advanced-json[open] summary { margin-bottom: 14px; }

/* ── CTA EDITOR TABLE ── */
.cta-editor-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 13px;
}
.cta-editor-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}
.cta-editor-table td { padding: 4px 8px; }
.cta-editor-table input,
.cta-editor-table select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 6px 8px;
  font-size: 12px;
  outline: none;
  font-family: var(--font);
}
.cta-editor-table input:focus,
.cta-editor-table select:focus { border-color: var(--brand); }
.cta-id-cell input { color: var(--muted); max-width: 100px; }
.cta-row-actions { display: flex; gap: 2px; white-space: nowrap; }
.cta-row-actions button { padding: 2px 6px; font-size: 12px; min-width: auto; }

/* ── COLOR PICKER ── */
.color-input-row { display: flex; gap: 8px; align-items: center; }
.color-input-row input[type="text"] { flex: 1; }
.color-picker {
  width: 40px;
  height: 40px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}
.color-picker::-webkit-color-swatch-wrapper { padding: 2px; }
.color-picker::-webkit-color-swatch { border-radius: 4px; border: none; }

/* ── WIDGET PREVIEW ── */
.preview-container {
  width: 100%;
  height: 540px;
  background: #1a1a2e;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.widget-preview-iframe { width: 100%; height: 100%; border: none; background: transparent; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
}
.modal-overlay.show { display: flex; }
.modal {
  width: min(700px, 92vw);
  background: var(--card);
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 24px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.4);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.modal-header h2 { margin: 0; font-size: 18px; font-weight: 600; }
.modal-body { display: flex; flex-direction: column; gap: 12px; }
.modal-actions { justify-content: flex-end; }

/* ── TOAST ── */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
}
.toast {
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 12px 24px rgba(0,0,0,0.35);
  min-width: 220px;
  max-width: 360px;
  font-size: 13px;
  color: var(--text);
  animation: toastIn 0.2s ease;
}
.toast.success { border-color: rgba(34,197,94,0.4); color: #86efac; }
.toast.error { border-color: rgba(239,68,68,0.4); color: #fca5a5; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

/* ── SUBTITLE ── */
.subtitle { color: var(--muted); font-size: 13px; }

#analyticsTopQuestions,
#analyticsUnknownQuestions {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

#analyticsTopQuestions li,
#analyticsUnknownQuestions li {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  line-height: 1.45;
}

.analytics-question-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.analytics-question-item + .analytics-question-item {
  margin-top: 8px;
}

.analytics-question-item__index {
  min-width: 18px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.6;
}

.analytics-question-item__text {
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.analytics-question-item__count {
  align-self: center;
  white-space: nowrap;
  color: #c4b5fd;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.22);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
}

/* ── HAMBURGER ── */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  margin-left: 8px;
  flex-shrink: 0;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.hamburger-btn:hover { background: var(--surface); }
.hb-line {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.22s ease, opacity 0.22s ease;
  transform-origin: center;
}
.hamburger-btn.is-open .hb-line:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.is-open .hb-line:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger-btn.is-open .hb-line:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .hamburger-btn { display: flex; }

  .dash-header {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 16px;
    gap: 0;
    position: relative;
  }
  .dash-logo { flex: 1; margin-right: 0; font-size: 15px; }
  .dash-user { margin-left: 0; }
  .dash-user #sessionUserLabel { display: none; }

  .dash-tabs {
    display: none;
    flex-direction: column;
    width: 100%;
    order: 10;
    padding: 8px 0 12px;
    gap: 2px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
  }
  .dash-tabs.nav-open { display: flex; }
  .dash-tab {
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
  }

  .panel-inner { padding: 20px 14px 40px; gap: 16px; }
  .login-card { padding: 28px 20px; }
  .card { padding: 16px; }
  .modal-actions { flex-direction: row; }
  button { transform: none !important; }

  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .panel-header,
  .card-header,
  .panel-top,
  .client-controls,
  .actions {
    align-items: stretch;
  }

  .panel-header .actions,
  .card-header .actions,
  .panel-top > div:last-child {
    width: 100%;
  }

  .panel-header .actions button,
  .card-header .actions button,
  .panel-top > div:last-child button,
  .actions button {
    width: 100%;
  }

  .form-grid,
  .checkbox-grid,
  .module-settings-grid,
  .biz-section-chip-settings {
    grid-template-columns: 1fr;
  }

  textarea {
    min-height: 180px;
  }

  .session-card__row,
  .session-card__meta,
  .booking-weekday-toggle,
  .booking-weekday-toggle__meta,
  .biz-service-row,
  .biz-followup-row,
  .qual-card-header,
  .stats-row {
    flex-direction: column;
    align-items: stretch;
  }

  .sess-right {
    align-items: flex-start;
  }

  .booking-weekday-toggle {
    padding: 12px;
  }

  .booking-weekday-body {
    padding: 0 12px 12px;
  }

  .biz-section-header {
    flex-wrap: wrap;
    align-items: center;
  }

  .biz-section-topic,
  .biz-section-chip-icon-field,
  .biz-service-price {
    min-width: 0;
    max-width: none;
    width: 100%;
  }

  .biz-service-price {
    text-align: left;
  }
}

@media (max-width: 480px) {
  .dash-header { padding: 8px 12px; }
  .dash-user .btn-ghost { font-size: 12px; padding: 4px 8px; }
  .status-badge { font-size: 11px; padding: 2px 6px; }

  .panel-inner {
    padding-left: 10px;
    padding-right: 10px;
  }

  .card {
    padding: 14px;
  }

  .field input,
  .field select,
  textarea {
    font-size: 16px;
  }
}

/* ── CONVERSATIONS PANEL (portal-style) ── */
.hint { font-size: 13px; color: var(--muted); margin-bottom: 16px; }

.session-filters {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border-radius: 8px;
  padding: 3px;
}
.filter-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  font-family: var(--font);
}
.filter-btn.active { background: var(--card); color: var(--text); }
.filter-btn:hover:not(.active) { color: var(--text); }

.sessions-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }

.session-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.session-card:hover {
  border-color: rgba(139,92,246,0.4);
  background: #1d1d24;
}
.booking-weekday-card {
  display: block;
  padding: 0;
  cursor: default;
  overflow: hidden;
}
.session-card[data-booking-service-row],
.session-card[data-booking-blackout-row],
#bookingList .session-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.session-card[data-booking-service-row] .form-grid,
.session-card[data-booking-blackout-row] .form-grid,
.booking-weekday-body .form-grid {
  width: 100%;
}

.session-card[data-booking-service-row] .actions,
.session-card[data-booking-blackout-row] .actions,
#bookingList .session-card .actions {
  width: 100%;
}
.booking-weekday-card:hover {
  background: var(--card);
}
.booking-weekday-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.booking-weekday-toggle__main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.booking-weekday-summary {
  font-size: 12px;
  color: var(--muted);
}
.booking-weekday-toggle__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.booking-weekday-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 9px;
}
.booking-weekday-badge.is-active {
  color: #86efac;
  border-color: rgba(34,197,94,0.28);
  background: rgba(34,197,94,0.12);
}
.booking-weekday-chevron {
  font-size: 14px;
  color: var(--muted);
  transition: transform 0.18s ease;
}
.booking-weekday-body {
  padding: 0 16px 16px;
  border-top: 1px solid var(--border);
}
.booking-weekday-card.is-collapsed .booking-weekday-body {
  display: none;
}
.booking-weekday-card.is-collapsed .booking-weekday-chevron {
  transform: rotate(-90deg);
}

.sess-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
}
.sess-avatar--lead {
  background: var(--brand-dim);
  border-color: rgba(139,92,246,0.3);
  color: #c4b5fd;
}

.sess-main { flex: 1; min-width: 0; }
.sess-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}
.sess-name { font-size: 14px; font-weight: 600; color: var(--text); }
.sess-contact { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.sess-preview { font-size: 12px; color: var(--muted); font-style: italic; }

.sess-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.sess-badge--lead { background: rgba(34,197,94,0.15); color: #86efac; border: 1px solid rgba(34,197,94,0.25); }
.sess-badge--anon { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
.sess-badge--unknown { background: rgba(239,68,68,0.12); color: #fca5a5; border: 1px solid rgba(239,68,68,0.2); }

.sess-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}
.sess-time { font-size: 11px; color: var(--muted); white-space: nowrap; }
.sess-turns { font-size: 11px; color: var(--muted); }
.sess-delete-btn {
  width: 26px;
  height: 26px;
  border: 1px solid rgba(239,68,68,0.22);
  border-radius: 8px;
  background: rgba(239,68,68,0.08);
  color: #f87171;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.78;
  transition: opacity 0.15s, background 0.15s, border-color 0.15s, transform 0.15s;
}
.sess-delete-btn:hover {
  opacity: 1;
  background: rgba(239,68,68,0.16);
  border-color: rgba(239,68,68,0.42);
  transform: translateY(-1px);
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
  font-size: 14px;
}

/* ── CONVERSATION MODAL ── */
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.modal-box .modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
  flex-shrink: 0;
}
.modal-box .modal-header h3 { font-size: 15px; font-weight: 600; margin: 0; }
.modal-close { font-size: 16px; padding: 4px 8px; }
.modal-box .modal-body {
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal-loading { text-align: center; color: var(--muted); padding: 32px; }

.msg-pair { display: flex; flex-direction: column; gap: 6px; }
.msg { border-radius: 8px; padding: 10px 12px; }
.msg-user {
  background: var(--brand-dim);
  border: 1px solid rgba(139,92,246,0.2);
  align-self: flex-start;
  max-width: 85%;
}
.msg-bot {
  background: var(--card);
  border: 1px solid var(--border);
  align-self: flex-end;
  max-width: 85%;
}
.msg-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}
.msg-text { font-size: 13px; color: var(--text); line-height: 1.5; }
.msg-time { font-size: 11px; color: var(--muted); text-align: center; }
.unknown-tag {
  background: rgba(239,68,68,0.15);
  color: #fca5a5;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10px;
}

/* ── BIZ SECTIONS EDITOR ── */
.biz-section-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
  transition: box-shadow .15s, opacity .15s;
}
.biz-section-card.collapsed .biz-section-body { display: none; }
.biz-section-card.collapsed .biz-section-header { border-bottom: none; }
.biz-section-card.drag-over { box-shadow: 0 0 0 2px var(--brand); }
.biz-section-card.dragging { opacity: .4; }
.biz-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: grab;
}
.biz-section-header:active { cursor: grabbing; }
/* Collapse toggle arrow */
.biz-section-collapse-btn {
  font-size: 10px;
  color: var(--muted);
  flex-shrink: 0;
  user-select: none;
  transition: transform .2s;
  cursor: pointer;
  padding: 2px 4px;
}
.biz-section-card:not(.collapsed) .biz-section-collapse-btn { transform: rotate(90deg); }
/* Preview button */
.biz-section-preview-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 4px;
  flex-shrink: 0;
  white-space: nowrap;
}
.biz-section-preview-btn:hover { color: var(--brand); border-color: var(--brand); }
.biz-section-name {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  padding: 5px 10px;
  outline: none;
}
.biz-section-name:focus { border-color: var(--brand); }
.biz-section-topic {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  padding: 5px 8px;
  outline: none;
  min-width: 120px;
}
.biz-section-topic:focus { border-color: var(--brand); color: var(--text); }
.biz-section-delete {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.biz-section-delete:hover { color: var(--red); background: rgba(239,68,68,0.1); }
.biz-section-content {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  line-height: 1.6;
  padding: 12px;
  resize: vertical;
  min-height: 90px;
  outline: none;
}
.biz-section-content:focus { background: rgba(255,255,255,0.02); }
.biz-section-chip-controls {
  padding: 10px 12px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.biz-section-chip-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}
.biz-section-chip-toggle input {
  accent-color: var(--brand);
}
.biz-section-chip-settings {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 10px;
}
.biz-section-chip-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.biz-section-chip-field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}
.biz-section-chip-label,
.biz-section-chip-icon {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  padding: 6px 8px;
  outline: none;
}
.biz-section-chip-label:focus,
.biz-section-chip-icon:focus {
  border-color: var(--brand);
}
.biz-section-chip-icon-field {
  max-width: 132px;
}
.biz-section-chip-icon {
  text-align: center;
  font-size: 16px;
  padding-left: 6px;
  padding-right: 6px;
}
.biz-sections-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 16px 0 8px;
}

/* ── SERVICES EDITOR ── */
.biz-service-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}
.biz-service-name {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 10px;
  outline: none;
}
.biz-service-name:focus { border-color: var(--brand); }
.biz-service-price {
  width: 80px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  padding: 6px 8px;
  outline: none;
  text-align: right;
}
.biz-service-price:focus { border-color: var(--brand); color: var(--text); }
.biz-service-del {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  padding: 4px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.biz-service-del:hover { color: var(--red); background: rgba(239,68,68,0.1); }

/* ── SECTION ORDER BUTTONS (legacy, hidden — drag&drop used instead) ── */
.biz-section-order { display: none; }

/* ── FOLLOW-UP BUTTONS EDITOR (inside biz section cards) ── */
.biz-followup-section {
  border-top: 1px solid var(--border);
  padding: 8px 12px 10px;
}
.biz-followup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
}
.biz-followup-question {
  width: 100%;
  box-sizing: border-box;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  padding: 5px 8px;
  outline: none;
  margin-bottom: 6px;
  font-style: italic;
}
.biz-followup-question:focus { border-color: var(--brand); font-style: normal; }
.biz-followup-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.biz-followup-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.biz-followup-label {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  padding: 4px 8px;
  outline: none;
}
.biz-followup-label:focus { border-color: var(--brand); }
.biz-followup-action {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 11px;
  padding: 4px 6px;
  outline: none;
  min-width: 100px;
}
.biz-followup-del {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 5px;
  border-radius: 4px;
  flex-shrink: 0;
}
.biz-followup-del:hover { color: var(--red); background: rgba(239,68,68,0.1); }

/* ── QUALIFICATION CARDS ── */
.qual-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.qual-card-header {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.qual-question-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  padding: 5px 9px;
  outline: none;
}
.qual-question-input:focus { border-color: var(--brand); }
.qual-del-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  padding: 3px 7px;
  border-radius: 4px;
  flex-shrink: 0;
}
.qual-del-btn:hover { color: var(--red); background: rgba(239,68,68,0.1); }
.qual-chips-list { display: flex; flex-direction: column; gap: 5px; }
.qual-chip-row { display: flex; gap: 6px; align-items: center; }
.qual-chip-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  padding: 4px 8px;
  outline: none;
}
.qual-chip-input:focus { border-color: var(--brand); }
.qual-chip-icon {
  width: 64px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  padding: 4px 8px;
  text-align: center;
  outline: none;
}
.qual-chip-icon:focus { border-color: var(--brand); }
.qual-chip-del {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 5px;
  border-radius: 4px;
  flex-shrink: 0;
}
.qual-chip-del:hover { color: var(--red); background: rgba(239,68,68,0.1); }

/* ── SIDEBAR TOGGLE IN SECTION HEADER ── */
.biz-section-sidebar-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.biz-section-sidebar-label input[type="checkbox"] {
  accent-color: var(--brand);
  width: 13px;
  height: 13px;
  cursor: pointer;
}
.biz-section-sidebar-label:has(input:checked) {
  color: var(--brand);
}

/* ── FEEDBACK ROWS ── */
.stats-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.stat-card {
  flex: 1;
  min-width: 80px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}
.stat-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}
.feedback-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.feedback-row--up  { border-left-color: #16a34a; }
.feedback-row--down{ border-left-color: #dc2626; }
.feedback-emoji-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 16px;
}
.feedback-emoji-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
}
.feedback-emoji-chip__icon {
  font-size: 16px;
  line-height: 1;
}
.feedback-emoji-chip strong {
  color: var(--muted);
  font-size: 11px;
}
.feedback-row__head{
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.feedback-row__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.feedback-row__meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.12);
  color: var(--text-soft);
  font-size: 11px;
  border: 1px solid rgba(139, 92, 246, 0.2);
}
.feedback-row__rating { font-size: 18px; line-height: 1; }
.feedback-row__label { color: var(--text); font-weight: 600; }
.feedback-row__session { color: var(--muted); font-family: monospace; font-size: 11px; }
.feedback-row__date { margin-left: auto; color: var(--muted); font-size: 11px; }
.feedback-row__delete { margin-left: 4px; }
.feedback-row__msg { font-size: 12.5px; color: var(--text-soft); }
.feedback-row__comment { font-size: 12.5px; color: var(--text); font-style: italic; padding: 4px 8px; background: var(--bg); border-radius: 6px; }
.feedback-empty {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 13px;
}
.feedback-empty strong {
  color: var(--text);
}
.feedback-empty--error {
  border-color: rgba(220, 38, 38, 0.35);
}

/* ── Booking Form Config Editor ─────────────────────────────────────────────── */
.bfc-row { display: flex; flex-direction: column; gap: 6px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.bfc-add-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.bfc-row-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bfc-input { background: var(--bg); border: 1px solid var(--border); border-radius: 7px; color: var(--text); font: inherit; font-size: 12.5px; padding: 6px 10px; outline: none; transition: border-color .14s; }
.bfc-input:focus { border-color: var(--accent); }
.bfc-preset { min-width: 220px; flex: 0 1 240px; }
.bfc-custom-input { flex: 1 1 160px; min-width: 130px; }
#bfc_custom_id { flex: 0 1 120px; font-family: monospace; font-size: 11px; }
#bfc_custom_type { flex: 0 1 130px; }
.bfc-label { flex: 1 1 160px; min-width: 120px; }
.bfc-id { flex: 0 1 120px; min-width: 80px; font-family: monospace; font-size: 11px; }
.bfc-type { flex: 0 1 130px; min-width: 100px; }
.bfc-req { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); white-space: nowrap; cursor: pointer; flex-shrink: 0; }
.bfc-req input { cursor: pointer; }
.bfc-row-btns { display: flex; gap: 4px; margin-left: auto; flex-shrink: 0; }
.bfc-btn { border: 1px solid var(--border); background: var(--bg); color: var(--muted); border-radius: 6px; padding: 4px 8px; font-size: 12px; cursor: pointer; transition: background .12s, color .12s; }
.bfc-btn:hover:not(:disabled) { background: var(--card); color: var(--text); }
.bfc-btn:disabled { opacity: .35; cursor: default; }
.bfc-del:hover { background: rgba(239,68,68,.1) !important; color: #ef4444 !important; border-color: rgba(239,68,68,.3) !important; }
.bfc-placeholder, .bfc-options { font-size: 12px; color: var(--muted); }
