/* ============================================================
   ProofBox - Legal Tech / Executive Noir Design System
   Dual-mode: Dark (default) + Light (parchment)
   Fonts: Playfair Display (headings) + Plus Jakarta Sans (UI) + JetBrains Mono (code)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,600;0,700;0,800;1,600;1,700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ============================================================
   CSS CUSTOM PROPERTIES - DARK MODE (DEFAULT)
   ============================================================ */

:root,
[data-theme="dark"] {
  /* Backgrounds */
  --bg-base:       #0D1117;   /* near-black ink */
  --bg-raised:     #161C26;   /* slightly lighter */
  --bg-elevated:   #1E293B;   /* card / panel surface */
  --bg-surface:    #243044;   /* interactive surface */
  --bg-hover:      #2C3B52;   /* hover state */
  --bg-active:     #1A3557;   /* selected / active */

  /* Borders */
  --border-faint:  rgba(255, 255, 255, 0.04);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-muted:  rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.20);

  /* Text */
  --text-primary:   #EDE9DF;  /* warm off-white - easy on eyes */
  --text-secondary: #9BAFC5;  /* muted blue-grey */
  --text-muted:     #5A7394;  /* very muted */
  --text-faint:     #3A5068;  /* barely visible */

  /* Brand - Teal (from logo) */
  --teal-700:  #1A7A6E;
  --teal-600:  #24897C;
  --teal-500:  #2A9D8F;
  --teal-400:  #38B2A3;
  --teal-300:  #52C9BA;
  --teal-100:  rgba(42, 157, 143, 0.12);
  --teal-glow: rgba(42, 157, 143, 0.25);

  /* Amber - Financial Values */
  --amber-700: #A07833;
  --amber-600: #C49A42;
  --amber-500: #D4A853;
  --amber-400: #E2BE77;
  --amber-300: #F0D49A;
  --amber-100: rgba(212, 168, 83, 0.12);
  --amber-glow: rgba(212, 168, 83, 0.20);

  /* Emerald - Verified / Success */
  --emerald-600: #059669;
  --emerald-500: #10B981;
  --emerald-400: #34D399;
  --emerald-100: rgba(16, 185, 129, 0.12);

  /* Rose - Danger / Deductions */
  --rose-600:  #DC2626;
  --rose-500:  #EF4444;
  --rose-400:  #F87171;
  --rose-100:  rgba(239, 68, 68, 0.12);

  /* Slate - Neutrals */
  --slate-800: #1E293B;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748B;
  --slate-400: #94A3B8;
  --slate-300: #CBD5E1;

  /* Semantic shortcuts */
  --accent:        var(--teal-500);
  --accent-hover:  var(--teal-400);
  --accent-bg:     var(--teal-100);
  --accent-border: rgba(42, 157, 143, 0.30);

  --financial:     var(--amber-500);
  --financial-bg:  var(--amber-100);
  --financial-border: rgba(212, 168, 83, 0.30);

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.4);
  --shadow-lg:  0 10px 32px rgba(0,0,0,0.6), 0 4px 8px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 20px var(--teal-glow);
}

/* ============================================================
   CSS CUSTOM PROPERTIES - LIGHT MODE (PARCHMENT)
   ============================================================ */

