/* Two palettes; System follows the device. Exports retain their print palette. */
:root { color-scheme: light; }
.header-tools { display: flex; align-items: center; gap: 14px; }
.theme-control { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); }
.theme-control select { min-height: 40px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: white; font-size: 12px; }
@media (max-width: 1000px) { .topbar nav { display: none; } }
@media (max-width: 480px) {
  .header-tools .nav-cta { display: none; }
  .theme-control > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .theme-control select { min-height: 44px; font-size: 12px; }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e8eaf5;
  --muted: #abb3c9;
  --line: #353c52;
  --accent: #b4a7ff;
  --teal: #b4a7ff;
  --paper: #1a2030;
  --tint: #2b2943;
  color: var(--ink);
  background: #111522;
}
[data-theme="dark"] body { background: radial-gradient(ellipse at 80% 5%, #29244266, transparent 30%), #111522; }
[data-theme="dark"] :is(.topbar, .steps) { background: #171c2bf5; border-color: var(--line); }
[data-theme="dark"] :is(.workspace, .input-card, .document, .preview-paper, .match, .pair-card, .shared-group, .extra-file, .word-detail, .source-entry, .advanced-settings, .options, .pair-review-state, .notes-card) { background: var(--paper); border-color: var(--line); }
[data-theme="dark"] :is(.workflow, .heatmap-layout, .auto-exclusions, .advanced-settings .auto-exclusions, .source-file, .review-toolbar, .document header, .input-card textarea) { background: #202638; border-color: var(--line); color: var(--ink); }
[data-theme="dark"] :is(textarea, input:not([type="checkbox"]), select, .notes-card textarea, .exclude-options textarea, .review-toolbar select, .pair-review-state select, .options select, .workflow select) { background: #151b29; border-color: #4b536c; color: var(--ink); }
[data-theme="dark"] textarea::placeholder, [data-theme="dark"] input::placeholder { color: #9da6bc; opacity: 1; }
[data-theme="dark"] :is(.secondary, .file-button, .nav-cta, .workspace-tools button, .workspace-tools .file-button, .preview-controls button, .skip) { background: #252c40; color: #e2e5f3; border-color: #4a526b; }
[data-theme="dark"] :is(.secondary:hover:enabled, .file-button:hover, .nav-cta:hover) { background: #343450; border-color: #9384d2; }
[data-theme="dark"] .primary { background: #b4a7ff; color: #19152e; border-color: #b4a7ff; box-shadow: none; }
[data-theme="dark"] .brand .brand-icon { background: #6553ca; color: white; }
[data-theme="dark"] :is(.topbar nav, .benefit-strip, .intro p.hero-footnote, .intro p.preview-caption, .preview-label, .paper-label, .input-card .filename, .step-heading .eyebrow, .steps small, .steps b, .document header > span, footer, .quiet, .limits summary) { color: var(--muted); }
[data-theme="dark"] .intro .preview-paper p { color: #c1c7d9; }
[data-theme="dark"] .hero-preview { background: linear-gradient(135deg, #28263e, #202838); border-color: #3b4058; box-shadow: 0 18px 45px #0002; }
[data-theme="dark"] :is(.paper-label, .workspace-tools, #review-step, .how-grid article, .results-heading, .heatmap-key li, .source-paste) { border-color: var(--line); }
[data-theme="dark"] .paper-lines i { background: #333c50; }
[data-theme="dark"] :is(.file-icon, .steps b) { background: #34304c; }
[data-theme="dark"] :is(.steps .current, .compare-defaults, .review-progress, .pair-card.selected) { background: #302d49; border-color: #7566b0; color: #ded8ff; }
[data-theme="dark"] .steps .current b { background: #b4a7ff; color: #19152e; }
[data-theme="dark"] .compare-defaults .toggle small { color: #bdb4dc; }
[data-theme="dark"] :is(.workspace-badge, .import-note, .result-badge) { background: #213b34; color: #b5e3c9; border-color: #406b58; }
[data-theme="dark"] .status-dot { background: #83d7ac; }
[data-theme="dark"] .hero-footnote > span:first-child { color: #9cdfb7; }
[data-theme="dark"] .preview-orbit { background: #284d3d; border-color: #171c2b; color: #b6edcb; }
[data-theme="dark"] .preview-controls button[aria-pressed="false"] { background: #171c2b; color: #b1b8cb; }
[data-theme="dark"] .document-text { color: #e4e7f0; scrollbar-color: #58627b #1a2030; }
[data-theme="dark"] .document header strong { color: var(--accent); }
/* Semantic colors stay distinct without putting pale text on pale highlights. */
[data-theme="dark"] :is(.document-text mark, .preview-paper .preview-exact, .diff-added) { background: #214c3a; color: #d1f5de; border-color: #68b888; }
[data-theme="dark"] :is(.document-text mark.semantic, .preview-paper .preview-meaning) { background: #514323; color: #ffe9b0; border-color: #c3a354; }
[data-theme="dark"] .document-text mark.active { outline-color: #90ddb0; }
[data-theme="dark"] .document-text mark.semantic.active { outline-color: #efd085; }
[data-theme="dark"] :is(.diff-removed) { background: #542e39; color: #ffd5dc; }
[data-theme="dark"] .excluded { background: #353b49; color: #c1c7d5; border-color: #8991a4; }
[data-theme="dark"] :is(.hide-wording .preview-exact, .hide-meaning .preview-meaning) { background: transparent; color: #c1c7d9; }
[data-theme="dark"] .dot.exact { background: #87d5aa; }
[data-theme="dark"] .dot.semantic { background: #dfbc68; }
[data-theme="dark"] .match.active { border-color: #6cb18a; box-shadow: inset 3px 0 #6cb18a; }
[data-theme="dark"] .shared-group blockquote { border-color: #6cb18a; }
[data-theme="dark"] :is(.source-pair, .source-pair.selected, .notice) { background: #25384e; color: #d0e2f5; border-color: #537597; }
[data-theme="dark"] .activity { background: #302d49; color: #e0d9ff; border-color: #6c609c; }
[data-theme="dark"] .activity .hint { color: #c6bddf; }
[data-theme="dark"] .error { background: #4a2c27; color: #ffdcc6; border-color: #a06a53; }
[data-theme="dark"] .status-badge { background: #363d50; color: #d0d6e5; }
[data-theme="dark"] .status-badge.reviewed { background: #244b39; color: #c0efcf; }
[data-theme="dark"] .status-badge.needs-discussion { background: #514323; color: #ffe9b0; }
[data-theme="dark"] .heat-0 { background: #202f2c; color: #c9ebd6; }
[data-theme="dark"] .heat-1 { background: #2a4438; color: #d5f0df; }
[data-theme="dark"] .heat-2 { background: #375c47; color: #e3f9ea; }
[data-theme="dark"] .heat-3 { background: #82b996; color: #102e20; }
[data-theme="dark"] .heat-4 { background: #bce5c9; color: #102e20; }
[data-theme="dark"] .heat-cell[aria-pressed="true"] { border-color: #c2b7ff; box-shadow: 0 0 0 2px #171c2b inset; }
[data-theme="dark"] .privacy-section { background: #1d2236; border: 1px solid var(--line); }
[data-theme="dark"] :is(button, select, textarea, input, a, [tabindex], summary):focus-visible { outline-color: #bcadff; }
[data-theme="dark"] .file-button:focus-within { outline-color: #bcadff; }
[data-theme="dark"] .focus-review .workspace { background: transparent; }
