/* ==========================================================================
   CALLPULSE AI - PRECISION DISPATCH DESIGN SYSTEM
   Sharp, editorial dark theme. Clean surfaces, no gradients, no gimmicks.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&family=JetBrains+Mono:wght@400;500;600&family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap');

:root {
  /* Canvas — deep slate, no white */
  --bg-app:              #0D1117;
  --bg-sidebar:          #111520;
  --bg-header:           rgba(13, 17, 23, 0.95);
  --bg-surface:          #161B27;
  --bg-surface-low:      #1A2030;
  --bg-surface-container:#1E2539;
  --bg-surface-high:     #232C42;
  --bg-surface-highest:  #293450;

  /* Text */
  --text-main:           #E8EBF0;
  --text-primary:        #CDD5E0;
  --text-secondary:      #8B95A8;
  --text-variant:        #6B7484;
  --text-muted:          #4A5568;
  --text-inverse:        #0D1117;

  /* Brand: Steel Blue — no purple, no black */
  --primary:             #2A6BBA;
  --primary-container:   #3480D8;
  --on-primary-container:#A8C8F5;
  --primary-fixed:       #1A3F6F;
  --primary-fixed-dim:   #2255A0;
  --surface-tint:        #4A90D9;

  /* Secondary & Tertiary */
  --secondary:           #5A6A82;
  --secondary-container: #1E3050;
  --tertiary:            #1A6B5A;
  --tertiary-container:  #1A4A40;
  --tertiary-fixed:      #3ABFA6;
  --tertiary-fixed-dim:  #2E9E8A;

  /* Status */
  --status-success-bg:   #0D2818;
  --status-success-border:#1A5A32;
  --status-success-text: #4ADE80;

  --status-warning-bg:   #2A1E08;
  --status-warning-border:#7A4E10;
  --status-warning-text: #F59E0B;

  --status-danger-bg:    #2A0D0D;
  --status-danger-border:#7A1A1A;
  --status-danger-text:  #F87171;

  --status-info-bg:      #0D1E3A;
  --status-info-border:  #1A3A7A;
  --status-info-text:    #60A5FA;

  /* Borders */
  --border-subtle:       #1E2738;
  --border-default:      #2A3448;
  --border-medium:       #374560;
  --border-primary:      #3480D8;

  /* Typography — DM Sans only */
  --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  /* Shadows */
  --shadow-sm:    0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md:    0 4px 8px rgba(0, 0, 0, 0.5);
  --shadow-lg:    0 8px 20px rgba(0, 0, 0, 0.6);
  --shadow-modal: 0 20px 40px rgba(0, 0, 0, 0.7);

  /* Radii — sharp, no soft corners */
  --radius-sm:   2px;
  --radius-md:   4px;
  --radius-lg:   6px;
  --radius-xl:   8px;
  --radius-2xl:  10px;
  --radius-full: 3px;

  /* Transitions */
  --transition-fast:   100ms ease;
  --transition-normal: 150ms ease;
}

/* ==========================================================================
   LIGHT THEME — warm slate canvas, steel blue accent, no pure white
   Applied via [data-theme="light"] on <html>
   ========================================================================== */