[data-theme="light"] {
  /* Backgrounds - warm parchment palette */
  --bg-base:       #F4EFE6;   /* warm parchment */
  --bg-raised:     #FAF7F2;   /* lighter parchment */
  --bg-elevated:   #FFFFFF;   /* white card */
  --bg-surface:    #F7F3EC;   /* slight warmth */
  --bg-hover:      #EDE8DF;   /* hover */
  --bg-active:     #E0F2EF;   /* active / selected */

  /* Borders */
  --border-faint:  rgba(0, 0, 0, 0.04);
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-muted:  rgba(0, 0, 0, 0.12);
  --border-strong: rgba(0, 0, 0, 0.20);

  /* Text */
  --text-primary:   #1C2B3A;  /* deep charcoal */
  --text-secondary: #4B5E72;  /* muted slate */
  --text-muted:     #7A92A8;  /* light muted */
  --text-faint:     #A8BBC8;

  /* Brand stays consistent */
  --teal-600:  #1A7A6E;
  --teal-500:  #1E8C7E;
  --teal-400:  #2A9D8F;
  --teal-100:  rgba(26, 122, 110, 0.10);
  --teal-glow: rgba(26, 122, 110, 0.20);

  --amber-600: #9B7228;
  --amber-500: #B8892A;
  --amber-400: #C49A42;
  --amber-100: rgba(184, 137, 42, 0.10);
  --amber-glow: rgba(184, 137, 42, 0.15);

  --emerald-600: #047857;
  --emerald-500: #059669;
  --emerald-400: #10B981;
  --emerald-100: rgba(5, 150, 105, 0.10);

  --rose-500:  #DC2626;
  --rose-100:  rgba(220, 38, 38, 0.10);

  --accent:        var(--teal-500);
  --accent-hover:  var(--teal-600);
  --accent-bg:     var(--teal-100);
  --accent-border: rgba(26, 122, 110, 0.25);

  --financial:     var(--amber-500);
  --financial-bg:  var(--amber-100);
  --financial-border: rgba(184, 137, 42, 0.25);

  /* Shadows - lighter for parchment */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.10), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.10), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg:  0 10px 32px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06);
  --shadow-glow: 0 0 16px var(--teal-glow);
}

/* ============================================================
   BASE RESET & TYPOGRAPHY
   ============================================================ */

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg-base);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
}

/* Heading font: authoritative serif */
h1, h2, h3, .font-serif, .heading-serif {
  font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
}

/* Monospace: legal codes, hashes, bates */
code, pre, .font-mono,
[class*="bates"], [class*="hash"], [class*="sha"] {
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace !important;
  font-variant-numeric: tabular-nums;
}

::selection {
  background: var(--accent-bg);
  color: var(--text-primary);
}

/* ============================================================
   THEME TRANSITION - smooth on toggle
   ============================================================ */

body, header, aside, .surface-card, .sidebar-nav-item,
.btn-primary, .btn-secondary, .btn-ghost, .form-input,
.toast-item {
  transition: background-color 0.25s ease, color 0.25s ease,
              border-color 0.25s ease, box-shadow 0.25s ease;
}

/* ============================================================
   TAILWIND OVERRIDE - global bg/text to CSS vars
   ============================================================ */

.bg-white    { background-color: var(--bg-elevated) !important; }
.bg-slate-50 { background-color: var(--bg-raised) !important; }
.bg-slate-100{ background-color: var(--bg-surface) !important; }
.text-slate-900 { color: var(--text-primary) !important; }
.text-slate-800 { color: var(--text-primary) !important; }
.text-slate-700 { color: var(--text-secondary) !important; }
.text-slate-600 { color: var(--text-secondary) !important; }
.text-slate-500 { color: var(--text-muted) !important; }
.text-slate-400 { color: var(--text-faint) !important; }
.border-slate-200 { border-color: var(--border-subtle) !important; }
.border-slate-100 { border-color: var(--border-faint) !important; }
.border-slate-300 { border-color: var(--border-muted) !important; }

/* Override Tailwind blue to brand teal */
.bg-blue-600, .bg-brand-600 { background-color: var(--accent) !important; }
.bg-blue-50, .bg-brand-50   { background-color: var(--accent-bg) !important; }
.text-blue-600, .text-blue-700 { color: var(--accent) !important; }
.text-blue-600              { color: var(--accent) !important; }
.border-blue-600            { border-color: var(--accent-border) !important; }
.border-b-2.border-blue-600 { border-bottom-color: var(--accent) !important; }

/* Financial amber overrides */
.text-amber-600, .text-amber-700 { color: var(--financial) !important; }
.bg-amber-50                     { background-color: var(--financial-bg) !important; }

/* Emerald overrides */
.text-emerald-600, .text-emerald-700 { color: var(--emerald-500) !important; }
.bg-emerald-50                       { background-color: var(--emerald-100) !important; }

/* Rose overrides */
.text-rose-600   { color: var(--rose-400) !important; }
.bg-rose-50      { background-color: var(--rose-100) !important; }

/* ============================================================
   SCROLLBARS
   ============================================================ */

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-muted); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ============================================================
   TOP LOADING PROGRESS BAR
   ============================================================ */

#topLoadingProgress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--teal-300));
  z-index: 9999;
  transition: width 0.25s ease, opacity 0.3s ease;
  width: 0%;
  box-shadow: 0 0 8px var(--teal-glow);
}

