/* Automatic keeps device day/night behavior and a distinct ATM Gram palette.
   Load after theme.css and theme-dark.css. Manual modes remain unchanged. */
html[data-theme-mode='auto'] {
  --teal: #80469c;
  --deep: #633280;
  --pink: #98315e;
  --purple: #643987;
  --ink: #28202f;
  --muted: #605469;
  --paper: #f1eef4;
  --line: #b6a9c1;
  --theme-surface: #faf7fc;
  --theme-raised: #eee7f2;
  --theme-soft: #e9dfef;
  --theme-button: #653780;
  --theme-button-ink: #ffffff;
  --theme-purple-soft: #e7dcef;
  --theme-pink-soft: #f7e2ed;
  --auto-outside: #dcd7e1;
  --auto-field: #fdfafe;
  --auto-input-line: #88758f;
  --auto-hover: #dfd0e8;
  --auto-button-hover: #50276b;
  --auto-panel: #291c33;
  --auto-panel-text: #ddd2e5;
  --auto-focus: #72378e;
  --auto-error: #fff0e5;
  --auto-error-ink: #753b18;
  --auto-error-line: #ae7950;
  --auto-cell: #faf6fd;
  --auto-cell-selected: #e2d3ee;
  --auto-cell-focus: #d8bde9;
  --auto-cell-number: #574166;
  --auto-grid-line: #8f789d;
  --auto-blocked: #15101b;
  --auto-silver: #d7d7dd;
  --auto-chrome: #09090d;
  --auto-chrome-trim: #9898a3;
  --auto-chrome-active: #482b55;
  --auto-chrome-pink: #f2a8c8;
}
html[data-theme-mode='auto'][data-theme='dark'] {
  --teal: #d0b0ed;
  --deep: #f2a8c8;
  --pink: #f2a8c8;
  --purple: #d0b0ed;
  --ink: #f3eef5;
  --muted: #c8bccf;
  --paper: #09090d;
  --line: #75667f;
  --theme-surface: #1d1723;
  --theme-raised: #2b2233;
  --theme-soft: #37283f;
  --theme-button: #f2a8c8;
  --theme-button-ink: #251425;
  --theme-purple-soft: #382646;
  --theme-pink-soft: #422434;
  --auto-outside: #040406;
  --auto-field: #100d15;
  --auto-input-line: #9b85a6;
  --auto-hover: #47324f;
  --auto-button-hover: #ffd0e3;
  --auto-panel: #211729;
  --auto-panel-text: #ded2e7;
  --auto-focus: #eac2f5;
  --auto-error: #3a261b;
  --auto-error-ink: #ffdabf;
  --auto-error-line: #c89163;
  --auto-cell: #22172d;
  --auto-cell-selected: #422950;
  --auto-cell-focus: #51325f;
  --auto-cell-number: #ead8f3;
  --auto-grid-line: #a58bb4;
  --auto-blocked: #050408;
}

/* Jet black chrome and silver trim identify Automatic in either appearance. */
html[data-theme-mode='auto'] body { background: var(--auto-outside); }
html[data-theme-mode='auto'] :is(header, .bottom, .icon-rail) {
  background: var(--auto-chrome);
  color: var(--auto-silver);
  border-color: var(--auto-chrome-trim);
}
html[data-theme-mode='auto'] :is(header .location, .bottom a) { color: var(--auto-silver); }
html[data-theme-mode='auto'] .bottom a.active {
  background: var(--auto-chrome-active);
  color: var(--auto-chrome-pink);
}
html[data-theme-mode='auto'] :is(header .icon-button, .theme-toggle) {
  color: var(--auto-chrome-pink);
}
html[data-theme-mode='auto'] header .icon-button {
  background: #211b28;
  border-color: var(--auto-chrome-trim);
}
html[data-theme-mode='auto'] .theme-control {
  --toggle-edge: var(--auto-chrome-pink);
  --toggle-glow: #b885bc40;
  --toggle-side: #79667d;
  --toggle-depth: #302538;
  --toggle-shadow: #00000090;
  color: var(--auto-chrome-pink);
}
html[data-theme-mode='auto'] .theme-toggle,
html[data-theme-mode='auto'] .theme-toggle:hover {
  border-color: transparent;
  background: linear-gradient(145deg, #f8e6f0, #c4bdd0 18%, #795d92 48%, #d8d5de 74%, #2f263c) padding-box,
    conic-gradient(#e8aec7, #8153a8, #09090d, #c9c7cf, #e8aec7) border-box;
}
html[data-theme-mode='auto'] .bottom .fab {
  background: var(--auto-chrome-pink);
  color: #251425;
  border-color: var(--paper);
}
html[data-theme-mode='auto'] #side-menu {
  background: var(--auto-chrome);
  color: var(--auto-silver);
}
html[data-theme-mode='auto'] #side-menu .eyebrow { color: var(--auto-chrome-pink); }
html[data-theme-mode='auto'] #side-menu nav a { background: #211b28; }
html[data-theme-mode='auto'] #side-menu nav a:hover { background: var(--auto-chrome-active); }
html[data-theme-mode='auto'] #side-menu .close {
  background: #34273e;
  color: var(--auto-silver);
}
html[data-theme-mode='auto'] .drawer-note { color: var(--auto-silver); }
html[data-theme-mode='auto'] .icon-rail a:hover { background: var(--auto-chrome-active); }

/* Pale Gram surfaces by day; charcoal and plum by night. */
html[data-theme-mode='auto'] :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-mode='auto'] :is(.more-menu, .quick-actions, .lesson-back,
  .secondary, .consultancy-tabs a, .consultancy-secondary,
  .one-health-domains span, .merch-item-nav a,
  .learning-button, .learning-clock, .close) {
  background: var(--theme-raised);
  color: var(--ink);
  border-color: var(--line);
}
html[data-theme-mode='auto'] :is(.lesson-back, .secondary,
  .consultancy-secondary, .learning-button) { color: var(--deep); }
