/* ==========================================================================
   Kala Voice AI - Admin Console Design System
   Matching Modern Multimodal Voice Agent Architecture
   ========================================================================== */

:root {
  --bg-app: #0b0d13;
  --bg-rail: #080a0f;
  --bg-topbar: #0c0e14;
  --bg-surface: #11141c;
  --bg-surface-raised: #161a25;
  --bg-surface-overlay: #1b202e;
  --bg-input: #0e1118;

  --border-subtle: #1c212d;
  --border-medium: #262c3d;
  --border-active: #3b82f6;

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-faint: #6b7280;

  --blue-primary: #2563eb;
  --blue-hover: #1d4ed8;
  --blue-soft: rgba(37, 99, 235, 0.12);
  --blue-border: rgba(37, 99, 235, 0.35);

  --purple-primary: #8b5cf6;
  --purple-soft: rgba(139, 92, 246, 0.12);

  --orange-primary: #f97316;
  --orange-soft: rgba(249, 115, 22, 0.12);

  --green-primary: #10b981;
  --green-soft: rgba(16, 185, 129, 0.12);
  --green-text: #34d399;

  --font-sans: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', SFMono-Regular, Consolas, monospace;

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 9999px;

  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.35);
  --shadow-window: 0 16px 40px rgba(0, 0, 0, 0.5);
}

/* Light Mode Design System */
[data-theme="light"] {
  --bg-app: #f8fafc;
  --bg-rail: #ffffff;
  --bg-topbar: #ffffff;
  --bg-surface: #ffffff;
  --bg-surface-raised: #f1f5f9;
  --bg-surface-overlay: #e2e8f0;
  --bg-input: #ffffff;

  --border-subtle: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-active: #2563eb;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-faint: #64748b;

  --blue-soft: rgba(37, 99, 235, 0.08);
  --blue-border: rgba(37, 99, 235, 0.25);

  --purple-soft: rgba(139, 92, 246, 0.08);
  --orange-soft: rgba(249, 115, 22, 0.08);
  --green-soft: rgba(16, 185, 129, 0.08);
  --green-text: #059669;

  --shadow-card: 0 4px 18px rgba(0, 0, 0, 0.06);
  --shadow-window: 0 16px 36px rgba(0, 0, 0, 0.12);
}

/* Light Mode Specific Component Overrides */
[data-theme="light"] .rail-logo-badge {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .rail-item:hover {
  background: #f1f5f9;
  color: #0f172a;
}

[data-theme="light"] .rail-item.is-active {
  background: #eff6ff;
  color: #1d4ed8;
  box-shadow: inset 0 0 0 1px #bfdbfe;
}

[data-theme="light"] .site-picker-pill,
[data-theme="light"] .topbar-btn,
[data-theme="light"] .topbar-icon-btn {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #334155;
}

[data-theme="light"] .site-picker-pill:hover,
[data-theme="light"] .topbar-btn:hover,
[data-theme="light"] .topbar-icon-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

[data-theme="light"] .search-input,
[data-theme="light"] .query-select {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}

[data-theme="light"] .search-input:focus,
[data-theme="light"] .query-select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

[data-theme="light"] .card-metric,
[data-theme="light"] .table-card,
[data-theme="light"] .embed-code-card,
[data-theme="light"] .widget-config-panel,
[data-theme="light"] .one-time-install-banner,
[data-theme="light"] .deploy-sub-sidebar,
[data-theme="light"] .studio-sub-sidebar,
[data-theme="light"] .canvas-card,
[data-theme="light"] .chat-card,
[data-theme="light"] .admin-modal-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .embed-code-card {
  background: #ffffff;
  border-color: #e2e8f0;
}

[data-theme="light"] .embed-code-header {
  background: #f1f5f9;
  border-bottom-color: #e2e8f0;
  color: #475569;
}

[data-theme="light"] .embed-pre {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #0f172a;
}

[data-theme="light"] .embed-pre code {
  color: #1e293b;
}

[data-theme="light"] .widget-preview-canvas {
  background: #f1f5f9;
  border-color: #cbd5e1;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .segmented-track {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

[data-theme="light"] .segment-btn {
  color: #64748b;
}

[data-theme="light"] .segment-btn:hover {
  color: #0f172a;
}

[data-theme="light"] .segment-btn.is-active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .code-box-header {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #475569;
}

[data-theme="light"] .code-pre {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #1e293b;
}

[data-theme="light"] .crawler-terminal {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .terminal-bar {
  background: #f1f5f9;
  border-bottom-color: #e2e8f0;
}

[data-theme="light"] .terminal-title {
  color: #64748b;
}

[data-theme="light"] .terminal-output {
  background: #ffffff;
  color: #065f46;
}

[data-theme="light"] .retrieval-card {
  background: #ffffff;
  border-color: #e2e8f0;
}

[data-theme="light"] .retrieval-card:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

[data-theme="light"] .card-rank-badge {
  background: #e2e8f0;
  border-color: #cbd5e1;
  color: #0f172a;
}

[data-theme="light"] .card-score-pill {
  background: #e0f2fe;
  color: #0284c7;
  border-color: #bae6fd;
}

[data-theme="light"] .badge-status-ready {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

[data-theme="light"] .query-card {
  background: #ffffff;
  border-color: #e2e8f0;
}

[data-theme="light"] .query-options-bar {
  border-top-color: #f1f5f9;
}

[data-theme="light"] .query-card-footer {
  border-top-color: #f1f5f9;
}

[data-theme="light"] .modal-window {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .modal-header {
  border-bottom-color: #e2e8f0;
}

[data-theme="light"] .modal-pre {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #1e293b;
}

[data-theme="light"] .modal-footer {
  border-top-color: #e2e8f0;
}

[data-theme="light"] .btn-secondary {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #1e293b;
}

[data-theme="light"] .btn-secondary:hover {
  background: #e2e8f0;
  color: #0f172a;
}

[data-theme="light"] .field-input,
[data-theme="light"] .field-select,
[data-theme="light"] .field-textarea {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}

[data-theme="light"] .field-input:focus,
[data-theme="light"] .field-select:focus,
[data-theme="light"] .field-textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

[data-theme="light"] .btn-copy-mini,
[data-theme="light"] .btn-copy-code {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
}

[data-theme="light"] .btn-copy-mini:hover,
[data-theme="light"] .btn-copy-code:hover {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

[data-theme="light"] .login-screen-wrapper {
  background: radial-gradient(circle at 50% 25%, #f8fafc 0%, #e2e8f0 75%);
}

[data-theme="light"] .login-card {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .login-logo-badge {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .login-input {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}

[data-theme="light"] .callout-box {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .slack-field-input {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}

[data-theme="light"] .dropzone-area {
  background: #f8fafc;
  border-color: #cbd5e1;
}

[data-theme="light"] .dropzone-area:hover {
  background: #f1f5f9;
  border-color: #2563eb;
}

[data-theme="light"] .sub-nav-link {
  color: #475569;
}

[data-theme="light"] .sub-nav-link:hover {
  background: #f1f5f9;
  color: #0f172a;
}

[data-theme="light"] .sub-nav-link.is-active {
  background: #eff6ff;
  color: #1d4ed8;
}

[data-theme="light"] .admin-modal-header {
  border-bottom-color: #e2e8f0;
}

[data-theme="light"] .modal-input-field input,
[data-theme="light"] .modal-input-field textarea,
[data-theme="light"] .modal-input-field select {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}

[data-theme="light"] .data-table thead tr {
  background: #f8fafc;
  border-bottom-color: #e2e8f0;
}

[data-theme="light"] .data-table th {
  color: #64748b;
}

[data-theme="light"] .data-table td {
  border-bottom-color: #f1f5f9;
  color: #1e293b;
}

[data-theme="light"] .data-table tbody tr:hover td {
  background: #f8fafc;
}

/* Theme Toggle Button Icons */
[data-theme="light"] .theme-icon-sun {
  display: none !important;
}

[data-theme="light"] .theme-icon-moon {
  display: block !important;
}

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

html, body {
  height: 100%;
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

/* ==========================================================================
   APP SHELL LAYOUT: LEFT RAIL + MAIN VIEWPORT
   ========================================================================== */

.admin-shell {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* 1. Left Icon Rail (Collapsible / Expandable) */
.nav-rail {
  width: 60px;
  min-width: 60px;
  background: var(--bg-rail);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0 16px;
  z-index: 50;
  user-select: none;
  transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.22s cubic-bezier(0.4, 0, 0.2, 1), padding 0.22s ease;
}

.rail-top {
  margin-bottom: 22px;
  width: 100%;
  display: flex;
  justify-content: center;
}

.rail-logo-badge {
  width: 34px;
  height: 34px;
  background: #2563eb;
  border: none;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: all 0.15s ease;
  overflow: hidden;
}

.rail-logo-badge svg,
.login-logo-badge svg {
  width: 100%;
  height: 100%;
}

.rail-logo-badge:hover {
  transform: scale(1.04);
}

.rail-brand-text {
  display: none;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  width: 100%;
  align-items: center;
}

.rail-bottom {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  align-items: center;
}

.rail-item {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  text-decoration: none;
}

.rail-item:hover {
  background: var(--bg-surface);
  color: var(--text-main);
}

.rail-item.is-active {
  background: var(--bg-surface-raised);
  color: #ffffff;
  box-shadow: inset 0 0 0 1px var(--border-medium);
}

.rail-item.is-active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  background: var(--blue-primary);
  border-radius: 0 4px 4px 0;
}

.rail-item-label {
  display: none;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.rail-toggle-icon {
  transition: transform 0.22s ease;
}

/* Expanded Left Rail State */
.nav-rail.is-expanded {
  width: 210px;
  min-width: 210px;
  align-items: stretch;
  padding: 14px 10px 16px;
}

.nav-rail.is-expanded .rail-top {
  justify-content: flex-start;
  padding: 0 2px;
}

.nav-rail.is-expanded .rail-logo-badge {
  width: 100%;
  height: 38px;
  justify-content: flex-start;
  padding: 0 10px;
  gap: 10px;
}

.nav-rail.is-expanded .rail-brand-text {
  display: inline-block;
}

.nav-rail.is-expanded .rail-nav,
.nav-rail.is-expanded .rail-bottom {
  align-items: stretch;
}

.nav-rail.is-expanded .rail-item {
  width: 100%;
  height: 38px;
  justify-content: flex-start;
  padding: 0 12px;
  gap: 12px;
}

.nav-rail.is-expanded .rail-item-label {
  display: inline-block;
}

.nav-rail.is-expanded .rail-item.is-active::before {
  left: 0;
  top: 6px;
  bottom: 6px;
}

.nav-rail.is-expanded .rail-toggle-icon {
  transform: rotate(180deg);
}

/* 2. Main Admin Container */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-app);
}

/* 3. Top Context Bar */
.top-context-bar {
  height: 52px;
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
}

.context-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
}

.crumb-section {
  color: var(--text-main);
}

.crumb-divider {
  color: var(--text-faint);
}

.crumb-target {
  color: var(--text-muted);
}

.context-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-picker-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  color: var(--text-muted);
}

.site-select {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
}

.site-select option {
  background: var(--bg-surface-raised);
  color: var(--text-main);
}

.topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 11px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.topbar-btn:hover {
  background: var(--bg-surface-raised);
  color: var(--text-main);
  border-color: var(--border-medium);
}

.topbar-icon-btn {
  background: transparent;
  border: none;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.15s ease;
}

.topbar-icon-btn:hover {
  color: var(--text-main);
  background: var(--bg-surface);
}

.system-health-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--green-text);
  background: var(--green-soft);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 3px 9px;
  border-radius: var(--radius-full);
}

.health-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green-primary);
  box-shadow: 0 0 6px var(--green-primary);
}

.admin-user-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.admin-user-pill svg {
  color: var(--text-muted);
}

/* 4. Workspace Viewport & Pane Visibility */
.workspace-viewport {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.workspace-view {
  display: none !important;
  height: 100%;
  width: 100%;
  overflow-y: auto;
}

.workspace-view.is-active {
  display: block !important;
}

/* ==========================================================================
   PILLAR 1: TEST PAGE (PLAYGROUND) - EXACT IMAGE 2 MATCH
   ========================================================================== */

.playground-layout {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  height: 100%;
  overflow: hidden;
}

.playground-col {
  padding: 24px;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.playground-request-col {
  border-right: 1px solid var(--border-subtle);
  background: var(--bg-app);
}

.playground-response-col {
  background: var(--bg-app);
  padding: 24px;
}

/* API Mode Segment Bar */
.api-mode-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.segmented-track {
  display: inline-flex;
  background: #12151d;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.segmented-track.mini-track {
  border-radius: var(--radius-sm);
  padding: 2px;
}

.segment-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.segment-btn.mini {
  font-size: 11.5px;
  padding: 4px 10px;
}

.segment-btn:hover {
  color: var(--text-main);
}

.segment-btn.is-active {
  background: var(--bg-surface-raised);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.api-mode-caption {
  font-size: 12px;
  color: var(--text-faint);
}

/* Query Card */
.query-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-card);
}

.query-textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  min-height: 90px;
  outline: none;
}

.query-textarea::placeholder {
  color: var(--text-faint);
}

.query-options-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.query-option-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-faint);
}

.query-select {
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 11.5px;
  border-radius: var(--radius-xs);
  padding: 2px 6px;
  outline: none;
}

.query-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  padding-top: 12px;
}

.query-route-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
}

.btn-send-request {
  background: var(--blue-primary);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.4);
}

.btn-send-request:hover {
  background: var(--blue-hover);
}

.btn-send-request:active {
  transform: translateY(1px);
}

/* Sample Questions Section */
.sample-questions-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sample-questions-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.sample-questions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sample-q-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.sample-q-card:hover {
  background: var(--bg-surface-raised);
  border-color: var(--border-medium);
  color: var(--text-main);
  transform: translateX(2px);
}

.sample-q-icon {
  margin-top: 2px;
  color: var(--text-faint);
  flex-shrink: 0;
}

/* Response Column Header & Controls */
.response-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-shrink: 0;
}

.response-viewport {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

/* 1. Visual Cards Stack (Image 2 Match) */
.retrieval-card-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.retrieval-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.retrieval-card:hover {
  border-color: var(--border-medium);
  background: #141822;
}

.retrieval-card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.card-rank-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #1c2233;
  border: 1px solid #2b344a;
  color: #ffffff;
  font-weight: 600;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.card-title-block {
  flex: 1;
  min-width: 0;
}

.card-header-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-score-pill {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: #142738;
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.card-source-url {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-faint);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-expand-btn {
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.card-expand-btn:hover {
  color: var(--text-main);
}

.card-snippet-text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
  padding-left: 34px;
}

.card-snippet-text mark,
.card-snippet-text .hl-token {
  background: rgba(37, 99, 235, 0.25);
  color: #93c5fd;
  padding: 0 2px;
  border-radius: 2px;
}

/* Empty State */
.empty-state-notice {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 280px;
  color: var(--text-faint);
  text-align: center;
  gap: 12px;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 30px;
}

/* JSON & Code Snippets Containers */
.code-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: #131620;
  border: 1px solid var(--border-subtle);
  border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-faint);
}

.code-pre {
  background: #0d1017;
  border: 1px solid var(--border-subtle);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  color: #cbd5e1;
  overflow-x: auto;
  max-height: 480px;
}

.btn-copy-mini {
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 11px;
  padding: 3px 9px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-copy-mini:hover {
  color: var(--text-main);
  background: var(--bg-surface-overlay);
}

/* Chat API Mode Preview */
.chat-preview-shell {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 0;
  max-width: 600px;
  margin: 0 auto;
}

.chat-bubble {
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  font-size: 13.5px;
  line-height: 1.6;
}

.chat-bubble-user {
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.sources-disclosure-pill {
  align-self: flex-start;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 4px 12px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.sources-disclosure-pill:hover {
  border-color: var(--border-medium);
  color: var(--text-main);
}

.pill-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pill-header .sparkle-icon {
  color: var(--purple-primary);
}

.cited-sources-drawer {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-surface-raised);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.cited-source-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}

.cited-source-title {
  color: var(--text-main);
  font-weight: 500;
}

.cited-source-url {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 11px;
}

.chat-bubble-agent {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

/* Footer Status Bar */
.playground-footer-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-faint);
  flex-shrink: 0;
}

.dot-sep {
  color: var(--border-medium);
}

/* ==========================================================================
   PILLAR 2: CONNECT PAGE (ADD CUSTOM SOURCES)
   ========================================================================== */

.connect-layout {
  padding: 28px 36px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1300px;
  margin: 0 auto;
}

.connect-header-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.connect-page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.connect-page-desc {
  font-size: 13px;
  color: var(--text-muted);
}

.connect-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.connect-metrics-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
}

.metric-lbl {
  font-size: 12px;
  color: var(--text-faint);
}

.source-types-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

@media (max-width: 1100px) {
  .source-types-grid {
    grid-template-columns: 1fr;
  }
}

.source-type-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-card);
}

.source-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.source-icon-badge {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.source-icon-badge.blue {
  background: var(--blue-soft);
  color: #60a5fa;
  border: 1px solid var(--blue-border);
}

.source-icon-badge.purple {
  background: var(--purple-soft);
  color: #c084fc;
  border: 1px solid rgba(139, 92, 246, 0.35);
}

.source-icon-badge.orange {
  background: var(--orange-soft);
  color: #fb923c;
  border: 1px solid rgba(249, 115, 22, 0.35);
}

.source-icon-badge.green {
  background: var(--green-soft);
  color: #4ade80;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.source-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
}

.source-card-subtitle {
  font-size: 12px;
  color: var(--text-faint);
}

.source-card-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input-row {
  display: flex;
  gap: 10px;
}

.text-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  transition: border-color 0.15s ease;
}

.text-input:focus {
  border-color: var(--blue-primary);
}

.btn-action-primary {
  background: var(--blue-primary);
  border: 1px solid transparent;
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-action-primary:hover {
  background: var(--blue-hover);
}

.options-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}

/* Crawler Terminal */
.crawler-terminal {
  background: #090b10;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.terminal-bar {
  background: #10131c;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.terminal-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.terminal-dot.red { background: #ef4444; }
.terminal-dot.yellow { background: #f59e0b; }
.terminal-dot.green { background: #10b981; }

.terminal-title {
  margin-left: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
}

.terminal-output {
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
  color: #a7f3d0;
  max-height: 160px;
  overflow-y: auto;
}

/* Dropzone */
.dropzone-area {
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.015);
  transition: all 0.15s ease;
  color: var(--text-faint);
}

.dropzone-area:hover,
.dropzone-area.drag-over {
  border-color: var(--purple-primary);
  background: rgba(139, 92, 246, 0.04);
  color: var(--text-main);
}

.dropzone-text {
  font-size: 13px;
  color: var(--text-main);
}

.dropzone-hint {
  font-size: 11.5px;
  color: var(--text-faint);
}

.upload-feedback-bar {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.upload-feedback-bar.success {
  background: var(--green-soft);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Mini Connectors List */
.connectors-mini-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.connector-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
}

.connector-name {
  color: var(--text-main);
}

.badge-status-ready {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: #1e293b;
  color: #94a3b8;
}

/* Sources Table Section */
.sources-table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-card);
}

.table-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.table-section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
}

.search-input {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 12.5px;
  padding: 5px 12px;
  outline: none;
  min-width: 200px;
}

