:root {
    --theme-dark-page: #0E2A42;
    --theme-dark-deep: #081D2E;
    --theme-dark-surface: #14364F;
    --theme-dark-raised: #1A435E;
    --theme-dark-soft: #102F48;
    --theme-dark-text: #F4F8FB;
    --theme-dark-muted: #A8BDCC;
    --theme-dark-line: #2B536C;
    --theme-dark-line-strong: #3D6A83;
    --theme-dark-highlight: #4DB3E6;
    --theme-dark-primary: #287BA7;
    --theme-dark-success: #4EBF91;
    --theme-dark-warning: #E1A84A;
    --theme-dark-danger: #B84F5A;
    --chart-primary: #2D63E8;
    --chart-secondary: #6F8EEA;
    --chart-success: #48A886;
    --chart-warning: #E2A33D;
    --chart-danger: #D95868;
    --chart-text: #53637E;
    --chart-line: #D7DFEB;
    --chart-grid: #EDF1F7;
    --chart-tooltip: #152B4F;
    --chart-tooltip-text: #FFFFFF;
    --chart-surface: #FFFFFF;
    --chart-warning-area: rgba(226, 163, 61, .10);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --ui-page: #0E2A42;
    --ui-surface: #14364F;
    --ui-surface-soft: #102F48;
    --ui-surface-blue: #1A435E;
    --ui-text: #F4F8FB;
    --ui-muted: #A8BDCC;
    --ui-line: #2B536C;
    --ui-line-strong: #3D6A83;
    --ui-primary: #287BA7;
    --ui-primary-strong: #226D94;
    --ui-primary-soft: #173F59;
    --ui-violet: #4DB3E6;
    --ui-success: #4EBF91;
    --ui-success-soft: #173E3B;
    --ui-warning: #E1A84A;
    --ui-warning-soft: #493A24;
    --ui-danger: #E27A84;
    --ui-danger-soft: #4D2B36;
    --ui-shadow-sm: 0 8px 22px rgba(4, 20, 32, .24);
    --ui-shadow-md: 0 20px 52px rgba(4, 20, 32, .36);

    /* Compatibility tokens used by the review and dashboard pages. */
    --green-950: #081D2E;
    --green-900: #F4F8FB;
    --green-800: #3E9BC8;
    --green-700: #287BA7;
    --green-300: #3D6A83;
    --green-100: #1A435E;
    --green-050: #102F48;
    --line: #2B536C;
    --line-soft: #23485F;
    --surface: #14364F;
    --page: #0E2A42;
    --text: #F4F8FB;
    --muted: #A8BDCC;
    --warning: #E1A84A;
    --danger: #E27A84;
    --chart-primary: #4DB3E6;
    --chart-secondary: #75C6E9;
    --chart-success: #4EBF91;
    --chart-warning: #E1A84A;
    --chart-danger: #E27A84;
    --chart-text: #A8BDCC;
    --chart-line: #3D6A83;
    --chart-grid: #23485F;
    --chart-tooltip: #081D2E;
    --chart-tooltip-text: #F4F8FB;
    --chart-surface: #14364F;
    --chart-warning-area: rgba(225, 168, 74, .14);
}

html[data-theme="light"] { color-scheme: light; }

html[data-theme="dark"],
html[data-theme="dark"] body {
    background: #0E2A42 !important;
    color: #F4F8FB;
}