/* ============================================================
   LOGO
   ============================================================ */

.proofbox-logo {
  height: 28px;
  width: auto;
  display: block;
}

.proofbox-logo-sm {
  height: 22px;
  width: auto;
  display: block;
}

[data-theme="dark"] .logo-on-dark  { display: block; }
[data-theme="dark"] .logo-on-light { display: none; }
[data-theme="light"] .logo-on-dark { display: none; }
[data-theme="light"] .logo-on-light { display: block; }

/* ============================================================
   BUTTONS
   ============================================================ */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: var(--accent);
  color: #ffffff;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.5rem 1.125rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  cursor: pointer;
  letter-spacing: 0.01em;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4), 0 0 0 1px var(--accent-border);
  transition: all 0.15s ease;
}
.btn-primary:hover {
  background-color: var(--accent-hover);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4), 0 0 12px var(--teal-glow);
}
.btn-primary:active { transform: translateY(1px); }

/* Alias for legacy class names in HTML */
.btn-primary-action { @extend .btn-primary; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: var(--bg-surface);
  color: var(--text-secondary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 500;
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-secondary:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.btn-secondary:active { transform: translateY(1px); }
.btn-secondary-action { @extend .btn-secondary; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: transparent;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-ghost:hover {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: var(--rose-100);
  color: var(--rose-400);
  font-weight: 500;
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(239, 68, 68, 0.25);
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-danger:hover {
  background-color: rgba(239, 68, 68, 0.20);
  border-color: rgba(239, 68, 68, 0.40);
}

/* ============================================================
   CARDS & SURFACES
   ============================================================ */

.surface-card {
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.surface-card-hover:hover {
  border-color: var(--border-muted);
  box-shadow: var(--shadow-md);
}

/* Parchment-like document surface for legal documents */
.document-surface {
  background: linear-gradient(145deg, var(--bg-elevated), var(--bg-surface));
  border: 1px solid var(--border-muted);
  border-radius: 0.5rem;
  box-shadow: var(--shadow-md);
}

/* ============================================================
   HEADER & SIDEBAR
   ============================================================ */

header {
  background-color: var(--bg-raised) !important;
  border-bottom-color: var(--border-subtle) !important;
}

aside {
  background-color: var(--bg-raised) !important;
  border-right-color: var(--border-subtle) !important;
}

/* Sub-header meta bar */
.meta-status-bar {
  background-color: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
}

#subHeaderStatusBar {
  background-color: var(--bg-elevated) !important;
  border-bottom: 1px solid var(--border-subtle) !important;
}

/* ============================================================
   EVIDENTIARY READINESS CHECKLIST (High-Contrast Theme-Safe)
   ============================================================ */

.readiness-item {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.5rem;
  transition: all 0.15s ease;
}

[data-theme="dark"] .readiness-item.satisfied {
  background-color: rgba(42, 157, 143, 0.12) !important;
  border: 1px solid rgba(42, 157, 143, 0.35) !important;
}

[data-theme="dark"] .readiness-item.satisfied .readiness-title {
  color: #EDE9DF !important;
  font-weight: 700;
}

[data-theme="dark"] .readiness-item.satisfied .readiness-desc {
  color: #9BAFC5 !important;
}

[data-theme="dark"] .readiness-item.satisfied .readiness-badge {
  background-color: rgba(42, 157, 143, 0.25) !important;
  color: #52C9BA !important;
  border: 1px solid rgba(42, 157, 143, 0.45) !important;
}

[data-theme="dark"] .readiness-item.missing {
  background-color: rgba(30, 41, 59, 0.6) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

[data-theme="dark"] .readiness-item.missing .readiness-title {
  color: #CBD5E1 !important;
  font-weight: 600;
}

[data-theme="dark"] .readiness-item.missing .readiness-desc {
  color: #64748B !important;
}

[data-theme="dark"] .readiness-item.missing .readiness-badge {
  background-color: rgba(255, 255, 255, 0.06) !important;
  color: #94A3B8 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

/* Light Theme (Parchment) */
[data-theme="light"] .readiness-item.satisfied {
  background-color: #ECFDF5 !important;
  border: 1px solid #A7F3D0 !important;
}

[data-theme="light"] .readiness-item.satisfied .readiness-title {
  color: #064E3B !important;
  font-weight: 700;
}

[data-theme="light"] .readiness-item.satisfied .readiness-desc {
  color: #047857 !important;
}

[data-theme="light"] .readiness-item.satisfied .readiness-badge {
  background-color: #D1FAE5 !important;
  color: #065F46 !important;
  border: 1px solid #6EE7B7 !important;
}

[data-theme="light"] .readiness-item.missing {
  background-color: #F8FAFC !important;
  border: 1px solid #E2E8F0 !important;
}

[data-theme="light"] .readiness-item.missing .readiness-title {
  color: #334155 !important;
  font-weight: 600;
}

[data-theme="light"] .readiness-item.missing .readiness-desc {
  color: #64748B !important;
}

[data-theme="light"] .readiness-item.missing .readiness-badge {
  background-color: #F1F5F9 !important;
  color: #475569 !important;
  border: 1px solid #CBD5E1 !important;
}

/* ============================================================
   SIDEBAR NAVIGATION
   ============================================================ */

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}
.sidebar-nav-item:hover {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-faint);
}
.sidebar-nav-item.active {
  background-color: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
  border-color: var(--accent-border);
}
.sidebar-nav-item.active i {
  color: var(--accent);
}

/* Section labels */
.sidebar-section-label {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 0.5rem 0.75rem 0.25rem;
  font-family: 'JetBrains Mono', monospace;
}

/* ============================================================
   BADGES & TAGS
   ============================================================ */

.bates-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.1875rem 0.5rem;
  border-radius: 0.25rem;
  background-color: var(--accent-bg);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.emerald-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.1875rem 0.5rem;
  border-radius: 9999px;
  background-color: var(--emerald-100);
  color: var(--emerald-400);
  border: 1px solid rgba(52, 211, 153, 0.25);
}

.blue-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.1875rem 0.5rem;
  border-radius: 9999px;
  background-color: var(--accent-bg);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.amber-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.1875rem 0.5rem;
  border-radius: 9999px;
  background-color: var(--financial-bg);
  color: var(--financial);
  border: 1px solid var(--financial-border);
}

.slate-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.1875rem 0.5rem;
  border-radius: 9999px;
  background-color: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-muted);
}

