/* === NERVE CENTER v3 -- COCKPIT LAYOUT === */
/* Command center / cockpit style: top nav strip, bento panels, agent-centric */

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

:root {
  --primary: #0D9488;
  --primary-hover: #0B7C72;
  --primary-light: #E6F7F5;
  --danger: #DC2626;
  --warning: #D97706;
  --success: #16A34A;
  --info: #2563EB;
  --muted: #A3A3A3;

  --bg: #F4F4F5;
  --surface: #FFFFFF;
  --surface-raised: #FFFFFF;
  --border: #E4E4E7;
  --border-subtle: #F0F0F2;

  --text: #18181B;
  --text-secondary: #71717A;
  --text-muted: #A1A1AA;
  --badge-bg: #F4F4F5;

  --thought-bg: hsl(45, 100%, 92%);
  --thought-border: hsl(45, 80%, 80%);

  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --topbar-h: 56px;
  --subnav-h: 44px;
}

html, body { 
  height: 100%; 
  font-family: var(--font); 
  font-size: 14px; 
  color: var(--text); 
  background: var(--bg); 
  -webkit-font-smoothing: antialiased;
}

#app { height: 100%; display: flex; flex-direction: column; }

/* === TOP BAR -- The cockpit command strip === */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 0;
  flex-shrink: 0;
  z-index: 100;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 20px;
  border-right: 1px solid var(--border);
  margin-right: 4px;
  flex-shrink: 0;
}

.topbar-brand .brand-icon {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
}

.topbar-brand .brand-text {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
}

.topbar-brand .brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: -2px;
}

/* === NAV STRIP === */
.nav-strip {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 4px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-strip::-webkit-scrollbar { display: none; }

.nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  position: relative;
}

.nav-btn:hover {
  background: var(--bg);
  color: var(--text);
}

.nav-btn.active {
  background: var(--primary-light);
  color: var(--primary);
}

.nav-btn .nav-icon { width: 16px; height: 16px; flex-shrink: 0; }

.nav-btn-compact {
  padding: 6px 8px;
}

.nav-btn .nav-badge {
  position: absolute;
  top: 2px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Nav divider */
.nav-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 6px;
  flex-shrink: 0;
}

/* === TOPBAR RIGHT === */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
  padding-left: 12px;
}

.cmd-search {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.cmd-search kbd {
  font-family: var(--font);
  font-size: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--text-muted);
}

.agent-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border-radius: 20px;
  border: 2px solid var(--primary);
  background: var(--primary-light);
  cursor: pointer;
  transition: all 0.15s ease;
}

.agent-chip:hover { box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15); }
.agent-chip.active { box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.25); }

.agent-chip .agent-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 11px;
}
.agent-chip .agent-avatar-img {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.agent-chip .agent-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}

.agent-chip .agent-status {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.user-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  color: white;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* === SUB NAV === */
.subnav {
  height: var(--subnav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
}

.subnav-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-right: 16px;
  white-space: nowrap;
}

.subnav-tabs {
  display: flex;
  gap: 2px;
}

.subnav-tab {
  padding: 4px 12px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.subnav-tab:hover { background: var(--bg); color: var(--text); }
.subnav-tab.active { background: var(--primary); color: white; }

.subnav-spacer { flex: 1; }

.subnav-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* === MAIN CONTENT AREA === */
.main {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

/* === BENTO GRID === */
.bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}

.bento-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  overflow: hidden;
}

.bento-1 { grid-column: span 1; }
.bento-2 { grid-column: span 2; }
.bento-3 { grid-column: span 3; }
.bento-4 { grid-column: span 4; }
.bento-5 { grid-column: span 5; }
.bento-6 { grid-column: span 6; }
.bento-7 { grid-column: span 7; }
.bento-8 { grid-column: span 8; }
.bento-9 { grid-column: span 9; }
.bento-10 { grid-column: span 10; }
.bento-12 { grid-column: span 12; }

.bento-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.bento-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.bento-card-action {
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--font);
}

/* === KPI STAT === */
.kpi {
  display: flex;
  flex-direction: column;
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.kpi-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 500;
}