[data-theme="light"] {
  --bg-app:              #F4F5F7;
  --bg-sidebar:          #ECEEF2;
  --bg-header:           rgba(244, 245, 247, 0.96);
  --bg-surface:          #F9FAFB;
  --bg-surface-low:      #ECEEF2;
  --bg-surface-container:#E4E7EC;
  --bg-surface-high:     #D8DCE5;
  --bg-surface-highest:  #CBD0DB;

  --text-main:           #111827;
  --text-primary:        #1F2937;
  --text-secondary:      #4B5563;
  --text-variant:        #6B7280;
  --text-muted:          #9CA3AF;
  --text-inverse:        #F9FAFB;

  --primary:             #1D5FA6;
  --primary-container:   #2563EB;
  --on-primary-container:#1E3A8A;
  --primary-fixed:       #DBEAFE;
  --primary-fixed-dim:   #BFDBFE;
  --surface-tint:        #3B82F6;

  --secondary:           #64748B;
  --secondary-container: #E2E8F0;
  --tertiary:            #0F766E;
  --tertiary-container:  #CCFBF1;
  --tertiary-fixed:      #0D9488;
  --tertiary-fixed-dim:  #0F766E;

  --status-success-bg:   #F0FDF4;
  --status-success-border:#BBF7D0;
  --status-success-text: #15803D;

  --status-warning-bg:   #FFFBEB;
  --status-warning-border:#FDE68A;
  --status-warning-text: #92400E;

  --status-danger-bg:    #FFF1F2;
  --status-danger-border:#FECDD3;
  --status-danger-text:  #BE123C;

  --status-info-bg:      #EFF6FF;
  --status-info-border:  #BFDBFE;
  --status-info-text:    #1D4ED8;

  --border-subtle:       #E5E7EB;
  --border-default:      #D1D5DB;
  --border-medium:       #9CA3AF;
  --border-primary:      #2563EB;

  --shadow-sm:    0 1px 3px rgba(17, 24, 39, 0.08);
  --shadow-md:    0 4px 8px rgba(17, 24, 39, 0.10);
  --shadow-lg:    0 8px 20px rgba(17, 24, 39, 0.12);
  --shadow-modal: 0 20px 40px rgba(17, 24, 39, 0.15);
}

/* Theme toggle button styling */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background-color: var(--bg-surface-low);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1;
}

/* Reset & Global */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  width: 100%;
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Material Symbols Icon Tweaks */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  vertical-align: middle;
}

/* App Container Layout */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100vw;
  position: relative;
}

/* Sidebar Navigation (256px Fixed) */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 256px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-default);
  box-shadow: var(--shadow-sm);
  z-index: 50;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 0;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand-header {
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
}

.brand-icon-box {
  width: 32px;
  height: 32px;
  background-color: var(--primary-container);
  color: var(--text-inverse);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(31, 16, 142, 0.2);
}

.brand-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.015em;
}

.sidebar-section-label {
  padding: 0 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-variant);
}

.nav-menu {
  display: flex;
  flex-direction: column;
  padding: 0 12px;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

/* nav-item hover intentionally removed */

/* .nav-item's own `display: flex` otherwise wins over the [hidden] UA
   default of `display: none` (a class selector beats the browser's default
   attribute-based rule) -- without this, the `hidden` attribute silently
   has no visual effect on any nav item (found live: the owner-only Admin
   Dashboard link stayed visible to a non-owner account despite `hidden`
   being correctly set in the DOM). */
.nav-item[hidden] {
  display: none;
}

.nav-item.active {
  background-color: var(--bg-surface-high);
  color: var(--text-main);
  font-weight: 600;
}

.nav-item .material-symbols-outlined {
  font-size: 18px;
  color: inherit;
}

/* Sidebar Footer & Concurrency Indicator */
.sidebar-footer {
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.concurrency-card {
  padding: 14px;
  border-radius: var(--radius-xl);
  background-color: var(--bg-surface-low);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.concurrency-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-variant);
}

.concurrency-percent {
  color: var(--primary-container);
  font-weight: 600;
}

.progress-bar-track {
  width: 100%;
  height: 6px;
  background-color: var(--bg-surface-highest);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background-color: var(--primary-container);
  border-radius: var(--radius-full);
  transition: width 300ms ease;
}

.concurrency-caption {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

.sidebar-status-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.status-dot-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--tertiary-fixed);
  display: inline-block;
  animation: statusPulse 3s infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* Main Content Wrapper (Offset 256px) */
.main-wrapper {
  margin-left: 256px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
}

/* Top Header Bar (Fixed) */
.top-header {
  position: fixed;
  top: 0;
  left: 256px;
  right: 0;
  height: 64px;
  background-color: var(--bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-default);
  box-shadow: var(--shadow-sm);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
}

.header-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background-color: var(--bg-surface-low);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  min-width: 260px;
}

