/* ═══════════════════════════════════════════════════
   DESIGN SYSTEM
═══════════════════════════════════════════════════ */
:root {
  /* ── Gold palette (unchanged) ── */
  --gold-500: #C9A84C;
  --gold-400: #D9BA6A;
  --gold-300: #E8CE90;
  --gold-600: #9A7A30;
  --gold-glow: rgba(201,168,76,0.15);
  --gold-border: rgba(201,168,76,0.25);
  --radius: 8px;
  --radius-lg: 12px;
  --transition: 0.18s cubic-bezier(0.4,0,0.2,1);
  --font-display: 'Bebas Neue', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;

  /* ── DARK MODE (default) ── */
  --bg-body:    #060C18;
  --bg-panel:   #0D1525;
  --bg-panel-2: #152035;
  --bg-card:    #1E2E4A;
  --bg-card-2:  #243558;
  --text-primary:   #FFFFFF;
  --text-secondary: #A8A098;
  --text-muted:     #6A6258;
  --border-subtle:  rgba(255,255,255,0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-gold: 0 0 24px rgba(201,168,76,0.12);
  --green-bg: rgba(34,120,70,0.12);
  --green-border: rgba(34,120,70,0.35);
  --green-text: #4ADE80;
  --red-bg: rgba(180,40,40,0.12);
  --red-border: rgba(180,40,40,0.35);
  --red-text: #F87171;
  --orange-bg: rgba(200,100,20,0.12);
  --orange-border: rgba(200,100,20,0.35);
  --orange-text: #FB923C;

  /* Legacy aliases (keep old names working) */
  --navy-900: var(--bg-body);
  --navy-800: var(--bg-panel);
  --navy-700: var(--bg-panel-2);
  --navy-600: var(--bg-card);
  --navy-500: var(--bg-card-2);
  --white: var(--text-primary);
  --gray-50:  #F7F5F0;
  --gray-100: #E8E3D8;
  --gray-300: var(--text-secondary);
  --gray-500: var(--text-muted);
  --gray-700: #3A3530;
}

/* ══════════════════════════════════════════════════════
   LIGHT MODE OVERRIDES — COMPREHENSIVE
   Every rgba(255,255,255,X) text/border goes dark here.
   Backgrounds flip to var(--bg-*) which are already
   remapped in the html.light variable block below.
══════════════════════════════════════════════════════ */

/* ── Panels & backgrounds ── */
html.light .work-panel       { background: var(--bg-body) !important; }
html.light .nav-panel        { background: var(--bg-panel) !important; border-right-color: rgba(0,0,0,0.1) !important; }
html.light .history-panel    { background: var(--bg-panel) !important; border-left-color: rgba(0,0,0,0.08) !important; }
html.light .chat-panel       { background: #F0EEF8 !important; }
html.light .gsm-modal        { background: #F5F3FA !important; border-color: rgba(100,120,220,0.15) !important; }
html.light .topbar           { background: var(--bg-panel) !important; }
html.light .qref-bar         { background: var(--bg-panel) !important; border-top-color: rgba(0,0,0,0.08) !important; }
html.light .tool-strip       { background: var(--bg-panel) !important; border-bottom-color: rgba(0,0,0,0.08) !important; }
html.light .chat-header      { background: linear-gradient(135deg, rgba(60,80,180,0.08), rgba(100,60,160,0.05)) !important; border-bottom-color: rgba(100,120,220,0.15) !important; }
html.light .chat-chips       { border-bottom-color: rgba(0,0,0,0.06) !important; }
html.light .empty-icon       { background: var(--bg-card) !important; border-color: rgba(0,0,0,0.1) !important; }
html.light .form-card        { background: var(--bg-panel) !important; border-color: rgba(0,0,0,0.1) !important; }
html.light .form-card-header { background: var(--bg-panel-2) !important; border-bottom-color: rgba(0,0,0,0.08) !important; }
html.light .card-foot        { background: var(--bg-card) !important; border-top-color: rgba(0,0,0,0.06) !important; }
html.light .card-top         { border-bottom-color: rgba(0,0,0,0.08) !important; }
html.light .safe .card-top   { background: rgba(34,120,70,0.12) !important; }
html.light .best .card-top   { background: rgba(201,168,76,0.12) !important; }
html.light .agg  .card-top   { background: rgba(180,40,40,0.12) !important; }
html.light .output-card.best { background: linear-gradient(160deg, rgba(201,168,76,0.07), rgba(201,168,76,0.02)) !important; }
html.light .output-card.safe { background: linear-gradient(160deg, rgba(34,120,70,0.07), rgba(34,120,70,0.02)) !important; }
html.light .output-card.agg  { background: linear-gradient(160deg, rgba(180,40,40,0.07), rgba(180,40,40,0.02)) !important; }

/* ── Center panel text — tool strip ── */
html.light .tool-strip-left h2    { color: #1A1410 !important; }
html.light .tool-strip-left p     { color: #5A5248 !important; }

/* ── Empty state (PICK YOUR LEAD TYPE) ── */
html.light .empty-state           { color: #5A5248 !important; }
html.light .empty-state h3        { color: #2A2420 !important; }
html.light .empty-state p         { color: #5A5248 !important; }
html.light .empty-hint            { color: #6A6258 !important; }

/* ── Quick-ref bar (bottom of center panel) ── */
html.light .qref-item             { border-right-color: rgba(0,0,0,0.1) !important; }
html.light .qref-val              { color: #2A2420 !important; }

/* ── Card body text (script text output) ── */
html.light .card-body             { color: #1A1410 !important; background: transparent !important; }
html.light .card-label.safe       { color: var(--green-text) !important; }
html.light .card-label.best       { color: var(--gold-600) !important; }
html.light .card-label.agg        { color: var(--red-text) !important; }
html.light .char-count            { color: #8A8278 !important; }

/* ── Copy / new buttons ── */
html.light .btn-copy              { background: rgba(0,0,0,0.04) !important; border-color: rgba(0,0,0,0.12) !important; color: #4A4540 !important; }
html.light .btn-copy:hover        { background: rgba(0,0,0,0.08) !important; color: #1A1410 !important; }
html.light .btn-new               { border-color: rgba(0,0,0,0.12) !important; color: #4A4540 !important; }
html.light .btn-new:hover         { border-color: rgba(0,0,0,0.2) !important; color: #1A1410 !important; }
html.light .btn-clear-chat        { border-color: rgba(0,0,0,0.12) !important; color: #4A4540 !important; }

/* ── Chat panel ── */
html.light .chat-title            { color: #1A1410 !important; }
html.light .chat-subtitle         { color: #6A6258 !important; }
html.light .chat-textarea         { color: #1A1410 !important; background: var(--bg-panel) !important; border-color: rgba(0,0,0,0.12) !important; }
html.light .chat-textarea::placeholder { color: #8A8278 !important; }

/* ── Nav panel ── */
html.light .nav-item              { color: #4A4540 !important; }
html.light .nav-item:hover        { background: rgba(0,0,0,0.05) !important; color: #1A1410 !important; }
html.light .nav-item.active       { color: #1A1410 !important; }
html.light .nav-name              { color: #2A2420 !important; }
html.light .nav-divider           { background: rgba(0,0,0,0.08) !important; }
html.light .nav-tag               { color: #5A5248 !important; }

/* ── Forms & inputs ── */
html.light .form-control,
html.light textarea,
html.light input                  { background: #FFFFFF !important; border-color: rgba(0,0,0,0.15) !important; color: #1A1410 !important; }
html.light .form-control::placeholder,
html.light textarea::placeholder  { color: #8A8278 !important; }
html.light .form-label            { color: #4A4540 !important; }
html.light select                 { background: #FFFFFF !important; border-color: rgba(0,0,0,0.15) !important; color: #1A1410 !important; }

/* ── Script output text ── */
html.light .script-text,
html.light .output-text,
html.light [id$="Text"],
html.light [id$="Output"]         { color: #1A1410 !important; }

/* ── Output section header ── */
html.light .output-section        { color: #1A1410 !important; }

/* ── Chip buttons ── */
html.light .chip                  { background: var(--bg-card) !important; border-color: rgba(0,0,0,0.1) !important; color: #4A4540 !important; }
html.light .chip:hover            { border-color: rgba(201,168,76,0.4) !important; color: #1A1410 !important; }

/* ── Brand text in topbar ── */
html.light .brand-name            { color: #1A1410 !important; }
html.light .brand-sub             { color: #5A5248 !important; border-left-color: rgba(0,0,0,0.15) !important; }
html.light .gsm-tag               { color: #5A5248 !important; }

/* ── Paste / coaching textareas ── */
html.light .paste-textarea        { color: #1A1410 !important; background: #FFFFFF !important; border-color: rgba(0,0,0,0.12) !important; }
html.light .paste-textarea::placeholder { color: #8A8278 !important; }
html.light .coaching-textarea     { color: #1A1410 !important; }
html.light .coaching-textarea::placeholder { color: #8A8278 !important; }

/* ── Section / package tab headers ── */
html.light .pkg-tab               { color: #5A5248 !important; }
html.light .pkg-tab.active        { color: var(--gold-600) !important; }
html.light .pkg-tab-bar           { border-bottom-color: rgba(0,0,0,0.1) !important; }
html.light .section-header        { color: #1A1410 !important; border-bottom-color: rgba(0,0,0,0.08) !important; }
html.light .section-label         { color: #4A4540 !important; }

/* ── Result buttons ── */
html.light .result-btn            { border-color: rgba(0,0,0,0.12) !important; color: #4A4540 !important; }
html.light .result-btn:hover      { border-color: rgba(0,0,0,0.2) !important; color: #1A1410 !important; }

/* ── Coaching / analysis text ── */
html.light .coaching-text         { color: #1A1410 !important; }
html.light .analysis-text         { color: #2A2420 !important; }

/* ── Chat message bubbles (right panel) ── */
html.light .user .msg-bubble       { color: #1A1410 !important; background: rgba(201,168,76,0.08) !important; }
html.light .assistant .msg-bubble  { color: #1A1410 !important; background: var(--bg-card) !important; border-color: rgba(0,0,0,0.08) !important; }
html.light .chat-welcome h4        { color: #2A2420 !important; }
html.light .chat-welcome p         { color: #5A5248 !important; }

/* ── Empty state (center panel) — these have hardcoded rgba in the CSS class ── */
html.light .empty-state h3         { color: #2A2420 !important; }
html.light .empty-state p          { color: #5A5248 !important; }
html.light .empty-hint             { color: #6A6258 !important; }

/* ── Coaching overlay ── */
html.light .coaching-overlay       { background: var(--bg-body) !important; }
html.light .coaching-header        { background: var(--bg-panel) !important; border-bottom-color: rgba(0,0,0,0.1) !important; }
html.light .coaching-title         { color: #1A1410 !important; }
html.light .coaching-subtitle      { color: #5A5248 !important; }
html.light .coaching-close         { border-color: rgba(0,0,0,0.15) !important; color: #4A4540 !important; }
html.light .coaching-thread        { background: var(--bg-body) !important; }
html.light .coaching-msg-label     { color: #8A8278 !important; }
html.light .coaching-msg.coach .coaching-msg-label    { color: var(--gold-600) !important; }
html.light .coaching-msg.customer .coaching-msg-label { color: var(--orange-text) !important; }
html.light .coaching-msg.customer .coaching-bubble    { color: #1A1410 !important; background: rgba(200,100,20,0.07) !important; border-color: rgba(200,100,20,0.2) !important; }
html.light .coaching-msg.coach .coaching-bubble       { color: #1A1410 !important; background: rgba(201,168,76,0.07) !important; }
html.light .coaching-bubble        { color: #1A1410 !important; }
html.light .coaching-sidebar       { background: var(--bg-panel) !important; border-left-color: rgba(0,0,0,0.08) !important; }
html.light .coaching-sidebar-header { color: #1A1410 !important; border-bottom-color: rgba(0,0,0,0.08) !important; background: var(--bg-panel-2) !important; }
html.light .coaching-ref-title     { color: var(--gold-600) !important; }
html.light .coaching-ref-text      { color: #2A2420 !important; }
html.light .coaching-ref-item      { color: #4A4540 !important; }
html.light .coaching-input-area    { background: var(--bg-panel) !important; border-top-color: rgba(0,0,0,0.08) !important; }
html.light .coaching-input-label   { color: #5A5248 !important; }
html.light #coachingThread *[style*="color:rgba(255,255,255"]  { color: #1A1410 !important; }
html.light #coachingThread *[style*="color: rgba(255,255,255"] { color: #1A1410 !important; }

/* ── Launch screen light mode ── */
html.light .launch-screen          { background: var(--bg-panel) !important; border-color: rgba(0,0,0,0.15) !important; }
html.light .launch-screen-title    { color: #1A1410 !important; }
html.light .launch-screen-sub      { color: #5A5248 !important; }
html.light .launch-field-label     { color: #4A4540 !important; }
html.light .launch-field-input     { background: var(--bg-body) !important; color: #1A1410 !important; border-color: rgba(0,0,0,0.15) !important; }
html.light .launch-channel-btn     { background: var(--bg-body) !important; color: #4A4540 !important; border-color: rgba(0,0,0,0.15) !important; }
html.light .launch-channel-btn.selected { border-color: var(--gold-600) !important; color: var(--gold-700) !important; background: rgba(201,168,76,0.08) !important; }

/* ── CRM / feedback output boxes ── */
html.light .crm-note-box           { color: #1A1410 !important; background: var(--bg-card) !important; border-color: rgba(201,168,76,0.3) !important; }
html.light .next-step-box          { color: #1A1410 !important; background: var(--bg-card) !important; }
html.light .feedback-structured    { color: #1A1410 !important; background: var(--bg-card) !important; }

/* ── Inline dynamic content (JS-injected rgba whites) — broad catch-all ── */
html.light #workScroll *[style*="color:rgba(255,255,255"],
html.light #workScroll *[style*="color: rgba(255,255,255"] { color: #1A1410 !important; }
html.light #chatMessages *[style*="color:rgba(255,255,255"],
html.light #chatMessages *[style*="color: rgba(255,255,255"] { color: #1A1410 !important; }
html.light *[style*="background:rgba(0,0,0,0.2)"],
html.light *[style*="background: rgba(0,0,0,0.2)"] { background: rgba(0,0,0,0.05) !important; }

/* ── LIGHT MODE ── */
html.light {
  --bg-body:    #F4F1EC;
  --bg-panel:   #FFFFFF;
  --bg-panel-2: #F0EDE6;
  --bg-card:    #E8E3D8;
  --bg-card-2:  #DDD8CC;
  --text-primary:   #1A1410;
  --text-secondary: #5A5248;
  --text-muted:     #8A8278;
  --border-subtle:  rgba(0,0,0,0.08);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
  --shadow-gold: 0 0 24px rgba(201,168,76,0.2);
  --green-bg: rgba(34,120,70,0.08);
  --green-border: rgba(34,120,70,0.3);
  --green-text: #15803D;
  --red-bg: rgba(180,40,40,0.08);
  --red-border: rgba(180,40,40,0.25);
  --red-text: #B91C1C;
  --orange-bg: rgba(200,100,20,0.08);
  --orange-border: rgba(200,100,20,0.25);
  --orange-text: #C2410C;
  --gold-glow: rgba(201,168,76,0.12);
  --gold-border: rgba(160,120,40,0.35);
  /* Legacy aliases */
  --navy-900: var(--bg-body);
  --navy-800: var(--bg-panel);
  --navy-700: var(--bg-panel-2);
  --navy-600: var(--bg-card);
  --navy-500: var(--bg-card-2);
  --white: var(--text-primary);
  --gray-300: var(--text-secondary);
  --gray-500: var(--text-muted);
}

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

html { height: 100%; overflow: hidden; }

body {
  font-family: var(--font-body);
  background: var(--bg-body);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-size: 14px;
  line-height: 1.5;
}

/* Noise grain texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 999;
  opacity: 0.4;
}

button { cursor: pointer; font-family: var(--font-body); border: none; }
input, textarea, select { font-family: var(--font-body); }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--navy-600); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-600); }

/* ═══════════════════════════════════════════════════
   TOP BAR
═══════════════════════════════════════════════════ */
.topbar {
  height: 54px;
  min-height: 54px;
  background: var(--navy-800);
  border-bottom: 1px solid var(--gold-border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  position: relative;
  z-index: 100;
  flex-shrink: 0;
}

.topbar::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--gold-500) 30%, var(--gold-400) 50%, var(--gold-500) 70%, transparent 100%);
  opacity: 0.5;
}

.logo-mark {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--gold-400), var(--gold-600));
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--navy-900);
  letter-spacing: 0.5px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(201,168,76,0.3);
}

.brand-name {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 2px;
  color: var(--white);
  line-height: 1;
}

.brand-name span { color: var(--gold-500); }

.brand-sub {
  font-size: 11px;
  color: var(--gray-300);
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 500;
  padding-left: 12px;
  border-left: 1px solid var(--navy-600);
  margin-left: 4px;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-signout {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 4px 12px;
  color: rgba(255,255,255,0.45);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-body);
}
.btn-signout:hover { border-color: #F87171; color: #F87171; }
html.light .btn-signout { border-color: rgba(0,0,0,0.12); color: rgba(0,0,0,0.4); }
html.light .btn-signout:hover { border-color: #EF4444; color: #EF4444; }

.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--green-bg);
  border: 1px solid var(--green-border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--green-text);
  letter-spacing: 1px;
}

.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green-text);
  animation: pulse 2.5s ease infinite;
}

@keyframes pulse {
  0%,100% { opacity:1; transform:scale(1); }
  50% { opacity:0.4; transform:scale(0.7); }
}

.gsm-tag {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* ── THEME TOGGLE ── */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  user-select: none;
}
.theme-toggle-track {
  width: 36px;
  height: 20px;
  background: var(--bg-card);
  border: 1px solid var(--gold-border);
  border-radius: 20px;
  position: relative;
  transition: background 0.2s;
}
.theme-toggle-thumb {
  width: 14px;
  height: 14px;
  background: var(--gold-500);
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
}
html.light .theme-toggle-thumb {
  transform: translateX(16px);
}
.theme-toggle-icon {
  font-size: 13px;
  line-height: 1;
}

/* ── TOPBAR LOGO (replaces HC square) ── */
.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.topbar-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 26px;
}
.topbar-bar {
  width: 5px;
  background: var(--gold-500);
  border-radius: 1px 1px 0 0;
}
.topbar-bar-1 { height: 22%; opacity: 0.28; animation: breathe 2.6s ease-in-out infinite 0s; }
.topbar-bar-2 { height: 46%; opacity: 0.52; animation: breathe 2.6s ease-in-out infinite 0.22s; }
.topbar-bar-3 { height: 72%; opacity: 0.76; animation: breathe 2.6s ease-in-out infinite 0.44s; }
.topbar-bar-4 { height: 100%; background: var(--gold-400); animation: breathe 2.6s ease-in-out infinite 0.66s; }
@keyframes breathe {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(0.55); }
}
.topbar-wordmark {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 3px;
  color: var(--text-primary);
  line-height: 1;
}
.topbar-wordmark .tw-close { color: var(--gold-400); }
.topbar-ai-badge {
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--gold-500);
  border: 1px solid var(--gold-500);
  padding: 1px 4px;
  border-radius: 2px;
  letter-spacing: 1px;
  margin-left: 4px;
  vertical-align: middle;
  line-height: 2;
}

/* ── USER AGREEMENT MODAL ── */
.agreement-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.agreement-overlay.hidden { display: none; }
.agreement-box {
  background: var(--bg-panel);
  border: 1px solid var(--gold-border);
  border-top: 3px solid var(--gold-500);
  border-radius: var(--radius-lg);
  max-width: 560px;
  width: 100%;
  padding: 36px 40px 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.agreement-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.agreement-icon {
  width: 40px;
  height: 40px;
  background: var(--gold-glow);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.agreement-title {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 2px;
  color: var(--text-primary);
  line-height: 1;
}
.agreement-subtitle {
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 3px;
}
.agreement-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 20px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}
.agreement-body p { margin-bottom: 12px; }
.agreement-body p:last-child { margin-bottom: 0; }
.agreement-body strong { color: var(--text-primary); }
.agreement-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  cursor: pointer;
}
.agreement-checkbox-row input[type=checkbox] {
  width: 16px;
  height: 16px;
  margin-top: 1px;
  accent-color: var(--gold-500);
  flex-shrink: 0;
  cursor: pointer;
}
.agreement-checkbox-label {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  cursor: pointer;
}
.agreement-checkbox-label strong { color: var(--text-primary); }
.agreement-accept-btn {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--gold-500), var(--gold-600));
  color: #0D1525;
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 2px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.2s;
  font-weight: 700;
}
.agreement-accept-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.agreement-accept-btn:not(:disabled):hover { opacity: 0.9; }
.agreement-patent {
  text-align: center;
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 14px;
}

/* ═══════════════════════════════════════════════════
   MAIN LAYOUT — 3 COLUMNS
═══════════════════════════════════════════════════ */
.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 220px 1fr 340px;
  overflow: hidden;
  min-height: 0;
}

/* ═══════════════════════════════════════════════════
   LEFT PANEL — TOOL NAVIGATOR
═══════════════════════════════════════════════════ */
.nav-panel {
  background: var(--navy-800);
  border-right: 1px solid rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.nav-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
}

.nav-header-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--gold-500);
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-header-label::before {
  content: '';
  display: inline-block;
  width: 12px; height: 1px;
  background: var(--gold-500);
}

.nav-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
  margin-bottom: 2px;
  position: relative;
  background: transparent;
  width: 100%;
  text-align: left;
  color: var(--gray-300);
}

.nav-item:hover {
  background: rgba(255,255,255,0.04);
  color: var(--white);
}

.nav-item.active {
  background: var(--gold-glow);
  border-color: var(--gold-border);
  color: var(--white);
  box-shadow: var(--shadow-gold);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 2px;
  background: var(--gold-500);
  border-radius: 0 2px 2px 0;
}

.nav-num {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--gold-600);
  background: rgba(201,168,76,0.08);
  border-radius: 3px;
  padding: 1px 5px;
  min-width: 24px;
  text-align: center;
  flex-shrink: 0;
  transition: all var(--transition);
}

.nav-item.active .nav-num {
  background: var(--gold-500);
  color: var(--navy-900);
  font-weight: 600;
}

.nav-name {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  flex: 1;
  min-width: 0;
}

.nav-divider {
  height: 1px;
  background: rgba(255,255,255,0.05);
  margin: 8px 4px;
}

/* ═══════════════════════════════════════════════════
   CENTER PANEL — WORK AREA
═══════════════════════════════════════════════════ */
.work-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--navy-900);
  border-right: 1px solid rgba(255,255,255,0.04);
}

/* Tool Header Strip */
.tool-strip {
  flex-shrink: 0;
  background: var(--navy-800);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.tool-strip-left h2 {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 2px;
  color: var(--white);
  line-height: 1;
}

.tool-strip-left p {
  font-size: 12px;
  color: var(--gray-300);
  margin-top: 3px;
}

.tool-type-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--gold-glow);
  border: 1px solid var(--gold-border);
  color: var(--gold-400);
  white-space: nowrap;
}

/* Scroll area */
.work-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Empty state */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
  padding: 40px 20px;
  color: var(--gray-500);
}

.empty-icon {
  width: 64px; height: 64px;
  border-radius: 16px;
  background: var(--navy-700);
  border: 1px solid rgba(255,255,255,0.06);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  margin-bottom: 4px;
}

.empty-state h3 {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.2);
}

.empty-state p {
  font-size: 13px;
  line-height: 1.6;
  max-width: 300px;
  color: rgba(255,255,255,0.15);
}

.empty-hints {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.empty-hint {
  font-size: 12px;
  color: rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  gap: 6px;
}

.empty-hint::before {
  content: '→';
  color: var(--gold-600);
}

/* Form Card */
.form-card {
  background: var(--navy-800);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-lg);
  overflow: hidden;
  animation: slideUp 0.22s ease;
}

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

.form-card-header {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-500);
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(201,168,76,0.04);
}

.form-body {
  padding: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.span2 { grid-column: 1/-1; }

.form-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gray-300);
}

.form-control {
  background: var(--navy-700);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 9px 12px;
  color: var(--white);
  font-size: 13.5px;
  transition: all var(--transition);
  width: 100%;
}

.form-control::placeholder { color: rgba(255,255,255,0.2); }

.form-control:focus {
  outline: none;
  border-color: var(--gold-500);
  background: rgba(201,168,76,0.06);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.08);
}

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23C9A84C' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

select.form-control option { background: var(--navy-700); }

textarea.form-control {
  resize: vertical;
  min-height: 72px;
  line-height: 1.5;
}

/* Generate Button Row */
.generate-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.05);
  background: rgba(0,0,0,0.2);
}

.btn-generate {
  background: linear-gradient(135deg, var(--gold-400) 0%, var(--gold-600) 100%);
  color: var(--navy-900);
  border-radius: var(--radius);
  padding: 10px 24px;
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 2px;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 12px rgba(201,168,76,0.25);
  white-space: nowrap;
}

.btn-generate:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(201,168,76,0.35);
  background: linear-gradient(135deg, var(--gold-300) 0%, var(--gold-500) 100%);
}

.btn-generate:active { transform: translateY(0); }
.btn-generate:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 10px 16px;
  color: var(--gray-300);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
}

.btn-secondary:hover {
  border-color: rgba(255,255,255,0.22);
  color: var(--white);
  background: rgba(255,255,255,0.04);
}

.kbd-hint {
  font-size: 11px;
  color: var(--gray-500);
  margin-left: auto;
  font-family: var(--font-mono);
}

/* Loading */
.loading-row {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--gold-glow);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius);
  animation: slideUp 0.2s ease;
}

.loading-row.show { display: flex; }

.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(201,168,76,0.2);
  border-top-color: var(--gold-500);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  flex-shrink: 0;
}

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

.loading-text {
  font-size: 13px;
  color: var(--gold-400);
  font-weight: 500;
}

.loading-dots::after {
  content: '';
  animation: dots 1.4s steps(4,end) infinite;
}

@keyframes dots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
}

/* Error */
.error-banner {
  display: none;
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: var(--red-text);
  font-size: 13px;
  animation: slideUp 0.2s ease;
}

.error-banner.show { display: block; }

/* Output Section */
.output-section {
  display: none;
  flex-direction: column;
  gap: 12px;
  animation: slideUp 0.28s ease;
  flex-shrink: 0;
}

.output-section.show { display: flex; }

.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.output-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--gold-500);
  display: flex;
  align-items: center;
  gap: 6px;
}

.output-label::before {
  content: '';
  display: inline-block;
  width: 12px; height: 1px;
  background: var(--gold-500);
}

.btn-new {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 5px 12px;
  color: var(--gray-300);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: all var(--transition);
}

.btn-new:hover { color: var(--white); border-color: rgba(255,255,255,0.2); }

.output-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.output-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid;
  transition: transform var(--transition), border-color 0.15s, box-shadow 0.15s;
  position: relative;
  cursor: pointer;
}

.output-card.safe    { background: linear-gradient(160deg, rgba(34,120,70,0.1), rgba(34,120,70,0.04)); border-color: var(--green-border); }
.output-card.best    { background: linear-gradient(160deg, rgba(27,42,74,0.8), rgba(27,42,74,0.5)); border-color: var(--gold-border); box-shadow: 0 0 20px rgba(201,168,76,0.08); }
.output-card.agg     { background: linear-gradient(160deg, rgba(180,40,40,0.1), rgba(180,40,40,0.04)); border-color: var(--red-border); }

.card-top {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  gap: 8px;
}

.safe .card-top  { background: rgba(34,120,70,0.18); }
.best .card-top  { background: rgba(201,168,76,0.1); }
.agg  .card-top  { background: rgba(180,40,40,0.18); }

.card-label {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 2px;
}

.safe .card-label  { color: var(--green-text); }
.best .card-label  { color: var(--gold-400); }
.agg  .card-label  { color: var(--red-text); }

.card-pill {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.5px;
  padding: 2px 7px;
  border-radius: 10px;
  text-transform: uppercase;
}

.safe .card-pill  { background: rgba(74,222,128,0.12); color: var(--green-text); }
.best .card-pill  { background: rgba(201,168,76,0.18); color: var(--gold-400); border: 1px solid var(--gold-border); }
.agg  .card-pill  { background: rgba(248,113,113,0.12); color: var(--red-text); }

.best-star { color: var(--gold-400); margin-right: 2px; }

.card-body {
  padding: 14px;
  font-size: 13px;
  line-height: 1.7;
  color: rgba(255,255,255,0.87);
  white-space: pre-wrap;
  word-break: break-word;
  font-weight: 300;
}

.card-foot {
  padding: 8px 14px;
  border-top: 1px solid rgba(255,255,255,0.04);
  background: rgba(0,0,0,0.15);
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ═══════════════════════════════════════════════════
   RESPONSE ACTION ROW — Refresh / Redirect / Use This
   Applies to: tool outputs, Live Coaching, Ask GSM
═══════════════════════════════════════════════════ */
.response-action-row {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  margin-top: 8px;
  border-top: 1px solid var(--border-subtle, rgba(201, 168, 76, 0.15));
  align-items: center;
  flex-wrap: wrap;
}

.response-action-row .action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-family: var(--font-body, inherit);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  background: transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.response-action-row .action-btn:hover {
  transform: translateY(-1px);
}

.response-action-row .action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.response-action-row .action-btn-refresh {
  color: var(--gold-400, #D9BA6A);
  border-color: rgba(201, 168, 76, 0.3);
}

.response-action-row .action-btn-refresh:hover {
  background: rgba(201, 168, 76, 0.08);
  border-color: var(--gold-400, #D9BA6A);
}

.response-action-row .action-btn-redirect {
  color: var(--gold-400, #D9BA6A);
  border-color: rgba(201, 168, 76, 0.3);
}

.response-action-row .action-btn-redirect:hover {
  background: rgba(201, 168, 76, 0.08);
  border-color: var(--gold-400, #D9BA6A);
}

.response-action-row .action-btn-use {
  color: #060C18;
  background: var(--gold-500, #C9A84C);
  border-color: var(--gold-500, #C9A84C);
}

.response-action-row .action-btn-use:hover {
  background: var(--gold-400, #D9BA6A);
  border-color: var(--gold-400, #D9BA6A);
}

.response-action-row .action-btn .action-icon {
  font-size: 13px;
  line-height: 1;
}

.response-action-row.is-finalized {
  opacity: 0.5;
  pointer-events: none;
}

.response-action-row.is-loading .action-btn-refresh,
.response-action-row.is-loading .action-btn-redirect {
  opacity: 0.5;
  pointer-events: none;
}

/* Redirect command box */
.redirect-command-box {
  display: none;
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(201, 168, 76, 0.25);
  border-radius: 6px;
}

.redirect-command-box.is-open {
  display: block;
}

.redirect-command-box label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--gold-400, #D9BA6A);
  margin-bottom: 6px;
}

.redirect-command-box textarea {
  width: 100%;
  min-height: 60px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  color: var(--text-primary, #fff);
  font-family: var(--font-body, inherit);
  font-size: 13px;
  resize: vertical;
  box-sizing: border-box;
}

.redirect-command-box textarea:focus {
  outline: none;
  border-color: var(--gold-400, #D9BA6A);
}

.redirect-command-box-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.redirect-command-box .btn-cancel {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.6);
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 4px;
  cursor: pointer;
}

.redirect-command-box .btn-submit {
  background: var(--gold-500, #C9A84C);
  border: 1px solid var(--gold-500, #C9A84C);
  color: #060C18;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
}

.btn-copy {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  padding: 5px 10px;
  color: var(--gray-300);
  font-size: 11px;
  font-weight: 500;
  transition: all var(--transition);
}

.btn-copy:hover { background: rgba(255,255,255,0.1); color: var(--white); }
.btn-copy.copied { background: rgba(74,222,128,0.12); border-color: var(--green-border); color: var(--green-text); }

.char-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--gray-500);
}

/* Quick-ref bar */
.qref-bar {
  flex-shrink: 0;
  border-top: 1px solid rgba(255,255,255,0.05);
  background: var(--navy-800);
  padding: 8px 24px;
  display: flex;
  gap: 0;
  overflow-x: auto;
  align-items: center;
}

.qref-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  border-right: 1px solid rgba(255,255,255,0.06);
  white-space: nowrap;
}

.qref-item:first-child { padding-left: 0; }
.qref-item:last-child  { border-right: none; }

.qref-key {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gold-600);
}

.qref-val {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
}

/* ═══════════════════════════════════════════════════
   RIGHT PANEL — GENERAL CHAT
═══════════════════════════════════════════════════ */
.history-panel {
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid rgba(255,255,255,0.05);
}
.history-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.history-title {
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: 2px;
  color: var(--gold-400);
  margin-bottom: 10px;
}
.history-search {
  width: 100%;
  padding: 8px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color var(--transition);
}
.history-search:focus { border-color: var(--gold-border); }
.history-search::placeholder { color: rgba(255,255,255,0.2); }
.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
}
.history-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 12px;
}

/* Rolling 30-day ledger: date group headers. Sticky so a rep scrolling a heavy
   month always knows which bucket they are looking at. */
.history-group-header {
  position: sticky;
  top: -8px;                 /* cancels .history-list's 8px top padding */
  z-index: 1;
  background: var(--bg-panel, #0B1220);
  backdrop-filter: blur(6px);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--gold-600, #9A7A30);
  padding: 8px 4px 5px;
  margin: 2px 0 6px;
  border-bottom: 1px solid rgba(201,168,76,0.16);
}
.history-group-header:first-child { margin-top: 0; }

.history-lazy-sentinel {
  text-align: center;
  padding: 12px 8px 16px;
  font-size: 10.5px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted, #6B6355);
}
html.light .history-group-header { background: #F0EDE6; color: #8A6D28; }
.history-entry {
  position: relative;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.04);
  margin-bottom: 6px;
  cursor: pointer;
  transition: all var(--transition);
  background: rgba(255,255,255,0.02);
}
.history-entry:hover {
  background: rgba(201,168,76,0.06);
  border-color: var(--gold-border);
}
.history-entry-delete {
  position: absolute; top: 6px; right: 6px;
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 4px;
  background: transparent; color: var(--text-muted);
  font-size: 12px; cursor: pointer;
  opacity: 0; transition: all var(--transition);
}
.history-entry:hover .history-entry-delete { opacity: 1; }
.history-entry-delete:hover { background: rgba(180,40,40,0.2); color: var(--red-text); }
.history-clear-btn {
  padding: 3px 8px; border: 1px solid rgba(255,255,255,0.1); border-radius: 4px;
  background: transparent; color: var(--text-muted); font-size: 10px;
  font-family: var(--font-body); cursor: pointer; transition: all var(--transition);
}
.history-clear-btn:hover { border-color: var(--red-border); color: var(--red-text); }
.history-entry-name {
  font-weight: 600;
  color: var(--gold-400);
  font-size: 13px;
  margin-bottom: 3px;
}
.history-entry-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  color: var(--text-muted);
}
.history-entry-tag {
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.history-tag-scripts { background: rgba(100,120,220,0.15); color: #8B9CF7; }
.history-tag-coached { background: rgba(201,168,76,0.15); color: var(--gold-400); }
.history-tag-both { background: rgba(34,120,70,0.15); color: var(--green-text); }

/* ─── Lead Session Drawer ─── */
.history-drawer {
  position: absolute;
  inset: 0;
  background: var(--bg-panel);
  display: none;
  flex-direction: column;
  z-index: 10;
}
.history-drawer.active { display: flex; }
.drawer-header {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.drawer-back {
  background: transparent;
  border: none;
  color: var(--gold-400);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: background var(--transition);
  font-family: var(--font-body);
}
.drawer-back:hover { background: rgba(201,168,76,0.1); }
.drawer-customer-name {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 1.5px;
  color: var(--gold-400);
}
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}
.drawer-section-label {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin: 16px 0 8px;
}
.drawer-section-label:first-child { margin-top: 0; }
.drawer-script-card {
  position: relative;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 12.5px;
  line-height: 1.55;
  margin-bottom: 6px;
  border: 1px solid;
  cursor: pointer;
  transition: all 0.15s;
  white-space: pre-wrap;
}
.drawer-script-card:hover { transform: translateY(-1px); box-shadow: 0 3px 12px rgba(0,0,0,0.3); }
.drawer-script-card.safe { background: rgba(34,120,70,0.08); border-color: var(--green-border); }
.drawer-script-card.best { background: linear-gradient(160deg,rgba(201,168,76,0.1),rgba(201,168,76,0.03)); border-color: var(--gold-border); }
.drawer-script-card.agg { background: rgba(180,40,40,0.08); border-color: var(--red-border); }
.drawer-script-label {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 1.5px;
  margin-bottom: 4px;
}
.drawer-script-card.safe .drawer-script-label { color: var(--green-text); }
.drawer-script-card.best .drawer-script-label { color: var(--gold-400); }
.drawer-script-card.agg .drawer-script-label { color: var(--red-text); }

.drawer-coaching-exchange {
  margin-bottom: 12px;
}
.drawer-coaching-customer {
  padding: 8px 12px;
  border-radius: var(--radius) var(--radius) var(--radius) 3px;
  background: rgba(200,100,20,0.1);
  border: 1px solid var(--orange-border);
  font-size: 12px;
  color: rgba(255,255,255,0.8);
  margin-bottom: 6px;
  white-space: pre-wrap;
}
.drawer-coaching-customer-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--orange-text);
  margin-bottom: 3px;
}

.drawer-actions {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ─── GSM Chat Modal ─── */
.gsm-modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 600;
  align-items: center;
  justify-content: center;
}
.gsm-modal-bg.active { display: flex; }
.gsm-modal {
  width: 500px;
  max-width: 95vw;
  max-height: 85vh;
  background: #0A0E1F;
  border: 1px solid rgba(100,120,220,0.25);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  overflow: hidden;
}
.gsm-modal-header {
  padding: 14px 16px;
  border-bottom: 2px solid rgba(100,120,220,0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(60,80,180,0.15), rgba(100,60,160,0.1));
  flex-shrink: 0;
}
.gsm-modal-title {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 2px;
  color: #8B9CF7;
}
.gsm-modal-sub {
  font-size: 10px;
  color: rgba(139,156,247,0.5);
  letter-spacing: 1px;
}
.gsm-modal-close {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 4px 12px;
  color: rgba(255,255,255,0.4);
  font-size: 16px;
  cursor: pointer;
  transition: all var(--transition);
}
.gsm-modal-close:hover { color: var(--red-text); border-color: var(--red-border); background: var(--red-bg); }
.gsm-modal-info {
  background: linear-gradient(90deg,rgba(100,120,220,0.12),rgba(100,60,160,0.08));
  padding: 8px 14px;
  border-bottom: 1px solid rgba(100,120,220,0.15);
  font-size: 11px;
  color: rgba(139,156,247,0.7);
  font-weight: 500;
  flex-shrink: 0;
}

/* Chat internals reused inside modal */
.chat-panel {
  background: #0A0E1F;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: none;
  flex: 1;
  min-height: 0;
}
.chat-header { display: none; }
.chat-chips {
  flex-shrink: 0;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(100,120,220,0.1);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chat-title {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 2px;
  color: #8B9CF7;
}
.chat-subtitle {
  font-size: 10px;
  color: rgba(139,156,247,0.5);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 500;
}

/* GSM nav button */
.nav-gsm-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: calc(100% - 24px);
  margin: 0 12px 8px;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(60,80,180,0.12), rgba(100,60,160,0.08));
  border: 1px solid rgba(100,120,220,0.2);
  border-radius: 8px;
  color: #8B9CF7;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}
.nav-gsm-btn:hover {
  background: linear-gradient(135deg, rgba(60,80,180,0.22), rgba(100,60,160,0.16));
  border-color: rgba(100,120,220,0.4);
  box-shadow: 0 0 16px rgba(100,120,220,0.15);
}

.btn-clear-chat {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  padding: 4px 10px;
  color: var(--gray-500);
  font-size: 11px;
  font-weight: 500;
  transition: all var(--transition);
}

.btn-clear-chat:hover { color: var(--red-text); border-color: var(--red-border); background: var(--red-bg); }

/* Quick prompt chips */
.chat-chips {
  flex-shrink: 0;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.chip {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--gray-300);
  cursor: pointer;
  transition: all var(--transition);
  font-weight: 500;
}

.chip:hover {
  background: var(--gold-glow);
  border-color: var(--gold-border);
  color: var(--gold-400);
}

/* Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.msg-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  animation: slideUp 0.18s ease;
}

.msg-row.user { align-items: flex-end; }
.msg-row.assistant { align-items: flex-start; }

.msg-bubble {
  max-width: 88%;
  padding: 10px 13px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.6;
  font-weight: 400;
}

.user .msg-bubble {
  background: linear-gradient(135deg, var(--gold-glow), rgba(201,168,76,0.08));
  border: 1px solid var(--gold-border);
  color: rgba(255,255,255,0.9);
  border-bottom-right-radius: 3px;
}

.assistant .msg-bubble {
  background: var(--navy-700);
  border: 1px solid rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.85);
  border-bottom-left-radius: 3px;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-meta {
  font-size: 10px;
  color: var(--gray-500);
  padding: 0 4px;
  font-family: var(--font-mono);
}

/* Chat welcome */
.chat-welcome {
  text-align: center;
  padding: 24px 16px;
  color: var(--gray-500);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.chat-welcome-icon {
  width: 48px; height: 48px;
  background: var(--navy-700);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}

.chat-welcome h4 {
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.25);
}

.chat-welcome p {
  font-size: 12px;
  line-height: 1.6;
  color: rgba(255,255,255,0.15);
  max-width: 220px;
}

/* Typing indicator */
.typing-indicator {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 10px 13px;
  background: var(--navy-700);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  border-bottom-left-radius: 3px;
  width: fit-content;
}

.typing-indicator.show { display: flex; }

.typing-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--gray-500);
  animation: typingBounce 1.2s ease infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%,60%,100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Chat input area */
.chat-input-area {
  flex-shrink: 0;
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.15);
}

.chat-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--navy-700);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 8px 8px 8px 12px;
  transition: border-color var(--transition);
}

.chat-input-row:focus-within {
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.08);
}

.chat-textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--white);
  font-size: 13px;
  line-height: 1.5;
  resize: none;
  outline: none;
  max-height: 100px;
  overflow-y: auto;
  font-family: var(--font-body);
}

.chat-textarea::placeholder { color: rgba(255,255,255,0.2); }

.btn-send {
  width: 32px; height: 32px;
  background: var(--gold-500);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--navy-900);
  font-size: 14px;
  transition: all var(--transition);
  flex-shrink: 0;
}

.btn-send:hover { background: var(--gold-400); transform: scale(1.05); }
.btn-send:active { transform: scale(0.97); }
.btn-send:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

.chat-hint {
  text-align: center;
  font-size: 10px;
  color: var(--gray-500);
  margin-top: 6px;
  font-family: var(--font-mono);
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .workspace { grid-template-columns: 200px 1fr 300px; }
}

@media (max-width: 850px) {
  .workspace { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
  .nav-panel { display: none; }
  .history-panel { height: 300px; border-left: none; border-top: 1px solid rgba(255,255,255,0.05); }
  body { overflow-y: auto; }
  html { overflow: auto; }
}

/* ═══════════════════════════════════════════════════
   LOGIN GATE
═══════════════════════════════════════════════════ */
#loginGate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #060C18;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 24px;
  overflow: hidden;
}

/* Animated diagonal stripe background */
#loginGate::before {
  content: '';
  position: absolute;
  inset: -50%;
  background: repeating-linear-gradient(
    -55deg,
    transparent,
    transparent 60px,
    rgba(201,168,76,0.025) 60px,
    rgba(201,168,76,0.025) 61px
  );
  animation: driftStripes 18s linear infinite;
  pointer-events: none;
}

@keyframes driftStripes {
  from { transform: translateX(0) translateY(0); }
  to   { transform: translateX(80px) translateY(80px); }
}

/* Gold glow orb behind the card */
#loginGate::after {
  content: '';
  position: absolute;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201,168,76,0.07) 0%, transparent 70%);
  pointer-events: none;
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  background: #0D1525;
  border: 1px solid rgba(201,168,76,0.25);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6), 0 0 40px rgba(201,168,76,0.08);
  animation: loginAppear 0.4s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes loginAppear {
  from { opacity:0; transform: scale(0.92) translateY(16px); }
  to   { opacity:1; transform: scale(1) translateY(0); }
}

.login-top {
  background: linear-gradient(135deg, #060C18 0%, #152035 100%);
  padding: 36px 32px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid rgba(201,168,76,0.25);
  position: relative;
  overflow: hidden;
}

/* Animated bar logo — matches nav */
.login-logo-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 32px;
  margin-bottom: 4px;
}
.login-logo-bar {
  width: 6px;
  border-radius: 2px 2px 0 0;
  background: var(--gold-400, #C9A84C);
  animation: loginBarBreathe 2.6s ease-in-out infinite;
}
.login-logo-bar:nth-child(1) { height: 22%; opacity: 0.28; animation-delay: 0s; }
.login-logo-bar:nth-child(2) { height: 46%; opacity: 0.52; animation-delay: 0.22s; }
.login-logo-bar:nth-child(3) { height: 72%; opacity: 0.76; animation-delay: 0.44s; }
.login-logo-bar:nth-child(4) { height: 100%; background: #D9BA6A; animation-delay: 0.66s; }
@keyframes loginBarBreathe {
  0%,100% { transform: scaleY(1); }
  50% { transform: scaleY(0.6); }
}

/* Subtle gold shimmer line across top of card header */
.login-top::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, #C9A84C 30%, #E8CE90 50%, #C9A84C 70%, transparent 100%);
}

.login-store-name {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 3px;
  color: #FFFFFF;
  text-align: center;
  line-height: 1;
}

.login-store-name span { color: #C9A84C; }

.login-tagline {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  text-align: center;
}

.login-body {
  padding: 28px 32px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-field-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
  margin-bottom: 6px;
  display: block;
}

.login-input-wrap {
  position: relative;
}

.login-input {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 12px 44px 12px 14px;
  color: #FFFFFF;
  font-family: var(--font-body);
  font-size: 15px;
  transition: all var(--transition);
  outline: none;
  box-sizing: border-box;
}

.login-input::placeholder { color: rgba(255,255,255,0.25); }

.login-input:focus {
  border-color: #C9A84C;
  background: rgba(201,168,76,0.06);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.1);
}

.toggle-pw {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.4);
  font-size: 16px;
  padding: 2px;
  transition: color var(--transition);
  line-height: 1;
}

.toggle-pw:hover { color: #C9A84C; }

.login-error {
  display: none;
  font-size: 12px;
  color: #F87171;
  background: rgba(248,113,113,0.1);
  border: 1px solid rgba(248,113,113,0.3);
  border-radius: 4px;
  padding: 8px 12px;
  text-align: center;
  font-weight: 500;
  animation: slideUp 0.18s ease;
}

.login-error.show { display: block; }

.login-support-action {
  background: none;
  border: none;
  color: #D9BA6A;
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  letter-spacing: 0.5px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.login-support-action:hover { color: #E8CE90; }
.login-support-action:focus-visible { outline: 2px solid #D9BA6A; outline-offset: 3px; border-radius: 4px; }

.btn-login {
  width: 100%;
  background: linear-gradient(135deg, #C9A84C 0%, #9A7A30 100%);
  color: #060C18;
  border: none;
  border-radius: var(--radius);
  padding: 14px;
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 3px;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(201,168,76,0.3);
  position: relative;
  overflow: hidden;
}

.btn-login::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.12), transparent);
  pointer-events: none;
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(201,168,76,0.4);
  background: linear-gradient(135deg, #D9BA6A 0%, #C9A84C 100%);
}

.btn-login:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.btn-login:active { transform: translateY(0); }

.login-footer {
  text-align: center;
  font-size: 10px;
  color: rgba(255,255,255,0.2);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 500;
  margin-top: 4px;
}

/* App hidden until authenticated */
#appWrapper {
  display: none;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

#appWrapper.unlocked { display: flex; }

/* ═══════════════════════════════════════════════════
   PASTE & GO MODE
═══════════════════════════════════════════════════ */
.paste-zone {
  background: var(--navy-800);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-lg);
  overflow: hidden;
  animation: slideUp 0.22s ease;
  flex-shrink: 0;
}

.paste-zone-header {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-500);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(201,168,76,0.04);
}

.paste-zone-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.paste-textarea {
  width: 100%;
  background: var(--navy-700);
  border: none;
  border-radius: 0;
  padding: 14px 16px;
  color: var(--white);
  font-size: 13px;
  font-family: var(--font-body);
  line-height: 1.6;
  resize: vertical;
  min-height: 120px;
  transition: all var(--transition);
}

.paste-textarea::placeholder { color: rgba(255,255,255,0.18); }
.paste-textarea:focus { outline: none; background: rgba(201,168,76,0.04); }

.mode-toggle {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--navy-700);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
}

.mode-btn {
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--gray-500);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
}

.mode-btn.active {
  background: var(--gold-glow);
  color: var(--gold-400);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius);
  margin: 2px;
}

.mode-btn:hover:not(.active) { color: var(--gray-300); }

.paste-hint {
  padding: 8px 16px;
  font-size: 11px;
  color: var(--gray-500);
  border-top: 1px solid rgba(255,255,255,0.04);
  background: rgba(0,0,0,0.1);
}
.paste-drag-overlay {
  position: absolute; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  border: 2px dashed var(--gold-500);
  border-radius: var(--radius-lg);
  background: rgba(201,168,76,0.08);
  color: var(--gold-400);
  font-family: var(--font-display);
  font-size: 18px; letter-spacing: 2px;
  pointer-events: none;
}
.paste-image-preview {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  background: rgba(201,168,76,0.04);
  border-top: 1px solid rgba(255,255,255,0.05);
}
.paste-image-preview img { max-height: 72px; max-width: 120px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.1); object-fit: contain; }
.paste-image-remove {
  padding: 4px 10px; border: 1px solid rgba(255,255,255,0.12); border-radius: 6px;
  background: transparent; color: var(--text-secondary); font-size: 11px; cursor: pointer;
  font-family: var(--font-body); transition: all var(--transition);
}
.paste-image-remove:hover { border-color: var(--red-border); color: var(--red-text); }
.paste-upload-btn {
  cursor: pointer; color: var(--gold-400); font-size: 11px; font-weight: 600;
  letter-spacing: 0.5px; white-space: nowrap; transition: color var(--transition);
}
.paste-upload-btn:hover { color: var(--gold-300); }
.paste-upload-btn input { display: none; }

/* ═══════════════════════════════════════════════════
   FULL PACKAGE OUTPUT SECTIONS
═══════════════════════════════════════════════════ */
.package-section {
  background: var(--navy-800);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-lg);
  overflow: hidden;
  animation: slideUp 0.22s ease;
}

.package-section-header {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-500);
  background: rgba(201,168,76,0.04);
  display: flex;
  align-items: center;
  gap: 6px;
}

.package-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  background: rgba(0,0,0,0.15);
  overflow-x: auto;
}

.pkg-tab {
  padding: 8px 16px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--gray-500);
  background: transparent;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
  border-bottom: 2px solid transparent;
}

.pkg-tab:hover { color: var(--gray-300); }
.pkg-tab.active { color: var(--gold-400); border-bottom-color: var(--gold-500); }

.pkg-content { display: none; }
.pkg-content.active { display: block; }

/* ═══════════════════════════════════════════════════
   COACHING LAUNCH SCREEN
═══════════════════════════════════════════════════ */
.launch-screen-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 550;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.launch-screen-bg.active { display: flex; }
.launch-screen {
  background: var(--navy-800);
  border: 1px solid var(--gold-border);
  border-radius: 12px;
  width: 440px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.launch-screen-top {
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  position: relative;
}
.launch-screen-title {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 2px;
  color: var(--white);
  margin-bottom: 4px;
}
.launch-screen-sub {
  font-size: 12px;
  color: var(--gray-500);
  letter-spacing: 0.5px;
  line-height: 1.5;
}
.launch-screen-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.launch-field-label {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--gray-300);
  margin-bottom: 6px;
}
.launch-field-input {
  width: 100%;
  background: var(--navy-900);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--white);
  font-family: var(--font-body);
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.launch-field-input:focus {
  outline: none;
  border-color: var(--gold-400);
}
.launch-field-input::placeholder { color: var(--gray-600); }
select.launch-field-input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.launch-channel-row {
  display: flex;
  gap: 8px;
}
.launch-channel-btn {
  flex: 1;
  padding: 10px 8px;
  background: var(--navy-900);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: var(--gray-400);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.launch-channel-btn:hover { border-color: rgba(255,255,255,0.25); color: var(--white); }
.launch-channel-btn.selected {
  border-color: var(--gold-400);
  background: rgba(201,168,76,0.1);
  color: var(--gold-400);
}
.launch-go-btn {
  width: 100%;
  padding: 14px;
  /* Was: gradient to undefined --gold-700 which degenerated to a washed-out flat.
     Now: same bright gradient pattern used elsewhere in this file, dark text,
     visible border so the button reads as "primary CTA" in both themes. */
  background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
  border: 1px solid var(--gold-500);
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #1A140A;                           /* dark text on gold for AA contrast in both themes */
  cursor: pointer;
  transition: all 0.15s;
  margin-top: 4px;
  box-shadow: 0 2px 8px rgba(201,168,76,0.25);
}
.launch-go-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--gold-500), var(--gold-600));
  box-shadow: 0 4px 14px rgba(201,168,76,0.4);
}
.launch-go-btn:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 1px 4px rgba(201,168,76,0.3);
}
.launch-go-btn:disabled {
  background: rgba(255,255,255,0.06);       /* clearly non-gold — reads as inactive */
  border-color: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.30);
  box-shadow: none;
  cursor: not-allowed;
}
html.light .launch-go-btn:disabled {
  background: rgba(0,0,0,0.05);
  border-color: rgba(0,0,0,0.10);
  color: rgba(0,0,0,0.35);
}

/* ═══════════════════════════════════════════════════
   CLICK-TO-COPY BADGE
═══════════════════════════════════════════════════ */
.output-card:hover {
  border-color: var(--gold-border);
}
.copy-badge {
  position: absolute;
  top: 8px;
  right: 10px;
  background: var(--green-bg);
  color: var(--green-text);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid var(--green-border);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 5;
}
.copy-badge.show { opacity: 1; }

.coaching-bubble {
  position: relative;
}
.coaching-bubble.clickable {
  cursor: pointer;
  transition: background 0.15s;
}
.coaching-bubble.clickable:hover {
  background: rgba(255,255,255,0.06);
}
.coaching-copy-badge {
  position: absolute;
  top: 6px;
  right: 8px;
  background: var(--green-bg);
  color: var(--green-text);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--green-border);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 5;
}
.coaching-copy-badge.show { opacity: 1; }

/* ═══════════════════════════════════════════════════
   LIVE COACHING MODE
═══════════════════════════════════════════════════ */
.coaching-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--navy-900);
  z-index: 500;
  flex-direction: column;
}

.coaching-overlay.active { display: flex; }

.coaching-header {
  background: var(--navy-800);
  border-bottom: 1px solid var(--gold-border);
  padding: 0 20px;
  height: 54px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  position: relative;
}

.coaching-title {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 2px;
  color: var(--white);
}

.coaching-subtitle {
  font-size: 12px;
  color: var(--gray-500);
  letter-spacing: 1px;
}

.coaching-close {
  margin-left: auto;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 6px 14px;
  color: var(--gray-300);
  font-size: 12px;
  font-weight: 500;
  transition: all var(--transition);
}

.coaching-close:hover { color: var(--red-text); border-color: var(--red-border); background: var(--red-bg); }

.coaching-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 340px;
  overflow: hidden;
  min-height: 0;
}

.coaching-thread {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.coaching-msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 85%;
}

.coaching-msg.customer { align-self: flex-start; }
.coaching-msg.coach { align-self: flex-end; }

.coaching-msg-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gray-500);
  padding: 0 4px;
}

.coaching-msg.customer .coaching-msg-label { color: var(--orange-text); }
.coaching-msg.coach .coaching-msg-label { color: var(--gold-500); text-align: right; }

.coaching-bubble {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 13.5px;
  line-height: 1.6;
  font-weight: 300;
  white-space: pre-wrap;
}

.coaching-msg.customer .coaching-bubble {
  background: rgba(200,100,20,0.1);
  border: 1px solid var(--orange-border);
  color: rgba(255,255,255,0.85);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 4px;
}

.coaching-msg.coach .coaching-bubble {
  background: var(--gold-glow);
  border: 1px solid var(--gold-border);
  color: rgba(255,255,255,0.9);
  border-radius: var(--radius-lg) var(--radius-lg) 4px var(--radius-lg);
}

.coaching-msg.coach .coaching-bubble.safe-v { border-left: 3px solid var(--green-text); }
.coaching-msg.coach .coaching-bubble.best-v { border-left: 3px solid var(--gold-400); }
.coaching-msg.coach .coaching-bubble.agg-v { border-left: 3px solid var(--red-text); }

/* ═══ Coaching Version Cards (separate Safe/Best/Agg) ═══ */
.coaching-version-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-top: 4px;
}
.coaching-version-card {
  position: relative;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  font-size: 13.5px;
  line-height: 1.6;
  font-weight: 300;
  white-space: pre-wrap;
  border: 1px solid;
  transition: all 0.15s ease;
}
.coaching-version-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.coaching-version-card:active {
  transform: translateY(0);
}
.coaching-version-card.version-safe {
  background: rgba(34,120,70,0.08);
  border-color: var(--green-border);
}
.coaching-version-card.version-best {
  background: linear-gradient(160deg, rgba(201,168,76,0.12), rgba(201,168,76,0.04));
  border-color: var(--gold-border);
  box-shadow: 0 0 20px rgba(201,168,76,0.08);
}
.coaching-version-card.version-agg {
  background: rgba(180,40,40,0.08);
  border-color: var(--red-border);
}
.coaching-version-label {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 2px;
  margin-bottom: 6px;
}
.coaching-version-card.version-safe .coaching-version-label { color: var(--green-text); }
.coaching-version-card.version-best .coaching-version-label { color: var(--gold-400); }
.coaching-version-card.version-agg .coaching-version-label { color: var(--red-text); }
.coaching-version-body {
  color: rgba(255,255,255,0.9);
}
.coaching-version-card .coaching-copy-badge {
  position: absolute;
  top: 8px;
  right: 10px;
  background: var(--green-bg);
  color: var(--green-text);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--green-border);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 5;
}
.coaching-version-card .coaching-copy-badge.show { opacity: 1; }
.coaching-extra-note {
  padding: 10px 14px;
  font-size: 12px;
  line-height: 1.5;
  color: rgba(255,255,255,0.6);
  border-left: 2px solid rgba(255,255,255,0.1);
  margin-top: 4px;
}

/* Light mode overrides for version cards */
html.light .coaching-version-body { color: #1A1410; }
html.light .coaching-version-card.version-safe { background: rgba(34,120,70,0.06); }
html.light .coaching-version-card.version-best { background: rgba(201,168,76,0.08); }
html.light .coaching-version-card.version-agg { background: rgba(180,40,40,0.06); }

.coaching-input-area {
  background: var(--navy-800);
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 16px 20px;
  flex-shrink: 0;
}

.coaching-input-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gray-500);
  margin-bottom: 8px;
}

.coaching-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.coaching-textarea {
  flex: 1;
  background: var(--navy-700);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--white);
  font-size: 14px;
  font-family: var(--font-body);
  line-height: 1.5;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  transition: border-color var(--transition);
}

.coaching-textarea:focus { outline: none; border-color: var(--gold-500); }
.coaching-textarea::placeholder { color: rgba(255,255,255,0.2); }

.btn-coach-send {
  background: linear-gradient(135deg, var(--gold-400), var(--gold-600));
  color: var(--navy-900);
  border-radius: var(--radius);
  padding: 10px 20px;
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 1px;
  white-space: nowrap;
  transition: all var(--transition);
  box-shadow: 0 2px 12px rgba(201,168,76,0.25);
}

.btn-coach-send:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(201,168,76,0.35); }
.btn-coach-send:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.coaching-sidebar {
  background: var(--navy-800);
  border-left: 1px solid rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.coaching-sidebar-header {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-500);
  background: rgba(201,168,76,0.04);
}

.coaching-ref {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}

.coaching-ref-section {
  margin-bottom: 16px;
}

.coaching-ref-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gold-600);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.coaching-ref-title::before {
  content: '';
  display: inline-block;
  width: 8px; height: 1px;
  background: var(--gold-600);
}

.coaching-ref-text {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  line-height: 1.6;
  font-weight: 300;
}

/* ═══════════════════════════════════════════════════
   OUTCOME REPORTING
═══════════════════════════════════════════════════ */
.outcome-section {
  background: var(--navy-800);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-lg);
  overflow: hidden;
  animation: slideUp 0.22s ease;
  flex-shrink: 0;
}

.outcome-header {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-500);
  background: rgba(201,168,76,0.04);
}

.outcome-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }

.outcome-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gray-300);
  margin-bottom: 8px;
}

.channel-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.channel-check {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--navy-700);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 6px 12px;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 12px;
  color: var(--gray-300);
  font-weight: 500;
  user-select: none;
}

.channel-check:hover { border-color: var(--gold-border); color: var(--gold-400); }
.channel-check.selected { background: var(--gold-glow); border-color: var(--gold-border); color: var(--gold-400); }
.channel-check input { display: none; }

.outcome-result {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.result-btn {
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  border: 1px solid rgba(255,255,255,0.08);
  background: var(--navy-700);
  color: var(--gray-300);
  cursor: pointer;
  transition: all var(--transition);
}

.result-btn:hover { border-color: rgba(255,255,255,0.2); color: var(--white); }
.result-btn.selected.reached { background: var(--green-bg); border-color: var(--green-border); color: var(--green-text); }
.result-btn.selected.voicemail { background: var(--gold-glow); border-color: var(--gold-border); color: var(--gold-400); }
.result-btn.selected.no-answer { background: var(--orange-bg); border-color: var(--orange-border); color: var(--orange-text); }
.result-btn.selected.appt { background: var(--green-bg); border-color: var(--green-border); color: var(--green-text); }
.result-btn.selected.objection { background: var(--red-bg); border-color: var(--red-border); color: var(--red-text); }

.btn-gen-note {
  background: linear-gradient(135deg, var(--gold-400), var(--gold-600));
  color: var(--navy-900);
  border-radius: var(--radius);
  padding: 11px 24px;
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 2px;
  transition: all var(--transition);
  box-shadow: 0 2px 12px rgba(201,168,76,0.25);
  width: 100%;
}

.btn-gen-note:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(201,168,76,0.35); }
.btn-gen-note:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.crm-note-box {
  background: var(--navy-700);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.7;
  color: rgba(255,255,255,0.85);
  font-family: var(--font-mono);
  white-space: pre-wrap;
  word-break: break-word;
}

.next-step-box {
  background: var(--green-bg);
  border: 1px solid var(--green-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--green-text);
  font-weight: 500;
}

.btn-start-coaching {
  background: transparent;
  border: 1px solid var(--gold-border);
  border-radius: var(--radius);
  padding: 8px 18px;
  color: var(--gold-400);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: all var(--transition);
  margin-left: auto;
}

.btn-start-coaching:hover { background: var(--gold-glow); }

/* ═══════════════════════════════════════════════════
   FEEDBACK BUTTON & MODAL
═══════════════════════════════════════════════════ */
.feedback-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: calc(100% - 24px);
  margin: 0 12px 12px;
  background: var(--navy-700);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}
.feedback-btn:hover { background: var(--gold-glow); border-color: var(--gold-500); }

/* ── Permanent Live Coaching nav button ── */
.nav-coaching-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: calc(100% - 24px);
  margin: 0 12px 8px;
  background: linear-gradient(135deg, rgba(201,168,76,0.18), rgba(201,168,76,0.08));
  border: 1px solid var(--gold-border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--gold-400);
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}
.nav-coaching-btn:hover {
  background: linear-gradient(135deg, rgba(201,168,76,0.28), rgba(201,168,76,0.14));
  border-color: var(--gold-500);
  box-shadow: 0 0 16px rgba(201,168,76,0.15);
}
.nav-leaderboard-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: calc(100% - 24px); margin: 0 12px 8px;
  background: rgba(201,168,76,0.06);
  border: 1px solid rgba(201,168,76,0.15);
  border-radius: 8px; padding: 10px 12px;
  color: var(--gold-400); font-family: var(--font-display);
  font-size: 13px; letter-spacing: 2px; cursor: pointer;
  transition: all var(--transition); flex-shrink: 0;
}
.nav-leaderboard-btn:hover {
  background: rgba(201,168,76,0.14); border-color: var(--gold-border);
}
/* ── History Nav Button ── */
.nav-history-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: calc(100% - 24px); margin: 0 12px 8px;
  background: rgba(201,168,76,0.06);
  border: 1px solid rgba(201,168,76,0.15);
  border-radius: 8px; padding: 10px 12px;
  color: var(--gold-400); font-family: var(--font-display);
  font-size: 13px; letter-spacing: 2px; cursor: pointer;
  transition: all var(--transition); flex-shrink: 0;
}
.nav-history-btn:hover {
  background: rgba(201,168,76,0.14); border-color: var(--gold-border);
}