.kpi-delta {
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
}

.kpi-delta.up { color: var(--success); }
.kpi-delta.down { color: var(--danger); }
.kpi-delta.warn { color: var(--warning); }

/* === ISSUE LIST === */
.issue-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.1s;
}

.issue-item:last-child { border-bottom: none; }
.issue-item:hover { background: var(--bg); margin: 0 -20px; padding: 12px 20px; border-radius: 8px; }

.issue-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.issue-dot.escalated { background: var(--danger); }
.issue-dot.in-progress { background: var(--info); }
.issue-dot.resolved { background: var(--success); }
.issue-dot.handed-off { background: var(--muted); }

.issue-content { flex: 1; min-width: 0; }

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

.issue-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.issue-time {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* === BADGES === */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-danger { background: #FEE2E2; color: #991B1B; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-success { background: #DCFCE7; color: #166534; }
.badge-info { background: #DBEAFE; color: #1E40AF; }
.badge-muted { background: var(--badge-bg); color: var(--text-secondary); }
.badge-primary { background: var(--primary-light); color: var(--primary); }

/* === LIVE CALL MONITOR === */
.live-call-monitor {
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.live-call-active {
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
}

.live-call-idle {
  background: var(--bg);
  border: 1px solid var(--border);
}

.live-call-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse-glow 1.5s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(22, 163, 74, 0); }
}

.waveform {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 32px;
  margin: 12px 0;
}

.waveform-bar {
  width: 3px;
  background: var(--primary);
  border-radius: 2px;
  animation: waveform-bounce 0.8s ease-in-out infinite;
}

.waveform-bar:nth-child(1) { animation-delay: 0s; }
.waveform-bar:nth-child(2) { animation-delay: 0.1s; }
.waveform-bar:nth-child(3) { animation-delay: 0.2s; }
.waveform-bar:nth-child(4) { animation-delay: 0.3s; }
.waveform-bar:nth-child(5) { animation-delay: 0.4s; }
.waveform-bar:nth-child(6) { animation-delay: 0.5s; }
.waveform-bar:nth-child(7) { animation-delay: 0.6s; }
.waveform-bar:nth-child(8) { animation-delay: 0.7s; }
.waveform-bar:nth-child(9) { animation-delay: 0.15s; }
.waveform-bar:nth-child(10) { animation-delay: 0.35s; }
.waveform-bar:nth-child(11) { animation-delay: 0.55s; }
.waveform-bar:nth-child(12) { animation-delay: 0.25s; }
.waveform-bar:nth-child(13) { animation-delay: 0.45s; }
.waveform-bar:nth-child(14) { animation-delay: 0.65s; }
.waveform-bar:nth-child(15) { animation-delay: 0.05s; }
.waveform-bar:nth-child(16) { animation-delay: 0.5s; }

@keyframes waveform-bounce {
  0%, 100% { height: 6px; }
  50% { height: 28px; }
}

.transcript-line {
  display: flex;
  gap: 8px;
  padding: 4px 0;
  font-size: 12px;
  line-height: 1.5;
}

.transcript-speaker {
  font-weight: 600;
  flex-shrink: 0;
  min-width: 70px;
}

.transcript-speaker.esmeralda { color: var(--primary); }
.transcript-speaker.caller { color: var(--text-secondary); }

.call-action-btns {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}

/* === SMS THREAD === */
.sms-thread {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding: 8px 0;
}

.sms-bubble {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
}

.sms-bubble.outgoing {
  background: var(--primary);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.sms-bubble.incoming {
  background: var(--bg);
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.sms-bubble .sms-sender {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 2px;
  opacity: 0.8;
}

.sms-input-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}

.sms-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-family: var(--font);
  font-size: 13px;
  outline: none;
}

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

/* === BRIDGE SESSION CARDS === */
.session-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: box-shadow 0.15s ease;
}

.session-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }

.session-breadcrumb {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 6px;
}

.session-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}

.session-prompt {
  background: var(--text);
  color: white;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 10px;
}

