:root { --surface: #fff; }
.theme-toggle { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); font: inherit; font-size: 12px; cursor: pointer; }
.theme-toggle:hover { background: var(--soft); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.theme-toggle-label { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.theme-switch-track { position: relative; width: 34px; height: 20px; flex-shrink: 0; border-radius: 20px; background: #b9c0c7; }
.theme-switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .18s ease; }
[data-theme="dark"] .theme-switch-track { background: #579d80; }
[data-theme="dark"] .theme-switch-track::after { transform: translateX(14px); }
.auth-header-actions { display: flex; align-items: center; gap: 20px; }
.auth-tagline { font-size: 12px; }
@media (max-width: 800px) { .auth-tagline { display: none; } }
@media (max-width: 800px) { .sidebar-bottom .theme-toggle { align-self: flex-start; min-width: 160px; } }
@media (max-width: 500px) { .auth-header { padding: 0 20px; gap: 12px; flex-wrap: wrap; height: auto; min-height: 96px; } .auth-header-actions { gap: 10px; flex-wrap: wrap; } }
@media (prefers-reduced-motion: reduce) { .theme-switch-track::after { transition: none; } }

html[data-theme="dark"] {
    color-scheme: dark;
    --ink: #e5e9ef;
    --muted: #a2adbb;
    --line: #35404d;
    --paper: #151a21;
    --surface: #1d242d;
    --soft: #252e39;
    --accent: #8cd3b1;
    --theme-success-bg: #1b332b;
    --theme-success: #a0d9b6;
    --theme-danger-bg: #3b2428;
    --theme-danger: #ffb0aa;
    --theme-warning-bg: #3c3220;
    --theme-warning: #f0cc87;
}
html[data-theme="dark"] :is(.sidebar, .panel, .team-list, .modal, .select-options, .review-comment, .workspace-calendar) { background-color: var(--surface); color: var(--ink); }
html[data-theme="dark"] :is(input, select, textarea, .select-trigger, .review-focus-input, .secondary, .logout-button) { background-color: var(--surface); color: var(--ink); border-color: var(--line); }
html[data-theme="dark"] :is(input, textarea)::placeholder { color: #929eae; }
html[data-theme="dark"] :is(input, select, textarea, .select-trigger):disabled { background-color: var(--soft); color: var(--muted); }
html[data-theme="dark"] input:is([type="checkbox"], [type="radio"]) { accent-color: var(--accent); }
html[data-theme="dark"] :is(.modal .modal-heading, .message-dialog > h2) { background: var(--surface); }
html[data-theme="dark"] :is(th, .avatar, .provider-limit, .provider-limit-period, .bitbucket-permissions-example, .review-file > .review-comment-index) { background: var(--soft); color: var(--muted); border-color: var(--line); }
html[data-theme="dark"] :is(p, .eyebrow, .nav-label, .topbar, .muted-label, .empty-icon, .device-icon, .auth-footer, .team-tabs button, .overview-progress li, .overview-team-stats dt, .nav-group summary .nav-role, .health-item > span:last-child) { color: var(--muted); }
html[data-theme="dark"] :is(nav a, .nav-group summary, .health-item strong) { color: var(--ink); }
html[data-theme="dark"] :is(nav a.active, nav a:hover, .secondary:hover, .select-option:hover, .select-option.focused) { background: var(--soft); color: var(--ink); }
html[data-theme="dark"] .team-tabs button.active { color: var(--ink); border-bottom-color: var(--accent); }
html[data-theme="dark"] .breadcrumb { color: #778494; }
html[data-theme="dark"] .primary { background: #99d0b5; color: #14271e; border-color: #99d0b5; }
html[data-theme="dark"] .primary:hover { background: #b1dfc7; border-color: #b1dfc7; }
html[data-theme="dark"] .page-number[aria-current="page"] { background: #99d0b5; color: #14271e; border-color: #99d0b5; }
html[data-theme="dark"] :is(.select-option[aria-selected="true"], .review-file-tree a.active) { background: var(--theme-success-bg); color: var(--theme-success); }
html[data-theme="dark"] :is(.notice, .badge) { background: var(--theme-success-bg); color: var(--theme-success); border-color: #3c6251; }
html[data-theme="dark"] .notice p { color: inherit; }
html[data-theme="dark"] :is(.notice.error, .logout-button:hover, .badge[data-status="FAILED"], .badge[data-status="DECLINED"]) { background: var(--theme-danger-bg); color: var(--theme-danger); border-color: #815056; }
html[data-theme="dark"] :is(.badge.check-warning, .badge[data-status="QUEUED"]) { background: var(--theme-warning-bg); color: var(--theme-warning); border-color: #786342; }
html[data-theme="dark"] .badge.check-unconfigured { background: var(--soft); color: var(--muted); border-color: var(--line); }
html[data-theme="dark"] :is(.badge[data-status="OPEN"], .badge[data-status="RUNNING"]) { background: #22344c; color: #a5caff; border-color: #456894; }
html[data-theme="dark"] :is(.field-error, .lines-removed) { color: var(--theme-danger); }
html[data-theme="dark"] :is(input, select, textarea, .select-trigger)[aria-invalid="true"] { border-color: var(--theme-danger); outline-color: var(--theme-danger); }
html[data-theme="dark"] .button.danger { background: #a6322c; color: #fff; border-color: #c55249; }
html[data-theme="dark"] .button.danger:hover:not(:disabled) { background: #ba3f36; border-color: #d56960; }
html[data-theme="dark"] .lines-added { color: var(--theme-success); }
html[data-theme="dark"] .review-code-line.ADD { background: #1d352b; }
html[data-theme="dark"] .review-code-line.DELETE { background: #3b252b; }
html[data-theme="dark"] .review-code-line.HUNK { background: #273443; }
html[data-theme="dark"] .review-comment { border-color: #416351; }
html[data-theme="dark"] .cookie-banner { background: var(--surface); border-color: var(--line); box-shadow: 0 8px 30px #0005; }
html[data-theme="dark"] .overview-progress li.current { color: #a5caff; border-color: #6e9dd9; }
html[data-theme="dark"] .overview-progress li.complete { color: var(--theme-success); border-color: #659e7f; }
html[data-theme="dark"] .page-progress { background: #304a3d; }
html[data-theme="dark"] .provider-limit progress,
html[data-theme="dark"] .provider-limit progress::-webkit-progress-bar { background: var(--line); }
html[data-theme="dark"] .modal::backdrop { background: #05080bb3; }
html[data-theme="dark"] .workspace-calendar { box-shadow: 0 12px 36px #0006; }
html[data-theme="dark"] .workspace-calendar :is(.flatpickr-day, .flatpickr-month, .flatpickr-current-month, .flatpickr-weekdays) { color: var(--ink); background: transparent; }
html[data-theme="dark"] .workspace-calendar .flatpickr-day.flatpickr-disabled { color: #647181; }
html[data-theme="dark"] .workspace-calendar :is(.flatpickr-day:hover, .calendar-navigation button:hover:not(:disabled), .calendar-choice-grid button:hover:not(:disabled)) { background: var(--soft); border-color: var(--line); color: var(--ink); }
html[data-theme="dark"] .workspace-calendar :is(.flatpickr-day.selected, .flatpickr-day.selected:hover, .calendar-choice-grid button[aria-pressed="true"]) { background: #99d0b5; color: #14271e; border-color: #99d0b5; }
html[data-theme="dark"] .workspace-calendar .flatpickr-day.today { border-color: var(--accent); }
html[data-theme="dark"] :is(.select-trigger:focus-visible, button:focus-visible, a:focus-visible) { outline-color: var(--accent); }
/* Keep the provider's illustrated dark UI and its contrast unchanged. */
html[data-theme="dark"] .openai-guide-example { color: #f5f5f5; }