html[data-theme-mode='auto'] .more-menu { color: var(--ink); }
html[data-theme-mode='auto'] :is(.more-menu button:hover,
  .more-menu a:hover, .learning-button:hover, .shortcut-grid a:hover,
  .theme-options label:hover, .theme-options label:has(input:checked)) {
  background: var(--auto-hover);
}
html[data-theme-mode='auto'] :is(.primary,
  .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-mode='auto'] :is(.primary:hover,
  .learning-button[aria-pressed='true']:hover) {
  background: var(--auto-button-hover);
  color: var(--theme-button-ink);
}
html[data-theme-mode='auto'] :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-mode='auto'] :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-mode='auto'] :is(.learning-option:has(input:checked),
  .quiz-option:has(input:checked)) { border-color: var(--deep); }

html[data-theme-mode='auto'] :is(.approach, .consultant-profile) {
  background: var(--auto-panel);
  color: #f3eef5;
}
html[data-theme-mode='auto'] :is(.approach p, .consultant-profile p,
  .consultant-profile ul) { color: var(--auto-panel-text); }
html[data-theme-mode='auto'] :is(.approach .eyebrow,
  .consultant-profile .eyebrow) { color: var(--auto-chrome-pink); }
/* The current consultant eyebrow has an inline turquoise declaration. */
html[data-theme-mode='auto'] .consultant-profile .eyebrow {
  color: var(--auto-chrome-pink) !important;
}
html[data-theme-mode='auto'] .approach .one-health-domains span {
  background: #403049;
  color: #e6d8ee;
  border-color: var(--auto-chrome-trim);
}
html[data-theme-mode='auto'] :is(.principles > div, .consultant-monogram) {
  border-color: #9580a3;
}
html[data-theme-mode='auto'] .toast {
  background: #291c33;
  color: #f3eef5;
  border: 1px solid #9a87a5;
}
html[data-theme-mode='auto'] dialog {
  background: var(--theme-surface);
  color: var(--ink);
}
html[data-theme-mode='auto'] dialog::backdrop { background: #09050fbd; }
html[data-theme-mode='auto'] .sheet-handle { background: #a08eab; }

/* Forms use silver-purple boundaries and an appearance-appropriate focus ring. */
html[data-theme-mode='auto'] :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: var(--auto-field);
  color: var(--ink);
  border-color: var(--auto-input-line);
}
html[data-theme-mode='auto'] :is(input, textarea)::placeholder { color: var(--muted); }
html[data-theme-mode='auto'] #lesson-quiz fieldset { background: var(--theme-surface); }
html[data-theme-mode='auto'] #quiz-result {
  background: var(--theme-soft);
  border-color: var(--line);
}
html[data-theme-mode='auto'] #quiz-result li + li { border-color: var(--line); }
html[data-theme-mode='auto'] :is(.template-scope, .action-item,
  .consultancy-empty) { background: var(--auto-field); }
html[data-theme-mode='auto'] :is(button, a, input, select, textarea):focus-visible {
  outline-color: var(--auto-focus);
}
html[data-theme-mode='auto'] :is(header > .brand, .header-actions > button, .theme-toggle,
  .bottom a, .bottom button, #side-menu a, #side-menu button,
  .icon-rail a):focus-visible { outline-color: var(--auto-chrome-pink); }

/* Feedback keeps the meaning of correct, review and error states. */
html[data-theme-mode='auto'] .learning-type-mcq .learning-pill {
  background: var(--theme-pink-soft);
  color: var(--pink);
}
html[data-theme-mode='auto'] :is(.learning-type-crossword .learning-pill,
  .learning-feedback.learning-review, .learning-revise) {
  background: var(--theme-purple-soft);
  color: var(--purple);
  border-color: var(--auto-input-line);
}
html[data-theme-mode='auto'] .learning-tag {
  background: var(--theme-raised);
  color: var(--purple);
  border-color: var(--auto-input-line);
}
html[data-theme-mode='auto'] .learning-notice.error {
  background: var(--auto-error);
  color: var(--auto-error-ink);
  border-color: var(--auto-error-line);
}
html[data-theme-mode='auto'] .learning-sync-error { color: var(--auto-error-ink); }
html[data-theme-mode='auto'] .learning-option-letter {
  background: var(--theme-raised);
  color: var(--ink);
}
html[data-theme-mode='auto'] .learning-progress { background: var(--line); }

/* Crossword geometry and merchandise artwork stay unchanged. */
html[data-theme-mode='auto'] .learning-grid {
  background: var(--auto-grid-line);
  border-color: var(--auto-grid-line);
}
html[data-theme-mode='auto'] .learning-cell { background: var(--auto-cell); }
html[data-theme-mode='auto'] .learning-blocked { background: var(--auto-blocked); }
html[data-theme-mode='auto'] .learning-cell.is-selected { background: var(--auto-cell-selected); }
html[data-theme-mode='auto'] .learning-cell input:focus {
  background: var(--auto-cell-focus);
  outline-color: var(--auto-focus);
}
html[data-theme-mode='auto'] .learning-cell-number { color: var(--auto-cell-number); }
html[data-theme-mode='auto'] .learning-clue.is-selected input {
  background: var(--theme-soft);
  border-color: var(--deep);
}
html[data-theme-mode='auto'] .merch-view { color: #526566; }
html[data-theme-mode='auto'] .merch-detail-grid .merch-art-container {
  background: var(--theme-surface);
}