.kbd-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  color: var(--secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.active-lines-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  background-color: var(--bg-surface-low);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.active-lines-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--tertiary-fixed);
  animation: statusPulse 3s infinite;
}

.profile-widget {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.profile-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-default);
}

.profile-info {
  display: flex;
  flex-direction: column;
}

.profile-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}

.profile-role {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* Page Content Area */
.page-content {
  padding-top: 64px;
  padding-left: 32px;
  padding-right: 32px;
  padding-bottom: 48px;
  width: 100%;
}

.view-section {
  display: none;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  animation: fadeIn 200ms ease;
}

.view-section.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Page Sub-Header */
.sub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0 16px 0;
}

.page-headline {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.page-subheadline {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Executive Cards & Grid */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  display: flex;
  flex-direction: column;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Grid Layout Utilities */
.grid-cols-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.grid-cols-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.grid-cols-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

@media (max-width: 1200px) {
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-3 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .grid-cols-4, .grid-cols-2 { grid-template-columns: 1fr; }
}

/* Stat Card Styling */
.stat-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-value {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text-main);
  margin-top: 8px;
}

.stat-meta {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  text-decoration: none;
  line-height: 1.2;
}

.btn-primary {
  background-color: var(--primary-container);
  color: #FFFFFF;
  border-color: var(--primary-fixed-dim);
}

.btn-secondary {
  background-color: var(--bg-surface-low);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.btn-danger {
  background-color: var(--status-danger-bg);
  color: var(--status-danger-text);
  border-color: var(--status-danger-border);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-lg {
  padding: 12px 20px;
  font-size: 15px;
}

/* Toggle Switch Control */
.toggle-control {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: var(--bg-surface);
  padding: 8px 16px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-sm);
}

.switch-track {
  position: relative;
  width: 44px;
  height: 24px;
  background-color: var(--border-medium);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.switch-track.active {
  background-color: var(--primary-container);
}

.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background-color: var(--text-primary);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}

.switch-track.active .switch-thumb {
  transform: translateX(20px);
}

/* Badges & Pill Tags */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
}

.badge-pending {
  background-color: var(--status-warning-bg);
  border-color: var(--status-warning-border);
  color: var(--status-warning-text);
}

.badge-calling {
  background-color: var(--status-info-bg);
  border-color: var(--status-info-border);
  color: var(--status-info-text);
}

.badge-booked {
  background-color: var(--status-success-bg);
  border-color: var(--status-success-border);
  color: var(--status-success-text);
}

.badge-not-interested {
  background-color: var(--bg-surface-high);
  border-color: var(--border-medium);
  color: var(--secondary);
}

.badge-dnc {
  background-color: var(--status-danger-bg);
  border-color: var(--status-danger-border);
  color: var(--status-danger-text);
}

/* Data Tables */
.table-container {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  background-color: var(--bg-surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

thead th {
  background-color: var(--bg-surface-low);
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-default);
}

tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 14px;
  color: var(--text-main);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

/* Form Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 8px 11px;
  background-color: var(--bg-surface-low);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-main);
  transition: border-color var(--transition-fast);
}

.form-input::placeholder, .form-textarea::placeholder {
  color: var(--text-muted);
}

.form-select option {
  background-color: var(--bg-surface-low);
  color: var(--text-main);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--border-primary);
  box-shadow: 0 0 0 2px rgba(52, 128, 216, 0.15);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

/* Live Call Spotlight Card */
.spotlight-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-2xl);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.spotlight-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.prospect-avatar-box {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-xl);
  background-color: var(--bg-surface-high);
  color: var(--primary-container);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
}

.waveform-bar-container {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 24px;
}

.waveform-bar {
  width: 4px;
  background-color: var(--primary-container);
  border-radius: 2px;
  height: 20%;
  transition: height 150ms ease;
}