.category-pill {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 0.375rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background-color: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

/* Financial value display - amber tone */
.financial-value {
  font-family: 'JetBrains Mono', monospace;
  color: var(--financial);
  font-weight: 700;
}

/* SHA hash display */
.hash-display {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.625rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  background: var(--bg-surface);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  border: 1px solid var(--border-faint);
}

/* ============================================================
   FORMS
   ============================================================ */

.form-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: 'JetBrains Mono', monospace;
}

.form-input {
  width: 100%;
  padding: 0.5625rem 0.875rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-muted);
  border-radius: 0.5rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.form-input:focus {
  outline: none;
  background-color: var(--bg-elevated);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.form-input::placeholder { color: var(--text-faint); }
.form-input option { background-color: var(--bg-elevated); color: var(--text-primary); }

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%235A7394'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
  padding-right: 2.5rem;
}

textarea.form-input { resize: vertical; min-height: 80px; line-height: 1.6; }

/* ============================================================
   TIMELINE
   ============================================================ */

.timeline-container { position: relative; }
.timeline-container::before {
  content: '';
  position: absolute;
  top: 1rem; bottom: 1rem;
  left: 7.75rem;
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--border-muted), transparent);
  z-index: 0;
}
@media (max-width: 640px) {
  .timeline-container::before { left: 1.25rem; }
}

.timeline-node {
  position: relative;
  z-index: 1;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 9999px;
  background-color: var(--bg-elevated);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  box-shadow: 0 0 8px var(--teal-glow), 0 0 0 4px var(--bg-base);
}

/* ============================================================
   AUTH OVERLAY
   ============================================================ */

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background-color: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* Auth card */
.auth-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-muted);
  border-radius: 1rem;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  overflow: hidden;
}

/* ============================================================
   SPINNER & LOADERS
   ============================================================ */

.spinner {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--border-muted);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */

#toastContainer {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background-color: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-muted);
  padding: 0.75rem 1rem;
  border-radius: 0.625rem;
  box-shadow: var(--shadow-lg);
  font-size: 0.8125rem;
  font-weight: 500;
  min-width: 280px;
  max-width: 400px;
  animation: toastSlideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast-item.success { border-left: 3px solid var(--emerald-500); }
.toast-item.error   { border-left: 3px solid var(--rose-500); }
.toast-item.info    { border-left: 3px solid var(--accent); }
.toast-item.warning { border-left: 3px solid var(--financial); }

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(16px) scale(0.96); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

/* ============================================================
   LANDING PAGE
   ============================================================ */

.landing-hero {
  background: var(--bg-base);
  position: relative;
  overflow: hidden;
}

/* Subtle mesh gradient background for hero */
.landing-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 20% 30%, rgba(42,157,143,0.07) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 80% 70%, rgba(212,168,83,0.05) 0%, transparent 70%);
  pointer-events: none;
}

.landing-section {
  padding: 5rem 1.5rem;
}

.landing-nav {
  background-color: rgba(13, 17, 23, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-faint);
}

[data-theme="light"] .landing-nav {
  background-color: rgba(250, 247, 242, 0.95);
  border-bottom-color: var(--border-subtle);
}

/* Feature grid card on landing */
.landing-feature-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  padding: 1.5rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.landing-feature-card:hover {
  border-color: var(--accent-border);
  box-shadow: 0 0 20px var(--teal-glow);
  transform: translateY(-2px);
}

/* Step card (How It Works) */
.step-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  padding: 1.75rem;
  position: relative;
}
.step-number {
  font-family: 'Playfair Display', serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent-border);
  line-height: 1;
  position: absolute;
  top: 1rem;
  right: 1.25rem;
}

/* Case study card */
.case-study-card {
  background: linear-gradient(135deg, var(--bg-elevated), var(--bg-surface));
  border: 1px solid var(--border-muted);
  border-radius: 1rem;
  overflow: hidden;
  position: relative;
}
.case-study-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--teal-300));
}

/* Pricing card */
.pricing-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 1rem;
  padding: 2rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.pricing-card.featured {
  background: linear-gradient(145deg, var(--bg-elevated), var(--bg-surface));
  border-color: var(--accent-border);
  box-shadow: 0 0 24px var(--teal-glow);
  position: relative;
}
.pricing-card.featured::before {
  content: 'MOST POPULAR';
  position: absolute;
  top: -1px; left: 50%; transform: translateX(-50%);
  background: var(--accent);
  color: white;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 0.1875rem 0.875rem;
  border-radius: 0 0 0.375rem 0.375rem;
}

/* Pricing price number */
.pricing-amount {
  font-family: 'Playfair Display', serif;
  font-size: 3rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}
.pricing-currency {
  font-family: 'JetBrains Mono', monospace;
  color: var(--financial);
  font-size: 1.25rem;
  font-weight: 600;
  vertical-align: super;
}

/* Trust pill */
.trust-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  padding: 0.375rem 0.875rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}
.trust-pill-dot {
  width: 0.5rem; height: 0.5rem;
  border-radius: 50%;
  background: var(--emerald-500);
  flex-shrink: 0;
}

/* ============================================================
   DEMO MODE BANNER
   ============================================================ */

#demoModeBanner {
  background-color: #78350F !important;
  color: #FEF3C7 !important;
  border-bottom: 1px solid rgba(245, 158, 11, 0.4) !important;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#demoModeBanner span,
#demoModeBanner i {
  color: #FEF3C7 !important;
}

#demoModeBanner button {
  background-color: #F59E0B !important;
  color: #451A03 !important;
  font-weight: 700;
  border: none;
}

#demoModeBanner button:hover {
  background-color: #FBBF24 !important;
}

/* ============================================================
   WORKSPACE VIEWS
   ============================================================ */

#mainContent {
  background-color: var(--bg-base);
}

/* View section containers */
.view-section {
  min-height: 100%;
}

/* Dashboard metric cards */
.metric-tile {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 0.625rem;
  padding: 1rem 1.25rem;
  transition: border-color 0.15s ease;
}
.metric-tile:hover { border-color: var(--border-muted); }

.metric-value {
  font-family: 'Playfair Display', serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}
.metric-value.financial { color: var(--financial); }
.metric-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.25rem;
}

