.theme-switch {
  position: relative; flex-shrink: 0; width: 60px; height: 32px; padding: 0; border: 1px solid #cddacf;
  border-radius: 100px; background: #eef2ec; color: #7b8a80;
}
.theme-switch-knob {
  position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s ease;
}
.theme-icon { position: absolute; top: 7px; width: 16px; height: 16px; transition: color .2s ease; }
.theme-icon-sun { left: 7px; color: #c77b1a; }
.theme-icon-moon { right: 7px; }
:root[data-theme="dark"] .theme-switch { border-color: #3a4842; background: #243029; }
:root[data-theme="dark"] .theme-switch-knob { transform: translateX(28px); background: #121815; }
:root[data-theme="dark"] .theme-icon-sun { color: #7b8a80; }
:root[data-theme="dark"] .theme-icon-moon { color: #e6c85a; }
@media (prefers-reduced-motion: reduce) { .theme-switch-knob, .theme-icon { transition: none; } }
.header-actions { display: flex; align-items: center; gap: 12px; }

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e6ece8;
  --muted: #9aaba1;
  --line: #2c3832;
  --paper: #1b2420;
  --background: #121815;
  --green: #2f7d5a;
  --accent: #cfe58c;
}

/* Accent text that was a dark green on light surfaces */
:root[data-theme="dark"] :is(.back-link, .search-controls a, .order-link, .inline-note a, .step-arrow, .work-nav a:hover,
  .work-nav a[aria-current="page"], .secondary-button, .clock-out-button, .step-index, .eyebrow,
  .section-kicker, .clock-card .section-kicker, .status-active, .in-progress, .clock-illustration, .illustration-spark) { color: #a8d3b4; }
:root[data-theme="dark"] .brand-mark { background: #2a5a43; color: #e3f2bd; }

/* Secondary text */
:root[data-theme="dark"] :is(.work-nav a, .logout-button span, .header-caption, .timezone-label, .clock-description,
  .history-tag, .th-note, .time-value, .muted-value, .pay-disclaimer, .pay-disclaimer span, .page-footer,
  .footer-divider, .order-number, .meta-label, .component-quantity, .step-name small, .shift-table th,
  .shift-table td::before, .status-off, .production-status) { color: var(--muted); }
:root[data-theme="dark"] :is(.clock-description strong, .shift-table td, .order-card-meta strong,
  .detail-grid p, .component-details span:not(.meta-label), .instructions-card > p:last-child, .inline-note) { color: #c9d5ce; }

/* Surfaces */
:root[data-theme="dark"] :is(.order-search, .order-card, .detail-card, .component-card, .login-card, .history-card,
  .logout-button, .secondary-button, .clock-out-button, .status-active) { background: var(--paper); }
:root[data-theme="dark"] :is(.search-controls input, .form-field input, .work-form .form-field select,
  .work-form .form-field textarea, .clock-role-form select) { background: #141b18; border-color: #3a4842; color: var(--ink); }
:root[data-theme="dark"] .form-field input:focus { border-color: #6fae86; }
:root[data-theme="dark"] :is(.logout-button, .secondary-button) { border-color: #3a4842; }
:root[data-theme="dark"] :is(.logout-button:hover, .secondary-button:hover, .clock-out-button:hover,
  .step-row:hover) { background: #243029; }
:root[data-theme="dark"] :is(.shift-table th, .inline-note, .status-off, .empty-icon, .production-status) { background: #222d27; }
:root[data-theme="dark"] .step-index { background: #243a2e; }
:root[data-theme="dark"] :is(.instructions-card, .clock-card) { background: #1f2e26; border-color: #2c4034; }
:root[data-theme="dark"] .illustration-face { background: rgba(255, 255, 255, .05); }
:root[data-theme="dark"] .in-progress { background: #1d3225; }
:root[data-theme="dark"] .empty-icon { color: #8fbf9e; }
:root[data-theme="dark"] .login-card { box-shadow: 0 16px 40px rgba(0, 0, 0, .35); }
:root[data-theme="dark"] .primary-button:hover { background: #276a4c; }

/* Borders */
:root[data-theme="dark"] :is(.work-nav, .shift-table td, .step-row + .step-row, .labor-row + .labor-row, .page-footer) { border-color: var(--line); }

/* Status colors */
:root[data-theme="dark"] .production-status.status-in_progress,
:root[data-theme="dark"] .production-status.status-complete { background: #1d3225; color: #8fd0a4; }
:root[data-theme="dark"] .production-status.status-blocked { background: #3a211b; color: #f0b4a3; }
:root[data-theme="dark"] .flash-message { border-color: #2c5036; background: #1d3225; color: #a9d8b5; }
:root[data-theme="dark"] .flash-error { border-color: #6b3b2e; background: #3a211b; color: #f0b4a3; }
:root[data-theme="dark"] .announcement { background: #243a2e; border-color: #3b654b; color: var(--ink); }
:root[data-theme="dark"] :is(.form-errors, .field-errors) { color: #f0b4a3; }
:root[data-theme="dark"] .form-errors { border-color: #6b3b2e; background: #3a211b; }
:root[data-theme="dark"] .progress-bar { accent-color: #4cb07e; }
:root[data-theme="dark"] :focus-visible { outline-color: #e0a45a; }