.session-metrics {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.session-metric {
  background: var(--badge-bg);
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.session-output {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.session-output-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.session-output-name { color: var(--text); font-weight: 500; }
.session-output-type { 
  font-size: 11px; font-weight: 600; color: var(--primary); 
  background: var(--primary-light); padding: 2px 8px; border-radius: 4px;
  margin-left: auto;
}

.session-actions {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

/* === THOUGHT CARDS (Gold tint) === */
.thought-card {
  background: var(--thought-bg);
  border: 1px solid var(--thought-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
}

.thought-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.thought-title { font-size: 14px; font-weight: 600; color: var(--text); }
.thought-body { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }

.thought-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.thought-source {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: 4px;
}

.thought-time { font-size: 12px; color: var(--text-muted); }

/* === SCHEDULE GRID === */
.schedule-grid {
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  gap: 0;
}

.schedule-header {
  padding: 8px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.schedule-header.today { color: var(--primary); }

.schedule-time {
  padding: 12px 4px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  border-bottom: 1px solid var(--border-subtle);
}

.schedule-cell {
  padding: 2px;
  min-height: 44px;
  border-bottom: 1px solid var(--border-subtle);
  border-left: 1px solid var(--border-subtle);
}

.schedule-event {
  background: var(--primary-light);
  border-left: 3px solid var(--primary);
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 11px;
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.schedule-event.warning { background: #FEF3C7; border-left-color: var(--warning); }
.schedule-event.danger { background: #FEE2E2; border-left-color: var(--danger); }

/* === TABLE === */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 10px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text);
}

.data-table tr:hover td { background: var(--bg); }

/* === LIBRARY CARDS === */
.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.lib-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: box-shadow 0.15s ease;
}

.lib-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }

.lib-card-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
  margin-bottom: 10px;
}

.lib-card-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.lib-card-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }

.lib-progress {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 6px;
}

.lib-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.lib-card-tag { font-size: 11px; color: var(--primary); font-weight: 500; }

/* === TASK ITEMS === */
.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.task-item:last-child { border-bottom: none; }

.task-toggle {
  width: 36px; height: 20px;
  border-radius: 10px;
  background: var(--muted);
  border: none;
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.task-toggle.on { background: var(--primary); }

.task-toggle::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: white;
  top: 2px; left: 2px;
  transition: transform 0.2s;
}

.task-toggle.on::after { transform: translateX(16px); }

.task-info { flex: 1; }
.task-name { font-size: 14px; font-weight: 500; color: var(--text); }
.task-schedule { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.task-run {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
}

.task-run:hover { border-color: var(--primary); color: var(--primary); }

/* === AGENT PROFILE === */
.agent-hero {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}

.agent-hero-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 24px;
  flex-shrink: 0;
  border: 3px solid var(--primary-light);
}

.agent-hero-info { flex: 1; }

.agent-hero-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.agent-hero-role {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.agent-hero-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--success);
  font-weight: 500;
  margin-top: 4px;
}

.agent-hero-status .status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.agent-hero-badges {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.agent-hero-actions {
  display: flex;
  gap: 8px;
}

/* === INFO CARDS === */
.info-card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 16px;
}

.info-card-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
}

.info-row .info-label { color: var(--text-secondary); font-weight: 500; }
.info-row .info-value { color: var(--text); }

/* === CAPABILITY CHECKS === */
.cap-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.cap-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--bg);
  font-size: 13px;
  color: var(--text);
}

.cap-item.enabled .cap-check { color: var(--primary); }
.cap-item.disabled { opacity: 0.5; }
.cap-item.disabled .cap-check { color: var(--muted); }
.cap-item .cap-badge {
  font-size: 9px;
  font-weight: 700;
  color: var(--warning);
  background: #FEF3C7;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: auto;
}

/* === PRODUCT CARDS === */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: box-shadow 0.15s ease;
}

.product-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.product-card.coming-soon { opacity: 0.6; }

.product-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
  margin-bottom: 14px;
}

.product-card.coming-soon .product-icon { background: var(--badge-bg); color: var(--muted); }

.product-name { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.product-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 14px; }

.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.product-price { font-size: 14px; font-weight: 600; color: var(--text); }