.waveform-bar-container.active .waveform-bar {
  animation: wave 1s infinite ease-in-out;
}

.waveform-bar-container.active .waveform-bar:nth-child(2) { animation-delay: 0.15s; }
.waveform-bar-container.active .waveform-bar:nth-child(3) { animation-delay: 0.3s; }
.waveform-bar-container.active .waveform-bar:nth-child(4) { animation-delay: 0.45s; }
.waveform-bar-container.active .waveform-bar:nth-child(5) { animation-delay: 0.6s; }

@keyframes wave {
  0%, 100% { height: 20%; }
  50% { height: 90%; }
}

/* Live Transcript Feed */
.transcript-box {
  background-color: var(--bg-surface-low);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 16px;
  height: 340px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.transcript-entry {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 85%;
}

.transcript-entry.ai {
  align-self: flex-start;
}

.transcript-entry.prospect {
  align-self: flex-end;
}

.transcript-speaker {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.transcript-bubble {
  padding: 10px 14px;
  border-radius: var(--radius-xl);
  font-size: 14px;
  line-height: 1.4;
}

.transcript-entry.ai .transcript-bubble {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  color: var(--text-main);
  border-top-left-radius: 2px;
}

.transcript-entry.prospect .transcript-bubble {
  background-color: var(--primary-container);
  color: #FFFFFF;
  border-top-right-radius: 2px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 560px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: modalPop 200ms ease;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-main);
}

/* Drawer Component */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(2px);
  z-index: 90;
  display: none;
}

.drawer-overlay.active {
  display: block;
}

.drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 480px;
  max-width: 90vw;
  background-color: var(--bg-surface);
  border-left: 1px solid var(--border-medium);
  box-shadow: var(--shadow-modal);
  z-index: 95;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 250ms cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer-panel.active {
  transform: translateX(0);
}

.drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ─────────────────────────────────────────────────────────────────────────
   Prompt Studio — Conversational Script Editor
   Scoped light/purple surface (operator-requested match to reference
   inspiration) — local custom properties so this card alone breaks from
   the app's dark/blue system without touching any other screen.
   ───────────────────────────────────────────────────────────────────────── */

.chat-studio-card {
  --chat-bg:           #FFFFFF;
  --chat-surface:      #F6F4FC;
  --chat-surface-hover:#EEEAFB;
  --chat-border:       #E8E4F5;
  --chat-text:         #1E1B2E;
  --chat-text-secondary:#6B6580;
  --chat-text-muted:   #A39CBD;
  --chat-accent:       #7C3AED;
  --chat-accent-dim:   #6D28D9;
  --chat-accent-soft:  #F1EBFE;
  --chat-accent-text-on-soft: #5B21B6;

  max-height: 560px;
  overflow: hidden;
  background-color: var(--chat-bg);
  border-color: var(--chat-border);
}

.chat-studio-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--chat-border);
  background-color: var(--chat-bg);
}

.chat-studio-header-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--chat-text);
  letter-spacing: -0.01em;
}

.chat-studio-header-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--chat-accent-text-on-soft);
  background-color: var(--chat-accent-soft);
  border: 1px solid var(--chat-border);
  border-radius: var(--radius-full);
  padding: 4px 10px;
}

.chat-thread {
  flex: 1 1 auto;
  min-height: 200px;
  max-height: 437px;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  background-color: var(--chat-bg);
}

.chat-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  padding: 0 32px;
}

.chat-agent-orb {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  margin-bottom: 6px;
  background: radial-gradient(circle at 32% 28%, #C4B5FD 0%, var(--chat-accent) 55%, var(--chat-accent-dim) 100%);
  box-shadow: 0 6px 20px -4px rgba(124, 58, 237, 0.45);
}

.chat-empty-headline {
  font-size: 22px;
  font-weight: 600;
  color: var(--chat-text);
  letter-spacing: -0.01em;
}

.chat-empty-headline span {
  color: var(--chat-accent);
}

.chat-empty-subline {
  font-size: 13px;
  color: var(--chat-text-secondary);
  line-height: 1.6;
  max-width: 46ch;
}

.chat-bubble-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 14px;
  animation: chatBubbleIn 150ms ease-out;
}

