:root { color-scheme: light; --surface: #fff; --surface-raised: #edf0f7; }
.theme-control { display: inline-flex; align-items: center; justify-content: space-between; gap: 10px; max-width: 100%; min-height: 44px; color: var(--muted); font-size: 12px; }
.theme-control select { min-width: 122px; min-height: 38px; max-width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px; background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; }
.sign-in-card > .theme-control { align-self: flex-end; }
.setup-header > .theme-control { margin-left: auto; }

html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #101722;
  --surface: #1a2433;
  --surface-raised: #28364c;
  --white: #1a2433;
  --ink: #edf2fa;
  --muted: #b0bed2;
  --line: #3c4b62;
  --navy-soft: #28364c;
  --cream: #3d2c1e;
  --orange-ink: #ffc28b;
}
html[data-theme="dark"] :is(.topbar, .account-menu, .search, .task-link, .app-card, .document-panel, .guide-card, .finder-dialog, .sign-in-card, .admin-tab, .admin-row, .editor, .editor-actions, .audit-table, .diagnostic, .setup-header, .setup-card, .ticket-row, .ticket-message, .ticket-reply, .ticket-deliveries, .rust-id-row, .rust-name-dialog, .health-card) { background: var(--surface); color: var(--ink); }
html[data-theme="dark"] :is(.field input, .field textarea, .field select, .support-tools select, .ticket-management select) { background: var(--paper); color: var(--ink); border-color: #687d9b; }
html[data-theme="dark"] .theme-control select { border-color: #687d9b; }
html[data-theme="dark"] :is(input, textarea, select) { caret-color: var(--ink); }
html[data-theme="dark"] :is(input, textarea)::placeholder { color: var(--muted); opacity: 1; }
html[data-theme="dark"] :is(.light, .subtle, .card-open, .icon-button) { background: var(--surface-raised); color: var(--ink); }
html[data-theme="dark"] :is(.pill, .ticket-badge, .health-badge, .task-link, .card-copy h3, .finder-choice, .recommendation .recommendation-extra, .redirect-uri) { color: var(--ink); }
html[data-theme="dark"] .finder-choice[aria-pressed="true"] { color: var(--orange-ink); }
html[data-theme="dark"] .recommendation .pill { background: var(--surface); }
html[data-theme="dark"] :is(.primary, .admin-tab.active) { background: var(--orange); color: #172036; border-color: var(--orange); }
html[data-theme="dark"] .primary:hover { background: #ff9a4d; }
html[data-theme="dark"] .button:hover { box-shadow: 0 0 0 2px #ffffff24; }
html[data-theme="dark"] .sidebar { background: #161f30; }
html[data-theme="dark"] .nav-item.active { background: #34425a; color: var(--ink); }
html[data-theme="dark"] .avatar { background: #34425a; }
html[data-theme="dark"] :is(.icon, .large-icon, .app-icon) { filter: brightness(0) invert(.92); }
html[data-theme="dark"] .nav-item.active .icon { filter: brightness(0) invert(.95); }
html[data-theme="dark"] .orange-icon { filter: brightness(0) saturate(100%) invert(71%) sepia(63%) saturate(873%) hue-rotate(325deg); }
html[data-theme="dark"] .sign-in { background: radial-gradient(ellipse at 80% 10%, #47302080, transparent 50%), var(--paper); }
/* Keep the supplied navy wordmark unchanged and readable on its white backing. */
html[data-theme="dark"] :is(.sign-in-card > .brand, .setup-header > .brand) { background: #fff; border-radius: 8px; padding: 8px; }
html[data-theme="dark"] .loading-screen .brand-logo { background: #fff; border-radius: 8px; padding: 8px; }
html[data-theme="dark"] .mobile-brand { background: #fff; border-radius: 6px; padding: 5px; }
html[data-theme="dark"] .mobile-brand .brand-logo { width: 130px; }
html[data-theme="dark"] .skip-link { background: var(--surface-raised); color: var(--ink); }
html[data-theme="dark"] .toast { background: #e2eafa; color: #172036; box-shadow: 0 6px 30px #0006; }
html[data-theme="dark"] :is(.notice, .empty-state, .rust-id-row) { border-color: var(--line); }
html[data-theme="dark"] :is(.finder-dialog, .rust-name-dialog)::backdrop { background: #0009; }
html[data-theme="dark"] .checkbox-field input { accent-color: var(--orange); }
html[data-theme="dark"] .warning { background: #403019; color: #ffdc9d; border-color: #816236; }
html[data-theme="dark"] .error { background: #41242c; color: #ffb7b2; border-color: #83434e; }
html[data-theme="dark"] .field .field-error { color: #ffb7b2; }
html[data-theme="dark"] .field [aria-invalid="true"] { border-color: #ff8d89; }
html[data-theme="dark"] .success { background: #173a2f; color: #a1eac2; border-color: #36715b; }
html[data-theme="dark"] :is(.ticket-badge.resolved, .ticket-badge.closed, .health-badge.ok) { background: #173a2f; color: #a1eac2; }
html[data-theme="dark"] .ticket-badge.open { background: #19374f; color: #aed7ff; }
html[data-theme="dark"] .ticket-badge.in_progress { background: #39284f; color: #dec0ff; }
html[data-theme="dark"] .ticket-badge.priority-urgent { background: #41242c; color: #ffb7b2; }
html[data-theme="dark"] :is(.ticket-badge.waiting_for_staff, .ticket-badge.priority-high, .health-badge.attention, .health-badge.permission_required) { background: var(--cream); color: var(--orange-ink); }
html[data-theme="dark"] .rust-online { color: #a1eac2; }
