/* ATM dark appearance. Load after the existing application styles.
   Photographs, product artwork backgrounds and merchandise swatches stay unchanged. */
html[data-theme='dark'] {
  color-scheme: dark;
  --teal: #45bdcb;
  --deep: #79d5df;
  --pink: #f0a6c6;
  --purple: #c8b0ed;
  --ink: #edf5f5;
  --muted: #b9cbce;
  --paper: #101e22;
  --line: #40575d;
  --theme-surface: #172a2f;
  --theme-raised: #1d3339;
  --theme-soft: #18383e;
  --theme-button: #79d5df;
  --theme-button-ink: #092126;
  --theme-purple-soft: #30253f;
  --theme-pink-soft: #3e2534;
}

html[data-theme='dark'] body { background: #0a1418; }
html[data-theme='dark'] header {
  background: #101e22f2;
}
html[data-theme='dark'] .bottom { background: #14262bec; }
html[data-theme='dark'] .bottom a.active {
  background: var(--theme-soft);
  color: var(--deep);
}
html[data-theme='dark'] :is(.card, .lesson-card, .takeaway, .lab-tools,
  .training-resource, .consultancy-package, .consultancy-section,
  .technology-card, .technology-workflow li,
  .technology-stages > .technology-section, .team-training-topic,
  .merch-card, .merch-home, .learning-stats > div,
  .learning-card, .learning-account, .learning-setup, .learning-question,
  .learning-crossword, .learning-result, .learning-guide) {
  background: var(--theme-surface);
}
html[data-theme='dark'] :is(.icon-button, .more-menu, .quick-actions,
  .lesson-back, .secondary, .consultancy-tabs a,
  .consultancy-secondary, .one-health-domains span,
  .merch-item-nav a, .learning-button, .learning-clock) {
  background: var(--theme-raised);
  border-color: var(--line);
}
html[data-theme='dark'] :is(.icon-button, .lesson-back, .secondary,
  .consultancy-secondary, .learning-button) { color: var(--deep); }
html[data-theme='dark'] :is(.primary, .bottom .fab,
  .consultancy-tabs a[aria-selected='true'],
  .merch-item-nav a[aria-current='page'],
  .learning-button[aria-pressed='true']) {
  background: var(--theme-button);
  color: var(--theme-button-ink);
  border-color: var(--theme-button);
}
html[data-theme='dark'] .primary:hover {
  background: #a1e8ef;
  color: var(--theme-button-ink);
}
html[data-theme='dark'] :is(.more-menu button:hover, .more-menu a:hover,
  .learning-button:hover, .shortcut-grid a:hover) {
  background: #244b54;
}
html[data-theme='dark'] .learning-button[aria-pressed='true']:hover {
  background: #a1e8ef;
}
html[data-theme='dark'] :is(.shortcut-grid a, .quick-actions a,
  .quick-actions button, .objectives, .reagent-reminders,
  .assessment-summary span, .technology-one-health, .technology-stage,
  .technology-status, .learning-account-strip, .learning-pill,
  .learning-notice, .learning-feedback, .learning-guide-takeaways,
  .quiz-option:has(input:checked), .learning-option:has(input:checked),
  .learning-question-jump [aria-current='step']) {
  background: var(--theme-soft);
  border-color: var(--line);
}
html[data-theme='dark'] :is(.shortcut-grid a, .quick-actions a,
  .quick-actions button, .technology-status, .learning-account-strip,
  .learning-pill, .learning-notice) { color: var(--deep); }
html[data-theme='dark'] :is(.learning-option:has(input:checked),
  .quiz-option:has(input:checked)) { border-color: var(--deep); }

/* Dark text tokens also occur on intentionally dark brand panels. */
html[data-theme='dark'] .approach {
  background: #13323a;
  color: var(--ink);
}
html[data-theme='dark'] :is(.approach p, .consultant-profile p,
  .consultant-profile ul) { color: #c8dfe2; }
html[data-theme='dark'] .approach .one-health-domains span {
  background: #21454e;
  color: #dbf1f3;
  border-color: #52717a;
}
html[data-theme='dark'] .principles > div { border-color: #52717a; }
html[data-theme='dark'] .consultant-profile {
  background: #123b45;
  color: var(--ink);
}
html[data-theme='dark'] .icon-rail { background: #123b45; }
html[data-theme='dark'] #side-menu {
  background: #12333c;
  color: var(--ink);
}
html[data-theme='dark'] #side-menu nav a { background: #1e424c; }
html[data-theme='dark'] #side-menu nav a:hover { background: #2a5661; }
html[data-theme='dark'] .drawer-note { color: #c8dfe2; }
html[data-theme='dark'] .toast {
  background: #213e46;
  color: var(--ink);
  border: 1px solid #66858d;
}
html[data-theme='dark'] dialog {
  background: var(--theme-surface);
  color: var(--ink);
}
html[data-theme='dark'] dialog::backdrop { background: #020a10ba; }
html[data-theme='dark'] .close {
  background: var(--theme-raised);
  color: var(--ink);
}
html[data-theme='dark'] .sheet-handle { background: #728b91; }

/* Forms retain readable text and native dark browser controls. */
html[data-theme='dark'] :is(.consultancy-field input,
  .consultancy-field select, .consultancy-field textarea,
  .assessment-item select, .assessment-item textarea,
  .action-item input, .action-item select, .action-item textarea,
  .request-review textarea, .learning-find input, .learning-find select,
  .learning-clue-controls input) {
  background: #102126;
  color: var(--ink);
  border-color: #66818a;
}
html[data-theme='dark'] :is(input, textarea)::placeholder { color: #aac0c5; }
html[data-theme='dark'] .request-review textarea { color: var(--ink); }
html[data-theme='dark'] #lesson-quiz fieldset { background: var(--theme-surface); }
html[data-theme='dark'] #quiz-result {
  background: var(--theme-soft);
  border-color: var(--line);
}
html[data-theme='dark'] #quiz-result li + li { border-color: var(--line); }
html[data-theme='dark'] :is(.template-scope, .action-item,
  .consultancy-empty) { background: #102126; }

/* Learning status colors remain distinct in dark appearance. */
html[data-theme='dark'] .learning-type-mcq .learning-pill {
  background: var(--theme-pink-soft);
  color: var(--pink);
}
html[data-theme='dark'] :is(.learning-type-crossword .learning-pill,
  .learning-feedback.learning-review, .learning-revise) {
  background: var(--theme-purple-soft);
  color: var(--purple);
  border-color: #9b7cba;
}
html[data-theme='dark'] .learning-tag {
  background: #211b2d;
  color: var(--purple);
  border-color: #9277ad;
}
html[data-theme='dark'] .learning-notice.error {
  background: #3e2b1d;
  border-color: #aa7b53;
  color: #ffd5af;
}
html[data-theme='dark'] .learning-sync-error { color: #ffc794; }
html[data-theme='dark'] .learning-option-letter {
  background: #29444c;
  color: #d1e1e5;
}
html[data-theme='dark'] .learning-progress { background: #38565f; }

/* Crossword borders, blocked cells, selection and text remain separate. */
html[data-theme='dark'] .learning-grid {
  background: #6b848c;
  border-color: #6b848c;
}
html[data-theme='dark'] .learning-cell { background: #142b33; }
html[data-theme='dark'] .learning-blocked { background: #060f13; }
html[data-theme='dark'] .learning-cell.is-selected { background: #20505c; }
html[data-theme='dark'] .learning-cell input:focus {
  background: #285f6b;
  outline-color: #9be8f1;
}
html[data-theme='dark'] .learning-cell-number { color: #d5e5e8; }
html[data-theme='dark'] .learning-clue.is-selected input {
  background: #18383e;
  border-color: var(--deep);
}

/* Fixed merchandise art labels sit on original pale studio backgrounds.
   Never invert/filter images or replace inline art and color swatches. */
html[data-theme='dark'] .merch-view { color: #526566; }
html[data-theme='dark'] .merch-detail-grid .merch-art-container {
  background: var(--theme-surface);
}

/* Stronger focus rings without imposing motion during appearance changes. */
html[data-theme='dark'] :is(button, a, input, select, textarea):focus-visible {
  outline-color: #9be8f1;
}