@keyframes chatBubbleIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chat-bubble-row-user {
  align-items: flex-end;
}

.chat-bubble-row-assistant {
  align-items: flex-start;
}

.chat-bubble {
  max-width: 60ch;
  padding: 10px 14px;
  border-radius: var(--radius-xl);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.chat-bubble-user {
  background-color: var(--chat-accent);
  color: #FFFFFF;
}

.chat-bubble-assistant {
  background-color: var(--chat-surface);
  border: 1px solid var(--chat-border);
  color: var(--chat-text);
}

.chat-bubble-row-pending .chat-bubble-assistant {
  color: var(--chat-text-muted);
  font-style: italic;
}

.chat-updated-chip {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--chat-accent-text-on-soft);
  background-color: var(--chat-accent-soft);
  border-radius: var(--radius-full);
  padding: 3px 9px;
}

.chat-input-bar {
  flex-shrink: 0;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--chat-border);
  background-color: var(--chat-bg);
}

.chat-input-pill {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 8px 10px;
  background-color: var(--chat-surface);
  border: 1px solid var(--chat-border);
  border-radius: 26px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.chat-input-pill:focus-within {
  border-color: var(--chat-accent);
  box-shadow: 0 0 0 3px var(--chat-accent-soft);
}

.chat-input {
  flex: 1;
  resize: none;
  max-height: 140px;
  padding: 7px 4px;
  background-color: transparent;
  border: none;
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  color: var(--chat-text);
}

.chat-input::placeholder {
  color: var(--chat-text-muted);
}

.chat-input:focus {
  outline: none;
}

.chat-icon-btn {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  background-color: transparent;
  color: var(--chat-text-secondary);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.chat-icon-btn:hover {
  background-color: var(--chat-accent-soft);
  color: var(--chat-accent);
}

.chat-icon-btn.chat-icon-btn-active {
  background-color: var(--chat-accent-soft);
  color: var(--chat-accent);
}

.chat-icon-btn .material-symbols-outlined {
  font-size: 18px;
}

.chat-var-menu-wrap {
  position: relative;
  flex-shrink: 0;
}

.chat-var-menu {
  display: none;
  position: absolute;
  bottom: 40px;
  left: 0;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  background-color: var(--chat-bg);
  border: 1px solid var(--chat-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px -6px rgba(30, 27, 46, 0.18);
  z-index: 20;
  min-width: 160px;
}

.chat-var-menu.open {
  display: flex;
}

.chat-var-menu button {
  text-align: left;
  padding: 7px 10px;
  border-radius: var(--radius-md);
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--chat-text);
  cursor: pointer;
}

.chat-var-menu button:hover {
  background-color: var(--chat-accent-soft);
  color: var(--chat-accent);
}

.chat-send-btn {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  background-color: var(--chat-accent);
  color: #FFFFFF;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: filter var(--transition-fast);
}

.chat-send-btn:hover {
  filter: brightness(1.08);
}

.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.chat-send-btn .material-symbols-outlined {
  font-size: 18px;
}

.snapshot-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  padding: 6px 12px;
  background: none;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--transition-fast), color var(--transition-fast);
}

.snapshot-toggle-btn:hover {
  border-color: var(--border-medium);
  color: var(--text-main);
}

.snapshot-toggle-btn .material-symbols-outlined {
  font-size: 15px;
}

.snapshot-field-flag {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--primary-container);
  text-transform: none;
  font-weight: 500;
}

.form-input[readonly], .form-textarea[readonly] {
  background-color: var(--bg-surface-low);
  color: var(--text-secondary);
  cursor: default;
}

.field-flash {
  animation: fieldFlash 1.2s ease-out;
}