/* Readiness progress bar */
.readiness-bar {
  height: 3px;
  background: var(--border-subtle);
  border-radius: 9999px;
  overflow: hidden;
}
.readiness-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--teal-300));
  border-radius: 9999px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 6px var(--teal-glow);
}

/* Checklist pillar item */
.pillar-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-faint);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.pillar-item.satisfied {
  background: rgba(42, 157, 143, 0.06);
  border-color: var(--accent-border);
}
.pillar-icon {
  width: 1.5rem; height: 1.5rem;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: var(--bg-surface);
  color: var(--text-faint);
}
.pillar-item.satisfied .pillar-icon {
  background: var(--accent-bg);
  color: var(--accent);
}

/* Recent Stream items */
#dashRecentStream .surface-card {
  background-color: var(--bg-surface) !important;
  border-color: var(--border-subtle) !important;
}

#dashRecentStream .surface-card:hover {
  background-color: var(--bg-hover) !important;
  border-color: var(--border-muted) !important;
}

#dashRecentStream .surface-card .text-slate-800 {
  color: var(--text-primary) !important;
}

#dashRecentStream .surface-card .text-slate-500 {
  color: var(--text-secondary) !important;
}

/* Timeline item */
.timeline-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  padding: 1rem;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.timeline-item:hover {
  border-color: var(--border-muted);
  box-shadow: var(--shadow-sm);
}
.timeline-item:hover .timeline-item-bates {
  color: var(--accent);
}

/* Vault item row */
.vault-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-faint);
  transition: background-color 0.12s ease;
  cursor: pointer;
}
.vault-item:hover { background-color: var(--bg-hover); }
.vault-item:last-child { border-bottom: none; }

/* Exhibit detail drawer */
.detail-drawer {
  background: var(--bg-elevated);
  border-left: 1px solid var(--border-subtle);
}
.drawer-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

/* Audit ledger row */
.audit-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-faint);
  font-size: 0.8125rem;
}
.audit-row:last-child { border-bottom: none; }
.audit-hash {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.5625rem;
  color: var(--text-faint);
  margin-top: 0.125rem;
}

/* Claims ledger */
.claim-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border-subtle);
  border-radius: 0.5rem;
  background: var(--bg-elevated);
  transition: border-color 0.12s ease;
}
.claim-row:hover { border-color: var(--border-muted); }
.claim-amount {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: var(--financial);
}
.claim-amount.deduction { color: var(--rose-400); }

/* Formal demand letter */
.formal-demand-letter {
  background: var(--bg-elevated);
  border: 1px solid var(--border-muted);
  border-radius: 0.5rem;
  padding: 2.5rem;
  font-size: 0.875rem;
  line-height: 1.75;
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  position: relative;
}
.demand-watermark {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(-30deg);
  font-family: 'Playfair Display', serif;
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--border-faint);
  pointer-events: none;
  white-space: nowrap;
  letter-spacing: 0.1em;
  z-index: 0;
}
.formal-demand-letter > * { position: relative; z-index: 1; }
.demand-letter-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  margin: 1rem 0;
}
.demand-letter-table th {
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 0.625rem;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-muted);
  text-align: left;
}
.demand-letter-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-faint);
  color: var(--text-primary);
}

/* ============================================================
   MODALS
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background-color: rgba(13, 17, 23, 0.80);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-muted);
  border-radius: 1rem;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
}

/* ============================================================
   THEME TOGGLE BUTTON
   ============================================================ */

#themeToggleBtn {
  width: 2rem; height: 2rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
#themeToggleBtn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-muted);
}

/* Sun icon visible in dark mode, moon icon in light */
[data-theme="dark"]  #iconSun  { display: none; }
[data-theme="dark"]  #iconMoon { display: block; }
[data-theme="light"] #iconSun  { display: block; }
[data-theme="light"] #iconMoon { display: none; }

/* ============================================================
   INGEST / UPLOAD ZONE
   ============================================================ */

.upload-zone {
  border: 2px dashed var(--border-muted);
  border-radius: 0.75rem;
  padding: 2rem;
  text-align: center;
  background: var(--bg-surface);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-bg);
}

/* Ingest method card */
.ingest-method-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}
.ingest-method-card:hover {
  border-color: var(--accent-border);
  background: var(--accent-bg);
}
.ingest-method-card.active {
  border-color: var(--accent);
  background: var(--accent-bg);
  box-shadow: 0 0 12px var(--teal-glow);
}

