:root { color-scheme: light; }
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--paper);
  color: var(--text);
}
.theme-toggle:hover { background: var(--bg); }
.theme-sun { display: none; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151c19;
  --paper: #1e2822;
  --text: #e5ebe1;
  --muted: #acb6a5;
  --border: #344036;
  --coral: #f39a7b;
  --green: #acd09f;
  --purple: #c6b5e2;
}
[data-theme="dark"] .theme-moon { display: none; }
[data-theme="dark"] .theme-sun { display: block; }
[data-theme="dark"] :is(.sidebar, .topbar, .panel, .stat-card, .date-button, .skip-link, .button.secondary) {
  background: var(--paper);
  border-color: var(--border);
  color: var(--text);
}
[data-theme="dark"] :is(.brand, .breadcrumb strong, .hero h2, .hero p strong, .coach-card h2, .official-card h3) { color: var(--text); }
[data-theme="dark"] :is(.workspace-label, .nav-link, .breadcrumb, .top-save, .streak-chip, .eyebrow, .page-heading p, .stat-label, .section-heading p, .task-copy p, .subject-link div>span, .stat-caption, .task-meta, .chart-legend, .test-reminder p, .disclaimer, .skill-footer>span, .small-quote p, .skill-card p, .form-panel .muted, .account-card p, .lesson-step p, .lesson-intro, .plan-row p, .plan-note p, .session-map p, .result-stats span, .completion-panel p, .empty-state p, .auth-switch, .stat-value small, .chart-empty strong, .form-panel form>label, .note-form label, .plan-day, .back-link, footer, footer>span, footer>a, .panel-bottom) { color: var(--muted); }
[data-theme="dark"] :is(.text-link, .text-button, .chart-empty a, .test-reminder a, .skill-progress .section-heading>strong) { color: #edb393; }
[data-theme="dark"] :is(.nav-link:hover, .button.secondary:hover, .icon-button:hover) { background: #2b382e; }
[data-theme="dark"] :is(.nav-link.active, .nav-count) { background: #3c2e27; color: #f2b292; }
[data-theme="dark"] :is(.avatar, .small-circle) { background: #35382d; border-color: #424638; color: #d4d4bc; }
[data-theme="dark"] :is(.hero, .practice-banner) { background: #362c24; border-color: #514034; }
[data-theme="dark"] :is(.hero p, .hero-meta, .hero-label, .practice-banner p, .altitude-tag, .altitude-tag strong) { color: #d0b89f; }
[data-theme="dark"] .mountain-art>svg { opacity: .65; }
[data-theme="dark"] .summit-tag { background: #3c3329; border-color: #695240; color: #f3c6a6; }
[data-theme="dark"] .button.dark { background: #c3d7b6; color: #25321f; }
[data-theme="dark"] .button.dark:hover { background: #d2e4c5; }
[data-theme="dark"] .button.primary { background: #efa080; border-color: #efa080; color: #30231c; }
[data-theme="dark"] .button.primary:hover { background: #f7b69a; }
[data-theme="dark"] :is(.coach-card, .official-card, .resume-banner) { background: #2a3225; border-color: #404a34; color: #bccaaa; }
[data-theme="dark"] :is(.coach-card p, .coach-card .eyebrow, .coach-card .text-link, .panel-bottom a, .official-card p) { color: #b9c5a7; }
[data-theme="dark"] .coach-decoration { color: #3d4c31; }
[data-theme="dark"] :is(.pill, .task-number, .question-dots>span, .mini-week span, .filter-tabs) { background: #2d382c; border-color: #44503b; color: #b6c3a7; }
[data-theme="dark"] :is(.task-number.task-done, .question-dots>span.complete, .mini-week .done, .green-light) { background: #304330; color: #b5d6a6; }
[data-theme="dark"] :is(.mini-week .today, .coral-light, .peach, .pill.peach, .orange-light) { background: #453429; color: #edba95; }
[data-theme="dark"] .purple-light { background: #373042; color: #cebae9; }
[data-theme="dark"] .blue-light { background: #293c43; color: #abcedc; }
[data-theme="dark"] .green { color: #b0d29f; }
[data-theme="dark"] .purple { color: #ccbbe4; }
[data-theme="dark"] .filter-tabs button { color: #bdc8b4; }
[data-theme="dark"] .filter-tabs button.selected { background: #45513d; color: #f0f4ea; }
[data-theme="dark"] :is(.task-row, .panel-bottom, .subject-link+.subject-link, .icon-button, .answer-letter, .answer-option) { border-color: var(--border); }
[data-theme="dark"] .icon-button { color: #c1d0b1; }
[data-theme="dark"] .progress-track { background: #354031; }
[data-theme="dark"] .chart-empty { background: #1e2822ed; }
[data-theme="dark"] .score-chart svg text { fill: #adb6a4; }
[data-theme="dark"] .score-chart svg line[stroke="#eff0ed"] { stroke: #344036; }
[data-theme="dark"] input:not([type=submit]):not([type=radio]),
[data-theme="dark"] :is(select, textarea) { background: #172019; border-color: #495641; color: var(--text); }
[data-theme="dark"] input::placeholder, [data-theme="dark"] textarea::placeholder { color: #9aa68f; opacity: 1; }
[data-theme="dark"] .answer-option:hover { background: #2b372b; }
[data-theme="dark"] .answer-option:has(input:checked) { background: #3f3229; border-color: #d39b78; }
[data-theme="dark"] .answer-letter { color: #c5cfb9; }
[data-theme="dark"] .answer-option.correct { background: #2c422d!important; border-color: #84ac75!important; color: #c0e1ac; }
[data-theme="dark"] .answer-option.incorrect { background: #4a3028!important; border-color: #c28c74!important; color: #f1bba5; }
[data-theme="dark"] :is(.feedback, .example-box) { background: #35372a; }
[data-theme="dark"] .feedback.success { background: #2b3a29; }
[data-theme="dark"] :is(.feedback p, .feedback>strong, details p, summary, .example-box p) { color: #c0cbb0; }
[data-theme="dark"] .answer-comparison { color: #e9b99c; }
[data-theme="dark"] .completion-icon { background: #44372a; color: #e9ba8e; }
[data-theme="dark"] .flash { background: #2b402b; border-color: #45603c; color: #c1dcad; }
[data-theme="dark"] .flash.alert { background: #472e26; border-color: #76513b; color: #f1c4a7; }
@media(max-width:720px) {
  .topbar { flex-wrap: wrap; height: auto; min-height: 58px; gap: 8px; padding-top: 8px; padding-bottom: 8px; }
  .top-actions { margin-left: auto; gap: 10px; }
  .theme-toggle { width: 44px; height: 44px; }
}
[data-theme="dark"] .question-dots>a.complete { background: #304330; color: #b5d6a6; }
[data-theme="dark"] .domain-panel summary { color: var(--text); }
