/* Theme presentation is separate from tool behavior and the established layout. */
:root { color-scheme: light; }
/* Contact addresses are selectable text, with a shared emphasis in every page. */
.contact-email { color: #383193; font-weight: 700; overflow-wrap: anywhere; }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex-shrink: 0; padding: 9px;
  color: var(--ink); background: transparent;
  border: 1px solid var(--line); border-radius: 9px;
}
.theme-toggle:hover { background: var(--lavender); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .theme-sun { display: none; }
[data-theme="dark"] .theme-toggle .theme-sun { display: block; }
[data-theme="dark"] .theme-toggle .theme-moon { display: none; }
@media (max-width: 760px) {
  .header-inner { gap: 8px; }
  .header-inner > .brand { margin-right: auto; }
  /* Brand consumes spare space; keep the two right-hand controls together. */
  .header-inner > .menu-toggle { margin-left: 0; }
  .theme-toggle { width: 40px; height: 40px; }
}
/* Screen-only tokens keep existing print output on its original light palette. */
@media screen {
  [data-theme="dark"] .contact-email { color: #c9c3ff; }
  :root[data-theme="dark"] {
    color-scheme: dark;
    --paper: #171621; --ink: #eeedf5; --muted: #b6b2c7;
    --indigo: #b8b0ff; --deep: #c9c3ff; --line: #464153;
    --lavender: #302b46; --apricot: #f5c9a6;
    scrollbar-color: #8b81c8 #24212f;
  }
  [data-theme="dark"] .header { background: rgba(23,22,33,.97); }
  [data-theme="dark"] :is(.journey-step,.skip,.hero-search,.paper-sheet,.tool-card,.search-field,.sort-label select,.filters button,.workbench,.result-panel,.export-actions button,.hero-task,.search-suggestions,.faq-item,.menu-toggle) {
    background: #211f2d; border-color: var(--line); color: var(--ink);
  }
  [data-theme="dark"] :is(input,textarea,select) { color: var(--ink); }
  [data-theme="dark"] :is(.field input,.field textarea) { background: #1b1925; border-color: #635b76; }
  [data-theme="dark"] input::placeholder,[data-theme="dark"] textarea::placeholder { color: #a49db7; }
  [data-theme="dark"] :is(.category-section,.trust-strip,footer) { background: #1d1b27; }
  [data-theme="dark"] :is(.footer-top,.paper-row) { border-color: var(--line); }
  [data-theme="dark"] :is(.hero-links a,.category-card,.summary-grid .summary-primary,.aside-note,.hero-search) { border-color: var(--line); }
  [data-theme="dark"] :is(.summary-grid>div,th,.paper-badge,.nav-count,.aside-note,.category-card,.filters button[aria-pressed="true"],.mobile-nav a[aria-current]) { background: #302b46; }
  [data-theme="dark"] :is(.summary-grid dt,th,.aside-note p,.art-label,.art-caption,.trust-strip span,.card-number,.card-bottom,.category-foot,.result-tag,.task-index,.export-actions button) { color: var(--muted); }
  [data-theme="dark"] .summary-grid dd { color: var(--ink); }
  [data-theme="dark"] .summary-primary dd { color: var(--indigo); }
  [data-theme="dark"] :is(.primary-button,.hero-search button,.empty-state button,.brand-mark) { background: #6558d6; color: #fff; }
  [data-theme="dark"] .primary-button:hover { background: #7668e7; }
  [data-theme="dark"] .filters button[aria-pressed="true"] { color: var(--indigo); }
  [data-theme="dark"] .hero-art { background-color: #272235; background-image: radial-gradient(#514665 1px,transparent 1px); border-color: var(--line); }
  [data-theme="dark"] .paper-sheet { box-shadow: 8px 10px 0 #383045; }
  [data-theme="dark"] :is(.hero-task:hover,.hero-task:focus-visible,.search-suggestions a:hover,.search-suggestions a:focus-visible) { background: #302b46; }
  [data-theme="dark"] .tool-icon { background: #332d4a; color: #c1b8ff; }
  [data-theme="dark"] .tool-icon.commerce { background: #3d3027; color: #edc097; }
  [data-theme="dark"] .tool-icon.operations { background: #293348; color: #b0c6f6; }
  [data-theme="dark"] .tool-icon.events { background: #442b37; color: #f1b4c5; }
  [data-theme="dark"] .tool-icon.documents { background: #2e362c; color: #c4d1b7; }
  [data-theme="dark"] .error-message { background: #432527; border-color: #ed9d92; color: #ffc4ba; }
  [data-theme="dark"] .notice { background: #3d3027; color: #edc097 !important; }
  [data-theme="dark"] ::selection { background: #514476; color: #fff; }
  [data-theme="dark"] ::-webkit-scrollbar-track,[data-theme="dark"] ::-webkit-scrollbar-corner { background: #24212f; }
  [data-theme="dark"] ::-webkit-scrollbar-thumb { background: #8b81c8; border-color: #24212f; }
}
@media print { .theme-toggle { display: none !important; } }
@media (forced-colors: active) {
  :root[data-theme="dark"] { scrollbar-color: auto; }
  .theme-toggle { border-color: ButtonText; }
}
