/* Keep reports and browser printing in their original light palette. */
@media print { .theme-picker { display: none !important; } }
@media screen {
:root {
    --theme-control-bg: #edf2ef;
    --theme-control-ink: #294941;
    --theme-control-line: #bbc9c2;
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --night-page: #111c22;
    --night-surface: #1b2a31;
    --night-raised: #23363e;
    --night-line: #3b5058;
    --night-ink: #e4eee9;
    --night-muted: #b1c2c2;
    --night-link: #9acfc6;
    --night-primary: #32675f;
    --night-info: #a5c9ea;
    --night-info-bg: #23394c;
    --night-good: #9bd5b2;
    --night-good-solid: #316449;
    --night-good-bg: #213c34;
    --night-warn: #e7c493;
    --night-warn-solid: #77552d;
    --night-warn-bg: #423728;
    --night-risk: #f1acb2;
    --night-risk-solid: #873e49;
    --night-risk-bg: #462f38;
    --night-sell: #c7b3dd;
    --night-sell-bg: #393346;
    --desk-paper: var(--night-page);
    --desk-surface: var(--night-surface);
    --desk-ink: var(--night-ink);
    --desk-muted: var(--night-muted);
    --desk-action: var(--night-link);
    --desk-rule: var(--night-line);
    --desk-sage: #263d3a;
    --desk-buy: #78b7a4;
    --desk-sell: #b49acb;
    --desk-focus: #a1d8c8;
    --desk-depth: 0 3px 12px -8px rgb(0 0 0 / 40%);
    --theme-control-bg: var(--night-raised);
    --theme-control-ink: var(--night-ink);
    --theme-control-line: #566e74;
}
:root[data-theme="dark"] .desk-page {
    --line-soft: #304249;
    --text: var(--night-ink);
    --green: var(--night-good);
    --green-soft: var(--night-good-bg);
    --red: var(--night-risk);
    --red-soft: var(--night-risk-bg);
    --orange: var(--night-warn);
    --orange-soft: var(--night-warn-bg);
    --blue-soft: var(--night-info-bg);
}
.theme-picker:not([hidden]) {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: max-content;
    min-height: 34px;
    padding: 0 11px;
    border: 1px solid var(--theme-control-line);
    border-radius: 8px;
    background: var(--theme-control-bg);
    color: var(--theme-control-ink);
    font: 550 12px/1.3 "Segoe UI", system-ui, sans-serif;
    cursor: pointer;
}
.theme-picker::before {
    content: "";
    width: 12px;
    height: 12px;
    border: 1.5px solid currentColor;
    border-radius: 50%;
    background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}
.theme-picker > span { color: inherit; font: inherit; }
.theme-picker:hover { border-color: var(--desk-focus, #39796f); }
.theme-picker:focus-visible { outline: 2px solid var(--desk-focus, #39796f); outline-offset: 2px; }
.header-session-actions { flex-wrap: wrap; justify-content: flex-end; }
:root[data-theme="dark"] :is(.auth-page, .access-admin-page) { color-scheme: dark; }
:root[data-theme="dark"] .access-admin-page { --amber: var(--night-warn); --danger: var(--night-risk); }
:root[data-theme="dark"] .access-cover {
    color: #e8f1ec;
    background-color: #243940;
    background-image: linear-gradient(165deg, rgb(13 32 39 / 84%), rgb(22 46 49 / 30%)), url("plateau-abidjan.webp");
}
:root[data-theme="dark"] .session-orders::before { opacity: .17; }
:root[data-theme="dark"] .auth-form input:focus { box-shadow: 0 0 0 4px #304a48; }
:root[data-theme="dark"] :is(.source-chip.ok b, .access-status.is-active, .order-side.buy) { background: var(--night-good-bg); color: var(--night-good); }
:root[data-theme="dark"] .order-side.sell { background: var(--night-sell-bg); color: var(--night-sell); }
:root[data-theme="dark"] .access-card-heading i { color: var(--night-muted); }
:root[data-theme="dark"] :is(.mi-heatmap, .mi-heat-legend) .strong-up { background: #256142; }
:root[data-theme="dark"] :is(.mi-heatmap, .mi-heat-legend) .up { background: #38594c; }
:root[data-theme="dark"] :is(.mi-heatmap, .mi-heat-legend) .flat { background: #465764; }
:root[data-theme="dark"] :is(.mi-heatmap, .mi-heat-legend) .down { background: #784b50; }
:root[data-theme="dark"] :is(.mi-heatmap, .mi-heat-legend) .strong-down { background: #923942; }
:root[data-theme="dark"] .cover-caption { background: #233a3d; color: #edf3ef; }
:root[data-theme="dark"] .auth-form .primary-button,
:root[data-theme="dark"] :is(.access-primary, .access-credential button, .access-user-actions button:not(.is-secondary)) {
    background: var(--night-link);
    color: #142d2a;
}
:root[data-theme="dark"] .auth-form .primary-button:hover { background: #b0ddd2; }
@media (max-width: 980px) {
    .sidebar.open .nav-group-links a { min-height: 44px; }
}
@media (max-width: 720px) {
    .header-session-actions { justify-content: flex-start; margin-left: 0; }
    .theme-picker:not([hidden]) { min-height: 38px; }
    :root[data-theme="dark"] .access-cover {
        background-image: linear-gradient(90deg, #21363a 12%, rgb(22 45 50 / 48%) 85%), url("plateau-abidjan.webp");
    }
    :root[data-theme="dark"] .cover-brand, :root[data-theme="dark"] .cover-title { background: transparent; }
}

:root[data-theme="dark"] .closing-report {
    --blue: var(--night-info);
    --paper: var(--night-surface);
    --soft: var(--night-raised);
    --ink: var(--night-ink);
    --line: var(--night-line);
    --muted: var(--night-muted);
    --red: var(--night-risk);
    --orange: var(--night-warn);
    --green: var(--night-good);
    background: var(--night-page);
}
:root[data-theme="dark"] .desk-page .qd-command section { background: var(--night-surface); color: var(--night-ink); }
}