/* ============================================================
   DROPDOWN MENUS
   ============================================================ */

.dropdown-menu {
  background: var(--bg-elevated);
  border: 1px solid var(--border-muted);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-lg);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.12s ease;
  font-weight: 500;
}
.dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ============================================================
   EMPTY STATES
   ============================================================ */

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--bg-elevated);
  border: 2px dashed var(--border-muted);
  border-radius: 0.75rem;
}
.empty-state-icon {
  width: 3rem; height: 3rem;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: var(--bg-surface);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

/* ============================================================
   GAP ANALYSIS
   ============================================================ */

.gap-item {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 1rem;
  border: 1px solid var(--border-subtle);
  border-radius: 0.625rem;
  background: var(--bg-elevated);
  transition: border-color 0.15s ease;
}
.gap-item.gap-satisfied {
  border-color: var(--accent-border);
  background: rgba(42, 157, 143, 0.05);
}
.gap-item.gap-missing {
  border-color: rgba(212, 168, 83, 0.25);
  background: rgba(212, 168, 83, 0.04);
}

/* ============================================================
   USER AVATAR
   ============================================================ */

.user-avatar {
  width: 1.875rem; height: 1.875rem;
  border-radius: 50%;
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.6875rem;
  text-transform: uppercase;
  font-family: 'JetBrains Mono', monospace;
}

/* ============================================================
   LEGAL DISCLAIMER FOOTER
   ============================================================ */

.legal-disclaimer {
  background: var(--bg-raised);
  border-top: 1px solid var(--border-faint);
  color: var(--text-faint);
  font-size: 0.6875rem;
  line-height: 1.6;
  padding: 1rem 1.5rem;
}

/* ============================================================
   PROGRESS INDICATORS
   ============================================================ */

.progress-bar-track {
  height: 4px;
  background: var(--border-subtle);
  border-radius: 9999px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--teal-300) 100%);
  border-radius: 9999px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 6px var(--teal-glow);
}

/* ============================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================ */

@media (max-width: 768px) {
  .landing-section { padding: 2.5rem 1rem; }
  .formal-demand-letter { padding: 1.25rem 1rem; font-size: 0.8125rem; }
  .demand-watermark { font-size: 2rem; }
  
  /* Timeline responsive alignment */
  .timeline-container::before {
    left: 1rem;
  }
  
  .timeline-node {
    width: 1.5rem;
    height: 1.5rem;
  }

  /* Make tables horizontally scrollable if needed */
  .table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Modal scaling for small touch screens */
  .modal-card, .auth-card {
    max-width: calc(100vw - 1.5rem);
    margin: 0.75rem auto;
  }

  /* Button touch target optimization */
  .btn-primary, .btn-secondary, .sidebar-nav-item {
    min-height: 2.5rem;
  }
}

@media (max-width: 480px) {
  .metric-value {
    font-size: 1.35rem;
  }
  
  .trust-pill {
    font-size: 0.6875rem;
    padding: 0.25rem 0.5rem;
  }
}

/* ============================================================
   TAILWIND COMPATIBILITY PATCH
   (Re-maps Tailwind classes used in HTML to theme-aware equivalents)
   ============================================================ */

/* Body background already overridden via var(--bg-base) on body */

/* Input autofill override for browsers */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text-primary);
  -webkit-box-shadow: 0 0 0 30px var(--bg-surface) inset !important;
  transition: background-color 5000s ease-in-out 0s;
}

/* Hover states for Tailwind classes we can't replace */
.hover\:bg-slate-100:hover { background-color: var(--bg-surface) !important; }
.hover\:bg-slate-50:hover  { background-color: var(--bg-hover) !important; }
.hover\:text-slate-900:hover { color: var(--text-primary) !important; }
.hover\:border-slate-300:hover { border-color: var(--border-muted) !important; }

/* Sidebar bg */
.bg-slate-50\/50 { background-color: rgba(36, 48, 68, 0.5) !important; }
[data-theme="light"] .bg-slate-50\/50 { background-color: rgba(247, 243, 236, 0.5) !important; }

/* Connection indicator dot */
.bg-emerald-500 { background-color: var(--emerald-500) !important; }
