/* Shared preference, Fluent tokens and legacy screen surfaces. */
html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"] {
  color-scheme: dark;
  --garrom-canvas: #11161d;
  --garrom-surface: #1a212b;
  --garrom-surface-subtle: #222c38;
  --garrom-surface-hover: #293544;
  --garrom-surface-muted: #303c4b;
  --garrom-ink: #edf2f7;
  --garrom-muted: #bbc7d5;
  --garrom-subtle: #a0afc1;
  --garrom-line: #354253;
  --garrom-line-strong: #637389;
  --garrom-brand: #0f6cbd;
  --garrom-brand-hover: #115ea3;
  --garrom-brand-soft: #18354a;
  --garrom-brand-ink: #7bc0f4;
  --garrom-danger: #ffaaaa;
  --garrom-success: #8cd6a6;
  --garrom-warning: #f3bd66;
  --garrom-info: #8cc6f3;
  --ink: var(--garrom-ink);
  --muted: var(--garrom-muted);
  --line: var(--garrom-line);
  --canvas: var(--garrom-canvas);
  --card: var(--garrom-surface);
  --accent: var(--garrom-brand-ink);
  --accent-soft: var(--garrom-brand-soft);
  --teal: #8cd6ca;
  --teal-soft: #183a37;
}
.app-theme-toggle {
  position: fixed; top: 12px; right: 12px; z-index: var(--garrom-layer-nav);
  display: grid; place-items: center; width: 36px; height: 36px; padding: 8px;
  border: 1px solid var(--garrom-line); border-radius: 6px;
  color: var(--garrom-ink); background: var(--garrom-surface); cursor: pointer;
}
.app-theme-toggle[hidden] { display: none; }
.app-theme-toggle:hover { background: var(--garrom-surface-hover); }
.app-theme-toggle span { display: block; width: 20px; height: 20px; background: currentColor; mask: url('../icons/fluent/moon.svg') center / contain no-repeat; }
html[data-theme="dark"] .app-theme-toggle span { mask-image: url('../icons/fluent/sun.svg'); }
.director-main > .director-topbar { padding-right: 48px; }
@media (max-width: 650px) {
  .app-theme-toggle { top: 8px; right: 8px; width: 44px; height: 44px; padding: 12px; }
}
/* Older pages predate the shared tokens. Keep their surfaces and form controls legible. */
html[data-theme="dark"] :is(.director-main, .dashboard-main, .email-reader-scroll) { background-color: var(--garrom-canvas); color: var(--garrom-ink); }
html[data-theme="dark"] :is(.director-data-card, .director-form-card, .director-stat-card, .flash-message, .email-connect-card, .email-security-card, .email-account-current, .email-recipient-summary, .email-attachment-section, .email-meeting-section, .email-preview-content, .email-calendar-dialog, .email-preview-dialog) {
  color: var(--garrom-ink); background-color: var(--garrom-surface); border-color: var(--garrom-line);
}
html[data-theme="dark"] :is(input:not([type="submit"]):not([type="button"]):not([type="checkbox"]):not([type="radio"]), select, textarea) {
  color: var(--garrom-ink); background-color: var(--garrom-surface); border-color: var(--garrom-line-strong);
}
html[data-theme="dark"] :is(input, textarea)::placeholder { color: var(--garrom-subtle); opacity: 1; }
html[data-theme="dark"] :is(.email-connect-fields, .email-reading-header, .email-security-card, .email-attachment-section, .email-meeting-section, .email-recipient-summary) :is(label, strong, h2) { color: var(--garrom-ink); }
html[data-theme="dark"] :is(.email-security-list > span, .email-account-status, .email-attachment-list article, .email-meeting-section article) { background: var(--garrom-surface-subtle); color: var(--garrom-muted); border-color: var(--garrom-line); }
html[data-theme="dark"] :is(.email-reading-body, .email-account-current strong) { color: var(--garrom-ink); }
html[data-theme="dark"] :is(.email-connect-fields, .email-security-card, .email-reading-header) :is(small, p) { color: var(--garrom-muted); }
html[data-theme="dark"] :is(.director-main, .dashboard-main) :is(h1, h2, h3, h4, label, strong) { color: var(--garrom-ink); }
html[data-theme="dark"] :is(.director-main, .dashboard-main) :is(p, small, .section-kicker, .muted) { color: var(--garrom-muted); }
html[data-theme="dark"] :is(.director-main, .dashboard-main) a:not(.director-button):not(.button):not(.email-thread-row):not(.email-folder-tabs a) { color: var(--garrom-brand-ink); }
html[data-theme="dark"] :is(.advisor-empty, .structure-empty, .calendar-weekdays, .advisor-calendar-weekdays, .objective-pipeline-empty, .director-empty, .email-message-empty, .form-notice, .panel, .metric-card) {
  color: var(--garrom-muted); background: var(--garrom-surface-subtle); border-color: var(--garrom-line);
}
html[data-theme="dark"] :is(.advisor-empty, .structure-empty, .advisor-calendar-empty) :is(span, strong) { color: var(--garrom-muted); }
html[data-theme="dark"] :is(.role-badge, .advisor-badge, .zone-badge, .advisor-pill, .work-pill) { color: var(--garrom-brand-ink); background: var(--garrom-brand-soft); border-color: var(--garrom-line); }
html[data-theme="dark"] .director-button.secondary { color: var(--garrom-ink); background: var(--garrom-surface); border-color: var(--garrom-line-strong); }
html[data-theme="dark"] .director-nav a.active { color: var(--garrom-brand-ink); }
/* The sign-in screen has its own token family. */
html[data-theme="light"] {
  --auth-bg: #f3f6fa; --auth-bg-soft: #e8eef6; --auth-surface: #fdfefe;
  --auth-surface-raised: #e9eff7; --auth-border: #cbd6e5; --auth-border-strong: #879bb5;
  --auth-text: #1c2d43; --auth-muted: #4c6079; --auth-subtle: #52677f;
  --auth-danger: #a32525; --auth-danger-bg: #fff0ef;
}
html[data-theme="light"] .auth-stage { background: var(--auth-bg-soft); }
html[data-theme="light"] :is(.auth-level, .auth-shell[data-auth-shell] .auth-level[aria-pressed="true"], .auth-shell[data-auth-shell] .auth-access, .auth-access-close) { background: var(--auth-surface); }
html[data-theme="light"] :is(.auth-kicker, .auth-level span, .auth-back-link, .auth-password-toggle, .auth-request-label, .auth-alert-success, .auth-alert-info) { color: #2855a0; }
html[data-theme="light"] .auth-brand-mark { color: #fff; }
html[data-theme="light"] .auth-field input::placeholder { color: var(--auth-subtle); }
@media print { .app-theme-toggle { display: none; } }