/* ── History Panel Overlay ── */
.history-overlay {
  position: fixed; inset: 0; z-index: 9998;
  background: rgba(0,0,0,0.6); display: none;
  align-items: flex-start; justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
}
.history-overlay.active { display: flex; }
.history-modal {
  background: var(--bg-panel, #0D1525);
  border: 1px solid var(--gold-border, rgba(201,168,76,0.25));
  border-radius: 14px;
  width: 100%; max-width: 720px;
  max-height: 85vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: fadeIn 0.2s ease;
}
.history-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.history-title {
  font-family: var(--font-display, 'Bebas Neue', sans-serif);
  font-size: 20px; letter-spacing: 2px; color: var(--gold-400, #D9BA6A);
}
.history-close {
  background: none; border: none; color: rgba(255,255,255,0.4);
  font-size: 20px; cursor: pointer; padding: 4px; line-height: 1;
}
.history-close:hover { color: #fff; }
.history-controls {
  display: flex; gap: 8px; padding: 12px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0; flex-wrap: wrap;
}
.history-filter {
  background: var(--bg-panel-2, #131E30); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px; padding: 7px 10px; color: var(--text-primary, #F0EDE8);
  font-size: 12px; font-family: var(--font-body, 'DM Sans', sans-serif);
  outline: none; cursor: pointer;
}
.history-filter:focus { border-color: rgba(201,168,76,0.4); }
.history-search {
  flex: 1; min-width: 140px;
  background: var(--bg-panel-2, #131E30); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px; padding: 7px 10px; color: var(--text-primary, #F0EDE8);
  font-size: 12px; font-family: var(--font-body, 'DM Sans', sans-serif);
  outline: none;
}
.history-search::placeholder { color: rgba(255,255,255,0.3); }
.history-search:focus { border-color: rgba(201,168,76,0.4); }
.history-list {
  flex: 1; overflow-y: auto; padding: 8px 0;
  min-height: 120px;
}
.history-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; cursor: pointer;
  transition: background 0.12s ease;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.history-row:hover { background: rgba(255,255,255,0.04); }
.history-row-icon {
  flex-shrink: 0; width: auto;
}
.history-module-pill {
  display: inline-block;
  background: rgba(201,168,76,0.12); border: 1px solid rgba(201,168,76,0.25);
  border-radius: 3px; padding: 2px 6px;
  font-size: 9px; font-weight: 700; letter-spacing: 0.8px;
  text-transform: uppercase; color: var(--gold-400, #D9BA6A);
  font-family: var(--font-mono, 'DM Mono', monospace);
  white-space: nowrap;
}
.history-row-body { flex: 1; min-width: 0; }
.history-row-title {
  font-size: 13px; font-weight: 500; color: var(--text-primary, #F0EDE8);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.history-row-meta {
  font-size: 11px; color: var(--text-muted, #7A7268); margin-top: 2px;
}
.history-row-actions {
  display: flex; gap: 6px; opacity: 0; transition: opacity 0.15s;
  flex-shrink: 0;
}
.history-row:hover .history-row-actions { opacity: 1; }
.history-row-btn {
  background: none; border: 1px solid rgba(255,255,255,0.1); border-radius: 4px;
  color: var(--text-muted, #7A7268); font-size: 11px; padding: 3px 8px;
  cursor: pointer; transition: all 0.12s;
}
.history-row-btn:hover { border-color: rgba(201,168,76,0.4); color: var(--gold-400, #D9BA6A); }
.history-row-btn.delete:hover { border-color: #EF4444; color: #EF4444; }
.history-empty {
  text-align: center; padding: 40px 20px;
  color: var(--text-muted, #7A7268); font-size: 13px; line-height: 1.6;
}
.history-load-more {
  display: block; width: calc(100% - 40px); margin: 8px 20px 12px;
  background: rgba(201,168,76,0.08); border: 1px solid rgba(201,168,76,0.2);
  border-radius: 6px; padding: 10px; color: var(--gold-400, #D9BA6A);
  font-size: 12px; font-weight: 500; cursor: pointer; text-align: center;
  transition: all 0.12s;
}
.history-load-more:hover { background: rgba(201,168,76,0.14); }
.history-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px; border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.history-archived-toggle {
  display: flex; align-items: center; gap: 6px; font-size: 11px;
  color: var(--text-muted, #7A7268); cursor: pointer; user-select: none;
}
.history-archived-toggle input { width: 14px; height: 14px; accent-color: var(--gold-500, #C9A84C); cursor: pointer; }

/* ── History Detail Modal ── */
.history-detail-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.7); display: none;
  align-items: flex-start; justify-content: center;
  padding: 24px 16px; overflow-y: auto;
}
.history-detail-overlay.active { display: flex; }
.history-detail-modal {
  background: var(--bg-panel, #0D1525);
  border: 1px solid var(--gold-border, rgba(201,168,76,0.25));
  border-radius: 14px; width: 100%; max-width: 680px;
  max-height: 85vh; display: flex; flex-direction: column;
  overflow: hidden; animation: fadeIn 0.2s ease;
}
.history-detail-header {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.history-detail-badge {
  background: rgba(201,168,76,0.12); border: 1px solid rgba(201,168,76,0.25);
  border-radius: 4px; padding: 3px 8px; font-size: 10px; font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase; color: var(--gold-400, #D9BA6A);
  flex-shrink: 0;
}
.history-detail-title {
  font-size: 15px; font-weight: 600; color: var(--text-primary, #F0EDE8);
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.history-detail-time {
  font-size: 11px; color: var(--text-muted, #7A7268); flex-shrink: 0;
}
.history-detail-body {
  flex: 1; overflow-y: auto; padding: 16px 20px;
}
.history-msg {
  margin-bottom: 12px; padding: 10px 14px; border-radius: 10px;
  font-size: 13px; line-height: 1.6; white-space: pre-wrap;
}
.history-msg.user {
  background: rgba(201,168,76,0.1); border: 1px solid rgba(201,168,76,0.2);
  color: var(--gold-400, #D9BA6A); border-bottom-right-radius: 4px;
  margin-left: 24px;
}
.history-msg.assistant {
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06);
  color: var(--text-primary, #F0EDE8); border-bottom-left-radius: 4px;
  margin-right: 24px;
}
.history-msg-label {
  font-size: 10px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase;
  color: var(--text-muted, #7A7268); margin-bottom: 4px;
}
.history-detail-output {
  margin-top: 16px; padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.history-detail-output-label {
  font-size: 10px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase;
  color: var(--gold-400, #D9BA6A); margin-bottom: 8px;
}
.history-detail-footer {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 20px; border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.history-detail-footer button {
  padding: 8px 16px; border-radius: 6px; font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all 0.12s; font-family: var(--font-body, 'DM Sans', sans-serif);
}

.leaderboard-overlay {
  position: fixed; inset: 0; z-index: 9998;
  background: rgba(0,0,0,0.6); display: none;
  align-items: center; justify-content: center;
}
.leaderboard-overlay.active { display: flex; }
.leaderboard-modal {
  background: var(--bg-panel); border: 1px solid var(--gold-border);
  border-radius: 12px; width: 90%; max-width: 520px; max-height: 80vh;
  overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 12px 48px rgba(0,0,0,0.5);
}
.leaderboard-modal-header {
  padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex; align-items: center; justify-content: space-between;
}
.leaderboard-modal-title {
  font-family: var(--font-display); font-size: 18px;
  letter-spacing: 2px; color: var(--gold-400);
}
.leaderboard-modal-body { flex: 1; overflow-y: auto; padding: 12px 16px; }

/* ── Cold-start context modal ── */
.coldstart-modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 400;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.coldstart-modal-bg.active { display: flex; }

.coldstart-modal {
  background: var(--navy-800);
  border: 1px solid var(--gold-border);
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  overflow: hidden;
  animation: loginAppear 0.25s cubic-bezier(0.34,1.56,0.64,1);
  box-shadow: 0 24px 64px rgba(0,0,0,0.7), 0 0 40px rgba(201,168,76,0.08);
}

.coldstart-top {
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(201,168,76,0.04);
}

.coldstart-title {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 2px;
  color: var(--white);
  margin-bottom: 4px;
}

.coldstart-sub {
  font-size: 12px;
  color: var(--gray-500);
  letter-spacing: 0.5px;
}

.coldstart-body {
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.coldstart-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-600);
  margin-bottom: 2px;
}

.coldstart-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.coldstart-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--navy-700);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
  color: var(--white);
}
.coldstart-opt:hover {
  border-color: var(--gold-border);
  background: var(--gold-glow);
}
.coldstart-opt-icon { font-size: 20px; flex-shrink: 0; }
.coldstart-opt-text { display: flex; flex-direction: column; gap: 2px; }
.coldstart-opt-name { font-size: 13px; font-weight: 600; color: var(--white); }
.coldstart-opt-desc { font-size: 11px; color: var(--gray-500); }

.feedback-modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.feedback-modal-bg.active { display: flex; }

.feedback-modal {
  background: var(--navy-800);
  border: 1px solid var(--gold-border);
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  overflow: hidden;
  animation: loginAppear 0.3s cubic-bezier(0.34,1.56,0.64,1);
  box-shadow: 0 24px 64px rgba(0,0,0,0.6), 0 0 40px rgba(201,168,76,0.08);
}

.feedback-modal-top {
  padding: 18px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(201,168,76,0.04);
}

.feedback-modal-title {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 2px;
  color: var(--white);
}

.feedback-modal-subtitle {
  font-size: 11px;
  color: var(--gray-500);
  letter-spacing: 1px;
  margin-top: 2px;
}

.feedback-modal-close {
  background: transparent;
  border: none;
  color: var(--gray-500);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  transition: color var(--transition);
  line-height: 1;
}
.feedback-modal-close:hover { color: var(--white); }

.feedback-modal-body {
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.feedback-type-row {
  display: flex;
  gap: 8px;
}

.feedback-type-btn {
  flex: 1;
  padding: 9px 6px;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.08);
  background: var(--navy-700);
  color: var(--gray-300);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}
.feedback-type-btn:hover { border-color: var(--gold-border); color: var(--gold-400); }
.feedback-type-btn.selected { background: var(--gold-glow); border-color: var(--gold-border); color: var(--gold-400); }

.feedback-submit {
  width: 100%;
  background: linear-gradient(135deg, var(--gold-400), var(--gold-600));
  color: var(--navy-900);
  border-radius: var(--radius);
  padding: 12px;
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 2px;
  transition: all var(--transition);
  box-shadow: 0 2px 12px rgba(201,168,76,0.25);
}
.feedback-submit:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(201,168,76,0.35); }
.feedback-submit:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.feedback-structured {
  display: none;
  background: var(--navy-700);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.7;
  color: rgba(255,255,255,0.85);
  white-space: pre-wrap;
  font-family: var(--font-body);
}

.feedback-stage-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-600);
  margin-bottom: 6px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PRINTABLE SCRIPT — reps film Covideo holding a paper script. The print view
   is a real DOM overlay (not a popup) so it can't be blocked, and @media print
   hides the entire app so only the sheets reach the page. Always light: black
   ink on white, teleprompter-sized type, one tier per page.
   ═══════════════════════════════════════════════════════════════════════════ */
.btn-print {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(201,168,76,0.10);
  border: 1px solid rgba(201,168,76,0.30);
  border-radius: 4px;
  padding: 5px 10px;
  color: var(--gold-400);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-print:hover { background: rgba(201,168,76,0.20); color: var(--gold-300, #E4CE8A); }

#printOverlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #FFFFFF;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
#printOverlay.show { display: block; }

/* On-screen control bar — never printed. */
.print-toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: #F4F2ED;
  border-bottom: 1px solid #D8D3C6;
}
.print-toolbar button {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 9px 16px;
  border-radius: 5px;
  cursor: pointer;
  border: 1px solid #B9AE93;
}
.print-btn-primary { background: #1A1410; color: #F3E6C0; border: 1px solid #1A1410; }
.print-btn-primary:hover { background: #2A2018; }
.print-btn-secondary { background: #FFFFFF; color: #1A1410; border: 1px solid #B9AE93; }
.print-btn-secondary:hover { background: #EFEBE0; }
.print-toolbar-hint {
  margin-left: auto;
  font-size: 11.5px;
  color: #6B6355;
  letter-spacing: 0.3px;
}

/* The sheets themselves live inside #printFrame, an isolated same-origin
   iframe. Their styling is PRINT_SHEET_CSS in the script below — one source of
   truth for both the on-screen preview and the paper output, so the two can
   never drift apart. */
#printFrame {
  display: block;
  width: 100%;
  height: calc(100vh - 58px);
  border: 0;
  background: #FFFFFF;
}

/* NOTE: there are deliberately NO @media print rules for the app document.
   Printing renders into an isolated same-origin IFRAME (see PRINT_SHEET_CSS in
   the script below), so the app document is never involved in a print job. That
   is what makes Ctrl+P anywhere in the app harmless, and it means printing can
   never touch navigation, history, or the rep's session. */
.no-print { }
