/* Shared theme tokens. Component fallbacks preserve the existing light palette.
   Screen-only overrides keep printed instructions and reports light. */
:root { color-scheme: light; --surface: var(--paper); --surface-soft: var(--canvas); }
.theme-toggle {
  display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center;
  gap: .65rem; min-width: 44px; min-height: 44px; padding: .6rem;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--paper); color: var(--ink); cursor: pointer;
}
.theme-toggle:hover { border-color: var(--signal); background: var(--signal-soft); }
.theme-toggle:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; }
.theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle-label, .theme-sun { display: none; }
[data-theme="dark"] .theme-moon { display: none; }
[data-theme="dark"] .theme-sun { display: block; }
.auth-site-header :is(.auth-drawer, .auth-account-panel, .auth-fallback-panel) .theme-toggle { width: 100%; min-height: 48px; justify-content: flex-start; margin: 0; padding-inline: 12px; font-size: 15px; }
.auth-site-header .theme-toggle-label { display: inline; }
.theme-card-control { float: right; margin-left: 8px; }
.portal-header .header-actions { gap: 12px; }
@media (max-width: 600px) {
  .portal-header .header-inner { gap: 12px; }
  .portal-header .brand-logo { width: 110px; }
  .portal-header .header-actions { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
}
@media screen {
  :root[data-theme="dark"] {
    color-scheme: dark;
    --ink: #e5eaf1;
    --muted: #a9b5c6;
    --line: #3d4b5e;
    --line-strong: #66788f;
    --paper: #1b2430;
    --canvas: #121820;
    --signal: #9dbaff;
    --signal-soft: #263652;
    --danger: #ffb0a8;
    --danger-soft: #422c32;
    --success: #93d9b8;
    --shadow: 0 24px 70px rgb(0 0 0 / 20%);
    --theme-surface: var(--paper);
    --theme-surface-soft: #242f3d;
    --theme-text-secondary: #bec8d6;
    --theme-border: var(--line);
    --theme-border-strong: var(--line-strong);
    --theme-info-text: #adc6ff;
    --theme-info-bg: #263652;
    --theme-info-border: #6689be;
    --theme-success-text: #a0dbbb;
    --theme-success-bg: #233c34;
    --theme-success-border: #567f6e;
    --theme-warning-text: #e8cd94;
    --theme-warning-bg: #3b3527;
    --theme-warning-border: #948057;
    --theme-danger-text: #f2afa8;
    --theme-danger-bg: #422c32;
    --theme-danger-border: #ac797a;
    --theme-purple-text: #c9b9f0;
    --theme-purple-bg: #342e49;
    --theme-teal-text: #8dd4dc;
    --theme-teal-bg: #203b43;
    --theme-teal-border: #5d97a2;
    --theme-header: rgb(27 36 48 / 96%);
    --theme-focus: #9dbaff;
    --theme-on-ink: #121820;
    --theme-on-signal: #121820;
  }
  [data-theme="dark"] .pos-form-experience {
    --muted: #a9b5c6; --signal: #9dbaff; --signal-soft: #263652;
  }
  [data-theme="dark"] .brand-logo { filter: brightness(0) invert(1); }
  [data-theme="dark"] .access-qr { background: var(--paper); }
  [data-theme="dark"] .access-qr img { background: #fff; }
  [data-theme="dark"] .checklist-entry-card .button-primary { color: #fff; }
  [data-theme="dark"] .assessment-experience #nextStep { color: #121820; }
  [data-theme="dark"] .assessment-experience #nextStep:hover { color: #fff; }
  [data-theme="dark"] dialog { background: var(--paper); color: var(--ink); }
  [data-theme="dark"] input::placeholder, [data-theme="dark"] textarea::placeholder { color: var(--muted); opacity: 1; }
  [data-theme="dark"] .rating-badge.rating-1 { background: #422c32; color: #f2afa8; }
  [data-theme="dark"] .rating-badge.rating-2 { background: #413326; color: #e4bd96; }
  [data-theme="dark"] .rating-badge.rating-3 { background: #3b3828; color: #dbce94; }
  [data-theme="dark"] .rating-badge.rating-4 { background: #303c2f; color: #b9d0a9; }
  [data-theme="dark"] .rating-badge.rating-5 { background: #233c34; color: #a0dbbb; }
  [data-theme="dark"] .period-chip.period-b { background: #a9b5c6; color: #121820; }
  /* Map tiles, photographs, QR codes and technical illustrations keep their colors. */
  [data-theme="dark"] .leaflet-popup-content-wrapper,
  [data-theme="dark"] .leaflet-popup-tip { background: var(--paper); color: var(--ink); }
  [data-theme="dark"] .leaflet-bar a { background: var(--paper); color: var(--ink); }
}
@media print { .theme-toggle { display: none !important; } }
