/* Shared theme control; light mode keeps the existing page palette. */
.theme-toggle { display:inline-grid; place-items:center; flex:none; width:34px; height:34px; padding:0; border:1px solid var(--line); border-radius:50%; color:var(--ink-soft); background:transparent; cursor:pointer; }
.theme-toggle:hover { color:var(--accent); background:var(--blue-soft); }
.theme-toggle svg { display:block; width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.topbar .theme-toggle { width:32px; height:32px; }
.lp-nav .theme-toggle { width:36px; height:36px; border-color:#e3e8ef; color:#515662; }
.auth-entry-actions { display:flex; align-items:center; gap:12px; }

:root[data-theme="dark"] {
  color-scheme:dark;
  --paper:#0e141e;
  --paper-light:#151e2b;
  --ink:#edf3fb;
  --ink-soft:#bbc8d9;
  --ink-muted:#94a5bb;
  --line:#2b394b;
  --line-strong:#8297b3;
  --accent:#70a8ff;
  --accent-dark:#91bbff;
  --positive:#5bcfa7;
  --warning:#e4b36b;
  --negative:#ff8192;
  --blue-soft:#1a2b45;
  --nav:#0b111b;
  --chart-border:#304258;
  --chart-label:#a9bad0;
  --chart-blue:#83b2ff;
}
[data-theme="dark"] body { background:var(--paper); color:var(--ink); }
[data-theme="dark"] .rosetta-shortcut { background:#1b293a; border-color:#3c5068; box-shadow:0 8px 28px #0006; }
[data-theme="dark"] .rosetta-shortcut[data-status="dormant"] { background:#202936; border-color:#3b4757; }
[data-theme="dark"] .rosetta-shortcut-dot { border-color:#1b293a; }
[data-theme="dark"] .rosetta-mini { background:#182535; border-color:#3b5068; box-shadow:0 20px 64px #0009; }
[data-theme="dark"] .app-shell:not(.landing-shell) { background:var(--paper); }
[data-theme="dark"] a { color:var(--accent-dark); }
[data-theme="dark"] .button:not(.primary), [data-theme="dark"] .icon-button, [data-theme="dark"] .field,
[data-theme="dark"] input, [data-theme="dark"] textarea, [data-theme="dark"] select { background:var(--paper-light); color:var(--ink); border-color:var(--line); }
[data-theme="dark"] .button.primary, [data-theme="dark"] .lp-button:not(.lp-button-outline) { background:#2468c8; border-color:#2468c8; color:#fff; }
[data-theme="dark"] .button.subtle, [data-theme="dark"] .text-button { background:transparent; color:var(--accent-dark); }
[data-theme="dark"] .field::placeholder, [data-theme="dark"] input::placeholder, [data-theme="dark"] textarea::placeholder { color:#8293a9; }
[data-theme="dark"] .button:hover:not(.primary), [data-theme="dark"] .icon-button:hover { background:var(--blue-soft); color:var(--accent-dark); }
[data-theme="dark"] .chip, [data-theme="dark"] .pill, [data-theme="dark"] .status-chip { background:#24344a; color:#c9dcf8; border-color:#3c5270; }
[data-theme="dark"] .chip:is(.stale,.warning,.partial,.limited) { background:#423421; color:#f2ce90; border-color:#73583b; }
[data-theme="dark"] .chip:is(.available,.validated,.covered) { background:#1d3b35; color:#94dfc3; border-color:#37695b; }
[data-theme="dark"] .chip:is(.invalid,.failed) { background:#492b37; color:#ffb5c0; border-color:#805261; }
[data-theme="dark"] .toast { color:var(--ink); background:#263b58; border-color:#49617f; }
[data-theme="dark"] .modal { background:var(--paper-light); color:var(--ink); }
[data-theme="dark"] .auth-story, [data-theme="dark"] .auth-story h1,
[data-theme="dark"] .auth-story .brand { color:var(--ink); }

/* Persistent workspace navigation and all major working surfaces. */
[data-theme="dark"] .workspace-nav, [data-theme="dark"] .chapter-nav { background:rgba(14,20,30,.96); }
[data-theme="dark"] .workspace-nav .brand, [data-theme="dark"] .workspace-nav .nav-item.active,
[data-theme="dark"] .workspace-nav .nav-item:hover, [data-theme="dark"] .account-link { color:var(--ink); }
[data-theme="dark"] .topbar, [data-theme="dark"] .card { background:transparent; }
[data-theme="dark"] .data-context > div, [data-theme="dark"] .holding-panel, [data-theme="dark"] .account-aside,
[data-theme="dark"] .onboarding-options article, [data-theme="dark"] .plan-use-cases article,
[data-theme="dark"] .review-priorities article, [data-theme="dark"] .entry-preview,
[data-theme="dark"] .rosetta-welcome, [data-theme="dark"] .testbed-selection-note { background:#182231; border-color:var(--line); color:var(--ink-soft); }
[data-theme="dark"] .onboarding-options article:last-child { background:#1b2532; }
[data-theme="dark"] .signal-atlas, [data-theme="dark"] .exposure-lens, [data-theme="dark"] .viz-readout,
[data-theme="dark"] .single-range, [data-theme="dark"] .rank-scenario, [data-theme="dark"] .analysis-details,
[data-theme="dark"] .workbench-viz .visual-section { background:#151e2b; border-color:var(--chart-border); }
[data-theme="dark"] .atlas-plot, [data-theme="dark"] .network-stage, [data-theme="dark"] .exposure-lens .network-stage,
[data-theme="dark"] .overview-intro { background:#192536; border-color:var(--chart-border); }
[data-theme="dark"] .exposure-lens .viz-readout { background:transparent; border-top-color:var(--line); }
[data-theme="dark"] .network-controls, [data-theme="dark"] .exposure-lens .network-controls,
[data-theme="dark"] .range-axis, [data-theme="dark"] .viz-segment { background:#202d3e; border-color:var(--line); }
[data-theme="dark"] .exposure-lens .network-controls strong, [data-theme="dark"] .shift-summary,
[data-theme="dark"] .forecast-purpose, [data-theme="dark"] .range-row.is-selected { background:#263c5c; border-color:#365477; color:#d7e7ff; }
[data-theme="dark"] .exposure-lens .network-controls input { background:linear-gradient(to right,#83b2ff var(--strength),#45576c var(--strength)); }
[data-theme="dark"] .exposure-lens .network-controls input::-webkit-slider-thumb { border-color:#1c293b; background:#83b2ff; }
[data-theme="dark"] .exposure-lens .network-controls input::-moz-range-thumb { border-color:#1c293b; background:#83b2ff; }
[data-theme="dark"] .network-strength-scale, [data-theme="dark"] .exposure-lens #networkEdgeCount,
[data-theme="dark"] .network-empty { color:var(--ink-muted); }
[data-theme="dark"] .viz-segment button[aria-pressed="true"] { background:#385171; color:#fff; }
[data-theme="dark"] .viz-segment button:hover:not([aria-pressed="true"]),
[data-theme="dark"] .range-row:hover { background:#2b405a; }
[data-theme="dark"] .data-table th { background:#1b2838; color:var(--ink-soft); }
[data-theme="dark"] .data-table tbody tr:hover, [data-theme="dark"] .data-table tbody tr.selected { background:#223650; }
[data-theme="dark"] .plan-table td:last-child, [data-theme="dark"] .plan-table thead th:last-child { background:#26394f; color:var(--ink); border-color:#40546c; }
[data-theme="dark"] .withheld-card { background:#30291f; }
[data-theme="dark"] .review-priorities p, [data-theme="dark"] .onboarding-options p,
[data-theme="dark"] .plan-use-cases p, [data-theme="dark"] .entry-preview p,
[data-theme="dark"] .entry-import p { color:var(--ink-soft); }
[data-theme="dark"] .advanced-price-chart { background:#151e2b; border-color:var(--chart-border); }
[data-theme="dark"] .coverage-bar { background:#33455a; }
[data-theme="dark"] .driver-track { background:#33455a; }
[data-theme="dark"] .allocation-slice, [data-theme="dark"] .allocation-slice:nth-child(n) { border-right-color:#151e2b; color:var(--stock-ink,#fff); }
[data-theme="dark"] .allocation-key small { color:var(--ink-muted); }

/* Recolour hard-coded chart labels and strokes without flattening data series. */
[data-theme="dark"] .forecast-purpose strong, [data-theme="dark"] .forecast-reading strong,
[data-theme="dark"] .forecast-reading > summary, [data-theme="dark"] .viz-facts dd,
[data-theme="dark"] .connection-readout strong, [data-theme="dark"] .allocation-key button,
[data-theme="dark"] .exposure-lens .network-controls label, [data-theme="dark"] .network-guidance strong,
[data-theme="dark"] .network-readout-head > strong, [data-theme="dark"] .network-forecast-details > summary { color:var(--ink); }
[data-theme="dark"] .forecast-purpose p, [data-theme="dark"] .forecast-reading p,
[data-theme="dark"] .network-readout-head small, [data-theme="dark"] .rosetta-welcome p,
[data-theme="dark"] .rosetta-welcome-note { color:var(--ink-soft); }
[data-theme="dark"] .viz-facts dt, [data-theme="dark"] .viz-legend { color:var(--ink-muted); }
[data-theme="dark"] .viz-facts > div, [data-theme="dark"] .connection-readout > div,
[data-theme="dark"] .allocation-key button, [data-theme="dark"] .network-forecast-details,
[data-theme="dark"] .exposure-lens .viz-legend { border-color:var(--line); }
[data-theme="dark"] .viz-grid, [data-theme="dark"] .shift-axis { stroke:#34465c; border-color:#34465c; }
[data-theme="dark"] .viz-zero { stroke:#8296ad; }
[data-theme="dark"] .atlas-label { fill:var(--ink); stroke:#192536; stroke-width:3px; }
[data-theme="dark"] .range-band { stroke:#304a6c; stroke-width:10px; }
[data-theme="dark"] .range-line, [data-theme="dark"] .range-row.is-selected .range-line { stroke:#70a3f3; }
[data-theme="dark"] .range-cap, [data-theme="dark"] .range-row.is-selected .range-cap { stroke:#8bb5f3; }
[data-theme="dark"] .range-median { fill:#70a3f3; stroke:#182535; }
[data-theme="dark"] .range-value, [data-theme="dark"] .range-row.is-selected .range-value { fill:var(--ink-soft); stroke:none; }
[data-theme="dark"] .viz-tick, [data-theme="dark"] .viz-axis-label,
[data-theme="dark"] .exposure-lens .network-ticker, [data-theme="dark"] .exposure-lens .network-company,
[data-theme="dark"] .exposure-lens .is-selected .network-company { fill:var(--ink-soft); }
[data-theme="dark"] .exposure-lens .network-weight { fill:var(--ink-muted); }
[data-theme="dark"] .exposure-lens .network-link { stroke:#83b2ff; opacity:.6; }
[data-theme="dark"] .exposure-lens .network-link.inverse { stroke:#d391c0; }
[data-theme="dark"] .exposure-lens .network-company { stroke:#192536; }
[data-theme="dark"] .exposure-lens .viz-mark > .network-core,
[data-theme="dark"] .exposure-lens .viz-mark.is-selected > .network-core { stroke:none; fill-opacity:.18; }
[data-theme="dark"] .exposure-lens .viz-mark:is(.is-selected,:hover,:focus-visible) > .network-core { fill-opacity:.3; }
[data-theme="dark"] .viz-mark.held > circle, [data-theme="dark"] .viz-mark.is-selected > circle { stroke:#151e2b; }
[data-theme="dark"] .viz-legend .legend-dot.unavailable { background:#192536; }
[data-theme="dark"] .history-controls label, [data-theme="dark"] .history-period,
[data-theme="dark"] .history-message, [data-theme="dark"] .history-summary small,
[data-theme="dark"] .history-summary span, [data-theme="dark"] .history-crosshair,
[data-theme="dark"] .history-attribution, [data-theme="dark"] .history-method,
[data-theme="dark"] .history-defaults { color:var(--ink-soft); }
[data-theme="dark"] .history-method summary, [data-theme="dark"] .history-settings > summary { color:var(--ink); }
[data-theme="dark"] .history-settings { border-color:var(--line); }

/* Rosetta's stylesheet is loaded on demand, after this file. */
[data-theme="dark"] .assistant-page .assistant-install, [data-theme="dark"] .assistant-page [data-assistant-form],
[data-theme="dark"] .assistant-page .assistant-result { background:#182535; border-color:var(--line); }
[data-theme="dark"] .assistant-page .assistant-activity { background:#202f43; border-color:#34475e; }
[data-theme="dark"] .assistant-page .assistant-answer-surface, [data-theme="dark"] .assistant-page .assistant-fact,
[data-theme="dark"] .assistant-page .assistant-source { background:#172231; border-color:#34475e; }
[data-theme="dark"] .assistant-page .assistant-answer-state { background:#2b405a; color:#d1e1f7; }
[data-theme="dark"] .assistant-page .assistant-steps li { color:#a7b8cd; border-color:#496077; }
[data-theme="dark"] .assistant-page .assistant-steps li[data-state="active"] { color:#a5caff; border-color:#70a8ff; }
[data-theme="dark"] .assistant-page .assistant-steps li[data-state="done"] { color:#80dab8; border-color:#5bcfa7; }
[data-theme="dark"] .assistant-page .assistant-model-choice p, [data-theme="dark"] .assistant-page .assistant-download-details,
[data-theme="dark"] .assistant-page .assistant-fact pre, [data-theme="dark"] .assistant-page .assistant-fact dt,
[data-theme="dark"] .assistant-page .assistant-source small, [data-theme="dark"] .assistant-page .assistant-licences,
[data-theme="dark"] .assistant-page [data-assistant-status], [data-theme="dark"] .assistant-page .assistant-activity-help,
[data-theme="dark"] .assistant-page .assistant-answer-placeholder, [data-theme="dark"] .assistant-page .assistant-answer-placeholder strong,
[data-theme="dark"] .assistant-page .assistant-activity-heading [data-assistant-elapsed] { color:var(--ink-soft); }
[data-theme="dark"] .assistant-page .assistant-source a, [data-theme="dark"] .assistant-page [data-assistant-answer] a { color:var(--accent-dark); }

/* Public landing page uses the same tones, with the model story still distinct. */
[data-theme="dark"] .landing-shell { --lp-ink:#eef3fa; --lp-soft:#b6c3d5; --lp-blue:#8ab9ff; color:var(--lp-ink); background:#0e141e; }
[data-theme="dark"] .lp-nav { background:rgba(14,20,30,.9); border-color:var(--line); }
[data-theme="dark"] .lp-brand, [data-theme="dark"] .lp-nav nav a, [data-theme="dark"] .lp-signin { color:var(--lp-ink); }
[data-theme="dark"] .lp-nav .theme-toggle { border-color:var(--line); color:var(--lp-ink); }
[data-theme="dark"] .lp-hero, [data-theme="dark"] .lp-final-cta { background:#0e141e; }
[data-theme="dark"] .lp-hero .lp-eyebrow, [data-theme="dark"] .lp-rosetta-trust,
[data-theme="dark"] .lp-rosetta-proof, [data-theme="dark"] .lp-workflow span { color:#a9c6f0; }
[data-theme="dark"] .landing-shell .lp-caption, [data-theme="dark"] .landing-shell .lp-stage-note,
[data-theme="dark"] .landing-shell .lp-audience-note { color:var(--lp-soft); }
[data-theme="dark"] .lp-feature-panel, [data-theme="dark"] .lp-audience-card,
[data-theme="dark"] .lp-plans, [data-theme="dark"] .lp-rosetta-companion { background:#192536; }
[data-theme="dark"] .lp-plan, [data-theme="dark"] .lp-plan-pro,
[data-theme="dark"] .lp-range-art, [data-theme="dark"] .lp-history-art,
[data-theme="dark"] .lp-connection-art, [data-theme="dark"] .lp-rosetta-prompts { background:#202d3e; border-color:var(--line); }
[data-theme="dark"] .lp-pill, [data-theme="dark"] .lp-connection-orbit,
[data-theme="dark"] .lp-connection-orbit span, [data-theme="dark"] .lp-history-periods b,
[data-theme="dark"] .lp-feature-tabs button[aria-selected=true] { background:#2b4060; border-color:#41628e; color:#cfe1ff; }
[data-theme="dark"] .lp-feature-tabs button, [data-theme="dark"] .lp-feature-tabs button span,
[data-theme="dark"] .lp-feature-tabs button[aria-selected=true] span { color:var(--lp-soft); }
[data-theme="dark"] .lp-investor-art { background:#263b55; }
[data-theme="dark"] .lp-investor-art > span, [data-theme="dark"] .lp-investor-art > b { color:#c3d9fc; }
[data-theme="dark"] .lp-plan h3 > span, [data-theme="dark"] .lp-plan > p:not(.lp-eyebrow),
[data-theme="dark"] .lp-plan ul, [data-theme="dark"] .lp-plan small,
[data-theme="dark"] .lp-rosetta-character p, [data-theme="dark"] .lp-rosetta-principles p,
[data-theme="dark"] .lp-rosetta-prompts p, [data-theme="dark"] .lp-workflow p,
[data-theme="dark"] .lp-footer > p, [data-theme="dark"] .lp-footer a:not(.lp-brand) { color:var(--lp-soft); }
[data-theme="dark"] .lp-rosetta-prompts > span, [data-theme="dark"] .lp-rosetta-principles article > span,
[data-theme="dark"] .lp-section-heading .lp-eyebrow, [data-theme="dark"] .lp-faq .lp-eyebrow,
[data-theme="dark"] .lp-evidence .lp-eyebrow { color:#a4b4ca; }
[data-theme="dark"] .lp-rosetta-principles, [data-theme="dark"] .lp-workflow article,
[data-theme="dark"] .lp-evidence, [data-theme="dark"] .lp-faq-list details,
[data-theme="dark"] .lp-footer-bottom, [data-theme="dark"] .lp-evidence-tags span { border-color:var(--line); }
[data-theme="dark"] .lp-evidence-tags span { color:var(--lp-soft); }
[data-theme="dark"] .lp-button-outline { background:transparent; border-color:#5276a8; color:#b4d0fa; }
[data-theme="dark"] .lp-button-light { background:#e6efff; border-color:#e6efff; color:#19273c; }
[data-theme="dark"] .lp-device { background:#1b2838; border-color:#41516a; box-shadow:0 20px 60px #0004; }
[data-theme="dark"] .lp-device-bar { background:#1b2838; border-color:var(--line); color:var(--lp-soft); }
[data-theme="dark"] .lp-preview-tag, [data-theme="dark"] .lp-art-top small,
[data-theme="dark"] .lp-range-row b, [data-theme="dark"] .lp-range-art > p,
[data-theme="dark"] .lp-plan .lp-eyebrow { color:#b4c4d8; }
[data-theme="dark"] .lp-workspace-preview { background:#182231; filter:invert(.88) hue-rotate(180deg); }
[data-theme="dark"] .lp-hero-visual-glow { background:radial-gradient(ellipse at 58% 45%,#17478688 0%,#16407444 35%,transparent 70%); }
[data-theme="dark"] .lp-hero-visual-card,[data-theme="dark"] .lp-visual-float { background:#1b2838; border-color:#3b4d66; box-shadow:0 24px 56px #0005; color:#eef3fa; }
[data-theme="dark"] .lp-hero-visual-head { background:#202f43; border-color:#344760; }
[data-theme="dark"] .lp-visual-mark,[data-theme="dark"] .lp-visual-title,[data-theme="dark"] .lp-visual-chart-label span:first-child,[data-theme="dark"] .lp-visual-rank { color:#eef3fa; }
[data-theme="dark"] .lp-visual-title strong { color:#86b7ff; }
[data-theme="dark"] .lp-visual-chart { background:linear-gradient(#1b2a3d,#1a2839); border-color:#344760; }
[data-theme="dark"] .lp-visual-grid { stroke:#344760; }
[data-theme="dark"] .lp-visual-median { stroke:#9aafcb; }
[data-theme="dark"] .lp-visual-axis,[data-theme="dark"] .lp-visual-chart-label,[data-theme="dark"] .lp-visual-rank small,[data-theme="dark"] .lp-visual-float span,[data-theme="dark"] .lp-visual-mark em { color:#a9b9ce; }
[data-theme="dark"] .lp-visual-axis span:nth-child(2) { color:#9dc5ff; }
[data-theme="dark"] .lp-skip { background:#202d3e; color:var(--lp-blue); }

@media (max-width:480px) {
  .lp-nav-actions { gap:8px; }
  .lp-nav .theme-toggle { width:30px; height:30px; }
}

[data-theme="dark"] .brand img.quantrose-wordmark,
[data-theme="dark"] .lp-brand img.quantrose-wordmark,
[data-theme="dark"] .lp-visual-mark img.quantrose-wordmark { filter: brightness(0) invert(1); }
