:root { color-scheme:light; }
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--border-color, #d7dee4);
    border-radius: 999px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    flex: 0 0 auto;
    transition:
        border-color 160ms ease,
        box-shadow 160ms ease,
        background-color 160ms ease;
}

.theme-toggle:hover {
    border-color: #8b9ba7;
}

.theme-toggle:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.35);
    outline-offset: 2px;
}

.theme-toggle__track {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 44px;
    height: 24px;
    padding: 0 5px;
    overflow: hidden;
    border-radius: 999px;
    background: #e8edf1;
    box-sizing: border-box;
    transition: background-color 180ms ease;
}

.theme-toggle__thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow:
        0 1px 3px rgba(15, 23, 42, 0.22),
        0 1px 2px rgba(15, 23, 42, 0.12);
    transform: translateX(0);
    transition:
        transform 180ms ease,
        background-color 180ms ease;
}

.theme-toggle__icon {
    position: relative;
    z-index: 1;
    font-size: 13px;
    line-height: 1;
    transition:
        color 180ms ease,
        opacity 180ms ease;
}

.theme-toggle__icon--sun {
    color: #b45309;
    opacity: 1;
}

.theme-toggle__icon--moon {
    color: #64748b;
    opacity: 0.55;
}

html[data-theme="dark"] .theme-toggle {
    border-color: #475569;
}

html[data-theme="dark"] .theme-toggle__track {
    background: #263d48;
}

html[data-theme="dark"] .theme-toggle__thumb {
    background: #f8fafc;
    transform: translateX(20px);
}

html[data-theme="dark"] .theme-toggle__icon--sun {
    color: #94a3b8;
    opacity: 0.55;
}