@keyframes fieldFlash {
  0%   { border-color: var(--border-primary); box-shadow: 0 0 0 2px rgba(52, 128, 216, 0.2); }
  100% { border-color: var(--border-default); box-shadow: none; }
}

/* ─────────────────────────────────────────────────────────────────────────
   Executive Dashboard — Caro-inspired light canvas
   Scoped local tokens (see design/DESIGN_DNA.md) — dark sidebar/header
   shell is untouched, only the dashboard's own content area goes light.
   ───────────────────────────────────────────────────────────────────────── */

.dash-canvas {
  --dash-bg:            #F3F2FA;
  --dash-card:          #FFFFFF;
  --dash-border:        #ECEAF6;
  --dash-text:          #1E1E2C;
  --dash-text-secondary:#8C8AA3;
  --dash-text-muted:    #B4B2C6;
  --dash-blue:          #3B7CFF;
  --dash-blue-light:    #BFD4FF;
  --dash-blue-dark:     #1E4FCC;
  --dash-green:         #22C55E;
  --dash-green-bg:      #E8FBEF;
  --dash-amber:         #F5A623;
  --dash-amber-bg:      #FFF6E3;
  --dash-pink:          #FB6B84;
  --dash-pink-bg:       #FFEAEE;
  --dash-radius:        20px;
  --dash-shadow:        0 12px 24px -12px rgba(30, 20, 60, 0.08);

  background-color: var(--dash-bg);
  border-radius: 24px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.dash-card {
  background-color: var(--dash-card);
  border: 1px solid var(--dash-border);
  border-radius: var(--dash-radius);
  box-shadow: var(--dash-shadow);
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.dash-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.dash-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--dash-text);
}

.dash-card-subtitle {
  font-size: 11.5px;
  color: var(--dash-text-secondary);
  margin-top: 2px;
}

.dash-icon-btn {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  border: none;
  background: var(--dash-bg);
  color: var(--dash-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.dash-icon-btn:hover {
  color: var(--dash-blue);
}

.dash-icon-btn .material-symbols-outlined {
  font-size: 16px;
}

.dash-bignum {
  font-size: 26px;
  font-weight: 700;
  color: var(--dash-text);
  letter-spacing: -0.01em;
}

.dash-bignum-caption {
  font-size: 12px;
  color: var(--dash-text-secondary);
  margin-bottom: 16px;
}

.dash-row-3 {
  display: grid;
  grid-template-columns: 1.3fr 1.1fr 1fr;
  gap: 20px;
  align-items: stretch;
}

/* Bar chart */
.dash-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 130px;
  margin-top: auto;
}

.dash-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
  justify-content: flex-end;
  min-width: 0;
}

.dash-bar {
  width: 100%;
  max-width: 34px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, var(--dash-blue) 0%, var(--dash-blue-light) 100%);
  transition: height 400ms ease;
}

.dash-bar-value {
  font-size: 11px;
  font-weight: 600;
  color: var(--dash-text);
}

.dash-bar-label {
  font-size: 10px;
  color: var(--dash-text-secondary);
  text-align: center;
  text-transform: capitalize;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* Donut */
.dash-donut-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1;
}

.dash-donut {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}

.dash-donut::after {
  content: "";
  position: absolute;
  inset: 22px;
  background: var(--dash-card);
  border-radius: 50%;
}

.dash-donut-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dash-legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--dash-text-secondary);
}

.dash-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dash-legend-value {
  font-weight: 700;
  color: var(--dash-text);
}

/* Region list */
.dash-region-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dash-region-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
}

.dash-region-name {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--dash-text);
  font-weight: 500;
}

.dash-region-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dash-blue);
  flex-shrink: 0;
}

