:root{--si-background:#fff;--si-surface:#fff;--si-text:#151412;--si-muted:#716b60;--si-border:#e7e5e1;--si-hover:#f1f0ed;--si-selected:#eeedf6}
html[data-theme=dark]{--si-background:#141519;--si-surface:#1d1e23;--si-text:#ececf1;--si-muted:#aaa8b2;--si-border:#36373e;--si-hover:#292a31;--si-selected:#343145;background:var(--si-background);color:var(--si-text)}
html[data-theme=dark] :is(body,.app,main,.sidebar,.collection,.conversation,.data-auth-screen){background:var(--si-background);color:var(--si-text)}
html[data-theme=dark] :is(dialog,.profile-popover,.chat-modes,.topic-suggestions,.custom-select-menu,.data-surface,.data-search,.composer,.savings-kpis,.savings-panel,.detail-keyfacts,.detail-section,.product-drawer,.ib-split,.ib-queue,.ib-reader,.ib-row,.settings-nav,.settings-row,.settings-rule,.settings-section,.settings-notice,.settings-field input,.settings-field textarea,.settings-field select,.insight-tile,.data-auth,.data-facts,.agreement-record,.agreement-upload){background:var(--si-surface);color:var(--si-text);border-color:var(--si-border)}
html[data-theme=dark] :is(input,textarea,select,.custom-select-trigger,.small-button,.workspace,.model,.ib-note-compose textarea){background:var(--si-surface);color:var(--si-text);border-color:var(--si-border)}
html[data-theme=dark] :is(h1,h2,h3,h4,button,label,dt,.settings-field,.ib-row strong,.ib-row-supplier,.ib-case-controls,.data-table td button,.settings-header,.settings-nav h2,.supplier-identity,.chat-title){color:var(--si-text)}
html[data-theme=dark] :is(p,small,.data-table th,.data-count,.product-note,.insight-source-note,.savings-basis-note,.settings-help,.settings-row span,.settings-nav-label,.settings-footer,.savings-kpis span,.data-facts dt,.ib-case-supplier,.ib-case-id,.ib-row-date,.product-row-meta,.disclaimer,.savings-chart-unit,.savings-chart-legend){color:var(--si-muted)}
html[data-theme=dark] :is(.data-table th,.data-table td,.data-pagination,.detail-tabs,.settings-header,.settings-footer,.settings-rule,.settings-row,.product-tabs,.product-drawer>header,.ib-reader-toolbar,.ib-case-identity,.ib-reader-section,.ib-action-bar,.savings-chart-data,.savings-kpis>div,.chat-header,.sidebar,.workspace){border-color:var(--si-border)}
html[data-theme=dark] :is(.data-table th,.data-toolbar,.ib-reader-toolbar,.ib-case-top,.ib-action-bar){background:var(--si-surface)}
html[data-theme=dark] :is(.nav-item:hover,.text-item:hover,.icon-button:hover,.small-button:hover,.data-back:hover,.custom-select-option:hover,.settings-nav button:hover,.chat-history-row:hover,.chat-history-row:focus-within,.ib-row:hover){background:var(--si-hover);color:var(--si-text)}
html[data-theme=dark] :is(.nav-item.active,.text-item.active,.settings-nav button[aria-current=true],.custom-select-option[aria-selected=true],.product-tabs button[aria-selected=true],.detail-tabs button[aria-selected=true],.ib-tabs button[aria-pressed=true],.ib-row[aria-current=true]){background:var(--si-selected);color:#d8d2fb}
html[data-theme=dark] .brand-logo{filter:invert(1)}html[data-theme=dark] .hero-art{opacity:.42}html[data-theme=dark] :is(.send,.ib-primary){background:#e5e4ee;color:#191a20}html[data-theme=dark] .savings-trend-chart text{fill:var(--si-muted)}html[data-theme=dark] .savings-trend-chart line{stroke:var(--si-border)}
html[data-theme=dark] :is(.preview-word,.preview-text,.preview-grid){background:#fff;color:#151412}html[data-theme=dark] :is(.preview-word,.preview-text,.preview-grid) :is(p,h1,h2,h3,h4,td,th,small){color:#151412}html[data-theme=dark] #preview-content{background:#141519}
.settings-appearance-language{max-width:300px;margin-bottom:28px}.settings-theme-label{display:block;font-size:14px;margin-bottom:12px}.settings-theme-options{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;max-width:460px;margin-bottom:26px}.settings-theme-options button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:14px;min-height:78px;border:1px solid var(--si-border);border-radius:10px;background:transparent;color:var(--si-text);font:500 14px Inter,sans-serif;transition:background-color 150ms ease,border-color 150ms ease}.settings-theme-options button[aria-pressed=true]{border-color:var(--si-text);background:var(--si-hover)}.settings-theme-options button:hover{background:var(--si-hover)}.settings-theme-options svg{width:20px;height:20px}.settings-theme-options button:focus-visible{outline:2px solid #394eeb;outline-offset:3px}

html[data-theme=dark] :is(.dashboard-kpis,.dashboard-panel,.dashboard-assistant,.dashboard-result,.attention-row,.dashboard-costs,.data-banner,.settings-section,.ib-case-summary){background:var(--si-surface);color:var(--si-text);border-color:var(--si-border)}html[data-theme=dark] :is(.dashboard-kpis strong,.dashboard-kpi-value,.dashboard-kpi span,.dashboard-period,.dashboard-text-link,.attention-row strong,.settings-section h3){color:var(--si-text)}html[data-theme=dark] :is(.dashboard-kpi,.dashboard-assistant,.attention-row){border-color:var(--si-border)}
html[data-theme=dark] #settings-dialog{background:var(--si-surface);color:var(--si-text);border-color:var(--si-border)}html[data-theme=dark] #settings-dialog :is(input,textarea,select,.custom-select-trigger){background:var(--si-surface);color:var(--si-text);border-color:var(--si-border)}

/* Shared dark states, including lazy-loaded workspaces and loading placeholders. */
html[data-theme=dark]{color-scheme:dark;--si-button-hover:var(--si-hover);--si-accent:#a4adff;--si-success:#9dd9b8;--si-warning:#e4c48a;--si-danger:#f0a5ac;--si-skeleton:#35363f}
html[data-theme=dark] :is(.sk-surface,.sk-metrics,.agreement-metrics,.agreement-empty,.queued-agreement,.agreement-search,.upload-select,.document-row,.chart-card,.ib-shell,.ib-evidence,.ib-workflow,.ib-case-layout,.ib-document,.ib-document-sheet,.ib-evidence-invoice,.savings-drivers button,.chips button,#home-composer>.composer){background:var(--si-surface);color:var(--si-text);border-color:var(--si-border)}
html[data-theme=dark] .sk-block{background:var(--si-skeleton)}
html[data-theme=dark] :is(.sk-row+.sk-row,.sk-metrics>div+div,.agreement-metric,.agreement-detail dl>div,.detail-disclosure,.detail-document+.detail-document,.invoice-dimension,.profile-menu-identity,.profile-menu-group,.profile-workspace,.profile-setting,.module-children,.modules-section,.ib-topline,.ib-list-footer,.ib-evidence-invoice,.ib-document-sheet dl>div,.ib-followup,.ib-case-evidence,.ib-note-input,.savings-drivers button,.savings-finding,.savings-evidence li,.savings-checks li,.savings-approval-history,.settings-nav-profile,.settings-users>div,.insight-observation,.chat-data-card,.chat-sources,.connected-answer td,.connected-answer th){border-color:var(--si-border)}
html[data-theme=dark] :is(.user-message,.ib-note,.ib-next-action,.price-empty,.demo-indicator,.settings-notice,.profile-municipality,.connected-answer pre,.connected-answer th,.chat-data-card,.savings-finding-body .data-facts){background:var(--si-hover);color:var(--si-text);border-color:var(--si-border)}
html[data-theme=dark] :is(.timestamp,.thinking,.axis,.answer-note,.upload-copy>span,.agreement-record-copy>span,.agreement-expiry>span,.agreement-expiry>strong,.agreement-metric h3,.agreement-metric p,.agreement-price-link.missing,.record-dot,.agreement-chevron,.profile-menu-identity>div>span,.profile-workspace h2,.profile-workspace small,.profile-setting>span,.profile-account p,.nav-section h2,.suggestions h2,.module-children .text-item,.custom-option-label small,.dashboard-unit,.spend-axis,.spend-month,.spend-summary,.attention-row>span>span,.dashboard-costs small,.settings-profile span:not(.user-avatar),.settings-row strong,.settings-rule-state,.settings-section-toolbar,.settings-pagination,.data-state,.data-table td small,.chat-data-card dt,.chat-sources summary,.product-tabs button,.insight-filters>label,.savings-area-amount,.savings-empty,.savings-type-table td small,.savings-evidence li>span,.ib-row-amount,.ib-row-owner,.ib-effect>span,.ib-case-controls label,.ib-note-compose>label,.ib-list-footer,.ib-tabs button span){color:var(--si-muted)}
html[data-theme=dark] :is(.detail-copy,.detail-list,.insight-source-note,.savings-empty,.savings-basis-note,.ib-case-supplier,.ib-reader .ib-readable-note){color:var(--si-muted)!important}
html[data-theme=dark] :is(.detail-disclosure blockquote,.savings-finding-body>p,.savings-checks p,.ib-reader .ib-case-scroll p,.ib-reader .ib-reference strong,.ib-reader .ib-context summary,.ib-followup>summary,.ib-reader .ib-note strong,.ib-comparison td){color:var(--si-text)}
html[data-theme=dark] :is(.ib-queue .ib-search,.ib-queue .ib-shell,.ib-queue .ib-row,.ib-reader .ib-workflow,.ib-case-controls .custom-select-trigger){background:var(--si-surface);border-color:var(--si-border)}
html[data-theme=dark] :is(.ib-queue .ib-tabs,.savings-tabs){background:var(--si-hover);border-color:var(--si-border)}
html[data-theme=dark] .ib-tab-indicator{background:var(--si-selected);box-shadow:none}
html[data-theme=dark] :is(.ib-queue .ib-tabs button,.ib-queue .ib-tabs button span){color:var(--si-muted)}
html[data-theme=dark] :is(.ib-queue .ib-tabs button[aria-pressed=true],.ib-queue .ib-tabs button[aria-pressed=true] span){background:transparent;color:var(--si-text)}
html[data-theme=dark] :is(.custom-select-trigger:hover,.custom-select-trigger[aria-expanded=true],.custom-select-option:focus-visible,.profile-menu-group button:hover,.profile-workspace>button:hover,.profile:hover,.chat-modes button:hover,.topic-suggestions>button:hover,.topic-suggestions>button:focus-visible,.chips button:hover,.topic-chips button:hover,.agreement-record:hover,.agreement-upload:hover,.agreement-upload.dragging,.ib-queue .ib-row:hover,.savings-drivers button:hover,[data-savings-back]:hover,[data-ib=back]:hover){background:var(--si-hover);color:var(--si-text);border-color:var(--si-border)}
html[data-theme=dark] :is(.page-number[aria-current=page],.text-item.selected,.profile[aria-expanded=true],.topic-chips button[aria-expanded=true],.ib-tools [aria-pressed=true],.savings-tabs button[aria-selected=true],.ib-queue .ib-row[aria-current=true],.ib-queue .ib-row[aria-current=true]:hover){background:var(--si-selected);color:var(--si-text);border-color:var(--si-border)}
html[data-theme=dark] .insight-tile:hover{background:var(--si-surface);border-color:#666370}
html[data-theme=dark] :is(.nav-item i,.icon-button,.profile-menu-group button>i,.custom-select-trigger>svg,.topic-chips button svg,.settings-nav nav svg){color:var(--si-muted)}
html[data-theme=dark] :is(.data-link,.chat-reference,.custom-option-check,.ib-reference button,.ib-evidence-invoice:hover,.smartin-progress .active>span,.smartin-progress .running>span){color:var(--si-accent)}
html[data-theme=dark] :is(input,textarea)::placeholder{color:var(--si-muted);opacity:1}
html[data-theme=dark] :is(button,a,input,textarea):focus-visible{outline-color:var(--si-accent)}
html[data-theme=dark] .composer:focus-within{border-color:#86839c}
html[data-theme=dark] :is(.savings-bar-track,.insight-bar-track,.product-bars .insight-bar-track){background:var(--si-border)}
html[data-theme=dark] :is(.spend-summary,.dashboard-costs>button+button,.product-drawer .product-kpis>div){border-color:var(--si-border)}
html[data-theme=dark] .spend-tooltip{background:#383942;color:var(--si-text)}
html[data-theme=dark] :is(.send,.ib-primary,.data-auth button,.period-range-form button[type=submit]){background:#e5e4ee;color:#191a20}
html[data-theme=dark] :is(.send:hover,.ib-primary:hover,.data-auth button:hover,.period-range-form button[type=submit]:hover){background:#cfccdF;color:#191a20}
html[data-theme=dark] .chat-delete-confirm{background:#a33440;color:#fff;border-color:#a33440}
html[data-theme=dark] .chat-delete-confirm:hover{background:#b63d4a;color:#fff}
html[data-theme=dark] .chat-history-delete:hover{background:#48262e;color:var(--si-danger)}
html[data-theme=dark] .settings-switch{background:#53545f}
html[data-theme=dark] .settings-switch[aria-checked=true]{background:#6875ea}
html[data-theme=dark] .settings-field input[readonly]{background:var(--si-hover);color:var(--si-muted)}
html[data-theme=dark] :is(.supplier-verified,.agreement-status.valid,.savings-verdict.verified,.savings-checks .pass,.ib-status.s-resolved){background:#243d33;color:var(--si-success);border-color:#365747}
html[data-theme=dark] :is(.agreement-status.expiring,.savings-verdict:not(.verified):not(.realized),.savings-checks .missing,.ib-status:not(.s-working):not(.s-resolved):not(.s-dismissed),.attention-count,.savings-control-warning){background:#3d3425;color:var(--si-warning)!important;border-color:#574a32}
html[data-theme=dark] .agreement-status.expired{background:#422b31;color:var(--si-danger);border-color:#634049}
html[data-theme=dark] :is(.agreement-status.unknown,.ib-status.s-dismissed){background:var(--si-hover);color:var(--si-muted);border-color:var(--si-border)}
html[data-theme=dark] :is(.savings-verdict.realized,.ib-status.s-working,.supplier-agreement small,.sidebar .inbox-unread-badge){background:var(--si-selected);color:#d8d2fb;border-color:var(--si-border)}
html[data-theme=dark] :is(.supplier-agreement.has-agreement,.agreement-price-link,.smartin-metric.positive>strong){color:var(--si-success)}
html[data-theme=dark] .smartin-metric.warning>strong{color:var(--si-warning)}
html[data-theme=dark] :is(.smartin-metric.critical>strong,.data-error,.data-auth [role=alert],#settings-form-error,#chat-delete-status){color:var(--si-danger)}
html[data-theme=dark] .supplier-verified [role=tooltip]{background:var(--si-surface);color:var(--si-text);border-color:var(--si-border)}
html[data-theme=dark] :is(dialog,.profile-popover,.custom-select-menu,.period-range-popup){box-shadow:0 18px 60px #0006}
html[data-theme=dark] dialog::backdrop{background:#0008}
/* Original files keep their paper surface; UI controls follow the selected theme. */
html[data-theme=dark] :is(.preview-heading,#preview-controls){border-color:var(--si-border)}
html[data-theme=dark] .preview-grid th{background:#f5f4f2;color:#151412}

html[data-theme=dark] :is(.attention-icon.violet,.cost-icon.energy){background:var(--si-selected);color:#d8d2fb}
html[data-theme=dark] :is(.attention-icon.amber,.cost-icon.interest){background:#3d3425;color:var(--si-warning)}
html[data-theme=dark] :is(#settings-save-state,.savings-pagination,.savings-chart-data>summary,.savings-approval-history>summary,.ib-reader-section>summary::after){color:var(--si-muted)}
html[data-theme=dark] .savings-finding[open]>summary{border-color:var(--si-border)}
html[data-theme=dark] .savings-trend-chart circle:focus{stroke:var(--si-text)}
html[data-theme=dark] :is(.smartin-bar-track span,.smartin-trend circle){background:#8e99fa;fill:#8e99fa}
html[data-theme=dark] .smartin-trend polyline{stroke:#8e99fa}

html[data-theme=dark] :is(.data-pagination,.detail-control-state){color:var(--si-muted)}
html[data-theme=dark] .savings-chart-unit{color:var(--si-muted)!important}

html[data-theme=dark] .chat-header{background:var(--si-surface);color:var(--si-text);border-color:var(--si-border)}

html[data-theme=dark] .connected-content .agreement-upload:disabled:hover{background:var(--si-surface);border-color:var(--si-border)}
html[data-theme=dark] .savings-trend-chart [stroke="#394eeb"]{stroke:var(--si-accent)}
html[data-theme=dark] .savings-trend-chart [fill="#394eeb"]{fill:var(--si-accent)}
html[data-theme=dark] .savings-chart-legend button[style*="#394eeb"]{--series:var(--si-accent)!important}