html[data-theme="dark"] .theme-toggle__icon--moon {
    color: #f8fafc;
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .theme-toggle,
    .theme-toggle__track,
    .theme-toggle__thumb,
    .theme-toggle__icon {
        transition: none;
    }
}
.access-brand .theme-control { margin-left:auto; }
html[data-theme="dark"] { color-scheme:dark; --ink:#e0ebe6; --muted:#a9bdb6; --canvas:#102026; --paper:#192d33; --line:#3c555a; --nav:#0c1d23; --nav-muted:#b4c8c4; --green:#9bd9bc; --mint:#24473b; --risk:#ffb4a5; --risk-bg:#492c2c; --blue:#a4c8f5; --blue-bg:#293d54; --amber:#efcc8c; --amber-bg:#453a27; --shadow:0 3px 14px #0002; }
html[data-theme="dark"] body { background:var(--canvas); color:var(--ink); }
html[data-theme="dark"] :is(.topbar,.panel,.source-dialog,.header-panel,.access-card,.assistant-panel,.assistant-compose,.asset-list,.ops-table,.institution-links,.operational-summary,.record-card,.entity-section-nav,.entity-context-bar,.filter-bar,.filters,.entity-card,.entity-row,.table-container,.stat-card,.kpi-card,.note-item,.demo-tour,.chart-tooltip,.tooltip,.card,.search-results) { background:var(--paper); color:var(--ink); border-color:var(--line); }
html[data-theme="dark"] :is(input,textarea,select,.login-card input,.assistant-compose textarea) { background:#13252b; color:var(--ink); border-color:#6e8985; }
html[data-theme="dark"] :is(input,textarea)::placeholder { color:#a9bdb6; opacity:1; }
html[data-theme="dark"] :is(.muted,.fine-print,small,.eyebrow,.access-intro,.login-card label,.assistant-caption,.assistant-context,.assistant-metadata,.assistant-compose-actions span,#assistant-disclaimer,.assistant-message-label,.record-origin,.nav-caption,.breadcrumb,.chart-legend,.axis-label,.chart-axis,.filter-label) { color:var(--muted); }
html[data-theme="dark"] :is(.button.primary,.access-primary,.assistant-launcher,.tour-launch) { background:#285f4c; color:#f3fff7; border-color:#629c80; }
html[data-theme="dark"] :is(.button.secondary,.icon-button,.favorite,.assistant-prompts button,.profile-button) { background:var(--paper); color:var(--ink); border-color:var(--line); }
html[data-theme="dark"] :is(.button.secondary:hover,.icon-button:hover,.assistant-prompts button:hover,.favorite:hover,.profile-button:hover,.password-field button:hover) { background:#29453f; color:#f3fff7; }
html[data-theme="dark"] :is(.text-link,.source-link,.assistant-links a,.assistant-links button,.assistant-context button,.institution-links a,.password-field button) { color:var(--green); }
html[data-theme="dark"] :is(.decision-note,.callout,.suggested-action,.norm-hero,.source-disclaimer,.briefing-summary,.assistant-context,.empty-inline,.empty-state,.assistant-message.user,.summary-card,.context-card) { background:#213e37; color:var(--ink); border-color:#46635b; }
html[data-theme="dark"] :is(.badge,.tiny-badge,.tag,.status-badge) { background:#31474c; color:#e5eee9; border-color:#54716a; }
html[data-theme="dark"] :is(.badge.risk,.badge.Critical,.severity.Critical,.text-risk,.access-error,.assistant-error) { background:var(--risk-bg); color:var(--risk); border-color:#87594d; }
html[data-theme="dark"] :is(.badge.warning,.badge.High,.severity.High) { background:var(--amber-bg); color:var(--amber); }
html[data-theme="dark"] :is(.badge.client,.badge.opportunity,.badge.Verified,.badge.success) { background:#264c3e; color:#b4e6c9; }
html[data-theme="dark"] :is(.badge.context,.badge.Information,.severity.Information) { background:var(--blue-bg); color:var(--blue); }
html[data-theme="dark"] :is(.tabs button,.entity-tabs button) { background:transparent; color:var(--muted); border-color:var(--line); }
html[data-theme="dark"] :is(.tabs button[aria-selected="true"],.tabs button.active) { color:var(--green); border-color:var(--green); background:#243e36; }
html[data-theme="dark"] :is(table,thead,tbody,tr,td,th) { border-color:var(--line); }
html[data-theme="dark"] :is(th,.source-card,.service-row,.document-row,.run-row,.agent-result,.compact-alert,.notification-item,.financial-metrics>div,.metric,.stat,.source-meta>div,.facts>div,.chart-table,.progress-track,.kanban-column) { background:var(--paper); color:var(--ink); border-color:var(--line); }
html[data-theme="dark"] :is(.run-row:hover,.notification-item:hover,tr:hover,.entity-row:hover) { background:#243e36; }
html[data-theme="dark"] :is(.nav-link.active,.nav-link:hover) { background:#2b5146; color:#f0fff6; }
html[data-theme="dark"] .sidebar { background:var(--nav); border-color:var(--line); }
html[data-theme="dark"] .avatar { background:#345449; color:#dff5e7; }
html[data-theme="dark"] .toast { background:#214a3a; color:#effbf4; }
html[data-theme="dark"] :is(.assistant-emblem,.mini-icon,.entity-icon,.norm-symbol) { background:#24473b; color:#b9e7ce; border-color:#54766a; }
html[data-theme="dark"] :is(.login-heading,.login-card,.access-note,.app-footer,.panel-heading,.source-card,.assistant-heading,.assistant-compose,.assistant-context) { border-color:var(--line); }
html[data-theme="dark"] .skip-link { background:var(--paper); color:var(--green); }
html[data-theme="dark"] :is(.attention-strip,.metric-strip,.agent-compact,.alert-item,.alert-filters,.briefing-paper,.tag-outline,.norm-action,.competitor-card) { background:var(--paper); color:var(--ink); border-color:var(--line); }
html[data-theme="dark"] :is(.agent-issue,.trend-summary,.briefing-takeaway,.briefing-risk,.norm-action,.severity-explanation) { background:#233c37; color:var(--ink); }
html[data-theme="dark"] :is(.app-footer,.entity-need,.risk-label.basso,.breadcrumb span,.norm-hero p,.norm-deadline strong,.norm-deadline span,.norm-deadline small,.norm-disclaimer,.briefing-risk strong,.text-button) { color:var(--muted); }
html[data-theme="dark"] :is(.metric-strip>a:hover,.attention-strip>a:hover,.agent-compact:hover) { background:#26483f; }
html[data-theme="dark"] progress { color:#17352b; }
html[data-theme="dark"] :is(.alert-inbox,.analysis-workspace,.analysis-phases li,.analysis-phases li>span) { background:var(--paper); color:var(--ink); border-color:var(--line); }
html[data-theme="dark"] :is(.analysis-phases .done,.analysis-phases .current,.alert-item summary:hover,.run-row[aria-pressed="true"]) { background:#26483f; color:#d7ecdf; }
html[data-theme="dark"] :is(.briefing-takeaway h2,.briefing-takeaway p,.decision-note h2,.decision-note p,.callout p,.step-number,.competitor-card blockquote) { color:var(--ink); }
html[data-theme="dark"] .favorite[aria-pressed="true"] { color:#f1cb7b; background:#413a28; }
html[data-theme="dark"] .tour-launch span { color:#f3fff7; }
html[data-theme="dark"] .filter-panel { background:var(--paper); border-color:var(--line); }
html[data-theme="dark"] .filter-panel label { color:var(--ink); }
html[data-theme="dark"] .segmented button { background:var(--paper); color:var(--muted); }
html[data-theme="dark"] .segmented button[aria-pressed="true"] { background:#285f4c; color:#f3fff7; }
html[data-theme="dark"] :is(.briefing-section p,.discussion-list,.suggested-action p,.competitor-card>p) { color:var(--ink); }
html[data-theme="dark"] .button.primary span { color:#f3fff7; }
html[data-theme="dark"] .norm-deadline .text-link { color:var(--blue); }
html[data-theme="dark"] .impact-flow b { color:var(--muted); }
html[data-theme="dark"] .source-excerpt { background:#13252b; color:var(--ink); }
html[data-theme="dark"] :focus-visible { outline:3px solid #f5c57b; outline-offset:3px; }
html[data-theme="dark"] .chart-tooltip { background:#203b34; color:var(--ink); border:1px solid var(--line); }
@media(max-width:760px){.theme-control select{max-width:108px;font-size:10px;}.topbar{gap:7px;}.access-brand{flex-wrap:wrap;}.access-brand .theme-control{margin-left:auto;}}
@media print { html[data-theme] { color-scheme:light; --ink:#203335; --muted:#526466; --canvas:white; --paper:white; --line:#d5dfd8; --green:#246652; --risk:#a14235; --amber:#895c20; } html[data-theme="dark"] body,html[data-theme="dark"] :is(.panel,.record-card,.asset-list,td,th,.decision-note,.callout,.norm-hero,.service-row,.document-row) {background:white!important;color:#203335!important;} .theme-control{display:none!important;} }
@media print { html[data-theme="dark"] :is(.briefing-paper,.briefing-paper *,.operational-entity,.operational-entity *) { background-color:transparent!important; color:#203335!important; } }