.dash-region-count {
  color: var(--dash-text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
}

.dash-region-empty {
  font-size: 12px;
  color: var(--dash-text-muted);
  padding: 12px 0;
}

/* Stat row */
.dash-row-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.dash-stat-card {
  background-color: var(--dash-card);
  border: 1px solid var(--dash-border);
  border-radius: var(--dash-radius);
  box-shadow: var(--dash-shadow);
  padding: 18px 20px;
}

.dash-stat-label {
  font-size: 12px;
  color: var(--dash-text-secondary);
  font-weight: 500;
}

.dash-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--dash-text);
  margin: 4px 0 8px;
}

.dash-sparkline-wrap {
  height: 32px;
}

.dash-sparkline {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.dash-sparkline polyline {
  fill: none;
  stroke: var(--dash-pink);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dash-sparkline-green polyline {
  stroke: var(--dash-green);
}

.dash-stat-card-icon {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dash-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--dash-bg);
  color: var(--dash-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dash-stat-icon .material-symbols-outlined {
  font-size: 20px;
}

.dash-stat-value-sm {
  font-size: 18px;
  font-weight: 700;
  color: var(--dash-text);
  display: block;
}

/* Row 2 */
.dash-row-2 {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  align-items: stretch;
}

/* Pill bars */
.dash-pill-row {
  display: flex;
  gap: 20px;
  justify-content: space-around;
  align-items: flex-end;
  height: 150px;
  margin-top: 8px;
}

.dash-pill-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
  justify-content: flex-end;
}

.dash-pill-track {
  width: 46px;
  height: 110px;
  border-radius: 23px;
  background: var(--dash-bg);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
}

.dash-pill-fill {
  border-radius: 23px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 6px;
  color: #FFFFFF;
  font-size: 10.5px;
  font-weight: 700;
  transition: height 400ms ease;
}

.dash-pill-label {
  font-size: 11px;
  color: var(--dash-text-secondary);
  text-align: center;
}

/* Mini stats */
.dash-mini-stats {
  display: flex;
  flex-direction: column;
  gap: 16px;
  justify-content: center;
  flex: 1;
}

.dash-mini-stat {
  display: flex;
  flex-direction: column;
}

.dash-mini-stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--dash-text);
}

.dash-mini-stat-label {
  font-size: 12px;
  color: var(--dash-text-secondary);
}

/* Table */
.dash-table-card {
  padding: 0;
}

.dash-table-card .dash-card-header {
  padding: 20px 20px 0;
  margin-bottom: 12px;
}

.dash-table-container {
  overflow-x: auto;
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
}

.dash-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--dash-text-secondary);
  padding: 10px 20px;
  border-bottom: 1px solid var(--dash-border);
  white-space: nowrap;
}

.dash-table td {
  padding: 12px 20px;
  font-size: 13px;
  color: var(--dash-text);
  border-bottom: 1px solid var(--dash-border);
  white-space: nowrap;
}

.dash-table tr:last-child td {
  border-bottom: none;
}

.dash-table-empty {
  text-align: center;
  color: var(--dash-text-muted);
  padding: 32px !important;
  white-space: normal !important;
}

.dash-pill-badge {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.dash-table-footer {
  display: flex;
  justify-content: flex-end;
  padding: 12px 20px;
  font-size: 12px;
  color: var(--dash-text-secondary);
  border-top: 1px solid var(--dash-border);
}

.dash-btn-outline {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--dash-border);
  background: var(--dash-card);
  color: var(--dash-text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--transition-fast), color var(--transition-fast);
  flex-shrink: 0;
}

.dash-btn-outline:hover {
  border-color: var(--dash-blue);
  color: var(--dash-blue);
}

@media (max-width: 1280px) {
  .dash-row-3 { grid-template-columns: 1fr 1fr; }
  .dash-row-3 .dash-card:last-child { grid-column: span 2; }
}

@media (max-width: 1024px) {
  .dash-row-3 { grid-template-columns: 1fr; }
  .dash-row-3 .dash-card:last-child { grid-column: span 1; }
  .dash-row-stats { grid-template-columns: repeat(2, 1fr); }
  .dash-row-2 { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .dash-row-stats { grid-template-columns: 1fr; }
  .dash-canvas { padding: 16px; }
}
