/* ============================================
   PIVOTRESET DARK MODE
   ============================================ */
@media (prefers-color-scheme: dark) {

  /* === BASE === */
  :root {
    --white: #1a2332;
    --cream: #0f1419;
    --warm: #1e2a3a;
    --navy: #e2e8f0;
    --text: #cbd5e1;
    --text-light: #94a3b8;
    --text-muted: #64748b;
    --border: #2d3748;
    --card: #1a2332;
  }

  /* BODY: token-driven via :root --pr-surface now (see index.html).
     This rule used to hard-set background:#0f1419, which fought the
     token. We leave only the legacy text color fallback for interior
     pages that don't use --pr-text. */
  body {
    color: #cbd5e1;
  }

  /* === NAV === */
  /* Background is now token-driven via --pr-surface-inverse in index.html.
     This rule used to force background:#0b1120 (too dark, didn't match the
     closing CTA banner). Border color stays here because it's not duplicated
     in the inline styles. */
  .nav {
    border-bottom-color: #1e293b !important;
  }
  .nav-inner { border-color: #1e293b !important; }
  .nav-links a, .nav-dd > span { color: #94a3b8 !important; }
  .nav-links a:hover, .nav-dd > span:hover { color: #e2e8f0 !important; background: rgba(255,255,255,.05) !important; }
  .nav-dd-menu, .fc-dd-panel {
    background: #1a2332 !important;
    border-color: #2d3748 !important;
    box-shadow: 0 8px 30px rgba(0,0,0,.5) !important;
  }
  .nav-dd-menu a, .fc-dd-panel a { color: #cbd5e1 !important; }
  .nav-dd-menu a:hover, .fc-dd-panel a:hover { background: rgba(255,255,255,.05) !important; }

  /* === HERO (already dark navy — minimal changes) === */
  .hero { background: #0b1120 !important; }
  .calc-hero { background: #0b1120 !important; }

  /* === CONTENT BODY === */
  .content-body, .bp-body, article, main {
    color: #cbd5e1 !important;
  }
  .content-body h2, .content-body h3,
  .bp-section h2, .bp-section h3 {
    color: #e2e8f0 !important;
  }
  .content-body p, .bp-section p {
    color: #94a3b8 !important;
  }
  .content-body blockquote {
    background: #1e2a3a !important;
    border-left-color: #e8772e !important;
    color: #94a3b8 !important;
  }
  .content-body a { color: #f59e0b !important; }

  /* === PAGE GRID & SIDEBAR === */
  .page-grid { color: #cbd5e1; }
  .sidebar-card {
    background: #1a2332 !important;
    border-color: #2d3748 !important;
  }
  .sidebar-card h4 { color: #e2e8f0 !important; }
  .sidebar-card a { color: #f59e0b !important; }

  /* === CARDS & CONTAINERS === */
  .calc-box, .calc-container, .results-box, .results-panel {
    background: #1a2332 !important;
    border-color: #2d3748 !important;
    color: #cbd5e1 !important;
  }
  .calc-box h2, .calc-container h2 { color: #e2e8f0 !important; }

  /* === TOC === */
  .toc {
    background: #1a2332 !important;
    border-color: #2d3748 !important;
  }
  .toc h4, .toc h3 { color: #e2e8f0 !important; }
  .toc a { color: #94a3b8 !important; }
  .toc a:hover { color: #e8772e !important; }

  /* === TABLES === */
  .bp-table th { background: #1e293b !important; }
  .bp-table td { border-color: #2d3748 !important; color: #94a3b8 !important; }
  .bp-table tr:nth-child(even) { background: rgba(255,255,255,.02) !important; }

  /* === BENCHMARK PAGES === */
  .bp-hero { background: #1a2332 !important; }
  .bp-hero h1 { color: #e2e8f0 !important; }
  .bp-hero-sub { color: #94a3b8 !important; }
  .bp-stat-card {
    background: #1a2332 !important;
    border-color: #2d3748 !important;
  }
  .bp-where {
    background: #1a2332 !important;
    border-color: #2d3748 !important;
  }
  .bp-where h3 { color: #e2e8f0 !important; }
  .bp-callout {
    background: rgba(232,119,46,.08) !important;
    color: #94a3b8 !important;
  }
  .bp-bar-track { background: #2d3748 !important; }

  /* === FORMS === */
  input, select, textarea {
    background: #0f1720 !important;
    color: #e2e8f0 !important;
    border-color: #374151 !important;
  }
  input:focus, select:focus, textarea:focus {
    border-color: #e8772e !important;
  }
  label { color: #94a3b8 !important; }

  /* === INLINE STYLE OVERRIDES (catches hardcoded backgrounds) === */
  [style*="background:#fff"],
  [style*="background: #fff"],
  [style*="background:#ffffff"],
  [style*="background:white"] {
    background: #1a2332 !important;
  }

  [style*="background:#fefcf9"],
  [style*="background:#faf6f1"],
  [style*="background:var(--cream)"],
  [style*="background:var(--warm)"] {
    background: #0f1419 !important;
  }

  [style*="background:#fefcf9;border"],
  [style*="background:#faf6f1;border"] {
    border-color: #2d3748 !important;
  }

  [style*="color:#0e2d42"],
  [style*="color:#154360"],
  [style*="color: #0e2d42"] {
    color: #e2e8f0 !important;
  }

  [style*="color:#2d3748"],
  [style*="color: #2d3748"] {
    color: #cbd5e1 !important;
  }

  [style*="color:#6b7280"],
  [style*="color: #6b7280"] {
    color: #94a3b8 !important;
  }

  [style*="color:#9ca3af"],
  [style*="color: #9ca3af"] {
    color: #64748b !important;
  }

  [style*="border:1px solid #e8e4df"],
  [style*="border:1.5px solid #e8e4df"],
  [style*="border:2px solid #e8e4df"] {
    border-color: #2d3748 !important;
  }

  [style*="border-bottom:1px solid #f0ece6"],
  [style*="border-bottom:1px solid #e8e4df"],
  [style*="border-top:1px solid #e8e4df"],
  [style*="border-top:1px solid #f0ece6"] {
    border-color: #2d3748 !important;
  }

  /* === FOOTER (already dark navy — keep but adjust text) === */
  footer { background: #0b1120 !important; }

  /* === NEWSLETTER SECTION (already dark navy — keep) === */

  /* === FAQ === */
  .faq-q { color: #e2e8f0 !important; }
  .faq-a { color: #94a3b8 !important; }

  /* === AI HELP WIDGET === */
  .ai-help-panel {
    background: #1a2332 !important;
    border-color: #2d3748 !important;
  }
  .ai-msg.bot { background: #1e2a3a !important; color: #cbd5e1 !important; }

  /* === RECOVERY PATH === */
  .pb-step {
    background: #1a2332 !important;
    border-color: #2d3748 !important;
  }
  .pb-step-title { color: #e2e8f0 !important; }
  .pb-step-desc { color: #94a3b8 !important; }
  .pb-phase-header { color: #e2e8f0 !important; }

  /* === RECOVERY SCORE === */
  .rs-step { color: #cbd5e1 !important; }
  .rs-opt {
    background: #1a2332 !important;
    border-color: #2d3748 !important;
    color: #cbd5e1 !important;
  }
  .rs-opt:hover { border-color: #e8772e !important; }

  /* === PRICING === */
  .price-card {
    background: #1a2332 !important;
    border-color: #2d3748 !important;
  }

  /* === COMPARISON PAGES === */
  .vs-card {
    background: #1a2332 !important;
    border-color: #2d3748 !important;
  }

  /* === CTA BANNERS (cream bg with orange) === */
  .cta-banner {
    background: #1e2a3a !important;
  }

  /* === STRONG/BOLD inside content === */
  .content-body strong,
  .bp-section strong,
  article strong {
    color: #e2e8f0 !important;
  }

  /* === SCROLL & SELECTION === */
  ::selection {
    background: rgba(232,119,46,.3);
    color: #fff;
  }
  ::-webkit-scrollbar { width: 8px; }
  ::-webkit-scrollbar-track { background: #0f1419; }
  ::-webkit-scrollbar-thumb { background: #374151; border-radius: 4px; }

  /* === SCENARIO PLANNER (already has .sc-wrap rules) === */
  .sc-wrap {
    background: #1a2332 !important;
    border-color: #2d3748 !important;
  }
  .sc-wrap label, .sc-wrap h3 { color: #e2e8f0 !important; }
  .sc-wrap p { color: #94a3b8 !important; }
  .sc-res { background: #0f1720 !important; }

  /* === PRINT — force light for printing === */
  @media print {
    body { background: #fff !important; color: #000 !important; }
  }
}