html[data-theme="dark"] ::selection { color: #071722; background: #4DB3E6; }
html[data-theme="dark"] button:focus-visible,
html[data-theme="dark"] input:focus-visible,
html[data-theme="dark"] select:focus-visible,
html[data-theme="dark"] textarea:focus-visible,
html[data-theme="dark"] [tabindex]:focus-visible {
    outline-color: rgba(77, 179, 230, .72) !important;
}

.ui-theme-switch {
    display: inline-grid;
    grid-template-columns: 1fr 1fr;
    min-width: 116px;
    padding: 3px;
    border: 1px solid var(--ui-line, #dce4f0);
    border-radius: 10px;
    background: var(--ui-surface-soft, #f7f9fc);
}
.ui-theme-switch button {
    min-width: 52px;
    min-height: 32px;
    padding: 5px 9px;
    border: 0;
    border-radius: 7px;
    color: var(--ui-muted, #697792);
    background: transparent;
    box-shadow: none;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}
.ui-theme-switch button:hover:not(:disabled) { color: var(--ui-text); background: color-mix(in srgb, var(--ui-primary) 12%, transparent); transform: none; }
.ui-theme-switch button.is-active { color: #F4F8FB; background: var(--ui-primary); box-shadow: 0 4px 12px rgba(4, 20, 32, .22); }
.auth-theme-slot { display: flex; justify-content: flex-end; margin: -8px -8px 14px 0; }
.account-actions [data-theme-toggle], .topbar-actions [data-theme-toggle] { width: 100%; }
.account-actions .ui-theme-switch, .topbar-actions .ui-theme-switch { width: 100%; }
.mobile-theme-toggle { display: none; }

/* Native controls and browser autofill */
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
    border-color: #2B536C !important;
    color: #F4F8FB !important;
    background-color: #102F48 !important;
    caret-color: #4DB3E6;
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: #7895A8 !important; opacity: 1; }
html[data-theme="dark"] input:-webkit-autofill,
html[data-theme="dark"] input:-webkit-autofill:hover,
html[data-theme="dark"] input:-webkit-autofill:focus {
    -webkit-text-fill-color: #F4F8FB;
    -webkit-box-shadow: 0 0 0 1000px #102F48 inset;
    transition: background-color 9999s ease-out;
}
html[data-theme="dark"] input[type="checkbox"],
html[data-theme="dark"] input[type="radio"] { accent-color: #4DB3E6; }
html[data-theme="dark"] select { color-scheme: dark; }
html[data-theme="dark"] button:disabled { color: #718C9E !important; background-color: #163348 !important; border-color: #294A60 !important; }

/* Login */
html[data-theme="dark"] .auth-overlay,
html[data-theme="dark"] .auth-screen {
    background: rgba(8, 29, 46, .96) !important;
}
html[data-theme="dark"] .auth-card {
    border-color: #2B536C !important;
    color: #F4F8FB !important;
    background: #14364F !important;
    box-shadow: 0 26px 70px rgba(3, 17, 28, .42) !important;
}
html[data-theme="dark"] .auth-card h1,
html[data-theme="dark"] .auth-card h2,
html[data-theme="dark"] .auth-card label { color: #F4F8FB !important; }
html[data-theme="dark"] .auth-card > p,
html[data-theme="dark"] .auth-card .auth-preferences label { color: #A8BDCC !important; }
html[data-theme="dark"] .auth-status { color: #F2A1A9 !important; }

/* Shared interactive surfaces */
html[data-theme="dark"] button:not(.weather-scene *):not([data-theme-choice]) {
    border-color: #287BA7;
}
html[data-theme="dark"] button.quiet,
html[data-theme="dark"] .icon-button,
html[data-theme="dark"] .chat-icon-button,
html[data-theme="dark"] .explorer-icon-btn,
html[data-theme="dark"] .mobile-resource-close,
html[data-theme="dark"] .mobile-account-toggle,
html[data-theme="dark"] .template-setup-head button,
html[data-theme="dark"] .chat-tool-drawer > header button,
html[data-theme="dark"] .link-btn,
html[data-theme="dark"] .btn.secondary {
    color: #D8E7F0 !important;
    border-color: #2B536C !important;
    background: #14364F !important;
}
html[data-theme="dark"] .account-chip {
    border-color: #2B536C !important;
    color: #D8E7F0 !important;
    background: #102F48 !important;
}
html[data-theme="dark"] button.quiet:hover:not(:disabled),
html[data-theme="dark"] .icon-button:hover:not(:disabled),
html[data-theme="dark"] .chat-icon-button:hover:not(:disabled),
html[data-theme="dark"] .explorer-icon-btn:hover:not(:disabled),
html[data-theme="dark"] .mobile-resource-close:hover:not(:disabled),
html[data-theme="dark"] .mobile-account-toggle:hover:not(:disabled),
html[data-theme="dark"] .template-setup-head button:hover:not(:disabled),
html[data-theme="dark"] .chat-tool-drawer > header button:hover:not(:disabled),
html[data-theme="dark"] .link-btn:hover {
    color: #F4F8FB !important;
    border-color: #4DB3E6 !important;
    background: #1A435E !important;
}
html[data-theme="dark"] .ui-tooltip::after { color: #F4F8FB; background: #081D2E; border: 1px solid #2B536C; }
html[data-theme="dark"] .ui-skeleton { background: #1A435E; }
html[data-theme="dark"] .ui-skeleton::after { background: linear-gradient(90deg, transparent, rgba(168,189,204,.15), transparent); }
html[data-theme="dark"] ::-webkit-scrollbar { width: 10px; height: 10px; }
html[data-theme="dark"] ::-webkit-scrollbar-track { background: #0B2438; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb { border: 2px solid #0B2438; border-radius: 999px; background: #3D6A83; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #4D7D96; }

/* Toasts, menus, dialogs, drawers and scrims */
html[data-theme="dark"] .ui-toast-card {
    border-color: #2B536C;
    color: #F4F8FB;
    background: rgba(20, 54, 79, .98);
    box-shadow: 0 18px 46px rgba(3, 17, 28, .42);
}
html[data-theme="dark"] .ui-toast-icon { background: color-mix(in srgb, var(--toast-accent) 18%, #102F48); }
html[data-theme="dark"] .ui-toast-close { color: #A8BDCC; }
html[data-theme="dark"] .ui-toast-close:hover { color: #F4F8FB; background: #1A435E; }
html[data-theme="dark"] .dialog-backdrop,
html[data-theme="dark"] .template-setup-scrim,
html[data-theme="dark"] .mobile-workspace-scrim,
html[data-theme="dark"] .chat-mobile-menu::before { background-color: rgba(3, 16, 27, .7) !important; }
html[data-theme="dark"] .approval-dialog,
html[data-theme="dark"] .template-setup-dialog,
html[data-theme="dark"] .preview-dialog,
html[data-theme="dark"] .preview-modal,
html[data-theme="dark"] .record-context-menu,
html[data-theme="dark"] .chat-user-actions,
html[data-theme="dark"] .chat-camera-menu,
html[data-theme="dark"] .chat-add-menu,
html[data-theme="dark"] .chat-mobile-menu,
html[data-theme="dark"] .chat-tool-drawer,
html[data-theme="dark"] .right-panel,
html[data-theme="dark"] .detail-drawer {
    border-color: #2B536C !important;
    color: #F4F8FB !important;
    background: #14364F !important;
    box-shadow: 0 26px 70px rgba(3, 17, 28, .46) !important;
}
html[data-theme="dark"] .chat-add-menu button,
html[data-theme="dark"] .chat-camera-menu button,
html[data-theme="dark"] .chat-user-actions button,
html[data-theme="dark"] .chat-user-action-menu button {
    color: #F4F8FB !important;
    background: transparent !important;
}
html[data-theme="dark"] .chat-add-menu button:hover:not(:disabled),
html[data-theme="dark"] .chat-camera-menu button:hover:not(:disabled),
html[data-theme="dark"] .chat-user-actions button:hover:not(:disabled),
html[data-theme="dark"] .chat-user-action-menu button:hover:not(:disabled) { background: #1A435E !important; }
html[data-theme="dark"] .chat-add-menu button:active:not(:disabled),
html[data-theme="dark"] .chat-camera-menu button:active:not(:disabled),
html[data-theme="dark"] .chat-user-actions button:active:not(:disabled),
html[data-theme="dark"] .chat-user-action-menu button:active:not(:disabled) { background: #173F59 !important; }
html[data-theme="dark"] .chat-add-menu button:focus-visible,
html[data-theme="dark"] .chat-camera-menu button:focus-visible,
html[data-theme="dark"] .chat-user-actions button:focus-visible,
html[data-theme="dark"] .chat-user-action-menu button:focus-visible { outline-color: #4DB3E6 !important; }

/* Member workspace */
html[data-theme="dark"] .app,
html[data-theme="dark"] .layout,
html[data-theme="dark"] .main,
html[data-theme="dark"] .chat-workspace,
html[data-theme="dark"] .conversation-stream { background-color: #0E2A42 !important; color: #F4F8FB; }
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .resource-brand,
html[data-theme="dark"] .log-explorer-card,
html[data-theme="dark"] .member-template-card,
html[data-theme="dark"] .right-panel-card,
html[data-theme="dark"] .chat-composer-shell,
html[data-theme="dark"] .chat-date-control,
html[data-theme="dark"] .chat-empty-mark {
    border-color: #2B536C !important;
    color: #F4F8FB !important;
    background: #14364F !important;
}
html[data-theme="dark"] .topbar .browser-tabs-shell,
html[data-theme="dark"] .topbar .browser-tab,
html[data-theme="dark"] .status-strip,
html[data-theme="dark"] .header-tool-btn,
html[data-theme="dark"] .user-pill,
html[data-theme="dark"] .pill,
html[data-theme="dark"] .badge,
html[data-theme="dark"] .ghost {
    border-color: #2B536C !important;
    color: #D8E7F0 !important;
    background: #102F48 !important;
}
html[data-theme="dark"] .topbar .browser-tab:hover,
html[data-theme="dark"] .topbar .browser-tab.active,
html[data-theme="dark"] .header-tool-btn:hover,
html[data-theme="dark"] .ghost:hover { color: #F4F8FB !important; border-color: #4DB3E6 !important; background: #1A435E !important; }
html[data-theme="dark"] .topbar .browser-tab .close:hover { color: #F4F8FB !important; background: #173F59 !important; }
html[data-theme="dark"] .chat-head { background: linear-gradient(180deg, #0E2A42 78%, rgba(14,42,66,0)) !important; }
html[data-theme="dark"] .chat-head-row h2,
html[data-theme="dark"] .chat-head-row strong { color: #F4F8FB !important; }
html[data-theme="dark"] .topbar { box-shadow: 0 10px 30px rgba(3, 17, 28, .22) !important; }
html[data-theme="dark"] .explorer-toolbar,
html[data-theme="dark"] .explorer-list-header,
html[data-theme="dark"] .explorer-folders,
html[data-theme="dark"] .record-list,
html[data-theme="dark"] .member-template-heading,
html[data-theme="dark"] .preview-head,
html[data-theme="dark"] .template-setup-head,
html[data-theme="dark"] .template-setup-actions,
html[data-theme="dark"] .chat-tool-drawer > header {
    border-color: #2B536C !important;
    background: #102F48 !important;
}
html[data-theme="dark"] .explorer-folder,
html[data-theme="dark"] .explorer-record,
html[data-theme="dark"] .tab,
html[data-theme="dark"] .composer-source-chip,
html[data-theme="dark"] .template-setup-summary,
html[data-theme="dark"] .chat-process-summary,
html[data-theme="dark"] .chat-generation-process,
html[data-theme="dark"] .generation-section,
html[data-theme="dark"] .generation-change,
html[data-theme="dark"] .generation-note,
html[data-theme="dark"] .approval-inline-item,
html[data-theme="dark"] .chat-edit-row {
    border-color: #2B536C !important;
    color: #F4F8FB !important;
    background: #102F48 !important;
}
html[data-theme="dark"] .explorer-record:hover,
html[data-theme="dark"] .explorer-folder:hover,
html[data-theme="dark"] .tab:hover { background: #1A435E !important; }
html[data-theme="dark"] .explorer-record.active,
html[data-theme="dark"] .explorer-folder.active,
html[data-theme="dark"] .tab.active,
html[data-theme="dark"] .tab.is-active { border-color: #4DB3E6 !important; color: #F4F8FB !important; background: #1A435E !important; }
html[data-theme="dark"] .explorer-record-name,
html[data-theme="dark"] .chat-ai-title,
html[data-theme="dark"] .generation-section h3,
html[data-theme="dark"] .chat-empty h2 { color: #F4F8FB !important; }
html[data-theme="dark"] .explorer-record-name strong { color: #F4F8FB !important; }
html[data-theme="dark"] .explorer-record-name span { color: #A8BDCC !important; }
html[data-theme="dark"] .explorer-record-status { color: #A8BDCC !important; background: #1A435E !important; }
html[data-theme="dark"] .explorer-record-date,
html[data-theme="dark"] .explorer-record-status,
html[data-theme="dark"] .member-template-hint,
html[data-theme="dark"] .chat-eyebrow,
html[data-theme="dark"] .chat-bubble-meta,
html[data-theme="dark"] .chat-empty p,
html[data-theme="dark"] .chat-composer-hint,
html[data-theme="dark"] .generation-note,
html[data-theme="dark"] .chat-process-duration { color: #A8BDCC !important; }

html[data-theme="dark"] .chat-row.assistant .chat-bubble,
html[data-theme="dark"] .generation-complete,
html[data-theme="dark"] .chat-live-process {
    border-color: #2B536C !important;
    color: #F4F8FB !important;
    background: #14364F !important;
    box-shadow: 0 12px 30px rgba(3, 17, 28, .24) !important;
}
html[data-theme="dark"] .chat-row.assistant .chat-bubble::before {
    border-left-color: #2B536C !important;
    border-bottom-color: #2B536C !important;
    background: #14364F !important;
}
html[data-theme="dark"] .chat-row.user .chat-bubble,
html[data-theme="dark"] .chat-bubble.user { color: #F4F8FB !important; background: #287BA7 !important; }
html[data-theme="dark"] .chat-row.user .chat-bubble::after,
html[data-theme="dark"] .chat-bubble.user::after { border-left-color: #287BA7 !important; }
html[data-theme="dark"] .assistant-avatar { background: #102F48 !important; border-color: #2B536C !important; }
html[data-theme="dark"] .user-avatar { color: #F4F8FB !important; background: #081D2E !important; }
html[data-theme="dark"] .chat-composer { border-color: #3D6A83 !important; background: #14364F !important; box-shadow: 0 16px 42px rgba(3,17,28,.34) !important; }
html[data-theme="dark"] .chat-composer-input { color: #F4F8FB !important; background: transparent !important; }
html[data-theme="dark"] .chat-composer-resize-handle { background: #3D6A83 !important; }
html[data-theme="dark"] .chat-composer-shell { background: linear-gradient(0deg, #0E2A42 84%, rgba(14,42,66,0)) !important; }
html[data-theme="dark"] .chat-load-error,
html[data-theme="dark"] .chat-conflict-note { color: #F2A1A9 !important; background: #4D2B36 !important; border-color: #7D4450 !important; }
html[data-theme="dark"] .chat-active-task-progress { background: #0B2438 !important; }
html[data-theme="dark"] .chat-active-task-progress span { background: #4DB3E6 !important; }
html[data-theme="dark"] .chat-task-spinner { border-color: #2B536C !important; border-top-color: #4DB3E6 !important; }
html[data-theme="dark"] .chat-generation-process details,
html[data-theme="dark"] .chat-generation-process li,
html[data-theme="dark"] .generation-row { border-color: #2B536C !important; }
html[data-theme="dark"] .chat-ai-actions button,
html[data-theme="dark"] .chat-user-actions button,
html[data-theme="dark"] .chat-edit-row input,
html[data-theme="dark"] .chat-edit-notes textarea,
html[data-theme="dark"] .chat-edit-notes input { color: #F4F8FB !important; border-color: #3D6A83 !important; background: #102F48 !important; }
html[data-theme="dark"] .chat-ai-actions button:hover:not(:disabled),
html[data-theme="dark"] .chat-user-actions button:hover:not(:disabled) { color: #F4F8FB !important; border-color: #4DB3E6 !important; background: #1A435E !important; }
html[data-theme="dark"] .chat-ai-actions button.primary { color: #F4F8FB !important; border-color: #287BA7 !important; background: #287BA7 !important; }
html[data-theme="dark"] .generation-gx-meta,
html[data-theme="dark"] .generation-gx-records { border-color: #2B536C !important; background: #2B536C !important; }
html[data-theme="dark"] .generation-gx-meta > div,
html[data-theme="dark"] .generation-gx-record { color: #F4F8FB !important; background: #14364F !important; }
html[data-theme="dark"] .generation-gx-records > h4 { color: #F4F8FB !important; background: #102F48 !important; }
html[data-theme="dark"] .generation-gx-meta dt,
html[data-theme="dark"] .generation-gx-record strong { color: #A8BDCC !important; }

html[data-theme="dark"] .right-panel-card,
html[data-theme="dark"] .panel-scroll-region,
html[data-theme="dark"] .chat-tool-drawer-body { background-color: #14364F !important; }
html[data-theme="dark"] .thumb,
html[data-theme="dark"] .photo-card,
html[data-theme="dark"] .photo-result,
html[data-theme="dark"] .ledger-card,
html[data-theme="dark"] .file-card,
html[data-theme="dark"] .file-row,
html[data-theme="dark"] .file-info,
html[data-theme="dark"] .mini-status,
html[data-theme="dark"] .attachment-card,
html[data-theme="dark"] .upload-box,
html[data-theme="dark"] .upload-zone,
html[data-theme="dark"] .drop-zone {
    border-color: #2B536C !important;
    color: #F4F8FB !important;
    background-color: #102F48 !important;
}
html[data-theme="dark"] .upload-box strong,
html[data-theme="dark"] .file-row strong { color: #F4F8FB !important; }
html[data-theme="dark"] .upload-box span,
html[data-theme="dark"] .file-row span { color: #A8BDCC !important; }

/* Attachment panels include ledger containers outside the photo-card family. */
html[data-theme="dark"] #ledgerSection,
html[data-theme="dark"] .ledger-section {
    color: #F4F8FB !important;
    background: #14364F !important;
    border-color: #2B536C !important;
}
html[data-theme="dark"] .ledger-source-tag {
    color: #9BD8F3;
    background: #173F59;
}
html[data-theme="dark"] .file-row-actions .mini-btn {
    color: #F4F8FB !important;
    background: #173F59 !important;
    border-color: #4DB3E6 !important;
}
html[data-theme="dark"] .file-row-actions .mini-btn:hover:not(:disabled) {
    background: #235878 !important;
}
html[data-theme="dark"] .file-row-actions .mini-btn:active:not(:disabled) {
    background: #102F48 !important;
}
html[data-theme="dark"] .file-row-actions .mini-btn:focus-visible {
    outline: 2px solid #4DB3E6;
    outline-offset: 3px;
}
html[data-theme="dark"] .file-row-actions .mini-btn.danger {
    color: #FFBBC2 !important;
    background: #4D2B36 !important;
    border-color: #E27A84 !important;
}
html[data-theme="dark"] .file-row-actions .mini-btn.danger:hover:not(:disabled) {
    background: #633441 !important;
}
html[data-theme="dark"] .file-row-actions .mini-btn.danger:active:not(:disabled) {
    background: #3D2530 !important;
}
html[data-theme="dark"] .file-row-actions .mini-btn:disabled {
    color: #A8BDCC !important;
    background: #163348 !important;
    border-color: #3D6A83 !important;
    opacity: 1;
}

/* Weather remains luminous but uses the requested dark-blue family. */
html[data-theme="dark"] .weather-scene {
    border-color: #2B536C !important;
    background: linear-gradient(118deg, #143F5E 0%, #145374 52%, #226D94 100%) !important;
    box-shadow: 0 16px 34px rgba(3,17,28,.28) !important;
}
html[data-theme="dark"] .weather-cloud { filter: brightness(.96) saturate(.85); }
html[data-theme="dark"] .weather-rain,
html[data-theme="dark"] .weather-drizzle,
html[data-theme="dark"] .weather-snow { filter: brightness(1.24); }

/* Project review workspace */
html[data-theme="dark"] .workspace-shell,
html[data-theme="dark"] .view,
html[data-theme="dark"] .workspace-nav { background-color: #0E2A42 !important; }
html[data-theme="dark"] .workspace-nav,
html[data-theme="dark"] .view,
html[data-theme="dark"] .filters,
html[data-theme="dark"] .request-list,
html[data-theme="dark"] .summary-layout,
html[data-theme="dark"] .summary-layout > aside,
html[data-theme="dark"] .summary-toolbar,
html[data-theme="dark"] .summary-common-info,
html[data-theme="dark"] .approval-progress,
html[data-theme="dark"] .approval-items,
html[data-theme="dark"] .approval-item {
    border-color: #2B536C !important;
    color: #F4F8FB !important;
    background-color: #14364F !important;
}
html[data-theme="dark"] .filters,
html[data-theme="dark"] .request-list,
html[data-theme="dark"] .summary-layout > aside,
html[data-theme="dark"] .summary-common-info,
html[data-theme="dark"] .approval-progress,
html[data-theme="dark"] .approval-items { background-color: #102F48 !important; }
html[data-theme="dark"] .request-card,
html[data-theme="dark"] .summary-item { border-color: #2B536C !important; color: #F4F8FB !important; background: #14364F !important; }
html[data-theme="dark"] .request-card:hover,
html[data-theme="dark"] .summary-item:hover,
html[data-theme="dark"] .summary-item.active,
html[data-theme="dark"] .nav-item.active { color: #F4F8FB !important; background: #1A435E !important; }
html[data-theme="dark"] .nav-item strong { color: #4DB3E6 !important; background: #102F48 !important; }
html[data-theme="dark"] .status-pill { color: #9BD8F3 !important; background: #173F59 !important; }
html[data-theme="dark"] .status-pill.approved { color: #8DE0BD !important; background: #173E3B !important; }
html[data-theme="dark"] .status-pill.partial,
html[data-theme="dark"] .status-pill.mixed { color: #F1CA82 !important; background: #493A24 !important; }
html[data-theme="dark"] .status-pill.rejected,
html[data-theme="dark"] .approval-item .comment { color: #F2A1A9 !important; background: #4D2B36 !important; }
html[data-theme="dark"] .approval-item.active { border-color: #4DB3E6 !important; box-shadow: 0 0 0 3px rgba(77,179,230,.24) !important; }
html[data-theme="dark"] .decision-actions .reject { color: #F2A1A9 !important; border-color: #8E4A55 !important; background: #3D2530 !important; }

/* Univer shell is dark; the workbook and print canvas stay paper-white. */
html[data-theme="dark"] .sheet-host,
html[data-theme="dark"] .univer-sheet-host {
    border-color: #3D6A83 !important;
    background: #0B2438 !important;
    box-shadow: inset 0 0 0 1px #2B536C;
}
html[data-theme="dark"] .sheet-host canvas,
html[data-theme="dark"] .univer-sheet-host canvas,
html[data-theme="dark"] .sheet-host .univer-sheet-container,
html[data-theme="dark"] .univer-sheet-host .univer-sheet-container {
    color-scheme: light;
    background-color: #fff;
}

/* Operations dashboard */
html[data-theme="dark"] .dashboard-topbar,
html[data-theme="dark"] .control-band,
html[data-theme="dark"] .loading-state,
html[data-theme="dark"] .metric,
html[data-theme="dark"] .chart-panel,
html[data-theme="dark"] .chart-panel header,
html[data-theme="dark"] .data-band,
html[data-theme="dark"] .alert-panel,
html[data-theme="dark"] .health-panel,
html[data-theme="dark"] .table-scroll,
html[data-theme="dark"] .detail-drawer,
html[data-theme="dark"] .ai-audit-row,
html[data-theme="dark"] .ai-audit-response {
    border-color: #2B536C !important;
    color: #F4F8FB !important;
    background: #14364F !important;
}
html[data-theme="dark"] .drawer-content { color: #F4F8FB !important; background: #102F48 !important; }
html[data-theme="dark"] .dashboard-shell { background: #0E2A42 !important; }
html[data-theme="dark"] .control-band,
html[data-theme="dark"] .range-presets,
html[data-theme="dark"] .loading-state { background: #102F48 !important; }
html[data-theme="dark"] .metric:nth-child(1),
html[data-theme="dark"] .metric:nth-child(3) { color: #F4F8FB !important; background: #173F59 !important; }
html[data-theme="dark"] .metric strong,
html[data-theme="dark"] .alert-item strong,
html[data-theme="dark"] .health-list dd,
html[data-theme="dark"] td strong { color: #8FD3F2 !important; }
html[data-theme="dark"] th { color: #D8E7F0 !important; background: #102F48 !important; }
html[data-theme="dark"] td,
html[data-theme="dark"] th,
html[data-theme="dark"] .activity-item,
html[data-theme="dark"] .user-row { border-color: #2B536C !important; }
html[data-theme="dark"] tbody tr:hover { background: #1A435E !important; }
html[data-theme="dark"] .ai-audit-row:hover,
html[data-theme="dark"] .ai-audit-response summary,
html[data-theme="dark"] .ai-audit-response pre { color: #D8E7F0 !important; background: #102F48 !important; }

/* Alternative page */
html[data-theme="dark"] .app-shell,
html[data-theme="dark"] .surface { color: #F4F8FB !important; background: #0E2A42 !important; }
html[data-theme="dark"] .rail,
html[data-theme="dark"] .command-bar,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .metric,
html[data-theme="dark"] .status-pill,
html[data-theme="dark"] .file-row,
html[data-theme="dark"] .record-row,
html[data-theme="dark"] .check-row {
    border-color: #2B536C !important;
    color: #F4F8FB !important;
    background-color: #14364F !important;
}
html[data-theme="dark"] .panel-head,
html[data-theme="dark"] .rail-section,
html[data-theme="dark"] .rail-status { border-color: #2B536C !important; background-color: #102F48 !important; }
html[data-theme="dark"] .auth-mark,
html[data-theme="dark"] .rail .brand-mark:not(img),
html[data-theme="dark"] .rail-dot { color: #F4F8FB !important; background: #287BA7 !important; }
html[data-theme="dark"] .auth-card .btn,
html[data-theme="dark"] .surface .btn { color: #F4F8FB !important; border-color: #287BA7 !important; background: #287BA7 !important; }
html[data-theme="dark"] .auth-card .btn:hover,
html[data-theme="dark"] .surface .btn:hover { background: #226D94 !important; }
html[data-theme="dark"] .rail-item.active,
html[data-theme="dark"] .rail-item:hover { color: #F4F8FB !important; background: #1A435E !important; }

@media (max-width: 767px) {
    .ui-theme-switch button { min-height: 38px; }
    .auth-theme-slot { margin: -4px -4px 12px 0; }
    .desktop-theme-toggle { display: none !important; }
    .mobile-theme-toggle { display: block; padding: 10px 12px; }
    .mobile-theme-toggle .ui-theme-switch { width: 100%; }
    html[data-theme="dark"] .sidebar,
    html[data-theme="dark"] .right-panel,
    html[data-theme="dark"] .chat-tool-drawer { background: #14364F !important; }
}

@media (prefers-reduced-motion: reduce) {
    html[data-theme="dark"] .weather-scene *,
    html[data-theme="dark"] .chat-task-spinner,
    html[data-theme="dark"] .tab-ai-spinner { animation: none !important; }
}