/* === SIGNAL SOURCE CARDS === */
.signal-card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.signal-card-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}

.signal-card-star {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--warning);
  color: white;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-ghost { background: none; border: none; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text); background: var(--bg); }
.btn-warning { background: #FEF3C7; color: #92400E; border-color: #FCD34D; }

/* === DETAIL PANEL === */
.detail-panel {
  position: fixed;
  top: 0; right: 0;
  width: 420px;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 24px rgba(0,0,0,0.08);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}

.detail-panel.open { transform: translateX(0); }

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

.detail-panel-close {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: none;
  background: var(--bg);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.detail-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* === CHART BARS (CSS-only) === */
.chart-area {
  height: 160px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  padding-top: 8px;
}

.chart-bar {
  flex: 1;
  background: var(--primary);
  border-radius: 3px 3px 0 0;
  min-height: 8px;
  opacity: 0.7;
  transition: opacity 0.15s;
  position: relative;
}

.chart-bar:hover { opacity: 1; }

.chart-bar-label {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Stacked bar chart */
.stacked-bar {
  display: flex;
  height: 24px;
  border-radius: 6px;
  overflow: hidden;
}

.stacked-bar-segment {
  height: 100%;
  transition: opacity 0.15s;
}

.stacked-bar-segment:hover { opacity: 0.8; }

/* === CALL INTELLIGENCE === */
.call-row-expanded {
  background: var(--bg);
  padding: 16px;
  border-radius: var(--radius);
  margin: 8px 0;
}

.audio-waveform {
  display: flex;
  align-items: center;
  gap: 1px;
  height: 40px;
  padding: 0 8px;
}

.audio-waveform-bar {
  width: 2px;
  background: var(--primary);
  border-radius: 1px;
  opacity: 0.6;
}

.transcript-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 80%;
}

.transcript-bubble.esmeralda-bubble {
  background: var(--primary-light);
  color: var(--text);
  align-self: flex-end;
  margin-left: auto;
}

.transcript-bubble.caller-bubble {
  background: var(--bg);
  color: var(--text);
  align-self: flex-start;
}

.transcript-bubble .bubble-speaker {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 4px;
}

.transcript-bubble.esmeralda-bubble .bubble-speaker { color: var(--primary); }
.transcript-bubble.caller-bubble .bubble-speaker { color: var(--text-secondary); }

/* === PLAYBOOK LIST === */
.playbook-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.playbook-item:last-child { border-bottom: none; }
.playbook-name { font-size: 14px; font-weight: 500; color: var(--text); flex: 1; }
.playbook-status { font-size: 12px; color: var(--success); font-weight: 500; }
.playbook-actions { display: flex; gap: 8px; }

/* === ESCALATION CARDS === */
.escalation-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--danger);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
}

.escalation-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.escalation-body { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.escalation-footer { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* === HERB BUTTON === */
.herb-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.35);
  z-index: 150;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.herb-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(13, 148, 136, 0.45);
}

/* === FOOTER === */
.footer {
  padding: 12px 24px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.footer a {
  color: var(--text-muted);
  text-decoration: none;
}
.footer a:hover { color: var(--primary); text-decoration: underline; }

/* === PAGE VISIBILITY === */
.page { display: none; }
.page.active { display: block; }

/* === SETTINGS CARDS === */
.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 12px;
}

.settings-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.settings-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* === TAB SYSTEM FOR CALL INTELLIGENCE === */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab-btn {
  padding: 10px 20px;
  border: none;
  background: none;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}

.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* === PERFORMANCE GRID === */
.perf-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.perf-card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}

.perf-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.perf-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* === OVERLAY for detail panel === */
.detail-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.2);
  z-index: 199;
  display: none;
}

.detail-overlay.open { display: block; }

/* === UTILITY === */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.font-semibold { font-weight: 600; }
.w-full { width: 100%; }

/* Call Esmeralda button */
.call-esmeralda-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 20px;
  background: var(--success); color: white;
  font-size: 12px; font-weight: 600;
  text-decoration: none; white-space: nowrap;
  transition: background 0.15s;
}
.call-esmeralda-btn:hover { background: #0a9960; }

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