/* Shared theme tokens. Printed dispute letters keep their own paper styling. */
:root { color-scheme: light; }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 40px; padding: 9px 12px; border: 1px solid var(--gray-300, var(--border));
  border-radius: 8px; background: var(--white, var(--surface)); color: var(--gray-700, var(--text));
  font: 600 .78rem/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  cursor: pointer; flex-shrink: 0;
}
.theme-toggle[hidden] { display: none; }
.theme-toggle:hover { background: var(--gray-100, var(--surface2)); }
.theme-toggle:focus-visible { outline: 2px solid var(--blue, var(--accent)); outline-offset: 3px; }
.theme-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.theme-sun, .theme-mobile { display: none; }
[data-theme="dark"] .theme-sun { display: block; }
[data-theme="dark"] .theme-moon { display: none; }
.theme-desktop { width: 40px; padding: 9px; }
.theme-desktop > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.theme-admin-login { margin: 0 0 24px auto; display: flex; width: max-content; }
.mobile-nav-arrow, .auth-divider, .steps-list li { color: var(--gray-500); }
.sidebar-section, .sidebar-footer { color: var(--muted); }
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder { color: var(--gray-400); opacity: 1; }

/* Light mode carries the editorial palette through the introduction. */
[data-theme="light"] .landing-hero { background: #f4f1eb; color: #172a3b; }
[data-theme="light"] .landing-masthead,
[data-theme="light"] .landing-brief-heading { color: #586875; border-color: #cbd1d3; }
[data-theme="light"] .landing-hero-copy .landing-kicker { color: #8c4e30; }
[data-theme="light"] .landing-kicker > span { background: #8c4e30; }
[data-theme="light"] .landing-hero-copy h1 { color: #172a3b; }
[data-theme="light"] .landing-hero-copy h1 em { color: #9b502d; }
[data-theme="light"] .landing-hero-copy > p,
[data-theme="light"] .landing-hero-assurance,
[data-theme="light"] .landing-brief-grid p { color: #52616c; }
[data-theme="light"] .landing-hero .landing-text-link { color: #172a3b; }
[data-theme="light"] .landing-brief-number,
[data-theme="light"] .landing-hero-assurance > span + span::before { color: #8c4e30; }
[data-theme="light"] .landing-brief-grid > div + div,
[data-theme="light"] .landing-brief-grid > div { border-color: #cbd1d3; }
[data-theme="light"] .landing-brief-grid .icon { color: #586875; }
[data-theme="light"] .landing-hero a:focus-visible { outline-color: #172a3b; }
[data-theme="light"] .landing-tabs button,
[data-theme="light"] .landing-tabs small { color: #4e606e; }

:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #101a23; --white: #192631;
  --gray-50: #1e2e3b; --gray-100: #243644; --gray-200: #354754; --gray-300: #516571;
  --gray-400: #93a6b3; --gray-500: #a6b7c4; --gray-600: #bac8d2; --gray-700: #d1dce3;
  --gray-800: #dfe7ec; --gray-900: #edf2f5;
  --blue: #77d4c3; --blue-dark: #a1e5d9; --blue-mid: #8bdccc;
  --blue-light: #203c3d; --blue-border: #41645f; --teal: #77d4c3; --teal-light: #203c3d; --indigo: #a1e5d9;
  --green: #86d9aa; --green-light: #193a30; --green-border: #3b7058;
  --red: #ffaaa4; --red-light: #41292d; --red-border: #80514f;
  --amber: #f5c780; --amber-light: #3b3225; --amber-border: #796242;
  --navy: #152a35; --navy-2: #203847;
  --shadow-xs: 0 1px 2px #0003; --shadow-sm: 0 2px 5px #0004;
  --shadow: 0 3px 10px #0004; --shadow-md: 0 6px 16px #0004; --shadow-lg: 0 16px 32px #0005;
  --focus-ring: 0 0 0 4px #77d4c333;
  /* Administration uses a separate, existing token vocabulary. */
  --bg: #101a23; --surface: #192631; --surface2: #243644; --border: #354754;
  --accent: #77d4c3; --accent2: #a1cce8; --success: #86d9aa; --warning: #f5c780;
  --danger: #ffaaa4; --text: #edf2f5; --muted: #a6b7c4;
}
[data-theme="dark"] .site-header { background: #192631f7; }
[data-theme="dark"] :is(.btn-primary, .btn-success, .btn-login-header, .auth-submit, .letter-btn-print.primary, .logo-mark, .logo-icon, .brand-mark),
[data-theme="dark"] .hero-panel[data-step="email"] .mini-steps li[data-step="email"] .dot,
[data-theme="dark"] .hero-panel[data-step="upload"] .mini-steps li[data-step="upload"] .dot,
[data-theme="dark"] .steps-list li.active .step-icon { color: #102b29; }
[data-theme="dark"] .footer-brand .logo-mark { color: var(--blue); }
[data-theme="dark"] .skip-link,
[data-theme="dark"] .skip-link:focus { color: #102b29; }
[data-theme="dark"] :is(.alert-error, .auth-alert.error) { color: var(--red); }
[data-theme="dark"] .alert-info { color: var(--blue); }
[data-theme="dark"] :is(.alert-warning, .provider-prompt-title, .provider-prompt-sub) { color: var(--amber); }
[data-theme="dark"] :is(.alert-success, .auth-alert.success, .note-success) { color: var(--green); }
[data-theme="dark"] .upload-card { background: var(--gray-50); border-color: var(--gray-300); }
[data-theme="dark"] .upload-card:hover { background: var(--blue-light); }
[data-theme="dark"] .locked-overlay { background: #101a238c; }
[data-theme="dark"] .legal-callout { color: var(--amber); }
[data-theme="dark"] .legal-callout strong { color: #ffdb9e; }
[data-theme="dark"] .legal-page--privacy .legal-callout { color: var(--gray-700); }
[data-theme="dark"] .legal-page--privacy .legal-callout strong { color: var(--blue-dark); }
[data-theme="dark"] .about-cta { background: #203c3d; border-color: var(--blue-border); }
[data-theme="dark"] .about-cta h2,
[data-theme="dark"] .about-cta .btn-secondary { color: var(--gray-900); }
[data-theme="dark"] .about-cta .btn-primary { background: var(--blue); color: #102b29; border-color: var(--blue); }

/* Landing surfaces and ink have separate roles from the fixed dark hero. */
[data-theme="dark"] .landing-page { --landing-ink: #edf2f5; --landing-cream: #14212b; }
[data-theme="dark"] .landing-page #screen-upload,
[data-theme="dark"] .landing-how { background: #101a23; }
[data-theme="dark"] :is(.landing-review, .landing-pricing) { background: #14212b; border-color: #354754; }
[data-theme="dark"] .landing-example { background: #1b2b37; border-color: #354754; }
[data-theme="dark"] :is(.landing-review .hero-panel, .landing-demo-panel, .landing-price-card) { background: #192631; border-color: #516571; }
[data-theme="dark"] .landing-review .hero-panel { box-shadow: 0 3px 0 #516571; }
[data-theme="dark"] .landing-demo-panel { border-top-color: #efb18c; }
[data-theme="dark"] :is(.landing-hero, .landing-final, .landing-price-featured) { background: #172a3b; }
[data-theme="dark"] .landing-price-featured { border-color: #516571; }
[data-theme="dark"] :is(.landing-section-heading, .landing-steps li, .landing-tabs button, .landing-demo-top, .landing-demo-footer, .landing-privacy-note, .landing-trust, .landing-faq-list, .landing-faq-list details) { border-color: #354754; }
[data-theme="dark"] :is(.landing-kicker, .landing-steps li > span, .landing-pricing-copy em, .landing-tabs button[aria-selected="true"] > span:first-child) { color: #efb18c; }
[data-theme="dark"] :is(.landing-tabs button, .landing-tabs small, .landing-small-label, .landing-demo-footer, .landing-demo-amounts dt, .landing-price-card > p, .landing-price-card li) { color: #bac8d2; }
[data-theme="dark"] .landing-tabs button[aria-selected="true"],
[data-theme="dark"] .landing-tabs button:hover { background: #293f4e; color: #edf2f5; }
[data-theme="dark"] .landing-tabs button[aria-selected="true"] { border-left-color: #efb18c; }
[data-theme="dark"] .landing-example-label { background: #243644; border-color: #516571; color: #d1dce3; }
[data-theme="dark"] .landing-demo-tag { background: #3b3225; color: #f5c780; }
[data-theme="dark"] .landing-demo-question { background: #243644; border-color: #efb18c; }
[data-theme="dark"] .landing-demo-question > span { color: #efb18c; }
[data-theme="dark"] .landing-demo-amounts > div { border-color: #516571; }
[data-theme="dark"] .landing-demo-amounts > div:last-child { background: #243644; }
[data-theme="dark"] .landing-button-outline { color: #edf2f5; border-color: #7a909f; }
[data-theme="dark"] .landing-button-outline:hover { background: #243644; }
[data-theme="dark"] .landing-button-dark { background: #efb18c; color: #172a3b; }
[data-theme="dark"] .landing-button-dark:hover { background: #f8c6a8; color: #172a3b; }

/* Administration: retain semantics in badges, banners, and navigation. */
[data-theme="dark"] .nav-item.active { background: #203c3d; color: #a1e5d9; }
[data-theme="dark"] .nav-item:hover { background: #243644; }
[data-theme="dark"] :is(.sidebar-section, .sidebar-footer) { color: var(--muted); }
[data-theme="dark"] .nav-badge { background: #41292d; }
[data-theme="dark"] .login-error { color: var(--danger); background: var(--red-light); }
[data-theme="dark"] thead th,
[data-theme="dark"] tbody tr:hover td,
[data-theme="dark"] .btn-sm:hover { background: var(--surface2); }
[data-theme="dark"] :is(.badge-success, .alert.success) { background: var(--green-light); border-color: var(--green-border); }
[data-theme="dark"] :is(.badge-danger, .alert.error),
[data-theme="dark"] .btn-sm.danger:hover { background: var(--red-light); border-color: var(--red-border); }
[data-theme="dark"] .badge-warning { background: var(--amber-light); }
[data-theme="dark"] .badge-info { background: var(--blue-light); }
[data-theme="dark"] .btn-sm.primary { color: #102b29; }
[data-theme="dark"] :is(.btn-sm.primary:hover, .btn-primary:hover) { background: var(--blue-dark); border-color: var(--blue-dark); }
[data-theme="dark"] .content button[style*="background:var(--accent)"],
[data-theme="dark"] .content button[style*="background: var(--accent)"] { color: #102b29 !important; }

@media (max-width:1100px) {
  .theme-desktop { display: none; }
  .theme-mobile { display: flex; width: 100%; justify-content: flex-start; margin-top: 8px; padding: 13px; min-height: 48px; }
}
@media (max-width:480px) { .theme-admin-header { width: 36px; padding: 8px; } .theme-admin-header > span { display: none; } }
@media print { .theme-toggle { display: none !important; } }