.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.data-table th {
  padding: 10px 14px;
  color: var(--text-faint);
  font-weight: 500;
  font-size: 11.5px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface-raised);
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.badge-source-type {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}
.badge-source-type.web { background: var(--blue-soft); color: #93c5fd; }
.badge-source-type.doc { background: var(--purple-soft); color: #d8b4fe; }
.badge-source-type.faq { background: var(--orange-soft); color: #fdba74; }
.badge-source-type.kb { background: var(--green-soft); color: #86efac; }
[data-theme="light"] .badge-source-type.web { color: #1d4ed8; }
[data-theme="light"] .badge-source-type.doc { color: #7e22ce; }
[data-theme="light"] .badge-source-type.faq { color: #c2410c; }
[data-theme="light"] .badge-source-type.kb { color: #047857; }

.status-badge-active {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--green-text);
}
.status-badge-active::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green-primary);
}

.btn-table-action {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-table-action:hover {
  background: var(--bg-surface-raised);
  color: var(--text-main);
}

.btn-table-action.delete:hover {
  border-color: #ef4444;
  color: #f87171;
}

.btn-table-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.table-hint {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 2px;
}

/* Website sources: a header row per crawl with its pages beneath */
.source-group-row td {
  background: var(--bg-surface-raised);
}

.source-group-row .source-url {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
}

.source-page-row td:first-child {
  padding-left: 32px;
}

.source-page-row.is-removed td {
  opacity: 0.55;
}

.row-sub {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-faint);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.interval-select {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 11.5px;
  padding: 3px 6px;
}

.status-badge-warn,
.status-badge-error,
.status-badge-muted,
.status-badge-busy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
}
.status-badge-warn::before,
.status-badge-error::before,
.status-badge-muted::before,
.status-badge-busy::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-badge-warn { color: var(--orange-primary); }
.status-badge-error { color: #ef4444; }
.status-badge-muted { color: var(--text-faint); }
.status-badge-busy { color: var(--blue-primary); }
.status-badge-busy::before { animation: pulse-dot 1s ease-in-out infinite; }

@keyframes pulse-dot {
  50% { opacity: 0.25; }
}

/* Per-page on/off switch in the website sources table */
.source-page-row.is-disabled td:not(:last-child) {
  opacity: 0.55;
}

.page-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 0 4px 0 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 11.5px;
  cursor: pointer;
}
.page-switch:disabled { opacity: 0.5; cursor: wait; }
.page-switch:focus-visible { outline: 2px solid var(--border-active); outline-offset: 2px; border-radius: var(--radius-xs); }

.page-switch-track {
  position: relative;
  flex-shrink: 0;
  width: 26px;
  height: 15px;
  border-radius: 999px;
  background: var(--border-medium);
  transition: background 0.15s ease;
}
.page-switch-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s ease;
}
.page-switch[aria-checked="true"] .page-switch-track { background: var(--green-primary); }
.page-switch[aria-checked="true"] .page-switch-track::after { transform: translateX(11px); }
.page-switch[aria-checked="true"] .page-switch-label { color: var(--green-text); }
.page-switch-label { min-width: 38px; text-align: left; }

/* Sync log modal: one collapsible card per run, problems open and listed first */
.sync-run {
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--green-primary);
  border-radius: var(--radius-md);
  background: var(--bg-surface-raised);
}
.sync-run.is-partial { border-left-color: var(--orange-primary); }
.sync-run.is-failed { border-left-color: #ef4444; }

.sync-run-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  list-style: none;
}
.sync-run-head::-webkit-details-marker { display: none; }
.sync-run-head::before {
  content: '\25B8';
  color: var(--text-faint);
  transition: transform 0.15s ease;
}
.sync-run[open] > .sync-run-head::before { transform: rotate(90deg); }

.sync-run-trigger {
  padding: 1px 7px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-size: 11px;
}
.sync-run-time { color: var(--text-main); }
.sync-run-duration { margin-left: auto; color: var(--text-faint); font-family: var(--font-mono); font-size: 11px; }

.sync-run-body {
  padding: 0 12px 12px;
  font-size: 12px;
  color: var(--text-muted);
}
.sync-run-body p { margin: 0 0 6px; }
.sync-run-window { color: var(--text-faint); font-size: 11px; }
.sync-run-failcount { color: #ef4444; font-weight: 600; }
.sync-run-error {
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  word-break: break-word;
}
[data-theme="light"] .sync-run-error,
[data-theme="light"] .sync-run-failcount { color: #dc2626; }

.sync-page-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  border-top: 1px solid var(--border-subtle);
}
.sync-page {
  display: flex;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.sync-page:last-child { border-bottom: none; }
.sync-page-result {
  flex-shrink: 0;
  width: 84px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
}
.sync-page.is-failed .sync-page-result { color: #ef4444; }
.sync-page.is-removed .sync-page-result,
.sync-page.is-warn .sync-page-result { color: var(--orange-primary); }
.sync-page.is-added .sync-page-result { color: var(--green-text); }
.sync-page.is-updated .sync-page-result { color: var(--blue-primary); }
.sync-page.is-failed { background: rgba(239, 68, 68, 0.06); }
.sync-page-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sync-page-title { color: var(--text-main); }
.sync-page-url {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  word-break: break-all;
}
.sync-page-error { color: #f87171; word-break: break-word; }
.sync-page-note, .page-render-note { color: var(--text-muted); word-break: break-word; }
.sync-page-note.is-warn, .page-render-note.is-warn { color: var(--orange-primary); }
[data-theme="light"] .sync-page.is-failed .sync-page-result,
[data-theme="light"] .sync-page-error { color: #dc2626; }
.sync-page-off {
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--bg-surface-overlay);
  color: var(--text-faint);
  font-size: 10.5px;
}

.sources-empty-row td {
  text-align: center;
  color: var(--text-faint);
  padding: 28px 14px;
}

/* Chunk viewer inside the source modal */
.modal-meta-line {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.5;
  word-break: break-word;
}

.chunk-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chunk-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface-raised);
  padding: 10px 12px;
}

.chunk-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  color: var(--text-faint);
  margin-bottom: 6px;
}

.chunk-card-body {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ==========================================================================
   PILLAR 3: DEPLOY PAGE (INTEGRATIONS & WIDGET) - IMAGE 1 MATCH
   ========================================================================== */

.deploy-two-col-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100%;
  overflow: hidden;
}

/* Left Sub-Sidebar Menu */
.deploy-sub-sidebar {
  background: var(--bg-rail);
  border-right: 1px solid var(--border-subtle);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}

.sub-nav-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sub-nav-group-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  padding: 4px 10px;
}

.sub-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  padding: 8px 10px;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sub-nav-link:hover {
  background: var(--bg-surface);
  color: var(--text-main);
}

.sub-nav-link.is-active {
  background: #1c2233;
  color: #ffffff;
}

.sub-icon-box {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sub-icon-box.blue { background: #2563eb; color: #ffffff; }
.sub-icon-box.purple { background: #a855f7; color: #ffffff; }
.sub-icon-box.orange { background: #f97316; color: #ffffff; }
.sub-icon-box.green { background: #10b981; color: #ffffff; }

/* Right Deploy Canvas */
.deploy-main-content {
  background: var(--bg-app);
  padding: 32px 48px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.deploy-sub-view {
  display: none;
  flex-direction: column;
  gap: 28px;
}

.deploy-sub-view.is-active {
  display: flex;
}

/* Floating Widget Window Canvas (Image 1 replica) */
.widget-preview-canvas {
  background: #141721;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 50px 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 480px;
  box-shadow: inset 0 2px 20px rgba(0, 0, 0, 0.3);
}

.floating-widget-window {
  width: 100%;
  max-width: 480px;
  background: #ffffff;
  color: #0f172a;
  border-radius: 18px;
  box-shadow: var(--shadow-window);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.widget-window-header {
  padding: 14px 18px;
  background: #ffffff;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.widget-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.widget-avatar-symbol {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
}

.widget-agent-name {
  font-size: 13.5px;
  font-weight: 600;
  color: #0f172a;
}

.widget-header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.win-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 13px;
  cursor: pointer;
  padding: 2px 4px;
}

.win-btn:hover {
  color: #334155;
}

.widget-window-body {
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 220px;
  background: #ffffff;
}

.preview-bubble {
  max-width: 82%;
  padding: 11px 16px;
  font-size: 13.5px;
  line-height: 1.5;
  border-radius: 14px;
}

.preview-bubble.bubble-user {
  align-self: flex-end;
  background: #f1f5f9;
  color: #0f172a;
  border-bottom-right-radius: 4px;
}

.preview-grounding-pill {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #475569;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 9999px;
  padding: 3px 11px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.pill-sparkle {
  color: #6366f1;
}

.pill-arrow {
  color: #94a3b8;
}

.preview-bubble.bubble-agent {
  align-self: flex-start;
  color: #0f172a;
  padding: 4px 0 0 2px;
}

.widget-window-footer {
  padding: 12px 16px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.preview-msg-input {
  flex: 1;
  background: transparent;
  border: none;
  font-family: var(--font-sans);
  font-size: 13px;
  color: #0f172a;
  outline: none;
}

.preview-mic-btn {
  background: #2563eb;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  cursor: pointer;
}

/* Widget Meta Details (Below Preview) */
.widget-meta-footer {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.meta-category {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}

.meta-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 2px;
}

.meta-desc {
  font-size: 13.5px;
  color: var(--text-muted);
  max-width: 600px;
  margin-top: 4px;
}

.meta-doc-link {
  font-size: 12.5px;
  color: #60a5fa;
  text-decoration: underline;
  text-underline-offset: 3px;
  margin-top: 4px;
  display: inline-block;
}

.embed-code-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  max-width: 820px;
}

.embed-code-header {
  padding: 10px 16px;
  background: #141722;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-faint);
}

.btn-copy-code {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 500;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-copy-code:hover {
  background: var(--blue-primary);
  border-color: var(--blue-primary);
  color: #ffffff;
}

.embed-pre {
  padding: 16px;
  background: #0d1017;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.5;
  color: #38bdf8;
  overflow-x: auto;
}

.quick-config-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 8px;
}

.config-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.save-feedback-text {
  font-size: 12px;
  color: var(--green-text);
  font-weight: 500;
}

/* Generic Card & Form System */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.card-header {
  margin-bottom: 20px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
}

.card-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

.form-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 600px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.field-input,
.field-select,
.field-textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
}

.field-input:focus,
.field-select:focus,
.field-textarea:focus {
  border-color: var(--blue-primary);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.modal-window {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 720px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 15px;
  font-weight: 600;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-faint);
  font-size: 16px;
  cursor: pointer;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

/* A form wrapping .modal-body + .modal-footer: it has to pass the window's height limit down, or the
   body never scrolls and the footer (Save) is clipped on short screens. */
.modal-body-form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.modal-pre {
  background: #090c12;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: #cbd5e1;
  white-space: pre-wrap;
  word-break: break-word;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
}

.btn-secondary {
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background: var(--bg-surface-overlay);
  border-color: var(--border-medium);
}

.btn-primary-blue {
  background: var(--blue-primary);
  border: 1px solid transparent;
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-primary-blue:hover {
  background: var(--blue-hover);
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .playground-layout {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
  .playground-request-col {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
  .deploy-two-col-layout {
    grid-template-columns: 1fr;
  }
  .deploy-sub-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    flex-direction: row;
    overflow-x: auto;
  }
  .source-types-grid {
    grid-template-columns: 1fr;
  }
  .connect-metrics-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==========================================================================
   LOGIN SCREEN (AUTHENTICATION SECTION)
   ========================================================================== */

.login-screen-wrapper {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 25%, #161b27 0%, #080a0f 75%);
  z-index: 9999;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 40px 32px 32px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: loginFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-brand-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

.login-logo-badge {
  width: 44px;
  height: 44px;
  background: #2563eb;
  border: none;
  border-radius: var(--radius-lg);
  color: #ffffff;
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  margin-bottom: 4px;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

.login-notice-banner {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12.5px;
  line-height: 1.4;
  text-align: center;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: block;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon svg {
  position: absolute;
  left: 12px;
  color: var(--text-faint);
  pointer-events: none;
}

.login-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 13.5px;
  padding: 10px 12px 10px 38px;
  outline: none;
  transition: all 0.15s ease;
}

.login-input:focus {
  border-color: var(--blue-primary);
  box-shadow: 0 0 0 2px var(--blue-soft);
}

.login-helpers-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}

.login-default-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
}

.btn-login-submit {
  width: 100%;
  background: var(--blue-primary);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
  padding: 11px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
  transition: all 0.15s ease;
  margin-top: 4px;
}

.btn-login-submit:hover {
  background: var(--blue-hover);
}

.btn-login-submit:active {
  transform: translateY(1px);
}

.btn-login-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: btnSpin 0.7s linear infinite;
  display: inline-block;
}

@keyframes btnSpin {
  to { transform: rotate(360deg); }
}

.login-card-footer {
  text-align: center;
  font-size: 11.5px;
  color: var(--text-faint);
  border-top: 1px solid var(--border-subtle);
  padding-top: 16px;
}

/* Logout button in Rail Footer */
.rail-item.logout-btn:hover {
  color: #f87171;
  background: rgba(239, 68, 68, 0.12);
}

/* ============================================================ */
/* WEBSITE & KNOWLEDGEBASE ASSIGNMENT BANNER                   */
/* ============================================================ */
.website-kb-config-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  flex-wrap: wrap;
}

.kb-config-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 500px;
}

.kb-badge-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.kb-site-tag {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.kb-website-badge {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.kb-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 600;
}

.kb-status-pill.dedicated {
  background: rgba(37, 99, 235, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(37, 99, 235, 0.3);
}

.kb-status-pill.linked {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.kb-config-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}

.kb-config-right {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 320px;
}

.kb-select-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kb-select-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.kb-source-select {
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 12.5px;
  padding: 8px 12px;
  outline: none;
  cursor: pointer;
}

.kb-source-select:focus {
  border-color: var(--blue-primary);
}

.kb-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.kb-feedback-msg {
  font-size: 11.5px;
  min-height: 16px;
}

.kb-feedback-msg.success {
  color: #34d399;
}

.kb-feedback-msg.error {
  color: #f87171;
}

.delete-site-btn {
  color: #f87171 !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
}

.delete-site-btn:hover {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: rgba(239, 68, 68, 0.5) !important;
}

/* ============================================================ */
/* MODAL: ADD WEBSITE EXTENSIONS                               */
/* ============================================================ */
.modal-window.modal-lg {
  max-width: 680px;
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-title-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-title-icon.blue {
  background: rgba(37, 99, 235, 0.15);
  color: #60a5fa;
}

.modal-title-icon.red {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.modal-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin: 2px 0 0 0;
}

.form-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-grid-2col .span-2 {
  grid-column: 1 / -1;
}

.field-helper {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 2px;
}

.modal-feedback-alert {
  margin-top: 16px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
}

.modal-feedback-alert.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.modal-feedback-alert.success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

/* ============================================================ */
/* SLACK INTEGRATION PANEL STYLES                              */
/* ============================================================ */
.slack-config-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 760px;
}

.header-tag-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.integration-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}

.integration-status-pill .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.integration-status-pill.connected {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.integration-status-pill.connected .status-dot {
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.integration-status-pill.disconnected {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.integration-status-pill.disconnected .status-dot {
  background: #64748b;
}

.slack-actions-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.callout-heading {
  margin: 0 0 10px 0;
  font-size: 13.5px;
  color: var(--text-main);
  font-weight: 600;
}

.callout-steps {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.callout-steps code {
  background: rgba(0, 0, 0, 0.3);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  color: #cbd5e1;
}

/* ============================================================ */
/* ONE-TIME INSTALL BANNER & DYNAMIC WIDGET CONFIG PANEL        */
/* ============================================================ */
.one-time-install-banner {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(139, 92, 246, 0.05) 100%);
  border: 1px solid rgba(37, 99, 235, 0.28);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 20px;
}

.banner-icon-badge {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(37, 99, 235, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #60a5fa;
  flex-shrink: 0;
}

.banner-body {
  flex: 1;
}

.banner-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.banner-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.banner-pill {
  font-size: 11px;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 1px 8px;
  border-radius: var(--radius-full);
}

.banner-desc {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-muted);
  margin: 0;
}

.banner-desc code {
  background: rgba(0, 0, 0, 0.25);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  color: #93c5fd;
}

[data-theme="light"] .banner-desc code {
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
}

/* Embed Header Actions */
.embed-code-title-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.embed-tag-label {
  font-weight: 600;
  color: var(--text-main);
  font-size: 13px;
}

.embed-sub-hint {
  font-size: 11px;
  color: var(--text-faint);
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 7px;
  border-radius: 4px;
}

[data-theme="light"] .embed-sub-hint {
  background: rgba(0, 0, 0, 0.05);
}

.embed-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.meta-doc-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #60a5fa;
  text-decoration: none;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.25);
  transition: all 0.15s ease;
}

.meta-doc-link-btn:hover {
  background: rgba(37, 99, 235, 0.2);
  color: #93c5fd;
}

/* Widget Config Panel */
.widget-config-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-top: 22px;
}

.panel-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.panel-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.panel-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
}

.widget-config-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.config-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.config-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
}

.field-hint {
  font-size: 11px;
  color: var(--text-faint);
}

/* Color picker & Presets */
.color-picker-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-swatch-native {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: transparent;
  padding: 2px;
}

.color-hex-input {
  width: 86px;
  height: 38px;
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 0 10px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  text-transform: uppercase;
}

.color-presets {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.preset-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.preset-dot:hover {
  transform: scale(1.15);
}

.preset-dot.is-active {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px var(--blue-primary);
}

[data-theme="light"] .preset-dot.is-active {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px #0f172a;
}

.panel-save-status-row {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.panel-header-save {
  display: flex;
  align-items: center;
  gap: 12px;
}

.save-feedback-text {
  font-size: 12px;
  color: var(--green-text);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Save & Push Live Button State Classes */
.btn-primary-blue.is-saving {
  opacity: 0.85;
  cursor: wait;
}

.btn-primary-blue.is-success {
  background: #10b981 !important;
  border-color: #059669 !important;
  color: #ffffff !important;
}

.btn-primary-blue.is-error {
  background: #ef4444 !important;
  border-color: #dc2626 !important;
  color: #ffffff !important;
}

/* Spinner Animation for buttons */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spin-icon {
  display: inline-block;
  animation: spin 0.85s linear infinite;
  transform-origin: center;
  flex-shrink: 0;
}

/* Global Admin Notification Toast Container & Elements */
.admin-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.admin-toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 440px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  animation: toastSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.admin-toast.success {
  background: #064e3b;
  border: 1px solid #059669;
  color: #a7f3d0;
}

.admin-toast.error {
  background: #7f1d1d;
  border: 1px solid #dc2626;
  color: #fecaca;
}

.admin-toast.info {
  background: #1e293b;
  border: 1px solid #3b82f6;
  color: #bfdbfe;
}

[data-theme="light"] .admin-toast.success {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #065f46;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .admin-toast.error {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .admin-toast.info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

@keyframes toastSlideUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================ */
/* CONVERSATION LOGS & HUMAN REVIEW CENTER                      */
/* ============================================================ */
.conv-logs-workspace {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.conv-workspace-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.conv-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Subtab Navigation */
.conv-subtabs-nav {
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
  max-width: 100%;
  overflow-x: auto;
}

.conv-subtab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.conv-subtab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.conv-subtab-btn.active {
  background: var(--bg-card);
  color: var(--blue-primary, #3b82f6);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.subtab-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.conv-subtab-btn.active .subtab-badge {
  background: rgba(59, 130, 246, 0.15);
  color: var(--blue-primary, #3b82f6);
}

/* KPI Cards Grid */
.conv-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.conv-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.conv-kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-focus, #3b82f6);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.conv-kpi-card .kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.conv-kpi-card .kpi-icon.blue { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.conv-kpi-card .kpi-icon.yellow { background: rgba(234, 179, 8, 0.15); color: #facc15; }
.conv-kpi-card .kpi-icon.red { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.conv-kpi-card .kpi-icon.purple { background: rgba(168, 85, 247, 0.15); color: #c084fc; }
.conv-kpi-card .kpi-icon.green { background: rgba(16, 185, 129, 0.15); color: #34d399; }

.conv-kpi-card .kpi-meta {
  display: flex;
  flex-direction: column;
}

.conv-kpi-card .kpi-label {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.conv-kpi-card .kpi-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-bright, #ffffff);
  margin-top: 2px;
}

/* Filter & Search Toolbar */
.conv-filter-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.conv-search-box {
  position: relative;
  flex: 1;
  min-width: 260px;
  max-width: 450px;
}

.conv-search-box svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.conv-search-box input {
  width: 100%;
  padding: 9px 36px 9px 36px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.conv-search-box input:focus {
  border-color: var(--blue-primary, #3b82f6);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.btn-clear-search {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  font-size: 12px;
}

.conv-filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.conv-filter-group .filter-select {
  padding: 9px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 12.5px;
  outline: none;
  cursor: pointer;
}

.conv-filter-group .filter-select:focus {
  border-color: var(--blue-primary, #3b82f6);
}

/* Conv Table Card */
.conv-table-card {
  margin-top: 0;
  overflow: hidden;
}

.conv-table tbody tr.conv-row {
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.conv-table tbody tr.conv-row:hover {
  background-color: var(--bg-surface-hover, rgba(255, 255, 255, 0.04));
}

.channel-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
}

.channel-tag-web { background: rgba(59, 130, 246, 0.12); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.25); }
.channel-tag-voice { background: rgba(16, 185, 129, 0.12); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.25); }
.channel-tag-text { background: rgba(14, 165, 233, 0.12); color: #38bdf8; border: 1px solid rgba(14, 165, 233, 0.25); }
.channel-tag-mixed { background: rgba(245, 158, 11, 0.12); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.25); }
.channel-tag-test { background: rgba(168, 85, 247, 0.12); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.25); }

.conv-preview-quote {
  font-size: 13px;
  color: var(--text-main);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.conv-row-notes {
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.conv-row-improved {
  margin-top: 4px;
  font-size: 11.5px;
  color: #a855f7;
}

.turns-badge-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.turn-chip {
  font-size: 11.5px;
  color: var(--text-muted);
}

.tool-chip {
  font-size: 10.5px;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-muted);
  width: fit-content;
}

.booking-ref-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
  border-radius: 4px;
}

/* Review Status Pills */
.review-status-pill {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 12px;
  text-transform: capitalize;
}

.review-status-pill.unreviewed {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.review-status-pill.needs_improvement {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.review-status-pill.approved {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.review-status-pill.improved {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.stars-gold {
  color: #fbbf24;
  font-size: 13px;
  letter-spacing: 1px;
}

.stars-unrated {
  color: var(--text-faint);
  font-size: 11.5px;
}

/* Pagination Bar */
.conv-pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface, transparent);
  font-size: 12.5px;
  color: var(--text-muted);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pagination-page-label {
  font-weight: 600;
  color: var(--text-main);
}

/* ============================================================ */
/* SLIDE-OVER CONVERSATION INSPECTOR DRAWER                     */
/* ============================================================ */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  z-index: 1040;
}

.conv-drawer {
  position: fixed;
  top: 0;
  right: -720px;
  width: 720px;
  max-width: 95vw;
  height: 100vh;
  background: var(--bg-card, #121826);
  border-left: 1px solid var(--border-subtle);
  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.4);
  z-index: 1050;
  display: flex;
  flex-direction: column;
  transition: right 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.conv-drawer.open {
  right: 0;
}

.conv-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface, rgba(255, 255, 255, 0.02));
}

.conv-drawer-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.channel-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--blue-primary, #3b82f6);
  color: #ffffff;
}

.drawer-tenant-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.drawer-session-id {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-bright, #ffffff);
  font-family: var(--font-mono);
  margin: 0;
}

.drawer-session-time {
  font-size: 12px;
  color: var(--text-muted);
  margin: 4px 0 0 0;
}

.btn-close-drawer {
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s ease;
}

.btn-close-drawer:hover {
  color: var(--text-bright);
  border-color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
}

.conv-drawer-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
}

.conv-transcript-panel {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  flex: 1;
}

.panel-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.panel-section-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.transcript-counter {
  font-size: 11.5px;
  color: var(--text-faint);
}

/* Chat Transcript Messages */
.conv-transcript-messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 4px;
}

.chat-bubble-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.chat-bubble-row.user-row {
  flex-direction: row;
}

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.user-avatar {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.agent-avatar {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.tool-avatar {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.chat-bubble {
  border-radius: 12px;
  padding: 12px 16px;
  max-width: 90%;
  border: 1px solid var(--border-subtle);
}

.user-bubble {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.2);
}

.agent-bubble {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.2);
}

.tool-bubble {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border-subtle);
  width: 100%;
}

.bubble-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 11.5px;
}

.bubble-author {
  font-weight: 600;
  color: var(--text-bright);
}

.modality-chip {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
}

.mod-voice { background: rgba(16, 185, 129, 0.18); color: #34d399; }
.mod-text { background: rgba(59, 130, 246, 0.18); color: #60a5fa; }
.mod-agent-voice { background: rgba(16, 185, 129, 0.18); color: #34d399; }
.mod-tool { background: rgba(245, 158, 11, 0.18); color: #fbbf24; }

.bubble-time {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

.bubble-body {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-word;
}

.tool-content-pre {
  margin: 4px 0 0 0;
  background: rgba(0, 0, 0, 0.3);
  padding: 8px 10px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  overflow-x: auto;
}

/* Evaluation Panel */
.conv-evaluation-panel {
  padding: 20px 24px;
  background: var(--bg-surface, rgba(255, 255, 255, 0.015));
}

.star-rating-picker {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}

.star-btn {
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--border-focus, rgba(255, 255, 255, 0.15));
  cursor: pointer;
  padding: 2px 4px;
  transition: color 0.1s ease, transform 0.1s ease;
}

.star-btn:hover,
.star-btn.active {
  color: #fbbf24;
  transform: scale(1.15);
}

.star-rating-hint {
  margin-left: 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.improved-action-notice {
  background: rgba(168, 85, 247, 0.1);
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 14px;
}

.action-notice-title {
  font-size: 11px;
  font-weight: 700;
  color: #c084fc;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 3px;
}

.action-notice-body {
  font-size: 12.5px;
  color: var(--text-main);
}

.review-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.btn-teach-bot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.35);
  border-radius: var(--radius-sm);
  color: #c084fc;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-teach-bot:hover {
  background: rgba(168, 85, 247, 0.25);
  border-color: #c084fc;
}

.drawer-booking-card {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
}

.drawer-booking-header {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #34d399;
  font-size: 12px;
  margin-bottom: 6px;
}

.drawer-footer-danger {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
}

.btn-danger-outline {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
  font-family: var(--font-sans);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-danger-outline:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: #ef4444;
}

/* Teach Bot Modal Banner */
.teach-bot-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(168, 85, 247, 0.1);
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 12.5px;
  color: #c084fc;
  margin-top: 12px;
  line-height: 1.45;
}

.teach-bot-banner svg {
  flex-shrink: 0;
  margin-top: 2px;
}

/* Light Mode Overrides for Conversation Logs & Drawer */
[data-theme="light"] .conv-drawer {
  background: #ffffff;
  border-left-color: #e2e8f0;
  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .conv-drawer-header {
  background: #f8fafc;
  border-bottom-color: #e2e8f0;
}

[data-theme="light"] .conv-transcript-panel {
  border-bottom-color: #e2e8f0;
}

[data-theme="light"] .conv-evaluation-panel {
  background: #f8fafc;
}

[data-theme="light"] .user-bubble {
  background: #eff6ff;
  border-color: #bfdbfe;
}

[data-theme="light"] .agent-bubble {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

[data-theme="light"] .tool-bubble {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .tool-content-pre {
  background: #e2e8f0;
  color: #1e293b;
}

[data-theme="light"] .star-btn {
  color: #cbd5e1;
}

[data-theme="light"] .conv-kpi-card {
  background: #ffffff;
  border-color: #e2e8f0;
}

[data-theme="light"] .conv-kpi-card .kpi-value {
  color: #0f172a;
}

[data-theme="light"] .drawer-session-id {
  color: #0f172a;
}

/* ==========================================================================
   DELETE WEBSITE AGENT & DANGER ZONE STYLING
   ========================================================================== */

.topbar-btn.topbar-btn-delete {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.28);
  background: rgba(239, 68, 68, 0.06);
}

.topbar-btn.topbar-btn-delete:hover {
  background: rgba(239, 68, 68, 0.16);
  border-color: #ef4444;
  color: #f87171;
}

[data-theme="light"] .topbar-btn.topbar-btn-delete {
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.28);
  background: rgba(220, 38, 38, 0.06);
}

[data-theme="light"] .topbar-btn.topbar-btn-delete:hover {
  background: rgba(220, 38, 38, 0.14);
  border-color: #dc2626;
  color: #b91c1c;
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #dc2626;
  border: 1px solid #b91c1c;
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-danger:hover:not(:disabled) {
  background: #ef4444;
  border-color: #dc2626;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

.btn-danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.danger-zone-card {
  border: 1px solid rgba(239, 68, 68, 0.25) !important;
  background: rgba(239, 68, 68, 0.02) !important;
  margin-top: 24px;
}

[data-theme="light"] .danger-zone-card {
  border: 1px solid rgba(239, 68, 68, 0.2) !important;
  background: rgba(239, 68, 68, 0.025) !important;
}

.danger-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.danger-zone-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-top: 14px;
}

@media (max-width: 768px) {
  .danger-zone-content {
    flex-direction: column;
    align-items: flex-start;
  }
}

.danger-action-title {
  font-size: 14px;
  color: var(--text-main);
  font-weight: 600;
}

.danger-action-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.5;
}

.delete-warning-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.delete-warning-text {
  font-size: 13px;
  color: var(--text-main);
  line-height: 1.5;
  margin-bottom: 10px;
}

.delete-impact-list {
  margin: 0 0 16px 20px;
  padding: 0;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
}

.delete-impact-list li {
  margin-bottom: 4px;
}

.delete-confirm-box {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}



/* ==========================================================================
   Chat & Call History
   ========================================================================== */
.conv-channel-tabs {
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
  max-width: 100%;
  overflow-x: auto;
  margin-bottom: 14px;
}
.conv-channel-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.conv-channel-btn:hover { color: var(--text-main); }
.conv-channel-btn:focus-visible { outline: 2px solid var(--blue-primary); outline-offset: 2px; }
.conv-channel-btn.active {
  background: var(--bg-surface-raised);
  color: var(--blue-primary, #3b82f6);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.conv-kpi-card[data-channel-filter],
.conv-kpi-card[data-outcome-filter] { cursor: pointer; }

.conv-date-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.conv-page-path {
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conv-cell-sub { margin-top: 5px; }
.conv-contact-name { font-size: 12px; color: var(--text-main); }

.outcome-pill {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 12px;
  border: 1px solid transparent;
}
.outcome-pill.booking, .outcome-pill.registration { background: rgba(16, 185, 129, 0.14); color: #34d399; border-color: rgba(16, 185, 129, 0.3); }
.outcome-pill.inquiry { background: rgba(59, 130, 246, 0.14); color: #60a5fa; border-color: rgba(59, 130, 246, 0.3); }
.outcome-pill.engaged { background: rgba(148, 163, 184, 0.14); color: var(--text-main); border-color: rgba(148, 163, 184, 0.3); }
.outcome-pill.no_reply,
.outcome-pill.pending { background: transparent; color: var(--text-muted); border-color: var(--border-subtle); }
.outcome-pill.error { background: rgba(239, 68, 68, 0.14); color: #f87171; border-color: rgba(239, 68, 68, 0.3); }
[data-theme="light"] .outcome-pill.booking, [data-theme="light"] .outcome-pill.registration { color: #047857; }
[data-theme="light"] .outcome-pill.inquiry { color: #1d4ed8; }
[data-theme="light"] .outcome-pill.error { color: #b91c1c; }

.drawer-meta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 8px 0 0;
  font-size: 12px;
}
.drawer-meta-list div { display: flex; gap: 6px; align-items: center; min-width: 0; }
.drawer-meta-list dt { color: var(--text-faint); }
.drawer-meta-list dd {
  margin: 0;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 260px;
}

.chat-system-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  font-size: 11.5px;
  color: var(--text-muted);
  font-style: italic;
}
.chat-system-row .bubble-time { margin-left: 0; font-style: normal; }
.bubble-cutoff { color: var(--text-faint); font-size: 11px; font-style: italic; }

.drawer-contact-card,
.drawer-visitor-sessions {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 14px;
  background: var(--bg-surface, rgba(255, 255, 255, 0.03));
}
.drawer-contact-name { font-weight: 600; color: var(--text-main); margin-top: 4px; }
.drawer-contact-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.visitor-session-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.visitor-session-item {
  width: 100%;
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.visitor-session-item:hover { background: var(--bg-surface-raised, rgba(255, 255, 255, 0.05)); border-color: var(--border-subtle); }
.visitor-session-item:focus-visible { outline: 2px solid var(--blue-primary); outline-offset: 1px; }
.visitor-session-time { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); }
.visitor-session-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); }

/* ==========================================================================
   Sales CRM
   ========================================================================== */
.crm-workspace { display: flex; flex-direction: column; gap: 16px; }
.crm-toolbar { flex-wrap: wrap; gap: 10px; }
.crm-toolbar .conv-channel-tabs { margin-bottom: 0; }
.crm-toolbar .conv-search-box { flex: 1 1 220px; }
#crm-kpi-due-card { cursor: pointer; }
#crm-kpi-due-card:focus-visible { outline: 2px solid var(--blue-primary); outline-offset: 2px; }

.crm-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(220px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  align-items: start;
}
.crm-column {
  background: var(--bg-surface, rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border-subtle);
  border-top: 3px solid var(--stage-color, var(--border-medium));
  border-radius: var(--radius-md);
  padding: 10px;
  min-height: 160px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.crm-column.is-drop-target { background: var(--blue-soft, rgba(59, 130, 246, 0.08)); border-color: var(--blue-primary); }
.crm-column-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.crm-column-title { font-weight: 600; font-size: 13px; color: var(--text-main); }
.crm-column-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-surface-raised);
  border-radius: 10px;
  padding: 1px 7px;
}
.crm-column-value { margin-left: auto; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.crm-column-cards { display: flex; flex-direction: column; gap: 8px; }
.crm-column-empty {
  margin: 0;
  padding: 18px 8px;
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-sm);
}

.crm-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-sans);
  cursor: grab;
}
.crm-card:hover { border-color: var(--border-medium); }
.crm-card:focus-visible { outline: 2px solid var(--blue-primary); outline-offset: 1px; }
.crm-card.is-dragging { opacity: 0.5; cursor: grabbing; }
.crm-card-name { font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }
.crm-card-company { font-size: 12px; color: var(--text-muted); }
.crm-card-value { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.crm-card-meta { display: flex; justify-content: space-between; width: 100%; font-size: 11px; color: var(--text-faint); margin-top: 2px; }

.crm-follow-chip {
  display: inline-flex;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}
.crm-follow-chip.today { color: #fbbf24; border-color: rgba(245, 158, 11, 0.4); background: rgba(245, 158, 11, 0.1); }
.crm-follow-chip.overdue { color: #f87171; border-color: rgba(239, 68, 68, 0.4); background: rgba(239, 68, 68, 0.1); }
[data-theme="light"] .crm-follow-chip.today { color: #b45309; }
[data-theme="light"] .crm-follow-chip.overdue { color: #b91c1c; }

/* One colour per stage, shared by column borders and pills. */
.stage-new { --stage-color: #94a3b8; }
.stage-contacted { --stage-color: #38bdf8; }
.stage-qualified { --stage-color: #a78bfa; }
.stage-proposal { --stage-color: #fbbf24; }
.stage-won { --stage-color: #34d399; }
.stage-lost { --stage-color: #f87171; }
[data-theme="light"] .stage-new { --stage-color: #64748b; }
[data-theme="light"] .stage-contacted { --stage-color: #0284c7; }
[data-theme="light"] .stage-qualified { --stage-color: #7c3aed; }
[data-theme="light"] .stage-proposal { --stage-color: #b45309; }
[data-theme="light"] .stage-won { --stage-color: #047857; }
[data-theme="light"] .stage-lost { --stage-color: #b91c1c; }
.crm-stage-pill {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 12px;
  color: var(--stage-color, var(--text-muted));
  border: 1px solid currentColor;
  background: transparent;
}

.crm-table-name { font-weight: 600; color: var(--text-main); }
.crm-table-sub { font-size: 12px; color: var(--text-muted); }
.crm-table tbody tr { cursor: pointer; }
.crm-table tbody tr:focus-visible { outline: 2px solid var(--blue-primary); outline-offset: -2px; }

.crm-empty-state {
  text-align: center;
  padding: 56px 20px;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-muted);
}
.crm-empty-state h2 { font-size: 16px; color: var(--text-main); margin: 0 0 6px; }
.crm-empty-state p { margin: 0 auto; max-width: 460px; font-size: 13px; line-height: 1.5; }

/* Contact drawer */
.crm-drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 22px; }
.crm-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 14px; }
.crm-money-input { display: flex; gap: 6px; }
.crm-money-input input[name="currency"] { width: 70px; text-transform: uppercase; }
.crm-drawer-section { display: flex; flex-direction: column; gap: 10px; }
.crm-drawer-section .panel-section-title { margin: 0; }
.crm-note-form { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.crm-note-form textarea { width: 100%; }
.crm-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.crm-timeline-item {
  border-left: 3px solid var(--border-medium);
  padding: 6px 10px;
  background: var(--bg-surface, rgba(255, 255, 255, 0.02));
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.crm-timeline-item.kind-booking, .crm-timeline-item.kind-registration { border-left-color: #34d399; }
.crm-timeline-item.kind-inquiry { border-left-color: #60a5fa; }
.crm-timeline-item.kind-stage_change { border-left-color: #a78bfa; }
.crm-timeline-head { display: flex; align-items: center; gap: 8px; }
.crm-timeline-kind { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.crm-timeline-head .bubble-time { margin-left: 0; }
.crm-timeline-body { margin-top: 4px; font-size: 13px; color: var(--text-main); white-space: pre-wrap; overflow-wrap: anywhere; }
.crm-timeline-empty { font-size: 12px; color: var(--text-faint); list-style: none; }
.crm-note-delete {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
}
.crm-note-delete:hover { color: #f87171; }
.crm-timeline-link,
.drawer-contact-open { margin-top: 6px; }
.crm-timeline-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--blue-primary);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
}
.crm-booking-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.crm-booking-list li { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; color: var(--text-main); }

@media (max-width: 640px) {
  .crm-form-grid { grid-template-columns: 1fr; }
  .crm-drawer-body { padding: 16px; }
}

/* Brand voice (Bot Studio) */
.voice-mode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 8px;
}

.voice-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 8px 0 4px;
}

#settings-voice-profile[readonly] {
  opacity: 0.85;
  cursor: default;
}

/* ==========================================================================
   AGENT WORKSPACE
   One place per website: Knowledge -> Persona -> Appearance -> Deploy.
   Replaces the separate Sources & KB, Integrations and Bot Studio screens.
   ========================================================================== */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.agent-shell [hidden] { display: none !important; }

.agent-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 36px 32px;
}

/* Header */
.agent-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 28px 0 18px;
}

.agent-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.agent-desc {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-muted);
}

.agent-site-chip {
  padding: 3px 11px;
  border-radius: var(--radius-full);
  border: 1px solid var(--blue-border);
  background: var(--blue-soft);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
}

.agent-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Step bar: stays pinned while a long step scrolls underneath */
.agent-steps-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0 -36px;
  padding: 0 36px;
  background: var(--bg-app);
  border-bottom: 1px solid var(--border-subtle);
}

.agent-steps {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.agent-steps::-webkit-scrollbar { display: none; }

.agent-step {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 10px 16px;
  margin-bottom: -1px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--dur-fast, 150ms) ease, background var(--dur-fast, 150ms) ease, border-color var(--dur-fast, 150ms) ease;
}

.agent-step:hover {
  color: var(--text-main);
  background: var(--bg-surface);
}

.agent-step.is-active {
  color: var(--text-main);
  border-bottom-color: var(--blue-primary);
}

.agent-step:focus-visible {
  outline: 2px solid var(--border-active);
  outline-offset: -2px;
  border-radius: var(--radius-md);
}

.agent-step-num {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--border-medium);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.agent-step.is-active .agent-step-num {
  background: var(--blue-primary);
  border-color: var(--blue-primary);
  color: #ffffff;
}

.agent-step-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}

.agent-step-title {
  font-size: 13.5px;
  font-weight: 600;
}

.agent-step-meta {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11.5px;
  color: var(--text-muted);
}

.agent-step-dirty {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--orange-primary);
}

.agent-step-settings { margin-left: auto; }
.agent-step-settings .agent-step-title { font-weight: 500; }

/* Body: form column, plus a live preview beside Persona and Appearance */
.agent-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  padding-top: 24px;
}

.agent-body[data-step="persona"],
.agent-body[data-step="appearance"] {
  grid-template-columns: minmax(0, 1fr) 360px;
}

.agent-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.agent-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.agent-panel-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.agent-panel-title {
  font-size: 17px;
  font-weight: 650;
  color: var(--text-main);
}

.agent-panel-desc {
  margin-top: 3px;
  font-size: 13px;
  color: var(--text-muted);
}

/* Existing blocks lose their own outer margins; the panel gap spaces them. */
.agent-panel .website-kb-config-card { margin-bottom: 0; }
.agent-panel .danger-zone-card { margin-top: 0; }
.agent-card .form-grid { max-width: 640px; }
.agent-appearance-note { margin-top: 18px; font-size: 12px; }

.agent-callout {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--blue-border);
  background: var(--blue-soft);
  color: var(--text-main);
  font-size: 13px;
  line-height: 1.5;
}

/* Back / Next */
.agent-step-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}

.agent-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
}

/* Inline text-style button for cross-step hints */
.link-btn {
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  color: var(--border-active);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.link-btn:hover { text-decoration-thickness: 2px; }
.link-btn:focus-visible {
  outline: 2px solid var(--border-active);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* One save for Persona + Appearance */
.agent-savebar {
  position: sticky;
  bottom: 16px;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.agent-savebar-actions { display: flex; align-items: center; gap: 10px; }
.agent-savebar .btn-primary-blue:disabled { opacity: 0.45; cursor: not-allowed; }

.agent-save-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}
.agent-save-status::before {
  content: "";
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green-primary);
}
.agent-save-status.is-dirty { color: var(--text-main); }
.agent-save-status.is-dirty::before { background: var(--orange-primary); }
.agent-save-status.is-saving::before { background: var(--blue-primary); }
.agent-save-status.is-error { color: #ef4444; }
.agent-save-status.is-error::before { background: #ef4444; }
[data-theme="light"] .agent-save-status.is-error { color: #dc2626; }

/* Deploy: readiness check and channel switch */
.agent-checklist {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.agent-check {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-main);
}
.agent-check + .agent-check { border-top: 1px solid var(--border-subtle); }
.agent-check-text { flex: 1; min-width: 0; }

.agent-check-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-surface-overlay);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}
.agent-check.is-ok .agent-check-icon { background: var(--green-soft); color: var(--green-text); }
.agent-check.is-ok .agent-check-icon::before { content: "\2713"; }
.agent-check.is-warn .agent-check-icon { background: var(--orange-soft); color: var(--orange-primary); }
.agent-check.is-warn .agent-check-icon::before { content: "!"; }

.agent-channel-tabs {
  display: inline-flex;
  align-self: flex-start;
  gap: 4px;
  padding: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}
.agent-channel-tabs .sub-nav-link { min-height: 36px; padding: 6px 14px 6px 10px; }
.agent-channel-tabs .sub-nav-link.is-active {
  background: var(--bg-surface-overlay);
  color: var(--text-main);
}
.agent-channel-tabs .sub-nav-link:focus-visible {
  outline: 2px solid var(--border-active);
  outline-offset: 1px;
}

/* Live preview */
.agent-preview { display: none; }

.agent-body[data-step="persona"] .agent-preview,
.agent-body[data-step="appearance"] .agent-preview {
  display: block;
  position: sticky;
  top: 84px;
}

.agent-preview-label {
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.agent-preview-canvas {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 14px;
  min-height: 0;
  padding: 18px 14px;
  background: var(--bg-surface-raised);
  box-shadow: none;
}

.agent-preview-canvas .floating-widget-window { max-width: 100%; --preview-accent: #2563eb; }

.floating-widget-window .widget-avatar-symbol {
  background: color-mix(in srgb, var(--preview-accent, #2563eb) 18%, transparent);
  border: 1.5px solid var(--preview-accent, #2563eb);
}
.floating-widget-window .preview-mic-btn {
  background: var(--preview-accent, #2563eb);
  color: #ffffff;
}

/* The widget's own dark theme, so the preview matches the Color Theme setting */
.floating-widget-window.is-dark { background: #0f1420; border-color: rgba(255, 255, 255, 0.12); color: #f1f5f9; }
.floating-widget-window.is-dark .widget-window-header { background: #0f1420; border-bottom-color: #1e2535; }
.floating-widget-window.is-dark .widget-agent-name { color: #f1f5f9; }
.floating-widget-window.is-dark .win-btn { color: #64748b; }
.floating-widget-window.is-dark .widget-window-body { background: #0f1420; }
.floating-widget-window.is-dark .preview-bubble.bubble-user { background: #1e2535; color: #f1f5f9; }
.floating-widget-window.is-dark .preview-bubble.bubble-agent { color: #e2e8f0; }
.floating-widget-window.is-dark .preview-grounding-pill { background: #151b29; border-color: #263046; color: #a8b3c7; }
.floating-widget-window.is-dark .widget-window-footer { background: #0b101a; border-top-color: #1e2535; }
.floating-widget-window.is-dark .preview-msg-input { color: #f1f5f9; }
.floating-widget-window.is-dark .preview-msg-input::placeholder { color: #64748b; }

.preview-launcher {
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 9px 16px 9px 12px;
  border-radius: var(--radius-full);
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  color: #0f172a;
  font-size: 13px;
  font-weight: 600;
}
.preview-launcher.is-left { align-self: flex-start; }
.preview-teaser {
  align-self: flex-end;
  max-width: min(280px, 100%);
  padding: 10px 12px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  color: #0f172a;
  font-size: 12.5px;
  line-height: 1.45;
}
.preview-teaser[hidden] { display: none; }
.preview-teaser p { margin: 0; overflow-wrap: anywhere; }
.preview-teaser.is-left { align-self: flex-start; }
.preview-teaser.is-dark { background: #0f1420; border-color: #263046; color: #f1f5f9; }
.preview-teaser-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.preview-teaser-chips span {
  padding: 3px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--preview-accent, #2563eb);
  font-size: 11.5px;
  font-weight: 600;
}
.preview-teaser-chips span.is-primary { background: var(--preview-accent, #2563eb); color: #ffffff; }
.teaser-card { margin-top: 16px; }
.teaser-card-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.teaser-card-title { margin: 0; font-size: 14px; font-weight: 600; }
.teaser-toggle { font-size: 13px; color: var(--text-primary, inherit); }
.teaser-toggle input { width: 16px; height: 16px; }
.teaser-replies { display: flex; flex-direction: column; gap: 8px; }
#teaser-fields.is-off { opacity: 0.55; }
.preview-launcher.is-dark { background: #0f1420; border-color: #263046; color: #f1f5f9; }
.preview-launcher span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-launcher-dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--preview-accent, #2563eb);
}

/* Narrower screens: single column, preview first so edits are visible right away */
@media (max-width: 1100px) {
  .agent-body[data-step="persona"],
  .agent-body[data-step="appearance"] {
    grid-template-columns: minmax(0, 1fr);
  }
  .agent-body[data-step="persona"] .agent-preview,
  .agent-body[data-step="appearance"] .agent-preview {
    position: static;
    order: -1;
  }
}

@media (max-width: 768px) {
  .agent-shell { padding: 0 16px 24px; }
  .agent-steps-bar { margin: 0 -16px; padding: 0 16px; }
  .agent-header { padding-top: 18px; }
  .agent-step { padding: 10px 12px; }
  .agent-step-meta { display: none; }
  .agent-step-footer { flex-wrap: wrap; }
  .agent-savebar { bottom: 8px; flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  .agent-step { transition: none; }
}

/* Phone fixes for blocks that now live inside the Agent workspace (they had desktop-only widths). */
.agent-panel .widget-config-form-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
}

@media (max-width: 768px) {
  .agent-panel .kb-config-right { min-width: 0; width: 100%; }
  .agent-panel .kb-select-wrap,
  .agent-panel .kb-source-select { width: 100%; min-width: 0; }
  .agent-panel .embed-code-header { flex-wrap: wrap; gap: 8px; }
  .agent-panel .embed-header-actions { flex-wrap: wrap; }
  .agent-header-actions { flex-wrap: wrap; }
}

@media (max-width: 1100px) {
  /* A bare 1fr track cannot shrink below its content; minmax(0, 1fr) can. */
  .agent-panel .source-types-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 768px) {
  .agent-panel .source-card-form .input-row { flex-wrap: wrap; }
  .agent-panel .source-card-form .input-row .text-input { flex: 1 1 160px; min-width: 0; }
}

@media (max-width: 768px) {
  .agent-panel .table-header-row { flex-wrap: wrap; gap: 12px; }
  .agent-panel .table-filter-box,
  .agent-panel .table-filter-box .search-input { width: 100%; }
}

/* ==========================================================================
   OVERVIEW
   Per website: is setup finished, what needs attention, how is it doing.
   ========================================================================== */

.ov-shell {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 36px 40px;
}

.ov-shell [hidden] { display: none !important; }

.ov-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.ov-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
}

.ov-sub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.ov-status { display: inline-flex; align-items: center; gap: 8px; }
.ov-status::before {
  content: "";
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-faint);
}
.ov-status.is-live::before { background: var(--green-primary); }

.ov-period {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.ov-period-btn {
  min-height: 34px;
  padding: 6px 14px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.ov-period-btn:hover { color: var(--text-main); }
.ov-period-btn.is-active { background: var(--bg-surface-overlay); color: var(--text-main); }
.ov-period-btn:focus-visible,
.ov-kpi:focus-visible,
.ov-recent-row:focus-visible {
  outline: 2px solid var(--border-active);
  outline-offset: 2px;
}

.ov-error {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-main);
}

/* Cards */
.ov-card {
  padding: 18px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.ov-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ov-card-title { font-size: 15px; font-weight: 650; color: var(--text-main); }
.ov-card-meta { font-size: 12px; color: var(--text-muted); }

.ov-action { min-height: 36px; white-space: nowrap; }

/* Needs attention */
.ov-attention-list { list-style: none; margin: 0; padding: 0; }

.ov-attention-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border-subtle);
}
.ov-attention-item:first-child { padding-top: 0; border-top: none; }

.ov-attention-icon { display: grid; place-items: center; flex-shrink: 0; color: var(--orange-primary); }
.ov-attention-item.is-info .ov-attention-icon { color: var(--border-active); }

.ov-attention-text { flex: 1 1 240px; min-width: 0; font-size: 13.5px; color: var(--text-main); }
.ov-attention-text small {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  color: var(--text-muted);
}

.ov-empty { font-size: 13px; color: var(--text-muted); }
.ov-empty-block { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 4px 0 2px; }
.ov-empty-block p { margin: 0; }

/* KPIs */
.ov-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.ov-kpi {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 4px;
  line-height: 1.4; /* buttons do not inherit line-height, so state it for the div variant to match */
  padding: 16px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  color: var(--text-main);
  font-family: var(--font-sans);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
button.ov-kpi:hover { background: var(--bg-surface-raised); border-color: var(--border-medium); }
.ov-kpi-static { cursor: default; }

.ov-kpi-label { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.ov-kpi-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.ov-kpi-delta { display: inline-flex; align-items: center; gap: 4px; min-height: 16px; font-size: 12px; font-weight: 600; }
.ov-kpi-delta.is-up { color: var(--green-text); }
.ov-kpi-delta.is-down { color: #f87171; }
.ov-kpi-delta.is-flat { color: var(--text-muted); }
[data-theme="light"] .ov-kpi-delta.is-up { color: #047857; }
[data-theme="light"] .ov-kpi-delta.is-down { color: #b91c1c; }
.ov-kpi-sub { min-height: 16px; font-size: 12px; color: var(--text-muted); }

/* Greeting bubble card: open rate on the left, the breakdown on the right */
.ov-bubble-body { display: grid; grid-template-columns: minmax(160px, 220px) 1fr; gap: 24px; align-items: start; }
.ov-bubble-body[hidden] { display: none; }
.ov-bubble-stat { display: flex; flex-direction: column; gap: 4px; }
.ov-bubble-facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; font-size: 13px; }
.ov-bubble-facts dt { color: var(--text-muted); }
.ov-bubble-facts dd { margin: 0; }
@media (max-width: 640px) {
  .ov-bubble-body { grid-template-columns: 1fr; gap: 16px; }
  .ov-bubble-facts { grid-template-columns: 1fr; gap: 2px; }
  .ov-bubble-facts dd { margin-bottom: 8px; }
}

/* Recent conversations: rows run edge to edge inside the card */
.ov-recent-list { list-style: none; margin: 0 -20px; padding: 0; }

.ov-recent-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 12px;
  width: 100%;
  padding: 11px 20px;
  background: transparent;
  border: none;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-family: var(--font-sans);
  text-align: left;
  cursor: pointer;
}
.ov-recent-row:hover { background: var(--bg-surface-raised); }
.ov-recent-list li:first-child .ov-recent-row { border-top: none; }
.ov-recent-row:focus-visible { outline-offset: -2px; }

.ov-recent-main { flex: 1 1 220px; min-width: 0; }
.ov-recent-name { display: block; font-size: 13.5px; font-weight: 600; }
.ov-recent-preview {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  color: var(--text-muted);
}
.ov-recent-time { flex-shrink: 0; font-size: 12px; color: var(--text-muted); }

@media (max-width: 1000px) {
  .ov-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .ov-shell { padding: 18px 16px 28px; }
}

@media (max-width: 480px) {
  .ov-kpis { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .ov-period-btn, .ov-kpi { transition: none; }
}

/* ==========================================================================
   LAYOUT FIXES: History, CRM, top bar and expanded menu
   History and CRM never had outer padding, so their title, buttons and cards sat
   flush against the top bar and menu, and filter rows ran into the right edge.
   ========================================================================== */

.conv-logs-workspace,
.crm-workspace {
  padding: 28px 36px 40px;
}

/* A wide table scrolls inside its card instead of being cut off. */
.conv-table-card { overflow-x: auto; overflow-y: hidden; }

/* Top bar: breadcrumbs give way first; the controls never wrap onto each other. */
.top-context-bar { gap: 16px; }
.context-breadcrumbs { flex: 1 1 0; min-width: 0; overflow: hidden; white-space: nowrap; }
.crumb-section, .crumb-divider { flex-shrink: 0; }
.crumb-target { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.context-actions { flex-shrink: 0; }
.topbar-btn { white-space: nowrap; }
.site-select { max-width: 220px; text-overflow: ellipsis; }

/* Expanded menu: the logo badge keeps its size and the brand text sits beside it. */
.nav-rail.is-expanded .rail-top { align-items: center; gap: 10px; }
.nav-rail.is-expanded .rail-logo-badge {
  flex: 0 0 38px;
  width: 38px;
  padding: 0;
  justify-content: center;
}
.nav-rail.is-expanded .rail-brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.rail-brand-title { overflow: hidden; text-overflow: ellipsis; }
.rail-brand-subtitle { font-size: 11px; font-weight: 500; color: var(--text-muted); }

@media (max-width: 1100px) {
  /* The pill is the way to the Account page, so it stays as a small icon button. */
  .admin-user-pill { padding: 6px 8px; }
  .admin-user-pill #admin-user-label, .admin-user-pill .admin-user-role { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .site-select { max-width: 170px; }
}

@media (max-width: 900px) {
  .system-health-pill { display: none; }
  .top-context-bar { padding: 0 14px; gap: 10px; }
  .context-actions { gap: 8px; }
}

@media (max-width: 768px) {
  .conv-logs-workspace,
  .crm-workspace { padding: 18px 16px 28px; }
  .site-select { max-width: 130px; }
}

@media (max-width: 560px) {
  .context-breadcrumbs { display: none; }
  .context-actions { flex: 1; justify-content: flex-end; min-width: 0; }
  #topbar-help-btn { display: none; }
}

/* Four CRM stats balance into 2x2 when narrow instead of leaving one card alone on a row. */
.crm-kpi-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }

/* Phones: keep the menu compact whatever the saved preference is. Expanded it takes 210 of ~375px,
   leaving the page about 165px, which squeezes everything into overlapping, overflowing rows. */
@media (max-width: 700px) {
  .nav-rail.is-expanded { width: 60px; min-width: 60px; align-items: center; padding: 14px 0 16px; }
  .nav-rail.is-expanded .rail-top { justify-content: center; padding: 0; gap: 0; }
  .nav-rail.is-expanded .rail-logo-badge { flex: 0 0 auto; width: 34px; height: 34px; padding: 0; }
  .nav-rail.is-expanded .rail-brand-text,
  .nav-rail.is-expanded .rail-item-label { display: none; }
  .nav-rail.is-expanded .rail-nav,
  .nav-rail.is-expanded .rail-bottom { align-items: center; }
  .nav-rail.is-expanded .rail-item { width: 40px; height: 40px; padding: 0; justify-content: center; gap: 0; }
  .nav-rail.is-expanded .rail-item.is-active::before { left: -10px; top: 10px; bottom: 10px; }
  .nav-rail.is-expanded .rail-toggle-icon { transform: none; }
  #btn-toggle-rail { display: none; }
}

/* ==========================================================================
   PAGE LAYOUT SYSTEM
   One content width, one gutter and one title style for every page, so titles
   and cards line up when you switch pages. History and CRM used a bare <h1>
   (.page-title had no rules) and a full-bleed width; Overview, Agent and the
   rest each had their own max-width.
   ========================================================================== */

:root {
  --page-max: 1200px;
  --page-gutter: 36px;
  --page-title-size: 22px;
}

.ov-shell,
.agent-shell,
.conv-logs-workspace,
.crm-workspace {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
}

.page-title,
.agent-title,
.ov-title {
  margin: 0;
  font-size: var(--page-title-size);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--text-main);
}

.page-subtitle {
  margin: 6px 0 0;
  max-width: 68ch;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}

/* History has seven KPI cards. Auto-fit left a lone card on its own row at every width,
   so lay them out 4 + 3 and let the last card take the rest of its row. */
.conv-kpi-grid--history { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.conv-kpi-grid--history .conv-kpi-card:last-child:nth-child(4n + 3) { grid-column: span 2; }

@media (max-width: 1000px) {
  .conv-kpi-grid--history { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .conv-kpi-grid--history .conv-kpi-card:last-child:nth-child(4n + 3) { grid-column: auto; }
  .conv-kpi-grid--history .conv-kpi-card:last-child:nth-child(odd) { grid-column: span 2; }
}

@media (max-width: 520px) {
  .conv-kpi-grid--history { grid-template-columns: minmax(0, 1fr); }
  .conv-kpi-grid--history .conv-kpi-card:last-child:nth-child(odd) { grid-column: auto; }
}

/* History filters: the search box takes the spare width and the controls share one height,
   so the row reads as a single bar instead of a ragged mix of 9px-padded selects and dates. */
#tab-bookings-logs .conv-filter-toolbar { justify-content: flex-start; align-items: center; }
#tab-bookings-logs .conv-search-box { flex: 1 1 260px; max-width: none; }
#tab-bookings-logs .conv-filter-group { flex: 0 1 auto; }
#tab-bookings-logs .conv-search-box input,
#tab-bookings-logs .conv-filter-group .filter-select { height: 38px; box-sizing: border-box; padding-block: 0; }
#tab-bookings-logs .conv-filter-group .filter-select:focus-visible,
#tab-bookings-logs .conv-search-box input:focus-visible { outline: 2px solid var(--blue-primary); outline-offset: 1px; }

/* ==========================================================================
   PLAYGROUND
   Same page frame as the other pages (title, width, gutter). The request and
   response panes become two cards that scroll on their own, instead of two
   edge-to-edge columns that left a tall empty gap under the request.
   ========================================================================== */

.pg-shell {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: var(--page-max);
  height: 100%;
  margin-inline: auto;
  padding: 28px var(--page-gutter) 28px;
  box-sizing: border-box;
}

.pg-header { flex-shrink: 0; }

.pg-shell .playground-layout {
  flex: 1;
  min-height: 0;
  height: auto;
  grid-template-columns: minmax(300px, 1fr) minmax(0, 1.45fr);
  gap: 20px;
  overflow: visible;
}

.pg-shell .playground-col {
  min-height: 0;
  padding: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-sizing: border-box;
}

.pg-shell .playground-request-col { border-right: 1px solid var(--border-subtle); }

/* The query box was a card inside a column; inside a card it only needs a field outline. */
.pg-shell .query-card {
  background: var(--bg-input);
  box-shadow: none;
  margin-bottom: 22px;
}

.pg-shell .sample-q-card { background: var(--bg-surface-raised); }
.pg-shell .sample-q-card:hover { border-color: var(--border-medium); color: var(--text-main); }
.pg-shell .segmented-track { background: var(--bg-input); }

@media (max-width: 1024px) {
  .pg-shell { height: auto; }
  .pg-shell .playground-layout { grid-template-columns: minmax(0, 1fr); overflow: visible; }
  .pg-shell .playground-request-col { border-bottom: 1px solid var(--border-subtle); }
  .pg-shell .response-viewport { min-height: 260px; }
}

@media (max-width: 768px) {
  .pg-shell { padding: 18px 16px 28px; }
  .pg-shell .playground-col { padding: 16px; }
}

/* ==========================================================================
   AGENT STEPS
   ========================================================================== */

/* The install snippet stopped at 820px while the banner above it ran the full panel width. */
.agent-panel .embed-code-card { max-width: none; }

/* The three source cards are about 300px wide, so the crawler's URL field and its button shared one
   row and left the field showing "https://docs.yourcompar". The field gets its own row instead. */
.agent-panel .source-card-form .input-row { flex-wrap: wrap; }
.agent-panel .source-card-form .input-row .text-input { flex: 1 1 100%; min-width: 0; }
.agent-panel .source-card-form .input-row .btn-action-primary { flex: 1 1 auto; }

/* ==========================================================================
   CLIENT MESSAGING: Email & SMS settings, contact thread, unread badges
   ========================================================================== */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.field-optional { font-weight: 400; color: var(--text-faint); margin-left: 4px; }

/* Settings */
.msg-base-warning {
  margin: 0 0 16px; padding: 10px 14px; max-width: 1040px;
  border: 1px solid rgba(249, 115, 22, 0.35); background: var(--orange-soft);
  border-radius: var(--radius-md); font-size: 12.5px; color: var(--text-main); line-height: 1.5;
}
.msg-base-warning code { font-family: var(--font-mono); font-size: 12px; }
.msg-settings-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: 20px; max-width: 1040px; align-items: start;
}
.msg-provider-card {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); padding: 20px; min-width: 0;
}
.msg-provider-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.msg-provider-title { margin: 0; font-size: 15px; font-weight: 700; color: var(--text-main); }
.msg-provider-sub { margin: 2px 0 0; font-size: 12px; color: var(--text-faint); }
.msg-provider-head .integration-status-pill { flex-shrink: 0; white-space: nowrap; max-width: 60%; overflow: hidden; text-overflow: ellipsis; }
.msg-provider-form { display: flex; flex-direction: column; gap: 14px; }
.msg-field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.msg-provider-form .field-input { width: 100%; min-width: 0; }
.msg-webhook-box {
  display: flex; flex-direction: column; gap: 6px; padding: 10px 12px;
  background: var(--bg-input); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
}
.msg-webhook-label { font-size: 11.5px; color: var(--text-muted); font-weight: 500; }
.msg-webhook-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.msg-webhook-url {
  flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-main);
  overflow-wrap: anywhere; user-select: all;
}
.msg-steps { font-size: 12px; }
.msg-actions { margin-top: 2px; flex-wrap: wrap; }
.msg-test-row {
  display: flex; gap: 8px; padding-top: 14px; border-top: 1px solid var(--border-subtle);
}
.msg-test-row .field-input { flex: 1; }
@media (max-width: 520px) {
  .msg-field-row { grid-template-columns: minmax(0, 1fr); }
  .msg-provider-card { padding: 16px; }
}

/* Unread badges */
.rail-badge {
  position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: var(--radius-full); background: #ef4444; color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; pointer-events: none;
}
.rail-badge[hidden] { display: none; }
.crm-unread-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px;
  padding: 0 5px; margin-left: 6px; border-radius: var(--radius-full); vertical-align: 1px;
  background: var(--blue-primary); color: #fff; font-size: 10.5px; font-weight: 700;
}

/* Contact drawer: quick actions + messages */
.crm-quick-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.crm-quick-actions .btn-sm,
.drawer-contact-actions .btn-sm { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; font-size: 12.5px; }
.drawer-contact-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* One card, three zones: header, history, compose box. */
.crm-msg-card {
  border: 1px solid var(--border-medium); border-radius: var(--radius-lg);
  background: var(--bg-surface); overflow: hidden;
}
.crm-msg-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border-subtle);
}
.crm-msg-card-heading { min-width: 0; }
.crm-msg-card-title { margin: 0; font-size: 14px; font-weight: 700; color: var(--text-main); }
.crm-msg-card-sub { margin: 2px 0 0; font-size: 12px; color: var(--text-faint); overflow-wrap: anywhere; }
.crm-icon-btn {
  flex-shrink: 0; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); background: transparent;
  color: var(--text-muted); cursor: pointer;
}
.crm-icon-btn:hover { color: var(--text-main); background: var(--bg-surface-raised); }
.crm-icon-btn:focus-visible { outline: 2px solid var(--blue-primary); outline-offset: 1px; }
.crm-icon-btn.is-spinning svg { animation: crm-spin 0.8s linear infinite; }
@keyframes crm-spin { to { transform: rotate(360deg); } }

/* History */
.crm-thread {
  list-style: none; margin: 0; padding: 16px; display: flex; flex-direction: column; gap: 14px;
  max-height: 340px; min-height: 96px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg-app);
}
.crm-thread-empty {
  margin: auto; text-align: center; font-size: 12.5px; color: var(--text-faint); line-height: 1.5; max-width: 260px;
}
.crm-msg { display: flex; flex-direction: column; gap: 4px; max-width: 85%; }
.crm-msg.is-outbound { align-self: flex-end; align-items: flex-end; }
.crm-msg.is-inbound { align-self: flex-start; align-items: flex-start; }
.crm-msg-bubble {
  padding: 9px 12px; border-radius: 14px; font-size: 13px; line-height: 1.5;
  border: 1px solid var(--border-subtle); min-width: 0; max-width: 100%;
}
.crm-msg.is-outbound .crm-msg-bubble { background: var(--blue-primary); border-color: var(--blue-primary); border-bottom-right-radius: 4px; }
.crm-msg.is-outbound .crm-msg-bubble,
.crm-msg.is-outbound .crm-msg-subject,
.crm-msg.is-outbound .crm-msg-body { color: #fff; }
.crm-msg.is-inbound .crm-msg-bubble { background: var(--bg-surface-raised); border-bottom-left-radius: 4px; }
.crm-msg.is-failed .crm-msg-bubble { background: transparent; border: 1px dashed rgba(239, 68, 68, 0.6); }
.crm-msg.is-failed .crm-msg-bubble .crm-msg-subject,
.crm-msg.is-failed .crm-msg-bubble .crm-msg-body { color: var(--text-main); }
.crm-msg-subject { font-weight: 700; color: var(--text-main); margin-bottom: 2px; overflow-wrap: anywhere; }
.crm-msg-body { color: var(--text-main); white-space: pre-wrap; overflow-wrap: anywhere; }
.crm-msg-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 11px; color: var(--text-faint); }
.crm-msg-channel {
  display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 10.5px; color: var(--text-muted);
}
.crm-msg-status { padding: 1px 6px; border-radius: var(--radius-full); background: var(--bg-surface-raised); color: var(--text-muted); }
.crm-msg-status.status-delivered { background: var(--green-soft); color: var(--green-text); }
.crm-msg-status.status-failed,
.crm-msg-status.status-bounced { background: rgba(239, 68, 68, 0.12); color: #f87171; }
[data-theme="light"] .crm-msg-status.status-failed,
[data-theme="light"] .crm-msg-status.status-bounced { color: #b91c1c; }
[data-theme="light"] .crm-msg-status.status-delivered { color: #047857; }
.crm-msg-error { font-size: 11.5px; color: #f87171; max-width: 100%; overflow-wrap: anywhere; }
[data-theme="light"] .crm-msg-error { color: #b91c1c; }

/* Compose */
.crm-compose { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px 16px; border-top: 1px solid var(--border-subtle); }
.crm-compose-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.crm-compose-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.crm-compose-channels {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--bg-input); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
}
.crm-channel-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border: none; border-radius: var(--radius-xs);
  background: transparent; color: var(--text-muted); font: 600 12.5px var(--font-sans); cursor: pointer;
}
.crm-channel-btn:hover { color: var(--text-main); }
.crm-channel-btn.is-active { background: var(--blue-primary); color: #fff; }
.crm-channel-btn:focus-visible { outline: 2px solid var(--blue-primary); outline-offset: 2px; }
.crm-compose-blocked {
  margin: 0; padding: 12px 14px; font-size: 12.5px; line-height: 1.5; color: var(--text-main);
  background: var(--bg-surface-raised); border: 1px dashed var(--border-medium); border-radius: var(--radius-md);
}
/* Looks like a mail client's compose window: To / Subject rows, then the writing area, then Send. */
.crm-compose-box {
  display: flex; flex-direction: column; border: 1px solid var(--border-medium); border-radius: var(--radius-md);
  background: var(--bg-input); transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.crm-compose-box:focus-within { border-color: var(--blue-primary); box-shadow: 0 0 0 3px var(--blue-soft); }
.crm-compose-row { display: flex; align-items: center; gap: 10px; padding: 0 12px; border-bottom: 1px solid var(--border-subtle); }
.crm-compose-label { flex: 0 0 56px; font-size: 12px; font-weight: 500; color: var(--text-faint); }
.crm-compose-input {
  flex: 1; min-width: 0; padding: 10px 0; border: none; outline: none; background: transparent;
  color: var(--text-main); font: 13px var(--font-sans);
}
.crm-compose-text {
  display: block; width: 100%; min-height: 120px; padding: 12px; border: none; outline: none; resize: vertical;
  background: transparent; color: var(--text-main); font: 13.5px/1.55 var(--font-sans);
}
.crm-compose-input::placeholder, .crm-compose-text::placeholder { color: var(--text-faint); }
.crm-compose-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 12px; border-top: 1px solid var(--border-subtle);
}
.crm-compose-meta { font-size: 11.5px; color: var(--text-faint); flex: 1 1 180px; min-width: 0; overflow-wrap: anywhere; }
.crm-send-btn { display: inline-flex; align-items: center; gap: 8px; }
.crm-compose-box[hidden], .crm-compose-blocked[hidden], #crm-compose-subject-row[hidden] { display: none; }
@media (max-width: 520px) {
  .crm-thread { padding: 12px; }
  .crm-compose { padding: 12px; }
  .crm-msg { max-width: 92%; }
}

/* Timeline entries for messages */
.crm-timeline-item.kind-email_sent, .crm-timeline-item.kind-sms_sent { border-left-color: #60a5fa; }
.crm-timeline-item.kind-email_received, .crm-timeline-item.kind-sms_received { border-left-color: #f59e0b; }
/* Three deploy channels no longer fit one row on a phone. */
.agent-channel-tabs { flex-wrap: wrap; max-width: 100%; }
.agent-channel-tabs .sub-nav-link { white-space: nowrap; }

/* Bot logo picker (Agent > Appearance) */
.logo-picker { display: flex; align-items: center; gap: 14px; }
.logo-preview {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-raised);
}
.logo-preview img, .logo-preview svg,
.widget-avatar-symbol img, .widget-avatar-symbol svg { display: block; width: 100%; height: 100%; object-fit: cover; }
.logo-preview svg rect, .widget-avatar-symbol svg rect { fill: var(--preview-accent, #2563eb); }
.logo-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.logo-actions .btn-secondary { min-height: 36px; }
#bot-logo-input:focus-visible + #bot-logo-upload { outline: 2px solid var(--accent-primary, #2563eb); outline-offset: 2px; }
.field-hint.is-error { color: #dc2626; }
.allowed-domains-field { max-width: 820px; margin-top: 18px; }
.floating-widget-window .widget-avatar-symbol.has-logo { background: transparent; border: none; overflow: hidden; }

/* ---------- Team access: roles, Team page, account ---------- */
body[data-role="agent"] .staff-only { display: none !important; }
.rail-item[hidden] { display: none !important; }

button.admin-user-pill { cursor: pointer; font: inherit; font-size: 11.5px; color: var(--text-main); background: var(--bg-surface-raised); border-color: var(--border-subtle); }
button.admin-user-pill:hover { border-color: var(--border-medium); }
button.admin-user-pill.is-active { border-color: var(--blue-primary); }
button.admin-user-pill:focus-visible { outline: 2px solid var(--blue-primary); outline-offset: 2px; }
.admin-user-role { color: var(--text-muted); font-weight: 500; }
.admin-user-role:not(:empty)::before { content: "· "; }

.team-workspace { display: flex; flex-direction: column; gap: 16px; padding: 28px 36px 40px; width: 100%; max-width: var(--page-max); margin-inline: auto; }
.team-table td { vertical-align: middle; }
.team-member-name { font-weight: 600; color: var(--text-main); }
.team-member-sub { display: block; font-size: 12px; color: var(--text-muted); }
.team-role-pill { display: inline-flex; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 12px; border: 1px solid currentColor; color: var(--text-muted); }
.team-role-pill.role-owner { color: var(--purple-primary); }
.team-role-pill.role-admin { color: var(--blue-primary); }
.team-status { font-size: 12px; color: var(--text-muted); }
.team-status.is-off { color: #dc2626; }
.team-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.team-row-off td { opacity: 0.6; }
.team-sites-field { border: 0; padding: 0; margin: 0; min-width: 0; }
.team-sites-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px 14px; max-height: 180px; overflow-y: auto; padding: 4px 0; }
.team-sites-list label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-main); min-height: 32px; cursor: pointer; }
.team-sites-list input { width: 16px; height: 16px; accent-color: var(--blue-primary); }
.team-password-row { display: flex; gap: 8px; }
.team-password-row .field-input { flex: 1; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.agent-no-sites { padding: 48px 24px; text-align: center; color: var(--text-muted); }

/* Account page */
/* A new owner with no website yet still reaches their account (the first-run panel would otherwise cover it). */
#tab-account.is-active { position: relative; z-index: 6; background: var(--bg-app); }
.account-workspace { display: flex; flex-direction: column; gap: 16px; padding: 28px 36px 40px; width: 100%; max-width: 760px; margin-inline: auto; }
.account-card .form-grid { max-width: none; }
.account-card .field-input, .account-card .field-select { width: 100%; min-width: 0; }
.account-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px 24px; margin: 0; }
.account-facts dt { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.account-facts dd { margin: 2px 0 0; font-size: 13px; color: var(--text-main); overflow-wrap: anywhere; }
.account-actions { display: flex; gap: 8px; }
.account-actions .btn-primary-blue:disabled { opacity: 0.45; cursor: not-allowed; }
.account-readonly { margin: 0; font-size: 13px; color: var(--text-main); }
.account-status { margin: 0; font-size: 12.5px; }
.account-status.is-error { color: #dc2626; }
.account-status.is-success { color: var(--green-text); }

/* Billing card (Account page, owner only) */
.billing-body { display: flex; flex-direction: column; gap: 20px; }
.billing-mode-pill { margin-left: 8px; vertical-align: middle; color: var(--orange-primary); }
.billing-status { margin: 0; padding: 12px 14px; border-radius: var(--radius-md); border: 1px solid var(--border-subtle); background: var(--bg-surface-raised); font-size: 14px; color: var(--text-main); }
.billing-status.is-warn { background: var(--orange-soft); border-color: var(--orange-primary); }
.billing-status.is-success { background: var(--green-soft); border-color: var(--green-primary); }
.billing-status.is-info { background: var(--blue-soft); border-color: var(--blue-border); }
.billing-manage { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.billing-manage .field-helper { margin: 0; }
.billing-section { display: flex; flex-direction: column; gap: 10px; }
.billing-heading { margin: 0; font-size: 13px; font-weight: 600; color: var(--text-main); }
.billing-empty { margin: 0; font-size: 13px; color: var(--text-muted); }
.billing-payments td, .billing-payments th { white-space: nowrap; }
.billing-payments a { color: var(--blue-primary); font-weight: 500; }
.billing-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.billing-plan { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: baseline; padding: 12px 14px; border: 1px solid var(--border-medium); border-radius: var(--radius-md); background: var(--bg-surface); cursor: pointer; }
.billing-plan:has(input:checked) { border-color: var(--border-active); background: var(--blue-soft); }
.billing-plan:has(input:focus-visible) { outline: 2px solid var(--border-active); outline-offset: 2px; }
.billing-plan input { grid-row: 1 / span 3; accent-color: var(--blue-primary); align-self: center; }
.billing-plan-name { font-size: 14px; font-weight: 600; color: var(--text-main); }
.billing-plan-price { font-size: 13px; color: var(--text-main); }
.billing-plan-limits { font-size: 12px; color: var(--text-muted); }
.billing-fields { margin-top: 4px; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.billing-fields .is-wide { grid-column: 1 / -1; }
.billing-change { display: flex; flex-wrap: wrap; gap: 8px; }
.billing-change .field-select { width: auto; min-width: 220px; flex: 1 1 220px; max-width: 360px; }
.billing-paylink { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 14px; border-radius: var(--radius-md); background: var(--blue-soft); border: 1px solid var(--blue-border); font-size: 13px; color: var(--text-main); }
.billing-link-btn { background: none; border: 0; padding: 0; color: var(--blue-primary); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: underline; }
.plan-banner .plan-banner-link { margin-left: auto; white-space: nowrap; font-weight: 600; color: var(--blue-primary); }

@media (max-width: 720px) {
  .account-workspace { padding: 20px 16px 32px; }
  .account-card { padding: 18px 16px; }
  .account-actions .btn-primary-blue { width: 100%; justify-content: center; min-height: 40px; }
  .billing-manage .btn-primary-blue, .billing-manage .btn-secondary, .billing-change .btn-secondary { width: 100%; justify-content: center; min-height: 40px; }
  .billing-change .field-select { max-width: none; }
  .team-workspace { padding: 20px 16px 32px; }
  .team-table { min-width: 0 !important; }
  .team-table thead { display: none; }
  .team-table, .team-table tbody, .team-table tr, .team-table td { display: block; width: 100%; }
  .team-table tr { padding: 10px 0; border-bottom: 1px solid var(--border-subtle); }
  .team-table td { border: 0; padding: 4px 16px; }
  .team-table td:nth-child(2), .team-table td:nth-child(3), .team-table td:nth-child(4) { display: inline-block; width: auto; padding-right: 4px; font-size: 12px; }
  .team-actions { justify-content: flex-start; padding-top: 6px; }
  .team-actions .btn-sm { min-height: 36px; }
}

/* ---------- Inbox: live chats + email/SMS threads ---------- */
.inbox-workspace { display: flex; flex-direction: column; gap: 20px; padding: 28px 36px 40px; width: 100%; max-width: var(--page-max); margin-inline: auto; }
.inbox-section { display: flex; flex-direction: column; gap: 10px; }
.inbox-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.inbox-section-title { font-size: 14px; font-weight: 700; color: var(--text-main); margin: 0; }
.inbox-count { font-weight: 500; color: var(--text-muted); margin-left: 4px; }
.inbox-filter { margin-bottom: 0; }
.inbox-live-list, .inbox-thread-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.inbox-empty { padding: 18px; border: 1px dashed var(--border-medium); border-radius: var(--radius-md); color: var(--text-muted); font-size: 13px; text-align: center; }
.inbox-card { width: 100%; display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; text-align: left; padding: 12px 14px; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); color: var(--text-main); font: inherit; cursor: pointer; min-height: 44px; }
.inbox-card:hover { border-color: var(--border-medium); background: var(--bg-surface-raised); }
.inbox-card:focus-visible { outline: 2px solid var(--blue-primary); outline-offset: 2px; }
.inbox-card.needs-reply { border-color: var(--orange-primary); }
.inbox-avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--blue-soft); color: var(--blue-primary); }
.inbox-avatar.is-live { background: var(--green-soft); color: var(--green-text); position: relative; }
.inbox-avatar.is-live::after { content: ""; position: absolute; right: 0; bottom: 0; width: 9px; height: 9px; border-radius: 50%; background: var(--green-primary); border: 2px solid var(--bg-surface); }
.inbox-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.inbox-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-snippet { font-size: 12.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-card.is-unread .inbox-snippet { color: var(--text-main); font-weight: 500; }
.inbox-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }
.inbox-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; border: 1px solid currentColor; }
.inbox-pill.is-bot { color: var(--text-muted); }
.inbox-pill.is-human { color: var(--green-text); }
.inbox-pill.is-alert { color: var(--orange-primary); }
.inbox-pill.is-away { color: var(--text-faint); }
.inbox-more { align-self: center; }

/* Live chat drawer */
.live-drawer { width: 560px; }
.live-drawer-title { font-size: 16px; font-weight: 700; color: var(--text-main); margin: 0; }
.live-state-pill { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 4px; background: var(--green-soft); color: var(--green-text); }
.live-state-pill.is-human { background: var(--blue-soft); color: var(--blue-primary); }
.live-state-pill.is-alert { background: var(--orange-soft); color: var(--orange-primary); }
.live-state-pill.is-ended { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }
.live-drawer-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 24px; border-bottom: 1px solid var(--border-subtle); }
.live-drawer-actions button { min-height: 36px; }
.live-drawer-note { margin: 0; padding: 10px 24px; font-size: 12.5px; color: var(--text-muted); border-bottom: 1px solid var(--border-subtle); }
.live-feed { flex: 1; max-height: none; padding: 16px 24px; }
.live-feed .is-streaming .bubble-body::after { content: " …"; color: var(--text-muted); }
.live-composer { display: flex; gap: 8px; align-items: flex-end; padding: 12px 24px 18px; border-top: 1px solid var(--border-subtle); }
.live-composer textarea { flex: 1; min-width: 0; resize: vertical; min-height: 44px; }
.live-composer button { min-height: 44px; }
.staff-avatar { background: var(--blue-soft); }
.staff-bubble { border-color: var(--blue-border) !important; }
.mod-staff { background: var(--blue-soft); color: var(--blue-primary); }

@media (max-width: 720px) {
  .inbox-workspace { padding: 20px 16px 32px; }
  .inbox-card { grid-template-columns: 32px 1fr; }
  .inbox-side { grid-column: 2; flex-direction: row; align-items: center; justify-content: flex-start; }
  .live-drawer { width: 100vw; max-width: 100vw; }
  .live-drawer-actions, .live-feed, .live-composer { padding-left: 16px; padding-right: 16px; }
}

/* ---------- Requests: settings editor (Agent > Requests) ---------- */
.req-defaults-banner { margin: 0 0 14px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--blue-soft); color: var(--text-main); font-size: 13px; }
.req-config-list { display: flex; flex-direction: column; gap: 12px; }
.req-type-card { border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-surface); }
.req-type-card.is-on { border-color: var(--blue-border); }
.req-type-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.req-type-icon { font-size: 20px; }
.req-type-titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.req-type-label { font: inherit; font-weight: 700; font-size: 14px; color: var(--text-main); background: transparent; border: 1px solid transparent; border-radius: var(--radius-xs); padding: 2px 6px; margin-left: -6px; max-width: 280px; }
.req-type-label:hover, .req-type-label:focus { border-color: var(--border-medium); outline: none; }
.req-type-help, .req-muted { font-size: 12.5px; color: var(--text-muted); font-weight: 400; }
.req-type-body { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.req-field-list { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.req-field-row { display: grid; grid-template-columns: minmax(140px, 1fr) 140px auto auto; gap: 8px; align-items: center; }
.req-field-row .req-options { grid-column: 1 / -1; }
.req-field-actions { display: flex; gap: 4px; }
.icon-btn { min-width: 32px; min-height: 32px; border-radius: var(--radius-xs); border: 1px solid var(--border-subtle); background: var(--bg-surface-raised); color: var(--text-main); cursor: pointer; font: inherit; }
.icon-btn:disabled { opacity: 0.4; cursor: default; }
.icon-btn:focus-visible, .req-slot-chip:focus-visible, .crm-request-link:focus-visible { outline: 2px solid var(--blue-primary); outline-offset: 2px; }
.req-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-main); cursor: pointer; white-space: nowrap; }
.req-check input { width: 16px; height: 16px; accent-color: var(--blue-primary); }
.req-switch { position: relative; display: inline-flex; width: 40px; height: 22px; flex: none; cursor: pointer; }
.req-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.req-switch-track { width: 100%; height: 100%; border-radius: 11px; background: var(--border-medium); transition: background 0.15s; position: relative; }
.req-switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.req-switch input:checked + .req-switch-track { background: var(--blue-primary); }
.req-switch input:checked + .req-switch-track::after { transform: translateX(18px); }
.req-switch input:focus-visible + .req-switch-track { outline: 2px solid var(--blue-primary); outline-offset: 2px; }
.req-schedule { width: 100%; display: flex; flex-direction: column; gap: 10px; margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--border-subtle); }
.req-days { display: flex; flex-direction: column; gap: 6px; }
.req-day { display: grid; grid-template-columns: 130px 1fr; gap: 10px; align-items: center; min-height: 36px; }
.req-day-ranges { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.req-range { display: inline-flex; align-items: center; gap: 6px; }
.req-range input[type="time"] { width: 118px; }
.req-schedule-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 14px; }
.req-schedule-grid .form-group { margin: 0; }
.req-closed { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.req-closed input[type="date"] { width: 170px; }
.req-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px; border-radius: 14px; background: var(--bg-surface-raised); border: 1px solid var(--border-subtle); font-size: 12.5px; }
.req-chip .icon-btn { min-width: 26px; min-height: 26px; border: 0; background: transparent; }
.req-preview { font-size: 12.5px; color: var(--text-muted); }
.req-events { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--border-subtle); }
.req-event-list { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 8px; }
.req-event { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); background: var(--bg-surface-raised); }
.req-event.is-past .req-event-title { color: var(--text-muted); }
.req-event.is-editing { display: block; border-color: var(--blue-border); }
.req-event-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.req-event-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--text-main); overflow-wrap: anywhere; }
.req-event-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.req-event-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.req-event-form .form-group { margin: 0; }
.req-event-form .req-event-name, .req-event-form .req-event-location, .req-event-form .req-event-description, .req-event-form .req-event-error, .req-event-form-actions { grid-column: 1 / -1; }
.req-event-error { margin: 0; font-size: 13px; color: #f87171; }
[data-theme="light"] .req-event-error { color: #b91c1c; }
.req-event-form-actions { display: flex; gap: 8px; }
.req-status-pill.ev-past { color: var(--text-faint); }
.req-status-pill.ev-closed { color: var(--orange-primary); }
.req-status-pill.ev-full { color: var(--purple-primary); }

/* ---------- Requests page ---------- */
.req-workspace { display: flex; flex-direction: column; gap: 16px; padding: 28px 36px 40px; width: 100%; max-width: var(--page-max); margin-inline: auto; }
.req-kpi-grid .conv-kpi-card { cursor: pointer; text-align: left; font: inherit; color: inherit; }
.req-kpi-grid .conv-kpi-card[hidden] { display: none; }
.req-kpi-grid .conv-kpi-card:focus-visible { outline: 2px solid var(--blue-primary); outline-offset: 2px; }
.req-toolbar { flex-wrap: wrap; gap: 10px; }
.req-toolbar .conv-channel-tabs { margin-bottom: 0; }
.req-toolbar .conv-search-box { flex: 1 1 220px; }
.req-tab-count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: var(--blue-soft); color: var(--blue-primary); font-size: 11px; }
.req-row { cursor: pointer; }
.req-row:focus-visible td { outline: 2px solid var(--blue-primary); outline-offset: -2px; }
.req-summary { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.req-status-pill { display: inline-flex; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 12px; border: 1px solid currentColor; color: var(--text-muted); white-space: nowrap; }
.req-status-pill.status-new { color: var(--orange-primary); }
.req-status-pill.status-confirmed { color: var(--blue-primary); }
.req-status-pill.status-in_progress { color: var(--purple-primary); }
.req-status-pill.status-done { color: var(--green-text); }
.req-status-pill.status-cancelled { color: var(--text-faint); text-decoration: line-through; }

/* Request drawer */
.req-drawer { width: 560px; }
.req-drawer-body { flex: 1; overflow-y: auto; padding: 16px 24px 28px; display: flex; flex-direction: column; gap: 16px; }
.req-drawer-links { display: flex; gap: 8px; flex-wrap: wrap; }
.req-drawer-links:empty { display: none; }
.req-form { display: flex; flex-direction: column; gap: 12px; }
.req-form .form-group { margin: 0; }
.req-when-text { margin: 4px 0 6px; font-size: 14px; font-weight: 600; color: var(--text-main); }
.req-reschedule summary { cursor: pointer; font-size: 13px; color: var(--blue-primary); min-height: 32px; display: flex; align-items: center; }
.req-reschedule-body { display: flex; flex-direction: column; gap: 8px; padding-top: 6px; }
.req-slot-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.req-slot-chip { min-height: 36px; padding: 0 12px; border-radius: 18px; border: 1px solid var(--blue-border); background: var(--blue-soft); color: var(--text-main); font: inherit; font-size: 13px; cursor: pointer; }
.req-slot-chip:hover { background: var(--blue-primary); color: #fff; }
.req-overlap { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--text-muted); }
.req-fields { display: flex; flex-direction: column; gap: 10px; }
.req-form-actions { display: flex; justify-content: flex-end; }
.crm-request-link { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 6px 8px; margin: -6px -8px; border: 0; border-radius: var(--radius-xs); background: transparent; color: inherit; font: inherit; cursor: pointer; }
.crm-request-link:hover { background: var(--bg-surface-raised); }

@media (max-width: 720px) {
  .req-workspace { padding: 20px 16px 32px; }
  .req-field-row { grid-template-columns: 1fr 1fr; }
  .req-event-form { grid-template-columns: 1fr; }
  .req-event { flex-wrap: wrap; }
  .req-day { grid-template-columns: 1fr; gap: 4px; }
  .req-drawer { width: 100vw; max-width: 100vw; }
  .req-drawer-body { padding: 16px; }
}
.req-schedule > .link-btn { align-self: flex-start; }
.req-table th, .req-table td:first-child, .req-table .req-nowrap { white-space: nowrap; }
@media (max-width: 720px) {
  .req-kpi-grid { grid-template-columns: 1fr 1fr !important; gap: 8px; }
  .req-kpi-grid .conv-kpi-card { padding: 12px; }
  .req-type-tabs { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .req-type-tabs .conv-channel-btn { flex: none; }
}

/* CRM sub-navigation: Pipeline | Requests (the second label follows what the site takes) */
.crm-subnav { display: flex; gap: 4px; border-bottom: 1px solid var(--border-subtle); margin-bottom: 4px; }
.crm-subnav-btn { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 0; background: transparent; color: var(--text-muted); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.crm-subnav-btn:hover { color: var(--text-main); }
.crm-subnav-btn.is-active { color: var(--text-main); }
.crm-subnav-btn.is-active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--blue-primary); }
.crm-subnav-btn:focus-visible { outline: 2px solid var(--blue-primary); outline-offset: -2px; border-radius: var(--radius-xs); }
.crm-subnav-count { min-width: 18px; padding: 0 6px; border-radius: 9px; background: var(--orange-soft); color: var(--orange-primary); font-size: 11px; line-height: 18px; text-align: center; }

/* ---------- Integrations: mailboxes and SMS ---------- */
.integ-workspace { display: flex; flex-direction: column; gap: 22px; padding: 28px 36px 40px; width: 100%; max-width: var(--page-max); margin-inline: auto; }
.integ-section { display: flex; flex-direction: column; gap: 12px; }
.integ-section-title { font-size: 16px; font-weight: 700; margin: 0; color: var(--text-main); }
.integ-section-sub { margin: 4px 0 0; font-size: 13px; color: var(--text-muted); max-width: 760px; }
.integ-mailboxes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.integ-mailbox { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-surface); }
.integ-mailbox-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.integ-mailbox-main strong { color: var(--text-main); overflow: hidden; text-overflow: ellipsis; }
.integ-status { font-size: 12.5px; color: var(--text-muted); }
.integ-status.is-ok { color: var(--green-text); }
.integ-status.is-error { color: #dc2626; }
.integ-logo { width: 36px; height: 36px; flex: none; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 16px; background: var(--bg-surface-raised); color: var(--text-main); border: 1px solid var(--border-subtle); }
.integ-logo-google { color: #ea4335; }
.integ-connect-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.integ-connect-card { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; padding: 16px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-surface); }
.integ-connect-card[hidden] { display: none; }
.integ-connect-head { display: flex; gap: 12px; align-items: flex-start; }
.integ-connect-head h3 { margin: 0; font-size: 14px; color: var(--text-main); }
.integ-connect-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-muted); }
.integ-connect-card button { min-height: 40px; }
.integ-note { margin: 0; font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }
.integ-note code { font-size: 11.5px; word-break: break-all; }
.integ-imap-form { padding: 16px; border: 1px solid var(--blue-border); border-radius: var(--radius-md); background: var(--bg-surface); display: flex; flex-direction: column; gap: 12px; }
.integ-advanced summary, .integ-resend summary { cursor: pointer; font-size: 13px; color: var(--blue-primary); min-height: 32px; display: flex; align-items: center; }
.integ-port-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.integ-form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.integ-single { grid-template-columns: minmax(0, 720px) !important; }
.integ-resend > .msg-settings-grid { margin-top: 8px; }

/* Inbox email */
.inbox-channel-nav { width: 100%; }
.inbox-mail-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.inbox-mail-toolbar .conv-search-box { flex: 1 1 220px; }
.inbox-mail-status { margin: 0; font-size: 12.5px; color: var(--text-muted); min-height: 1em; }
.inbox-channel-pane { display: flex; flex-direction: column; gap: 10px; }
.inbox-channel-pane[hidden] { display: none; }
.inbox-empty .btn-primary-blue { margin-top: 10px; }

/* Inbox email: a list and a reading pane */
.mail-split { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); height: clamp(540px, calc(100vh - 96px), 980px); scroll-margin-top: 12px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-surface); overflow: hidden; }
.mail-list-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--border-subtle); }
.mail-list-col .inbox-mail-toolbar { padding: 12px 12px 0; }
.mail-list-col .inbox-mail-status { padding: 8px 14px 6px; }
.mail-list-col .inbox-more { margin: 8px auto; }
.mail-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; gap: 0; }
.mail-list > li { border-top: 1px solid var(--border-subtle); }
.mail-list > li.inbox-empty { border: 0; margin: 12px; }
.mail-avatar { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.mail-row { width: 100%; display: grid; grid-template-columns: 8px 34px minmax(0, 1fr); gap: 10px; align-items: start; padding: 11px 14px 11px 8px; background: none; border: 0; border-left: 3px solid transparent; text-align: left; font: inherit; color: var(--text-main); cursor: pointer; min-height: 44px; transition: background-color .12s; }
.mail-row:hover { background: var(--bg-surface-raised); }
.mail-row:focus-visible { outline: 2px solid var(--blue-primary); outline-offset: -2px; }
.mail-row.is-selected { background: var(--blue-soft); border-left-color: var(--blue-primary); }
.mail-row-dot { width: 8px; height: 8px; margin-top: 13px; border-radius: 50%; }
.mail-row.is-unread .mail-row-dot { background: var(--blue-primary); }
.mail-row-main { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.mail-row-top { display: flex; align-items: baseline; gap: 6px; }
.mail-row-who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.mail-row-count { font-size: 11px; color: var(--text-muted); }
.mail-row-time { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }
.mail-row-subject, .mail-row-snippet { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.mail-row-subject { font-size: 13px; }
.mail-row-snippet { color: var(--text-muted); }
.mail-row-clip { display: inline-flex; vertical-align: -2px; color: var(--text-muted); }
.mail-row.is-unread .mail-row-who, .mail-row.is-unread .mail-row-subject { font-weight: 700; }
.mail-row.is-unread .mail-row-time { color: var(--blue-primary); font-weight: 600; }

.mail-skeleton-row { display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding: 12px 14px; }
.mail-skel-lines { display: flex; flex-direction: column; gap: 8px; padding-top: 3px; }
.mail-skel { display: block; height: 11px; border-radius: 6px; background: linear-gradient(90deg, var(--bg-surface-raised) 25%, var(--border-subtle) 50%, var(--bg-surface-raised) 75%); background-size: 200% 100%; animation: mail-shimmer 1.3s linear infinite; }
.mail-skel-lines .mail-skel:last-child { width: 70%; }
.mail-avatar.mail-skel { height: 34px; border-radius: 50%; }
.mail-skeleton-msg { display: flex; flex-direction: column; gap: 10px; padding: 8px 0; }
.mail-skeleton-msg .mail-skel:nth-child(2) { width: 85%; }
.mail-skeleton-msg .mail-skel:nth-child(3) { width: 60%; }
@keyframes mail-shimmer { to { background-position: -200% 0; } }

.mail-reader { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg-card, var(--bg-surface)); }
.mail-reader-empty { flex: 1; display: grid; place-content: center; justify-items: center; gap: 6px; padding: 24px; text-align: center; color: var(--text-muted); }
.mail-reader-empty p { margin: 0; }
.mail-reader-empty svg { margin-bottom: 6px; opacity: .6; }
.mail-keys { font-size: 12px; }
.mail-reader-empty[hidden], .mail-reader-view[hidden], .mail-reply[hidden], .mail-reply-box[hidden], .mail-reply-collapsed[hidden] { display: none; }
.mail-reader-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.mail-reader-bar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--border-subtle); }
.mail-reader-actions { flex: 1; display: flex; flex-wrap: wrap; gap: 4px; }
.mail-reader-nav { display: flex; gap: 2px; }
.mail-icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 36px; min-height: 36px; padding: 0 8px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text-muted); font: inherit; font-size: 12.5px; cursor: pointer; }
.mail-icon-btn:hover:not(:disabled) { background: var(--bg-surface-raised); color: var(--text-main); }
.mail-icon-btn:focus-visible { outline: 2px solid var(--blue-primary); outline-offset: 1px; }
.mail-icon-btn:disabled { opacity: .35; cursor: default; }
.mail-back-btn { display: none; }
.mail-reader-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 24px 8px; }
.mail-reader-head { margin-bottom: 10px; }
.mail-subject { margin: 0 0 6px; font-size: 20px; line-height: 1.3; font-weight: 650; color: var(--text-main); overflow-wrap: anywhere; }
.mail-reader-sub { margin: 0; font-size: 12.5px; color: var(--text-muted); }
.mail-messages { display: flex; flex-direction: column; }
.mail-msg { padding: 14px 0; border-top: 1px solid var(--border-subtle); }
.mail-msg:first-child { border-top: 0; }
.mail-msg.is-pending { opacity: .6; }
.mail-msg-head { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: start; cursor: pointer; border-radius: var(--radius-sm); }
.mail-msg-head:focus-visible { outline: 2px solid var(--blue-primary); outline-offset: 4px; }
.mail-msg-meta { min-width: 0; }
.mail-msg-from { font-size: 13.5px; color: var(--text-main); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-msg-addr { font-size: 12px; color: var(--text-muted); }
.mail-msg-line { font-size: 12.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-msg:not(.is-collapsed) .mail-msg-preview, .mail-msg.is-collapsed .mail-msg-to { display: none; }
.mail-msg-time { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.mail-msg-content { margin: 10px 0 0 44px; }
.mail-msg.is-collapsed .mail-msg-content { display: none; }
.mail-msg-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.6; color: var(--text-main); }
.mail-msg-body a { color: var(--blue-primary); }
.mail-fold-btn { display: block; margin-top: 8px; padding: 0 9px; border: 0; border-radius: 10px; background: var(--bg-surface-raised); color: var(--text-muted); font: inherit; line-height: 1.3; letter-spacing: 2px; cursor: pointer; }
.mail-fold-btn:hover { background: var(--border-subtle); }
.mail-quoted { margin-top: 8px; padding-left: 12px; border-left: 3px solid var(--border-medium); color: var(--text-muted); font-size: 13px; }
.mail-quoted[hidden] { display: none; }
.mail-html-wrap { overflow: hidden; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); background: #fff; }
.mail-html-frame { display: block; width: 100%; height: 96px; border: 0; background: #fff; }
.mail-images-bar { padding: 8px 12px; font-size: 12.5px; color: #444; background: #f4f4f5; border-bottom: 1px solid #e4e4e7; }
.mail-attachments { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.mail-att-btn { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 36px; padding: 6px 10px; border: 1px solid var(--border-medium); border-radius: var(--radius-sm); background: var(--bg-surface); color: var(--text-main); font: inherit; font-size: 12.5px; cursor: pointer; }
.mail-att-btn:hover:not(:disabled) { background: var(--bg-surface-raised); }
.mail-att-btn:focus-visible { outline: 2px solid var(--blue-primary); outline-offset: 2px; }
.mail-att-btn[aria-busy="true"] { opacity: .6; cursor: progress; }
.mail-att-ico { padding: 2px 5px; border-radius: 4px; background: var(--blue-soft); color: var(--blue-primary); font-size: 10px; font-weight: 700; }
.mail-att-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-formatted-btn { display: block; margin-top: 10px; font-size: 12.5px; }
.mail-reply { padding: 10px 24px 14px; border-top: 1px solid var(--border-subtle); background: var(--bg-surface); }
.mail-reply-collapsed { display: flex; gap: 8px; }
.mail-reply-box { display: flex; flex-direction: column; gap: 8px; }
.mail-reply-to { font-size: 12.5px; overflow-wrap: anywhere; }
.mail-reply textarea { resize: vertical; min-height: 88px; max-height: 40vh; }
.mail-reply-actions { display: flex; align-items: center; gap: 12px; }
.mail-reply-hint { margin-left: auto; font-size: 12px; }
.mail-reply-actions button { min-height: 40px; }
.mail-reply-open { min-height: 38px; }

@media (max-width: 900px) {
  .mail-split { display: block; height: auto; border: 0; background: none; overflow: visible; }
  .mail-list-col { border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-surface); }
  .mail-list { overflow: visible; }
  .mail-reader { position: fixed; inset: 0; z-index: 1050; visibility: hidden; transform: translateX(100%); transition: transform .22s ease, visibility 0s .22s; }
  .mail-reader.is-open { visibility: visible; transform: none; transition: transform .22s ease; }
  .mail-back-btn { display: inline-flex; }
  .mail-keys { display: none; }
  .mail-reply-hint { display: none; }
}
@media (max-width: 600px) {
  .mail-text-btn span { display: none; }
  .mail-reader-scroll, .mail-reply { padding-left: 16px; padding-right: 16px; }
  .mail-msg-content { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .mail-skel { animation: none; }
  .mail-reader, .mail-reader.is-open { transition: none; }
}
@media (max-width: 720px) {
  .integ-workspace { padding: 20px 16px 32px; }
  .integ-mailbox { grid-template-columns: 32px 1fr; }
  .integ-mailbox .team-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
.integ-imap-form[hidden], .integ-note[hidden] { display: none; }
.integ-connect-card button:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.req-check[hidden] { display: none; }

/* ---------- Conversation transcripts (History and Live now): chat layout ----------
   The visitor speaks on the left; the bot or a team member answers on the right. */
.conv-transcript-messages .chat-bubble-row { align-items: flex-end; }
.conv-transcript-messages .chat-bubble-row.agent-row { flex-direction: row-reverse; }
.conv-transcript-messages .chat-bubble {
  width: fit-content;
  min-width: 0;
  max-width: min(78%, 520px);
}
.conv-transcript-messages .user-row .chat-bubble { border-bottom-left-radius: 4px; }
.conv-transcript-messages .agent-row .chat-bubble { border-bottom-right-radius: 4px; }
.conv-transcript-messages .chat-bubble-row.tool-row { flex-direction: row; }
.conv-transcript-messages .chat-bubble-row.tool-row .chat-bubble { max-width: 100%; border-bottom-left-radius: 12px; }
.conv-transcript-messages .chat-avatar { align-self: flex-end; }
.conv-transcript-messages .bubble-header { flex-wrap: wrap; row-gap: 2px; }
.conv-transcript-messages .bubble-author,
.conv-transcript-messages .modality-chip,
.conv-transcript-messages .bubble-time { white-space: nowrap; }
@media (max-width: 720px) {
  .conv-transcript-messages .chat-bubble { max-width: calc(100% - 44px); padding: 10px 12px; }
  .conv-transcript-messages .chat-bubble-row { gap: 8px; }
}

/* ---------- Customer persona (contact drawer) ---------- */
.persona-section { border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-surface); padding: 14px 16px; }
.persona-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.persona-head .panel-section-title { margin: 0; }
.persona-sub { margin: 4px 0 0; font-size: 12px; color: var(--text-muted); }
.persona-stale { margin: 10px 0 0; padding: 6px 10px; border-radius: var(--radius-xs); background: var(--orange-soft); color: var(--orange-primary); font-size: 12.5px; }
.persona-stale[hidden] { display: none; }
.persona-body { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.persona-empty { margin: 0; font-size: 13px; color: var(--text-muted); }
.persona-headline { font-size: 15px; font-weight: 700; color: var(--text-main); line-height: 1.35; }
.persona-badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.persona-intent, .persona-tag, .persona-confidence { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 12px; border: 1px solid currentColor; color: var(--text-muted); }
.persona-intent.intent-ready_to_buy, .persona-intent.intent-customer { color: var(--green-text); }
.persona-intent.intent-comparing, .persona-intent.intent-researching { color: var(--blue-primary); }
.persona-intent.intent-at_risk { color: #dc2626; }
.persona-confidence { border-style: dashed; font-weight: 500; }
.persona-tag { border-color: var(--border-medium); font-weight: 500; }
.persona-summary { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--text-main); }
.persona-reason { margin: 0; font-size: 12.5px; color: var(--text-muted); }
.persona-facts { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 14px; }
.persona-facts dt { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.03em; }
.persona-facts dd { margin: 1px 0 0; font-size: 13px; color: var(--text-main); }
.persona-src { font-size: 10.5px; color: var(--text-faint); border: 1px solid var(--border-subtle); border-radius: 8px; padding: 0 5px; margin-left: 4px; }
.persona-block h5 { margin: 0 0 4px; font-size: 12px; color: var(--text-muted); font-weight: 600; }
.persona-block ul, .persona-block ol { margin: 0; padding-left: 18px; font-size: 13px; color: var(--text-main); display: flex; flex-direction: column; gap: 2px; }
.persona-block p { margin: 0; font-size: 13px; color: var(--text-main); }
.persona-next { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--blue-soft); }
.contacts-persona-line { margin-top: 2px; font-size: 12px; font-style: italic; color: var(--text-muted); max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Ask: the team's AI assistant ---------- */
.ask-workspace .ask-mount { margin-top: 4px; }
.ask-panel { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; align-items: start; }
.ask-history { border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-surface); padding: 10px; max-height: calc(100vh - 300px); overflow-y: auto; }
.ask-history-head { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 6px 8px; }
.ask-history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.ask-history-empty { padding: 8px 6px; font-size: 12.5px; color: var(--text-muted); }
.ask-history-item { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 8px; border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--text-main); font: inherit; cursor: pointer; min-height: 44px; }
.ask-history-item:hover { background: var(--bg-surface-raised); }
.ask-history-item.is-active { background: var(--blue-soft); border-color: var(--blue-border); }
.ask-history-item:focus-visible, .ask-chip:focus-visible, .ask-contact:focus-visible { outline: 2px solid var(--blue-primary); outline-offset: 2px; }
.ask-history-title { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ask-history-meta { font-size: 11.5px; color: var(--text-muted); }
.ask-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-surface); padding: 14px; }
.ask-main-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.ask-title { margin: 0; font-size: 14px; font-weight: 700; color: var(--text-main); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.ask-main-actions { display: flex; gap: 6px; }
.ask-main-actions [hidden] { display: none; }
.ask-banner { margin: 0; padding: 8px 12px; border-radius: var(--radius-xs); background: var(--orange-soft); color: var(--orange-primary); font-size: 12.5px; }
.ask-banner[hidden] { display: none; }
.ask-thread { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 220px; max-height: calc(100vh - 380px); padding-right: 2px; }
.ask-empty { margin: auto; max-width: 420px; text-align: center; font-size: 13px; color: var(--text-muted); }
.ask-msg { max-width: 92%; display: flex; flex-direction: column; gap: 3px; }
.ask-msg.is-user { align-self: flex-end; align-items: flex-end; }
.ask-msg-meta { font-size: 11.5px; color: var(--text-muted); }
.ask-msg-body { padding: 9px 13px; border-radius: 12px; font-size: 13.5px; line-height: 1.5; color: var(--text-main); word-break: break-word; }
.ask-msg.is-user .ask-msg-body { background: var(--blue-soft); border: 1px solid var(--blue-border); white-space: pre-wrap; }
.ask-msg.is-assistant .ask-msg-body { background: var(--bg-surface-raised); border: 1px solid var(--border-subtle); }
.ask-msg-body p { margin: 0 0 8px; }
.ask-msg-body p:last-child, .ask-msg-body ul:last-child { margin-bottom: 0; }
.ask-msg-body ul { margin: 0 0 8px; padding-left: 18px; display: flex; flex-direction: column; gap: 3px; }
.ask-msg.is-error .ask-msg-body { border-color: #dc2626; color: #dc2626; }
.ask-msg.is-working .ask-msg-body { color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.ask-spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border-medium); border-top-color: var(--blue-primary); animation: ask-spin 0.8s linear infinite; flex: none; }
@keyframes ask-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ask-spinner { animation-duration: 3s; } }
.ask-contact { display: inline; padding: 1px 8px; margin: 0 1px; border-radius: 10px; border: 1px solid var(--blue-border); background: var(--blue-soft); color: var(--blue-primary); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.ask-contact:hover { background: var(--blue-primary); color: #fff; }
.ask-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ask-chips:empty { display: none; }
.ask-chip { min-height: 36px; padding: 0 12px; border-radius: 18px; border: 1px solid var(--border-medium); background: var(--bg-surface-raised); color: var(--text-main); font: inherit; font-size: 12.5px; cursor: pointer; text-align: left; }
.ask-chip:hover { border-color: var(--blue-primary); }
.ask-form { display: flex; gap: 8px; align-items: flex-end; }
.ask-form textarea { flex: 1; min-width: 0; resize: vertical; min-height: 44px; max-height: 160px; }
.ask-form button { min-height: 44px; }
.ask-note { margin: 0; font-size: 11.5px; color: var(--text-faint); }
.ask-proposal { margin-top: 8px; padding: 12px; border: 1px solid var(--blue-border); border-radius: var(--radius-md); background: var(--bg-surface); display: flex; flex-direction: column; gap: 8px; }
.ask-proposal.is-applied { border-color: var(--border-subtle); background: var(--bg-surface-raised); }
.ask-proposal.is-dismissed { border-color: var(--border-subtle); opacity: 0.7; }
.ask-proposal.is-failed { border-color: #dc2626; }
.ask-proposal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ask-proposal-kind { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.ask-proposal-summary { margin: 0; font-size: 13.5px; font-weight: 600; color: var(--text-main); }
.ask-proposal-to { font-size: 12.5px; color: var(--text-muted); word-break: break-all; }
.ask-proposal-to strong { color: var(--text-main); font-weight: 600; }
.ask-proposal-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.ask-proposal-field .field-textarea { min-height: 72px; resize: vertical; font-weight: 400; }
.ask-proposal-field .field-input { font-weight: 400; }
.ask-proposal-warn { margin: 0; padding: 7px 10px; border-radius: var(--radius-xs); background: var(--orange-soft); color: var(--orange-primary); font-size: 12.5px; }
.ask-proposal-error { margin: 0; font-size: 12.5px; color: #dc2626; }
.ask-proposal-state { margin: 0; font-size: 12.5px; color: var(--text-muted); }
.ask-proposal-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ask-proposal-actions button { min-height: 40px; }

/* In the contact drawer (and on narrower screens) the chat list is tucked behind a button. */
.ask-panel [data-ask-toggle-history] { display: none; }
.ask-panel--compact .ask-panel { grid-template-columns: 1fr; }
.ask-panel--compact .ask-panel [data-ask-toggle-history] { display: inline-flex; }
.ask-panel--compact .ask-history { display: none; max-height: 200px; }
.ask-panel--compact .ask-panel.show-history .ask-history { display: block; }
.ask-panel--compact .ask-thread { max-height: 340px; min-height: 120px; }
.ask-panel--compact .ask-main { border: 0; padding: 0; background: transparent; }
.ask-details { border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-surface); padding: 12px 16px; }
.ask-details-summary { display: flex; flex-direction: column; gap: 2px; cursor: pointer; list-style: none; min-height: 32px; justify-content: center; }
.ask-details-summary::-webkit-details-marker { display: none; }
.ask-details-summary:focus-visible { outline: 2px solid var(--blue-primary); outline-offset: 2px; border-radius: var(--radius-xs); }
.ask-details[open] .ask-details-summary { margin-bottom: 10px; }
.ask-site-link { margin-top: 8px; }
/* History drawer: Ask about one conversation, and the Translate shortcuts above the transcript */
.conv-ask-wrap { padding: 16px 24px; border-bottom: 1px solid var(--border-subtle); }
.conv-ask-details .ask-thread { max-height: 520px; }
.conv-transcript-tools { display: inline-flex; align-items: center; gap: 10px; }
.conv-lang-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: -4px 0 12px; padding: 8px 12px;
  border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-surface); font-size: 13px; color: var(--text-secondary, inherit); }
.conv-lang-banner[hidden], .conv-transcript-tools [hidden] { display: none; }

@media (max-width: 900px) {
  .ask-panel { grid-template-columns: 1fr; }
  .ask-panel [data-ask-toggle-history] { display: inline-flex; }
  .ask-history { display: none; max-height: 220px; }
  .ask-panel.show-history .ask-history { display: block; }
  .ask-thread { max-height: calc(100dvh - 360px); }
  .ask-form { position: sticky; bottom: 0; background: var(--bg-surface); padding-top: 6px; }
}
@media (max-width: 720px) {
  .ask-msg { max-width: 100%; }
}
.crm-subnav { overflow-x: auto; scrollbar-width: none; }
.crm-subnav::-webkit-scrollbar { display: none; }
.crm-subnav-btn { flex: none; }

/* ==========================================================================
   ASK RAIL ITEM: the AI assistant gets its own accent so it stands out
   ========================================================================== */
.rail-item.rail-item-ask {
  color: #a78bfa;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(37, 99, 235, 0.14));
  box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.45);
}
.rail-item.rail-item-ask:hover {
  color: #ffffff;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.32), rgba(37, 99, 235, 0.24));
}
.rail-item.rail-item-ask.is-active {
  color: #ffffff;
  background: linear-gradient(135deg, #7c3aed, #2563eb);
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
}
.rail-item.rail-item-ask.is-active::before { background: var(--purple-primary); }
.rail-item.rail-item-ask:focus-visible { outline: 2px solid var(--purple-primary); outline-offset: 2px; }
.rail-ai-tag {
  position: absolute;
  top: -5px;
  right: -6px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
  padding: 3px 4px;
  border-radius: 6px;
  color: #ffffff;
  background: var(--purple-primary);
  box-shadow: 0 0 0 2px var(--bg-rail);
  pointer-events: none;
}
.nav-rail.is-expanded .rail-ai-tag { position: static; margin-left: auto; box-shadow: none; }
.rail-item.rail-item-ask.is-active .rail-ai-tag { background: #ffffff; color: #6d28d9; }
[data-theme="light"] .rail-item.rail-item-ask { color: #6d28d9; background: linear-gradient(135deg, #f3e8ff, #e0e7ff); box-shadow: inset 0 0 0 1px #c4b5fd; }
[data-theme="light"] .rail-item.rail-item-ask:hover { color: #5b21b6; background: linear-gradient(135deg, #ede9fe, #dbeafe); }
[data-theme="light"] .rail-item.rail-item-ask.is-active { color: #ffffff; background: linear-gradient(135deg, #7c3aed, #2563eb); box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3); }

/* ==========================================================================
   CALENDAR: booked appointments by month or week
   ========================================================================== */
.cal-workspace { gap: 14px; }
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cal-nav { display: flex; align-items: center; gap: 6px; min-width: 0; }
.cal-arrow { padding-inline: 8px; display: inline-flex; align-items: center; }
.cal-range-label { margin: 0 0 0 8px; font-size: 17px; font-weight: 700; color: var(--text-main); white-space: nowrap; }
.cal-toolbar-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.cal-toolbar-right .conv-channel-tabs { margin-bottom: 0; }
.cal-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); cursor: pointer; }
.cal-summary { font-size: 13px; color: var(--text-muted); min-height: 18px; }
.cal-summary strong { color: var(--text-main); }
.cal-summary .link-btn { margin-left: 6px; font-size: 13px; }
.cal-card { padding: 0; overflow: hidden; }
.cal-loading, .cal-empty-note { padding: 18px; margin: 0; font-size: 13px; color: var(--text-muted); text-align: center; }
.cal-empty-note { border-top: 1px solid var(--border-subtle); }

.cal-head-row, .cal-body { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head { padding: 8px 10px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-faint); border-bottom: 1px solid var(--border-subtle); display: flex; align-items: baseline; gap: 6px; }
.cal-head-date { font-size: 15px; font-weight: 700; color: var(--text-main); text-transform: none; letter-spacing: 0; }
.cal-head-date.is-today { color: #ffffff; background: var(--blue-primary); border-radius: 999px; padding: 0 7px; }
.cal-cell { border-right: 1px solid var(--border-subtle); border-bottom: 1px solid var(--border-subtle); padding: 6px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cal-cell:nth-child(7n) { border-right: none; }
.cal-month .cal-cell { min-height: 112px; }
.cal-week .cal-cell { min-height: 320px; }
.cal-cell.is-outside { background: color-mix(in srgb, var(--bg-app) 60%, transparent); }
.cal-cell.is-outside .cal-day-num { color: var(--text-faint); opacity: 0.6; }
.cal-cell.is-today { background: var(--blue-soft); }
.cal-cell-head { display: flex; align-items: center; justify-content: space-between; }
.cal-day-num { border: none; background: transparent; color: var(--text-muted); font: 600 12.5px var(--font-sans); padding: 2px 6px; border-radius: 999px; cursor: pointer; }
.cal-day-num:hover { background: var(--bg-surface-raised); color: var(--text-main); }
.cal-cell.is-today .cal-day-num { background: var(--blue-primary); color: #ffffff; }
.cal-day-num:focus-visible, .cal-chip:focus-visible, .cal-more:focus-visible { outline: 2px solid var(--blue-primary); outline-offset: 1px; }
.cal-dot-count { display: none; }
.cal-day-mobile { display: none; font-size: 13px; font-weight: 600; color: var(--text-main); }
.cal-cell-items { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.cal-chip { --chip: var(--blue-primary); display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; min-width: 0; text-align: left; border: none; border-left: 3px solid var(--chip); background: color-mix(in srgb, var(--chip) 14%, transparent); color: var(--text-main); border-radius: 6px; padding: 5px 7px; cursor: pointer; font-family: var(--font-sans); transition: background 0.12s ease; }
.cal-chip:hover { background: color-mix(in srgb, var(--chip) 26%, transparent); }
.cal-chip.is-compact { flex-direction: row; align-items: baseline; gap: 6px; padding: 3px 6px; }
.cal-chip-time { font-size: 11.5px; font-weight: 700; color: var(--chip); font-variant-numeric: tabular-nums; flex: none; }
.cal-chip-name { font-size: 12.5px; font-weight: 600; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-chip-what, .cal-chip-meta { font-size: 11.5px; color: var(--text-muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-chip.is-compact .cal-chip-name { font-size: 12px; }
.cal-chip.status-new { --chip: var(--orange-primary); }
.cal-chip.status-in_progress { --chip: var(--purple-primary); }
.cal-chip.status-done { --chip: var(--green-primary); }
.cal-chip.status-cancelled { --chip: var(--text-faint); opacity: 0.75; }
.cal-chip.status-cancelled .cal-chip-name { text-decoration: line-through; }
.cal-cell.is-past .cal-chip:not(.status-cancelled) { opacity: 0.85; }
.cal-more { border: none; background: transparent; color: var(--blue-primary); font: 600 12px var(--font-sans); padding: 2px 4px; text-align: left; cursor: pointer; }
.cal-more:hover { text-decoration: underline; }
.cal-empty-day { font-size: 12px; color: var(--text-faint); padding: 4px 2px; }

/* Phones: the month grid shows a count per day, the week turns into a list of days. */
@media (max-width: 700px) {
  .cal-nav { flex-wrap: wrap; }
  .cal-range-label { flex-basis: 100%; font-size: 15px; margin: 6px 0 0; white-space: normal; }
  .cal-toolbar-right { width: 100%; justify-content: space-between; }
  .cal-month .cal-cell { min-height: 58px; padding: 4px 2px; align-items: center; }
  .cal-month .cal-cell-items { display: none; }
  .cal-month .cal-cell-head { flex-direction: column; gap: 3px; }
  .cal-month .cal-dot-count { display: inline-flex; min-width: 18px; height: 18px; align-items: center; justify-content: center; border-radius: 999px; background: var(--blue-primary); color: #fff; font-size: 10.5px; font-weight: 700; }
  .cal-head { padding: 6px 2px; justify-content: center; font-size: 10.5px; }
  .cal-week .cal-head-row { display: none; }
  .cal-week .cal-body { grid-template-columns: minmax(0, 1fr); }
  .cal-week .cal-cell { min-height: 0; border-right: none; padding: 10px 12px; }
  .cal-week .cal-day-mobile { display: inline; }
}

/* ==========================================================================
   CONTACTS: avatars, "Next up" column, follow-ups-due chip, drawer header,
   at-a-glance strip and section jump links
   ========================================================================== */
.crm-avatar {
  --hue-bg: rgba(37, 99, 235, 0.18); --hue-fg: #93c5fd;
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font: 700 12.5px var(--font-sans); letter-spacing: 0.02em;
  background: var(--hue-bg); color: var(--hue-fg);
}
.crm-avatar.hue-1 { --hue-bg: rgba(139, 92, 246, 0.2); --hue-fg: #c4b5fd; }
.crm-avatar.hue-2 { --hue-bg: rgba(16, 185, 129, 0.18); --hue-fg: #6ee7b7; }
.crm-avatar.hue-3 { --hue-bg: rgba(249, 115, 22, 0.18); --hue-fg: #fdba74; }
.crm-avatar.hue-4 { --hue-bg: rgba(236, 72, 153, 0.18); --hue-fg: #f9a8d4; }
.crm-avatar.hue-5 { --hue-bg: rgba(20, 184, 166, 0.18); --hue-fg: #5eead4; }
[data-theme="light"] .crm-avatar { --hue-bg: #dbeafe; --hue-fg: #1d4ed8; }
[data-theme="light"] .crm-avatar.hue-1 { --hue-bg: #ede9fe; --hue-fg: #6d28d9; }
[data-theme="light"] .crm-avatar.hue-2 { --hue-bg: #d1fae5; --hue-fg: #047857; }
[data-theme="light"] .crm-avatar.hue-3 { --hue-bg: #ffedd5; --hue-fg: #c2410c; }
[data-theme="light"] .crm-avatar.hue-4 { --hue-bg: #fce7f3; --hue-fg: #be185d; }
[data-theme="light"] .crm-avatar.hue-5 { --hue-bg: #ccfbf1; --hue-fg: #0f766e; }
.crm-avatar-lg { width: 46px; height: 46px; font-size: 16px; }

.contacts-person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.contacts-person-text { min-width: 0; }
.contacts-next { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.contacts-next-appt { display: inline-flex; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-main); white-space: nowrap; }
.contacts-open-req { font-size: 12px; color: var(--orange-primary); white-space: nowrap; }
.contacts-due-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px;
  border-radius: var(--radius-md); border: 1px solid rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08); color: #f87171; font: 600 12.5px var(--font-sans); cursor: pointer; white-space: nowrap;
}
.contacts-due-chip[hidden] { display: none; }
.contacts-due-chip:hover { background: rgba(239, 68, 68, 0.16); }
.contacts-due-chip.is-on { background: #dc2626; border-color: #dc2626; color: #fff; }
.contacts-due-chip:focus-visible { outline: 2px solid var(--blue-primary); outline-offset: 2px; }
.contacts-due-count { display: inline-flex; min-width: 18px; height: 18px; padding: 0 5px; align-items: center; justify-content: center; border-radius: 999px; background: rgba(239, 68, 68, 0.2); font-size: 11px; }
.contacts-due-chip.is-on .contacts-due-count { background: rgba(255, 255, 255, 0.25); }
[data-theme="light"] .contacts-due-chip { color: #b91c1c; }
[data-theme="light"] .contacts-due-chip.is-on { color: #fff; }

.crm-drawer-identity { display: flex; align-items: center; gap: 14px; min-width: 0; }
.crm-drawer-identity-text { min-width: 0; }
.crm-drawer-name { margin: 0; font: 700 19px/1.25 var(--font-sans); color: var(--text-main); overflow-wrap: anywhere; }
.crm-drawer-facts { margin: 3px 0 0; font-size: 13px; color: var(--text-main); opacity: 0.85; overflow-wrap: anywhere; }
.crm-drawer-identity .drawer-session-time { margin-top: 2px; }

.crm-drawer-jump {
  display: flex; gap: 4px; padding: 8px 24px; border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface, transparent); overflow-x: auto; scrollbar-width: none;
}
.crm-drawer-jump a {
  flex: none; padding: 5px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  color: var(--text-muted); text-decoration: none;
}
.crm-drawer-jump a:hover { color: var(--text-main); background: var(--bg-surface-raised); }
.crm-drawer-jump a:focus-visible { outline: 2px solid var(--blue-primary); outline-offset: 1px; }

.crm-glance { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.crm-glance-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; text-align: left;
  padding: 10px 12px; border-radius: var(--radius-md); border: 1px solid var(--border-subtle);
  background: var(--bg-surface-raised); color: var(--text-main); font-family: var(--font-sans); cursor: pointer;
}
.crm-glance-tile:hover { border-color: var(--border-medium); }
.crm-glance-tile:focus-visible { outline: 2px solid var(--blue-primary); outline-offset: 1px; }
.crm-glance-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-faint); }
.crm-glance-value { font-size: 14px; font-weight: 700; line-height: 1.3; max-width: 100%; overflow-wrap: anywhere; }
.crm-glance-hint { font-size: 11.5px; color: var(--text-muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-glance-tile.is-overdue { border-color: rgba(239, 68, 68, 0.45); }
.crm-glance-tile.is-overdue .crm-glance-value { color: #f87171; }
.crm-glance-tile.is-today .crm-glance-value { color: #fbbf24; }
[data-theme="light"] .crm-glance-tile.is-overdue .crm-glance-value { color: #b91c1c; }
[data-theme="light"] .crm-glance-tile.is-today .crm-glance-value { color: #b45309; }

.crm-sec-title { scroll-margin-top: 12px; outline: none; }
.crm-sub-title { margin: 4px 0 0; font-size: 12px; font-weight: 600; color: var(--text-faint); }
#crm-messages-section { scroll-margin-top: 12px; }

@media (max-width: 700px) {
  .crm-glance { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .crm-drawer-jump { padding: 8px 16px; }
  .crm-avatar-lg { width: 40px; height: 40px; font-size: 14px; }
}

/* ---- Plan banner (client instances) and first run ---- */
.plan-banner { display: flex; gap: 12px; align-items: center; padding: 10px var(--page-gutter, 24px); font-size: 13px; color: var(--text-main); background: var(--blue-soft); border-bottom: 1px solid var(--blue-border); }
.plan-banner[hidden] { display: none; }
.plan-banner[data-tone="warn"] { background: var(--orange-soft); border-bottom-color: var(--orange-primary); }
.plan-banner strong { font-weight: 600; }
.plan-banner .plan-banner-notice { color: var(--text-muted); }
.first-run-panel { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--bg-app); }
.first-run-panel[hidden] { display: none; }
.first-run-card { max-width: 460px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; padding: 28px; border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); background: var(--bg-surface); }
.first-run-card .page-subtitle { margin: 0; }
.limit-hint { margin-left: 6px; font-size: 11.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.login-form[hidden] { display: none; }
.invite-intro { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-main); }
.login-form [hidden] { display: none; }
.login-link { align-self: center; background: none; border: 0; padding: 4px 6px; font: inherit; font-size: 12.5px; color: var(--blue-primary); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.login-link:hover { color: var(--blue-hover); }
.btn-primary-blue .limit-hint { color: rgba(255, 255, 255, 0.78); }
.topbar-btn[hidden] { display: none; }
/* Plan is full: still clickable, so the click can say why. */
.is-at-limit { opacity: 0.6; }

/* ---- Use cases: picker, setup guide, Persona card, change review ---- */
.usecase-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 6px; }
.usecase-card { display: block; min-width: 0; cursor: pointer; }
.usecase-card-box {
  display: flex; align-items: flex-start; gap: 10px; height: 100%; padding: 12px;
  border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-surface-raised);
  transition: border-color 0.15s, background 0.15s;
}
.usecase-card:hover .usecase-card-box { border-color: var(--border-medium); }
.usecase-radio:checked + .usecase-card-box { border-color: var(--border-active); background: var(--blue-soft); box-shadow: 0 0 0 1px var(--border-active); }
.usecase-radio:focus-visible + .usecase-card-box { outline: 2px solid var(--border-active); outline-offset: 2px; }
.usecase-card-icon { flex: none; font-size: 20px; line-height: 1.2; }
.usecase-card-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.usecase-card-title { font-size: 13.5px; font-weight: 650; color: var(--text-main); }
.usecase-card-best { font-size: 12px; color: var(--text-muted); }
.usecase-card-want { font-size: 12px; color: var(--text-faint); line-height: 1.4; }

.usecase-card .btn-sm { padding: 6px 12px; font-size: 12.5px; }

.usecase-current { display: flex; align-items: flex-start; gap: 12px; }
.usecase-current .usecase-card-icon { font-size: 24px; }
.usecase-current-title { font-size: 14px; color: var(--text-main); }
.usecase-current-desc { margin: 3px 0 0; font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.usecase-card-progress { display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.usecase-current-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.usecase-modal-footer { gap: 8px; align-items: center; }
.usecase-modal-spacer { flex: 1; }
.usecase-review-lead { margin: 0 0 12px; font-size: 13.5px; line-height: 1.5; color: var(--text-main); }
.usecase-changes { margin: 0 0 12px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.usecase-change { padding: 10px 12px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-surface-raised); }
.usecase-change-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; cursor: pointer; font-size: 13.5px; }
.usecase-change-head input { width: 16px; height: 16px; margin: 0; accent-color: var(--blue-primary); }
.usecase-change-name { font-weight: 600; color: var(--text-main); }
.usecase-edited { padding: 1px 8px; border-radius: var(--radius-full); background: var(--orange-soft); color: var(--orange-primary); font-size: 11.5px; font-weight: 600; }
.usecase-diff { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0 0 24px; }
.usecase-diff > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.usecase-diff-tag { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-faint); }
.usecase-diff-text { font-size: 12.5px; color: var(--text-muted); line-height: 1.45; overflow-wrap: anywhere; white-space: pre-line; }

#agent-checklist-usecase .agent-check { border-top: 1px solid var(--border-subtle); }
#agent-checklist-usecase[hidden] { display: none; }

@media (max-width: 720px) {
  .usecase-grid { grid-template-columns: minmax(0, 1fr); }
  .usecase-diff { grid-template-columns: minmax(0, 1fr); margin-left: 0; }
  .usecase-current-actions .btn-secondary { min-height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .usecase-card-box { transition: none; }
}
.usecase-nav-note { margin: 0 0 14px; }
.usecase-nav-note[hidden] { display: none; }
.form-grid-2col > .form-group { min-width: 0; }
.usecase-card-text { overflow-wrap: anywhere; }
@media (max-width: 560px) {
  .form-grid-2col { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Setup journey (Overview), chip (top bar) and drawers ---------- */
.ov-journey {
  --jy-done-bg: #10b981; --jy-done-fg: #052e22;
  scroll-margin-top: 16px;
  border-color: var(--blue-border); box-shadow: inset 3px 0 0 var(--blue-primary);
}
[data-theme="light"] .ov-journey { --jy-done-bg: #059669; --jy-done-fg: #ffffff; }
.ov-journey.is-complete { border-color: var(--green-soft); box-shadow: inset 3px 0 0 var(--jy-done-bg); }
.ov-journey .ov-card-title:focus-visible { outline: 2px solid var(--border-active); outline-offset: 3px; border-radius: var(--radius-xs); }
.jy-use { font-weight: 500; color: var(--text-muted); }
.jy-hide-btn { margin-left: 12px; min-height: 32px; padding: 4px 14px; font-size: 13px; }
.jy-reopen { margin: 0; text-align: center; font-size: 12.5px; }
.jy-allset-icon {
  flex: none; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: var(--jy-done-bg); color: var(--jy-done-fg);
}

.jy-stepper { display: flex; margin: 2px 0 16px; padding: 0 0 4px; list-style: none; overflow-x: auto; }
.jy-node { position: relative; flex: 1 0 64px; min-width: 64px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.jy-node + .jy-node::before { content: ""; position: absolute; top: 13px; right: 50%; width: 100%; height: 2px; background: var(--border-medium); }
.jy-node.is-done + .jy-node::before { background: var(--jy-done-bg); }
.jy-dot {
  position: relative; z-index: 1; display: grid; place-items: center; width: 28px; height: 28px; padding: 0;
  border: 2px solid var(--border-medium); border-radius: 50%; background: var(--bg-surface); color: var(--text-muted);
  font: 600 12px var(--font-sans); cursor: pointer; transition: box-shadow 0.15s;
}
.jy-dot:hover { border-color: var(--text-muted); }
.jy-dot:focus-visible { outline: 2px solid var(--border-active); outline-offset: 3px; }
.jy-node.is-done .jy-dot { background: var(--jy-done-bg); border-color: var(--jy-done-bg); color: var(--jy-done-fg); }
.jy-node.is-current .jy-dot { border-color: var(--border-active); color: var(--border-active); box-shadow: 0 0 0 4px var(--blue-soft); }
.jy-node-label { font-size: 11.5px; line-height: 1.3; color: var(--text-muted); text-align: center; }
.jy-node.is-current .jy-node-label { color: var(--text-main); font-weight: 600; }

.jy-compact { display: none; align-items: center; gap: 12px; margin: 2px 0 14px; }
.jy-compact-text { flex: none; font-size: 13px; font-weight: 600; color: var(--text-main); white-space: nowrap; }
.jy-compact-bar { flex: 1; height: 6px; border-radius: var(--radius-full); background: var(--bg-surface-overlay); overflow: hidden; }
.jy-compact-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--jy-done-bg); transition: width 0.3s; }

.jy-next {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px;
  margin-bottom: 6px; padding: 12px 14px; border: 1px solid var(--blue-border); border-radius: var(--radius-md); background: var(--blue-soft);
}
.jy-next-text { min-width: 0; font-size: 14px; color: var(--text-main); }
.jy-next-label { color: var(--text-muted); }
.jy-next-btn { min-height: 36px; }
.jy-allset {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px;
  margin-bottom: 6px; padding: 12px 14px; border-radius: var(--radius-md); background: var(--green-soft);
}
.jy-allset-icon { width: 26px; height: 26px; }
.jy-allset-text { flex: 1 1 200px; display: flex; flex-direction: column; font-size: 13px; color: var(--text-muted); }
.jy-allset-text strong { font-size: 14px; color: var(--text-main); }

.jy-list { margin: 0; padding: 0; list-style: none; }
.jy-list li + li { border-top: 1px solid var(--border-subtle); }
.jy-row {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 58px; margin: 0; padding: 10px 8px;
  border: 0; border-radius: var(--radius-sm); background: transparent; font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.jy-row:hover { background: var(--bg-surface-raised); }
.jy-row:focus-visible { outline: 2px solid var(--border-active); outline-offset: -2px; }
.jy-icon {
  flex: none; display: grid; place-items: center; width: 22px; height: 22px;
  border: 1.5px solid var(--border-medium); border-radius: 50%; color: transparent;
}
.jy-row.is-done .jy-icon { background: var(--jy-done-bg); border-color: transparent; color: var(--jy-done-fg); }
.jy-row.is-current .jy-icon { border-color: var(--border-active); box-shadow: 0 0 0 3px var(--blue-soft); }
.jy-row.is-current .jy-icon::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--border-active); }
.jy-row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.jy-row-title { font-size: 13.5px; font-weight: 600; color: var(--text-main); }
.jy-row.is-done .jy-row-title { font-weight: 500; color: var(--text-muted); }
.jy-row-detail { font-size: 12.5px; line-height: 1.4; color: var(--text-muted); overflow-wrap: anywhere; }
.jy-pill { margin-left: 8px; padding: 1px 8px; border-radius: var(--radius-full); background: var(--bg-surface-overlay); color: var(--text-muted); font-size: 11px; font-weight: 600; white-space: nowrap; }
.jy-row-action {
  flex: none; padding: 6px 12px; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
  background: var(--bg-surface-raised); color: var(--text-main); font-size: 12.5px; font-weight: 500; white-space: nowrap;
}
.jy-row:hover .jy-row-action { background: var(--bg-surface-overlay); }
.jy-row.is-current .jy-row-action { border-color: var(--blue-border); }

@media (max-width: 480px) {
  .ov-journey .ov-card-head { flex-wrap: wrap; gap: 2px 12px; }
  .jy-stepper { display: none; }
  .jy-compact { display: flex; }
  .jy-row { gap: 10px; padding-left: 4px; padding-right: 4px; }
  .jy-row-action { padding: 6px 10px; }
  .jy-next-btn { width: 100%; min-height: 40px; }
}

/* Top-bar chip */
.setup-chip { gap: 7px; color: var(--text-main); border-color: var(--blue-border); background: var(--blue-soft); font-weight: 600; font-variant-numeric: tabular-nums; }
.setup-chip[hidden] { display: none; }
.setup-chip:focus-visible { outline: 2px solid var(--border-active); outline-offset: 2px; }
[data-theme="light"] .setup-chip { background: var(--blue-soft); border-color: var(--blue-border); color: var(--text-main); }
[data-theme="light"] .setup-chip:hover { background: rgba(37, 99, 235, 0.14); color: var(--text-main); }
.setup-chip-ring { flex: none; }
.setup-chip-track { stroke: var(--border-medium); }
.setup-chip-arc { stroke: var(--border-active); transition: stroke-dasharray 0.3s; }
@media (max-width: 560px) {
  .setup-chip-word { display: none; }
  .setup-chip { padding: 5px 9px; }
  /* Chip, website picker, Add Website, theme and account no longer fit on one row: wrap instead of being cut off. */
  .top-context-bar { height: auto; min-height: 52px; padding-top: 6px; padding-bottom: 6px; }
  .context-actions { flex-wrap: wrap; row-gap: 6px; }
  .site-select { max-width: 150px; }
}

/* Setup drawer: reuses the conversation drawer shell */
.setup-drawer { width: 520px; visibility: hidden; transition: right 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 0.28s; }
.setup-drawer.open { visibility: visible; transition: right 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s; }
.setup-drawer-body { flex: 1; overflow-y: auto; padding: 16px 24px 24px; display: flex; flex-direction: column; gap: 14px; }
.setup-drawer-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 24px; border-top: 1px solid var(--border-subtle); background: var(--bg-surface); }
.setup-drawer-foot .link-btn { font-size: 13px; text-align: left; }
.setup-drawer-foot .link-btn[hidden] { display: none; }
.setup-drawer-foot .btn-secondary { margin-left: auto; min-height: 36px; }
.setup-drawer .live-drawer-title:focus-visible { outline: none; }

.sd-stack { display: flex; flex-direction: column; gap: 14px; }
.sd-status[hidden] { display: none; }
.sd-lead { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--text-muted); }
.sd-lead code { font-family: var(--font-mono); font-size: 12px; color: var(--text-main); }
.sd-status { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 8px 12px; border-radius: var(--radius-md); font-size: 13px; line-height: 1.45; color: var(--text-main); background: var(--bg-surface-raised); }
.sd-status.is-done { background: var(--green-soft); }
.sd-status-icon { flex: none; display: grid; place-items: center; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; border: 1.5px solid var(--border-medium); color: transparent; }
.sd-status.is-done .sd-status-icon, .sd-result.is-ok .sd-status-icon, .sd-qa.is-done .sd-status-icon, .sd-wait.is-done .sd-status-icon { border-color: transparent; background: #10b981; color: #052e22; }
[data-theme="light"] .sd-status.is-done .sd-status-icon, [data-theme="light"] .sd-result.is-ok .sd-status-icon,
[data-theme="light"] .sd-qa.is-done .sd-status-icon, [data-theme="light"] .sd-wait.is-done .sd-status-icon { background: #059669; color: #ffffff; }
.sd-form { display: flex; flex-direction: column; gap: 12px; }
.sd-form .form-group { margin: 0; }
.sd-actions { display: flex; justify-content: flex-end; gap: 8px; }
.sd-actions-start { justify-content: flex-start; flex-wrap: wrap; }
.sd-link-btn { display: inline-flex; align-items: center; text-decoration: none; }
.sd-actions .btn-primary-blue, .sd-actions .btn-secondary { min-height: 36px; }
.sd-alt { margin: 0; font-size: 12.5px; color: var(--text-muted); }
.sd-alt a { color: var(--border-active); }
.sd-msg { margin: 0; padding: 8px 12px; border-radius: var(--radius-md); font-size: 13px; line-height: 1.45; background: var(--bg-surface-raised); color: var(--text-main); }
.sd-msg[hidden] { display: none; }
.sd-msg.is-ok { background: var(--green-soft); }
.sd-msg.is-error { background: var(--orange-soft); }
.sd-progress { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-muted); }
.sd-progress[hidden] { display: none; }
.sd-spinner { flex: none; width: 16px; height: 16px; border: 2px solid var(--border-medium); border-top-color: var(--border-active); border-radius: 50%; animation: sd-spin 0.8s linear infinite; }
@keyframes sd-spin { to { transform: rotate(360deg); } }
.sd-result { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: var(--radius-md); background: var(--bg-surface-raised); font-size: 13px; line-height: 1.45; color: var(--text-main); }
.sd-result.is-ok { background: var(--green-soft); }
.sd-result.is-error { background: var(--orange-soft); }
.sd-result-note { margin: 4px 0 0; font-size: 12.5px; color: var(--text-muted); }
.sd-results { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.sd-results:empty { display: none; }
.sd-drop {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 22px 16px; border: 1.5px dashed var(--border-medium);
  border-radius: var(--radius-md); background: var(--bg-surface-raised); text-align: center; cursor: pointer;
}
.sd-drop:hover, .sd-drop.is-over, .sd-drop:focus-within { border-color: var(--border-active); background: var(--blue-soft); }
.sd-drop-title { font-size: 14px; font-weight: 600; color: var(--text-main); }
.sd-drop-sub { font-size: 12.5px; color: var(--text-muted); }

.sd-days { display: flex; flex-direction: column; }
.sd-day { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 4px 0; border-top: 1px solid var(--border-subtle); }
.sd-day:first-child { border-top: 0; }
.sd-day-name { flex: 0 0 116px; display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-main); cursor: pointer; }
.sd-day-name input { width: 18px; height: 18px; margin: 0; accent-color: var(--blue-primary); }
.sd-day-times { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; min-width: 0; font-size: 13px; color: var(--text-muted); }
.sd-day-times .field-input { width: 112px; padding: 6px 8px; }
.sd-day-extra { font-size: 12px; color: var(--text-faint); }
.sd-day-closed { font-size: 13px; color: var(--text-faint); }
.sd-copy { align-self: flex-start; font-size: 12.5px; }

.sd-qas { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 14px; }
.sd-qa form { display: flex; flex-direction: column; gap: 6px; }
.sd-qa-label { font-weight: 600; color: var(--text-main); }
.sd-qa .sd-actions { justify-content: flex-start; }
.sd-qa.is-done { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-muted); }
.sd-qa-q { min-width: 0; overflow-wrap: anywhere; }
.sd-qa-saved { margin-left: auto; flex: none; font-size: 12px; color: var(--green-text); }

.sd-preview { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px dashed var(--border-medium); border-radius: var(--radius-md); }
.sd-preview-tag { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-faint); }
.sd-preview-line { margin: 0; display: flex; gap: 10px; font-size: 13px; line-height: 1.45; color: var(--text-main); }
.sd-preview-label { flex: 0 0 64px; color: var(--text-muted); }
.sd-preview-line > span:last-child { min-width: 0; overflow-wrap: anywhere; }

.sd-chips { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.sd-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 2px 4px 2px 12px; border: 1px solid var(--border-subtle); border-radius: 18px; background: var(--bg-surface-raised); font-size: 13px; color: var(--text-main); }
.sd-chip span { min-width: 0; overflow-wrap: anywhere; }
.sd-chip .icon-btn { min-width: 28px; min-height: 28px; border: 0; background: transparent; }
.sd-empty { margin: 0; font-size: 13px; color: var(--text-muted); }
.sd-inline { display: flex; gap: 8px; }
.sd-inline .field-input { flex: 1; min-width: 0; }
.sd-inline .btn-secondary { min-height: 36px; }

.sd-code { display: flex; flex-direction: column; gap: 8px; }
.sd-code pre { margin: 0; padding: 12px 14px; white-space: pre-wrap; overflow-wrap: anywhere; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-input); font-family: var(--font-mono); font-size: 12px; line-height: 1.55; color: var(--text-main); }
.sd-code pre:focus-visible { outline: 2px solid var(--border-active); outline-offset: 2px; }
.sd-code .btn-primary-blue { align-self: flex-start; min-height: 36px; }
.sd-platforms { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; line-height: 1.5; color: var(--text-muted); }
.sd-platforms li { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 8px; }
.sd-platforms strong { color: var(--text-main); }
.sd-wait { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: var(--radius-md); background: var(--bg-surface-raised); font-size: 13px; line-height: 1.45; color: var(--text-muted); }
.sd-wait.is-done { background: var(--green-soft); }
.sd-wait strong { color: var(--text-main); }
.sd-wait-text { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.sd-wait .sd-spinner, .sd-wait .sd-status-icon { margin-top: 2px; }
.sd-wait .link-btn { font-size: 12.5px; }

.sd-ticks { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.sd-tick-row { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border-subtle); }
.sd-tick-row:first-child { border-top: 0; }
.sd-tick { flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.sd-tick input { flex: none; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--blue-primary); }
.sd-tick-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 13.5px; color: var(--text-main); }
.sd-where { font-size: 12px; color: var(--text-faint); }
.sd-tick-row .link-btn { flex: none; margin-top: 2px; font-size: 12.5px; }

@media (max-width: 560px) {
  .setup-drawer { width: 100vw; max-width: 100vw; }
  .setup-drawer-body { padding: 16px; }
  .setup-drawer-foot { padding: 12px 16px; }
  .sd-day { flex-wrap: wrap; gap: 4px 12px; }
  .sd-day-name { flex-basis: 100%; }
  .sd-tick-row { flex-wrap: wrap; }
  .sd-tick-row .link-btn { margin-left: 28px; }
  .sd-inline .btn-secondary, .sd-actions .btn-primary-blue, .sd-actions .btn-secondary, .setup-drawer-foot .btn-secondary { min-height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .setup-drawer, .setup-drawer.open { transition: none; }
  .jy-dot, .jy-compact-bar > span, .setup-chip-arc { transition: none; }
  .sd-spinner { animation: none; border-top-color: var(--border-medium); border-right-color: var(--border-active); }
}

/* Speaking style (Agent > Persona): three cards, one per style. */
.speaking-style-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
  gap: 10px;
}
.speaking-style-option {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.speaking-style-option:hover { border-color: var(--border-active); }
.speaking-style-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.speaking-style-option:has(input:checked) {
  border-color: var(--blue-primary);
  background: var(--blue-soft);
  box-shadow: inset 0 0 0 1px var(--blue-primary);
}
.speaking-style-option:has(input:focus-visible) {
  outline: 2px solid var(--border-active);
  outline-offset: 2px;
}
.speaking-style-name { font-size: 13.5px; font-weight: 600; color: var(--text-main); }
.speaking-style-desc { font-size: 12px; line-height: 1.4; color: var(--text-muted); }
@media (prefers-reduced-motion: reduce) {
  .speaking-style-option { transition: none; }
}

/* ---------- Conversation insights (History) and unanswered questions (Overview) ---------- */
.insight-chips { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 6px; }
.insight-chips:empty { display: none; }
.insight-chip { display: inline-flex; align-items: center; min-height: 20px; padding: 1px 8px; border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full, 9999px); background: var(--bg-surface-raised); font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }
.insight-chip.is-lang { border-color: var(--blue-border); background: var(--blue-soft); color: var(--text-main); }
.insight-chip.is-negative, .insight-chip.is-frustrated, .insight-chip.is-gap { border-color: var(--orange-primary); background: var(--orange-soft); color: var(--text-main); }
.insight-chip.is-positive { border-color: var(--green-primary); background: var(--green-soft); color: var(--text-main); }
.conv-insight-line { margin-top: 6px; font-size: 12.5px; line-height: 1.45; color: var(--text-muted); }
.conv-gap-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0 0 12px; padding: 8px 12px; border: 1px solid var(--blue-border);
  border-radius: var(--radius-md); background: var(--blue-soft); font-size: 13px; color: var(--text-main); }
.conv-gap-filter[hidden], .conv-insight[hidden] { display: none; }

.conv-insight { margin-bottom: 18px; padding: 12px 14px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-surface); }
.conv-insight-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.conv-insight-head [hidden] { display: none; }
.conv-insight-summary { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--text-main); }
.conv-insight-empty, .conv-insight-note { margin: 0; font-size: 12.5px; color: var(--text-muted); }
.conv-insight-note { margin-top: 8px; font-size: 11.5px; }
.conv-insight-gaps { margin-top: 10px; }
.conv-insight-gaps ul { list-style: none; margin: 4px 0 0; padding: 0; }
.conv-insight-gaps li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; padding: 6px 0; border-top: 1px solid var(--border-subtle); font-size: 13px; }
.conv-insight-gaps li:first-child { border-top: none; }
.conv-gap-q { flex: 1 1 220px; color: var(--text-main); }
.conv-gap-asked { flex-basis: 100%; order: 3; font-size: 12px; color: var(--text-muted); }
.conv-gap-state { font-size: 12px; color: var(--text-muted); }

.ov-gap-list { list-style: none; margin: 0; padding: 0; }
.ov-gap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 0; border-top: 1px solid var(--border-subtle); }
.ov-gap:first-child { padding-top: 0; border-top: none; }
.ov-gap-main { flex: 1 1 260px; min-width: 0; }
.ov-gap-q { display: block; font-size: 13.5px; font-weight: 600; color: var(--text-main); }
.ov-gap-main small { display: block; margin-top: 2px; font-size: 12px; color: var(--text-muted); overflow-wrap: anywhere; }
.ov-gap-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ov-gap-form { flex-basis: 100%; display: flex; flex-direction: column; gap: 6px; }
.ov-gap-form[hidden] { display: none; }
.ov-gap-form-actions { display: flex; gap: 8px; }
/* Teach Bot always opens from the History drawer (z-index 1050), so it must sit above it. */
#modal-teach-bot { z-index: 1100; }

/* Agent > Settings > Privacy */
.privacy-body { display: flex; flex-direction: column; gap: 20px; max-width: 640px; }
.privacy-example {
  display: flex; flex-direction: column; gap: 8px; margin-top: 12px; padding: 12px 14px;
  border: 1px dashed var(--border-medium); border-radius: var(--radius-md); background: var(--bg-surface);
}
.privacy-example-row { display: flex; flex-direction: column; gap: 2px; }
.privacy-example-tag { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.privacy-example-text { font-size: 13px; line-height: 1.5; color: var(--text-main); overflow-wrap: anywhere; }
.privacy-keeps { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; line-height: 1.5; color: var(--text-muted); }
.privacy-clean-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.privacy-clean-row .field-helper { flex: 1 1 220px; margin: 0; }
.privacy-clean-row .field-helper.is-error { color: #ef4444; }

/* ============================================================
   Campaigns (bulk email) and contact tags
   ============================================================ */
.camp-workspace [hidden],
.crm-subnav-btn[hidden],
#btn-contacts-import[hidden],
#contacts-filter-tag[hidden],
.crm-tags[hidden],
#modal-camp-import [hidden] { display: none !important; }

.camp-table .num, .camp-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.camp-table tbody tr { cursor: pointer; }
.camp-table tbody tr:focus-visible, .camp-rcpt-table tbody tr.conv-row:focus-visible { outline: 2px solid var(--blue-primary); outline-offset: -2px; }
.camp-rcpt-table tbody tr.conv-row { cursor: pointer; }

.camp-status { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 12px; border: 1px solid currentColor; color: var(--text-muted); white-space: nowrap; }
.camp-status-scheduled { color: var(--purple-primary); }
.camp-status-sending { color: var(--blue-primary); }
.camp-status-paused { color: var(--orange-primary); }
.camp-status-done { color: var(--green-text); }

.camp-hint { margin: 4px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--text-muted); }
.camp-setup-banner, .camp-paused, .camp-warning {
  margin: 0 0 16px; padding: 12px 14px; border-radius: var(--radius-md); font-size: 13px; line-height: 1.55;
  background: var(--orange-soft); border: 1px solid rgba(249, 115, 22, 0.35); color: var(--text-main);
}
.camp-setup-banner span { display: block; margin-top: 4px; color: var(--text-muted); }
.camp-warning p { margin: 0 0 8px; }

.camp-panels { display: grid; gap: 14px; margin-top: 22px; }
.camp-panel { padding: 0; }
.camp-panel > summary { list-style: none; cursor: pointer; padding: 14px 18px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.camp-panel > summary::-webkit-details-marker { display: none; }
.camp-panel > summary::before { content: "▸"; color: var(--text-faint); transition: transform 0.15s ease; }
.camp-panel[open] > summary::before { transform: rotate(90deg); }
.camp-panel > summary:focus-visible { outline: 2px solid var(--blue-primary); outline-offset: -2px; border-radius: var(--radius-md); }
.camp-panel-title { font-weight: 700; color: var(--text-main); }
.camp-panel-sub { font-size: 12.5px; color: var(--text-muted); }
.camp-settings-form, .camp-suppress-body { padding: 0 18px 18px; display: grid; gap: 12px; }
.camp-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.camp-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.camp-grid-2 .form-group, .camp-grid-3 .form-group { margin: 0; display: grid; gap: 6px; }
.camp-days { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.camp-days legend { margin-bottom: 6px; }
.camp-day, .camp-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-main); }
.camp-check { line-height: 1.45; }
.camp-actions { display: flex; justify-content: flex-end; gap: 10px; }
.camp-inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.camp-inline-form .field-input { flex: 1 1 220px; min-width: 0; }
.camp-suppress-tools { display: flex; gap: 10px; flex-wrap: wrap; }
.camp-suppress-tools > .field-input { flex: 1 1 200px; min-width: 0; }
.camp-suppress-tools .camp-inline-form { flex: 1 1 280px; }
.camp-paste summary { cursor: pointer; font-size: 13px; color: var(--text-muted); }
.camp-paste textarea { margin-top: 8px; width: 100%; }

.camp-back { margin-bottom: 6px; }
.camp-name-input {
  display: block; width: min(560px, 100%); font: inherit; font-size: var(--page-title-size); font-weight: 700; color: var(--text-main);
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 2px 6px; margin-left: -7px;
}
.camp-name-input:hover { border-color: var(--border-subtle); }
.camp-name-input:focus { outline: none; border-color: var(--border-active); background: var(--bg-input); }

.camp-step { padding: 18px 20px; margin-bottom: 16px; display: grid; gap: 14px; }
.camp-step-title { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; color: var(--text-main); }
.camp-step-num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--blue-soft); color: var(--blue-primary); font-size: 12px; }
.camp-audience { display: grid; gap: 12px; }
.camp-audience .form-group { margin: 0; display: grid; gap: 6px; }
.camp-tag-pick, .camp-consent-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.camp-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 12px; border-radius: var(--radius-full);
  border: 1px solid var(--border-medium); background: transparent; color: var(--text-main); font: inherit; font-size: 12.5px; cursor: pointer;
}
.camp-chip span { color: var(--text-faint); font-size: 11.5px; }
.camp-chip:hover { border-color: var(--blue-border); }
.camp-chip[aria-pressed="true"] { background: var(--blue-soft); border-color: var(--blue-primary); color: var(--blue-primary); font-weight: 600; }
.camp-chip:focus-visible { outline: 2px solid var(--blue-primary); outline-offset: 2px; }
.camp-field { font-family: var(--font-mono); font-size: 11.5px; min-height: 26px; padding: 0 9px; }
.camp-fields-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.camp-fields-row > span:last-child { display: contents; }
.camp-count { padding: 12px 14px; border-radius: var(--radius-md); background: var(--bg-surface-raised); font-size: 13.5px; color: var(--text-main); }
.camp-follow-note { padding: 12px 14px; border-radius: var(--radius-md); background: var(--blue-soft); font-size: 13px; line-height: 1.55; display: grid; gap: 8px; }

.camp-compose { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.camp-compose-fields { display: grid; gap: 12px; }
.camp-compose-fields .form-group { margin: 0; display: grid; gap: 6px; }
.camp-body { min-height: 240px; font-size: 14px; line-height: 1.55; resize: vertical; }
.camp-preview { position: sticky; top: 12px; display: grid; gap: 8px; }
.camp-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.camp-preview-nav { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); }
.camp-preview-mail { border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-input); overflow: hidden; }
.camp-preview-subject { padding: 12px 14px; border-bottom: 1px solid var(--border-subtle); font-weight: 700; color: var(--text-main); overflow-wrap: anywhere; }
.camp-preview-body { padding: 14px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; line-height: 1.6; color: var(--text-main); max-height: 460px; overflow-y: auto; }
.camp-preview-missing { color: var(--orange-primary); }

.camp-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.camp-check-item { position: relative; padding: 8px 12px 8px 30px; border-radius: var(--radius-sm); font-size: 13px; line-height: 1.5; background: var(--bg-surface-raised); color: var(--text-main); }
.camp-check-item::before { position: absolute; left: 11px; top: 8px; font-weight: 700; }
.camp-check-item.is-error { background: rgba(239, 68, 68, 0.1); }
.camp-check-item.is-error::before { content: "!"; color: #ef4444; }
.camp-check-item.is-warn { background: var(--orange-soft); }
.camp-check-item.is-warn::before { content: "•"; color: var(--orange-primary); }
.camp-check-item.is-ok { background: var(--green-soft); }
.camp-check-item.is-ok::before { content: "✓"; color: var(--green-text); }
.camp-projection { margin: 0; font-size: 13px; color: var(--text-muted); }
.camp-send-row { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; }
.camp-when-input { width: auto; min-width: 0; padding: 6px 8px; }

.camp-progress { display: grid; gap: 6px; margin-bottom: 16px; }
.camp-bar { height: 8px; border-radius: var(--radius-full); background: var(--bg-surface-raised); overflow: hidden; }
.camp-bar span { display: block; height: 100%; background: var(--blue-primary); border-radius: inherit; transition: width 0.3s ease; }
.camp-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.camp-stat { padding: 12px 14px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-surface); display: grid; gap: 2px; }
.camp-stat-label { font-size: 12px; color: var(--text-muted); }
.camp-stat-value { font-size: 20px; font-weight: 700; color: var(--text-main); font-variant-numeric: tabular-nums; }
.camp-stat-rate { font-size: 12px; color: var(--text-faint); min-height: 1em; }
.camp-rcpt-toolbar { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border-subtle); }
#camp-dt-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.camp-import-window { max-width: 560px; }
.camp-import-window .form-group { display: grid; gap: 6px; }
.camp-report { padding: 12px 14px; border-radius: var(--radius-md); background: var(--bg-surface-raised); font-size: 13px; line-height: 1.55; }
.camp-report p { margin: 0 0 6px; }
.camp-report p:last-child { margin-bottom: 0; }

/* Tags on contacts */
.crm-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.crm-tags-inline { margin-top: 4px; }
.crm-tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--radius-full);
  background: var(--purple-soft); color: var(--text-main); font-size: 11.5px; font-weight: 600; line-height: 1.5;
}
.crm-tag-x { border: 0; background: none; color: var(--text-muted); font-size: 14px; line-height: 1; padding: 0 0 0 2px; cursor: pointer; }
.crm-tag-x:hover { color: var(--text-main); }
.crm-tag-x:focus-visible { outline: 2px solid var(--blue-primary); border-radius: 4px; }
.crm-tag-input {
  width: 90px; min-height: 24px; padding: 0 8px; border-radius: var(--radius-full); border: 1px dashed var(--border-medium);
  background: transparent; color: var(--text-main); font: inherit; font-size: 11.5px;
}
.crm-tag-input:focus { outline: none; border-style: solid; border-color: var(--border-active); width: 140px; }
.crm-tag-note { flex-basis: 100%; font-size: 12px; color: var(--text-muted); }

@media (max-width: 900px) {
  .camp-compose { grid-template-columns: 1fr; }
  .camp-preview { position: static; }
  .camp-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .camp-grid-2, .camp-grid-3 { grid-template-columns: 1fr; }
  .camp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .camp-table th:nth-child(n+5), .camp-table td:nth-child(n+5) { display: none; }
}
.camp-workspace .conv-workspace-header { margin-bottom: 18px; }
.camp-import-window .modal-body { display: grid; gap: 14px; }
.camp-import-window .modal-body .form-group { margin: 0; }
.camp-state-select { width: auto; min-width: 180px; }
.camp-workspace .conv-workspace-header > div:first-child { flex: 1 1 320px; min-width: 0; }
.camp-follow-note p { margin: 0; }
