/* v228 complete theme layer.
   Presentation only: no layout, simulation, calculation or persistence rules. */

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

:root{
 --theme-warning-bg:#fff4df;
 --theme-warning-ink:#805b17;
 --theme-warning-line:#eed49e;
 --theme-success-bg:#e8f7ef;
 --theme-success-ink:#266947;
 --theme-success-line:#bde3cc;
 --theme-danger-solid:#b94444;
 --theme-toast:#122333;
 --theme-on-solid:#fff;
 --theme-card-end:#e5f7f5;
 --theme-hover-line:#9fc8cb;
}
[data-theme="dark"]{
 --theme-warning-bg:#352817;
 --theme-warning-ink:#f2cb7d;
 --theme-warning-line:#6f5427;
 --theme-success-bg:#173128;
 --theme-success-ink:#82d9ad;
 --theme-success-line:#315f4b;
 --theme-danger-solid:#c95359;
 --theme-toast:#e7f2f6;
 --theme-on-solid:#08131c;
 --theme-card-end:#123034;
 --theme-hover-line:#39767b;
}

.warning-strip{background:var(--theme-warning-bg);color:var(--theme-warning-ink);border-color:var(--theme-warning-line)}
.ok-strip{background:var(--theme-success-bg);color:var(--theme-success-ink);border-color:var(--theme-success-line)}
.calc-error{background:color-mix(in srgb,var(--danger) 11%,var(--surface));color:var(--danger)}
.advanced-lab-card{background:linear-gradient(135deg,var(--surface) 0%,var(--surface) 55%,var(--theme-card-end) 100%)}
.advanced-lab-card:hover,.tool-card:hover{border-color:var(--theme-hover-line)}
#toast{background:var(--theme-toast);color:var(--theme-on-solid)}
.confirm-icon,.danger-action{background:var(--theme-danger-solid)!important;border-color:var(--theme-danger-solid)!important;color:#fff!important}
[data-theme="dark"] input,[data-theme="dark"] select,[data-theme="dark"] textarea{color-scheme:dark}
[data-theme="dark"] select option{background:var(--surface);color:var(--ink)}

/* Circuit Lab semantic palette. */
.circuit-lab-app{
 color-scheme:light;
 --cl-theme-canvas:#fff;
 --cl-theme-canvas-soft:#f7fafc;
 --cl-theme-panel:#fff;
 --cl-theme-panel-soft:#f8fafc;
 --cl-theme-panel-raised:#f7fbff;
 --cl-theme-ink:#172235;
 --cl-theme-ink-strong:#102c3b;
 --cl-theme-muted:#667587;
 --cl-theme-faint:#82909e;
 --cl-theme-line:#d8e2ea;
 --cl-theme-line-soft:#e7edf2;
 --cl-theme-accent:#276da8;
 --cl-theme-accent-soft:#edf5fc;
 --cl-theme-accent-line:#9bc2e7;
 --cl-theme-canvas-wire:#2f7fbd;
 --cl-theme-symbol:#172235;
 --cl-theme-shadow:rgba(25,48,70,.12);
 --cl-theme-overlay:rgba(28,42,58,.24);
 --cl-theme-glass:rgba(255,255,255,.96);
 --cl-theme-glass-strong:rgba(255,255,255,.985);
 --cl-theme-input:#fff;
 --cl-theme-grid-minor:#e2e8ee;
 --cl-theme-grid-major:#cfe0ef;
 --cl-theme-warning:#805b17;
 --cl-theme-warning-bg:#fff4df;
 --cl-theme-warning-line:#eed49e;
 --cl-theme-danger:#c92d35;
 --cl-theme-danger-bg:#fff5f5;
 --cl-theme-danger-line:#efb7bb;
 --cl-theme-success:#2b7c5b;
 --cl-theme-scroll:#b8c6d1;
}
[data-theme="dark"] .circuit-lab-app{
 color-scheme:dark;
 --cl-bg:#0e1620;
 --cl-panel:#15212d;
 --cl-panel2:#1a2936;
 --cl-line:#2c4050;
 --cl-text:#eaf2f7;
 --cl-muted:#9fb0bf;
 --cl-accent:#55cdd0;
 --cl-theme-canvas:#0e1620;
 --cl-theme-canvas-soft:#101b25;
 --cl-theme-panel:#111c27;
 --cl-theme-panel-soft:#172431;
 --cl-theme-panel-raised:#192936;
 --cl-theme-ink:#eaf2f7;
 --cl-theme-ink-strong:#f4fbff;
 --cl-theme-muted:#9fb0bf;
 --cl-theme-faint:#8298aa;
 --cl-theme-line:#2c4050;
 --cl-theme-line-soft:#223442;
 --cl-theme-accent:#55cdd0;
 --cl-theme-accent-soft:#17383d;
 --cl-theme-accent-line:#347d83;
 --cl-theme-canvas-wire:#6ec9d0;
 --cl-theme-symbol:#dce9f0;
 --cl-theme-shadow:rgba(0,0,0,.34);
 --cl-theme-overlay:rgba(1,7,12,.66);
 --cl-theme-glass:rgba(17,28,39,.96);
 --cl-theme-glass-strong:rgba(17,28,39,.985);
 --cl-theme-input:#0f1b25;
 --cl-theme-grid-minor:#1d2b37;
 --cl-theme-grid-major:#314555;
 --cl-theme-warning:#f2cb7d;
 --cl-theme-warning-bg:#352817;
 --cl-theme-warning-line:#6f5427;
 --cl-theme-danger:#ff9298;
 --cl-theme-danger-bg:#351d23;
 --cl-theme-danger-line:#75464a;
 --cl-theme-success:#82d9ad;
 --cl-theme-scroll:#536b7c;
}

/* Main Circuit Lab surfaces and navigation. */
[data-theme="dark"] .circuit-lab-app,
[data-theme="dark"] .circuit-lab-app .cl-workspace,
[data-theme="dark"] .circuit-lab-app .cl-canvas-wrap,
[data-theme="dark"] .circuit-lab-app .cl-canvas{background:var(--cl-theme-canvas)!important;color:var(--cl-theme-ink)!important}
[data-theme="dark"] .circuit-lab-app{border-color:var(--cl-theme-line)!important;box-shadow:0 25px 70px var(--cl-theme-shadow)!important}
[data-theme="dark"] .circuit-lab-app .cl-top,
[data-theme="dark"] .circuit-lab-app .cl-tools,
[data-theme="dark"] .circuit-lab-app .cl-bottom-tools{background:var(--cl-theme-glass)!important;border-color:var(--cl-theme-line)!important;color:var(--cl-theme-ink)!important}
[data-theme="dark"] .circuit-lab-app .cl-title strong{color:var(--cl-theme-ink)!important}
[data-theme="dark"] .circuit-lab-app .cl-title span{color:var(--cl-theme-muted)!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-tools,.cl-bottom-tools) button{
 background:var(--cl-theme-panel-soft)!important;border-color:var(--cl-theme-line)!important;color:var(--cl-theme-ink)!important
}
[data-theme="dark"] .circuit-lab-app :where(.cl-tools,.cl-bottom-tools) button:hover,
[data-theme="dark"] .circuit-lab-app :where(.cl-tools,.cl-bottom-tools) button.active{
 background:var(--cl-theme-accent-soft)!important;border-color:var(--cl-theme-accent-line)!important;color:var(--cl-theme-accent)!important
}
[data-theme="dark"] .circuit-lab-app :where(.cl-tools,.cl-bottom-tools) .cl-danger-tool,
[data-theme="dark"] .circuit-lab-app .cl-bottom-delete{background:var(--cl-theme-danger-bg)!important;border-color:var(--cl-theme-danger-line)!important;color:var(--cl-theme-danger)!important}

/* Panels, component library and inspector. */
[data-theme="dark"] .circuit-lab-app :where(.cl-panel,.cl-library,.cl-inspector,.cl-panel-head,.cl-library-toolbar,#clLibraryBody,.cl-instrument-library){
 background:var(--cl-theme-panel)!important;border-color:var(--cl-theme-line)!important;color:var(--cl-theme-ink)!important
}
[data-theme="dark"] .circuit-lab-app :where(.cl-panel-head,.cl-library-toolbar){border-bottom-color:var(--cl-theme-line-soft)!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-library-search,.cl-library>input){background:var(--cl-theme-panel-soft)!important;border-color:var(--cl-theme-line)!important;color:var(--cl-theme-ink)!important}
[data-theme="dark"] .circuit-lab-app .cl-library-search input{background:transparent!important;color:var(--cl-theme-ink)!important;-webkit-text-fill-color:var(--cl-theme-ink)!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-library-search input,.cl-form input,.cl-form select,.cl-modal-card input)::placeholder{color:var(--cl-theme-faint)!important;opacity:1}
[data-theme="dark"] .circuit-lab-app .cl-library-folders button{background:var(--cl-theme-panel)!important;border-color:var(--cl-theme-line)!important;color:var(--cl-theme-muted)!important}
[data-theme="dark"] .circuit-lab-app .cl-library-folders button.active{background:var(--cl-theme-accent-soft)!important;border-color:var(--cl-theme-accent-line)!important;color:var(--cl-theme-accent)!important}
[data-theme="dark"] .circuit-lab-app .cl-library-item{color:var(--cl-theme-ink)!important}
[data-theme="dark"] .circuit-lab-app .cl-library-item:hover,
[data-theme="dark"] .circuit-lab-app .cl-library-item:active{background:var(--cl-theme-panel-soft)!important;border-color:var(--cl-theme-line)!important}
[data-theme="dark"] .circuit-lab-app .cl-library-item-name{color:var(--cl-theme-ink)!important}
[data-theme="dark"] .circuit-lab-app .cl-symbol-chip{background:var(--cl-theme-panel-soft)!important;border-color:var(--cl-theme-line)!important;color:var(--cl-theme-symbol)!important}
[data-theme="dark"] .circuit-lab-app .cl-instrument-library>button{background:var(--cl-theme-panel-raised)!important;border-color:var(--cl-theme-line)!important;color:var(--cl-theme-ink)!important}
[data-theme="dark"] .circuit-lab-app .cl-instrument-card-icon{background:var(--cl-theme-panel)!important;border-color:var(--cl-theme-line)!important;color:var(--cl-theme-accent)!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-empty,.cl-cat h4,.cl-instrument-library small){color:var(--cl-theme-muted)!important}

/* Canvas, circuit symbols and interaction geometry. */
[data-theme="dark"] .circuit-lab-app .cl-canvas pattern:first-of-type path{stroke:var(--cl-theme-grid-minor)!important}
[data-theme="dark"] .circuit-lab-app .cl-canvas pattern:nth-of-type(2)>path,
[data-theme="dark"] .circuit-lab-app .cl-grid{stroke:var(--cl-theme-grid-major)!important}
[data-theme="dark"] .circuit-lab-app .cl-world-wire{stroke:var(--cl-theme-canvas-wire)!important}
[data-theme="dark"] .circuit-lab-app .cl-world-wire.selected{stroke:var(--cl-theme-accent)!important}
[data-theme="dark"] .circuit-lab-app .cl-junction{fill:var(--cl-theme-canvas-wire)!important;stroke:var(--cl-theme-canvas)!important}
[data-theme="dark"] .circuit-lab-app .cl-free-node{fill:var(--cl-theme-panel)!important;stroke:var(--cl-theme-canvas-wire)!important}
[data-theme="dark"] .circuit-lab-app .cl-body{fill:#172633!important;stroke:#8aa6b8!important}
[data-theme="dark"] .circuit-lab-app .cl-pin{fill:#d8eef3!important;stroke:#10202c!important}
[data-theme="dark"] .circuit-lab-app .cl-label{fill:#eaf2f7!important;stroke:var(--cl-theme-canvas)!important}
[data-theme="dark"] .circuit-lab-app .cl-value{fill:#a8bbc8!important;stroke:var(--cl-theme-canvas)!important}
[data-theme="dark"] .circuit-lab-app .cl-symbol-text{fill:var(--cl-theme-symbol)!important;stroke:var(--cl-theme-canvas)!important}
[data-theme="dark"] .circuit-lab-app .cl-terminal-dot{fill:var(--cl-theme-panel)!important;stroke:var(--cl-theme-symbol)!important}
[data-theme="dark"] .circuit-lab-app .cl-switch-state{stroke:var(--cl-theme-canvas)!important}
[data-theme="dark"] .circuit-lab-app .cl-led-base{fill:#172633!important;stroke:#dce9f0!important}
[data-theme="dark"] .circuit-lab-app .cl-led-outline,
[data-theme="dark"] .circuit-lab-app .cl-led-symbol-rays{stroke:#dce9f0!important}
[data-theme="dark"] .circuit-lab-app .cl-diode-body{fill:#dce9f0!important;stroke:#dce9f0!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-component-end-handle-mark,.cl-wire-end-handle-mark){fill:var(--cl-theme-panel)!important}
[data-theme="dark"] .circuit-lab-app .cl-component-end-hold circle:last-child{stroke:var(--cl-theme-canvas)!important}
[data-theme="dark"] .circuit-lab-app .cl-annotation rect{fill:var(--cl-theme-panel-soft)!important;stroke:#627b8e!important}
[data-theme="dark"] .circuit-lab-app .cl-annotation text{fill:var(--cl-theme-ink)!important}
[data-theme="dark"] .circuit-lab-app .cl-hud span,
[data-theme="dark"] .circuit-lab-app .cl-explorer-legend{background:var(--cl-theme-glass)!important;border-color:var(--cl-theme-line)!important;color:var(--cl-theme-muted)!important}
[data-theme="dark"] .circuit-lab-app .cl-workspace-position-track>i{background:rgba(159,176,191,.68)!important;border-color:rgba(17,28,39,.82)!important}

/* Shared fields, buttons, cards and feedback. */
[data-theme="dark"] .circuit-lab-app :where(.cl-form,.cl-control-card,.cl-probe-card,.cl-scope-section,.cl-scope-channel,.cl-measure,.cl-project-row,.cl-diag-row){
 background:var(--cl-theme-panel-soft)!important;border-color:var(--cl-theme-line)!important;color:var(--cl-theme-ink)!important
}
[data-theme="dark"] .circuit-lab-app :where(.cl-form input,.cl-form select,.cl-probe-card select,.cl-meter-controls select,.cl-scope-pro select,.cl-scope-pro input,.cl-scope-controls select,.cl-scope-controls input,.cl-scope-channel select,.cl-scope-channel input:not([type="color"]),.cl-instrument-dock input:not([type="checkbox"]):not([type="color"]),.cl-instrument-dock select,.cl-modal-card input){
 background:var(--cl-theme-input)!important;border-color:var(--cl-theme-line)!important;color:var(--cl-theme-ink)!important;-webkit-text-fill-color:var(--cl-theme-ink)!important
}
[data-theme="dark"] .circuit-lab-app :where(.cl-form label,.cl-meter-controls label,.cl-scope-pro label,.cl-scope-field>span,.cl-control-kicker,.cl-probe-title small,.cl-current-target p){color:var(--cl-theme-muted)!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-form>strong,.cl-probe-title strong,.cl-scope-section-title strong,.cl-ch-enable){color:var(--cl-theme-ink)!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-form button,.cl-probe-pick,.cl-scope-runbar button,.cl-scope-probe){background:var(--cl-theme-panel)!important;border-color:var(--cl-theme-line)!important;color:var(--cl-theme-ink)!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-form button,.cl-probe-pick,.cl-scope-runbar button,.cl-scope-probe):hover{background:var(--cl-theme-accent-soft)!important;border-color:var(--cl-theme-accent-line)!important;color:var(--cl-theme-accent)!important}
[data-theme="dark"] .circuit-lab-app .cl-scope-runbar button.active{background:var(--cl-theme-accent)!important;border-color:var(--cl-theme-accent)!important;color:#071319!important}
[data-theme="dark"] .circuit-lab-app .cl-form .cl-danger{background:var(--cl-theme-danger-bg)!important;border-color:var(--cl-theme-danger-line)!important;color:var(--cl-theme-danger)!important}
[data-theme="dark"] .circuit-lab-app .cl-warning{background:var(--cl-theme-warning-bg)!important;border-color:var(--cl-theme-warning-line)!important;color:var(--cl-theme-warning)!important}

/* Instrument dock and displays. */
[data-theme="dark"] .circuit-lab-app :where(.cl-instrument-dock,.cl-inst-tabs,.cl-inst-body,.cl-scope-pro,.cl-scope-display-panel,.cl-scope-control-panel){background:var(--cl-theme-panel)!important;border-color:var(--cl-theme-line)!important;color:var(--cl-theme-ink)!important}
[data-theme="dark"] .circuit-lab-app .cl-instrument-dock{box-shadow:0 -12px 36px var(--cl-theme-shadow)!important}
[data-theme="dark"] .circuit-lab-app .cl-inst-tabs button{background:var(--cl-theme-panel-soft)!important;border-color:var(--cl-theme-line)!important;color:var(--cl-theme-ink)!important}
[data-theme="dark"] .circuit-lab-app .cl-inst-tabs button.active{background:var(--cl-theme-accent-soft)!important;border-color:var(--cl-theme-accent-line)!important;color:var(--cl-theme-accent)!important}
[data-theme="dark"] .circuit-lab-app .cl-meter-readout{background:linear-gradient(145deg,#12232e,#0c1922)!important;border-color:var(--cl-theme-line)!important;box-shadow:inset 0 1px 0 rgba(255,255,255,.04)!important}
[data-theme="dark"] .circuit-lab-app .cl-meter-readout #clDmmValue{color:#c8fff2!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-meter-brand,.cl-meter-readout #clDmmLabel,.cl-meter-readout #clDmmNote){color:var(--cl-theme-muted)!important}
[data-theme="dark"] .circuit-lab-app .cl-meter-live{color:var(--cl-theme-success)!important}
[data-theme="dark"] .circuit-lab-app .cl-scope-display-panel{background:var(--cl-theme-panel-soft)!important}
[data-theme="dark"] .circuit-lab-app .cl-scope-statusbar strong,
[data-theme="dark"] .circuit-lab-app .cl-scope-scale b{color:var(--cl-theme-ink)!important}
[data-theme="dark"] .circuit-lab-app .cl-scope-scale span{background:var(--cl-theme-panel)!important;border-color:var(--cl-theme-line)!important;color:var(--cl-theme-muted)!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-scope-screen,.cl-dmm-display){background:#071218!important;border-color:#294757!important}
[data-theme="dark"] .circuit-lab-app .cl-scope-grid{stroke:#28404f!important}
[data-theme="dark"] .circuit-lab-app .cl-scope-zero{stroke:#42606f!important}
[data-theme="dark"] .circuit-lab-app .cl-measure{background:var(--cl-theme-panel-soft)!important;border-color:var(--cl-theme-line)!important;color:var(--cl-theme-ink)!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-top-instrument,.cl-instrument-display,.cl-instrument-screen-head,.cl-channel-strip,.cl-probe-pair){background:var(--cl-theme-panel)!important;border-color:var(--cl-theme-line)!important;color:var(--cl-theme-ink)!important}
[data-theme="dark"] .circuit-lab-app .cl-top-instrument.active,
[data-theme="dark"] .circuit-lab-app .cl-probe-pair.active{background:var(--cl-theme-accent-soft)!important;border-color:var(--cl-theme-accent-line)!important;color:var(--cl-theme-accent)!important}
[data-theme="dark"] .circuit-lab-app .cl-instrument-screen-head button{background:transparent!important;color:var(--cl-theme-accent)!important}
[data-theme="dark"] .circuit-lab-app .cl-instrument-screen-head button:hover{background:var(--cl-theme-accent-soft)!important}
[data-theme="dark"] .circuit-lab-app .cl-dmm-display-compact #clDmmValue{color:var(--cl-theme-ink-strong)!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-dmm-display-compact #clDmmLabel,.cl-dmm-display-compact #clDmmNote){color:var(--cl-theme-muted)!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-probe-point.colored,.cl-probe-point.reference){border-color:var(--cl-theme-panel)!important}

/* Project, diagnostics, modal and toast surfaces. */
[data-theme="dark"] .circuit-lab-app .cl-modal{background:var(--cl-theme-overlay)!important}
[data-theme="dark"] .circuit-lab-app .cl-modal-card{background:var(--cl-theme-panel)!important;border-color:var(--cl-theme-line)!important;color:var(--cl-theme-ink)!important;box-shadow:0 24px 80px rgba(0,0,0,.38)!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-modal-card>label,.cl-modal-card>p,.cl-project-meta small,.cl-diag-row small,.cl-project-section-head strong){color:var(--cl-theme-muted)!important}
[data-theme="dark"] .circuit-lab-app .cl-modal button{background:var(--cl-theme-panel-soft)!important;border-color:var(--cl-theme-line)!important;color:var(--cl-theme-ink)!important}
[data-theme="dark"] .circuit-lab-app .cl-project-section{border-color:var(--cl-theme-line)!important}
[data-theme="dark"] .circuit-lab-app .cl-diag-chip.error{background:var(--cl-theme-danger-bg)!important;border-color:var(--cl-theme-danger-line)!important;color:var(--cl-theme-danger)!important}
[data-theme="dark"] .circuit-lab-app .cl-diag-chip.warning{background:var(--cl-theme-warning-bg)!important;border-color:var(--cl-theme-warning-line)!important;color:var(--cl-theme-warning)!important}
[data-theme="dark"] .circuit-lab-app .cl-diag-ok{background:#102b28!important;border-color:#315f4b!important}
[data-theme="dark"] .circuit-lab-app .cl-toast{background:#e7f2f6!important;border-color:#e7f2f6!important;color:#0b1720!important}

/* Oscilloscope settings and all nested editor cards. */
[data-theme="dark"] .circuit-lab-app :where(
 .cl-instrument-settings,.cl-scope-settings,.cl-scope-settings-inline,.cl-scope-settings-content,.cl-settings-head,
 .cl-scope-settings-card,.cl-selected-channel-card,.cl-display-settings-card,.cl-math-settings-card,.cl-trigger-settings-card,.cl-measure-settings-card,
 .cl-measure-manager,.cl-math-expression,.cl-trigger-level-control,.cl-channel-drawer,.cl-scope-control-strip
 ){
 background:var(--cl-theme-panel)!important;border-color:var(--cl-theme-line)!important;color:var(--cl-theme-ink)!important;box-shadow:none!important
}
[data-theme="dark"] .circuit-lab-app :where(.cl-settings-head,.cl-scope-settings-card-head,.cl-scope-feature-head,.cl-measure-settings-head){border-color:var(--cl-theme-line)!important}
[data-theme="dark"] .circuit-lab-app :where(
 .cl-settings-head strong,.cl-scope-settings-card-head strong,.cl-scope-feature-copy strong,.cl-measure-settings-copy strong,
 .cl-selected-channel-card-title>strong,.cl-measure-manager-head strong,.cl-math-pot-card>strong,.cl-scope-setting-row strong
 ){color:var(--cl-theme-ink)!important}
[data-theme="dark"] .circuit-lab-app :where(
 .cl-scope-settings-card-head small,.cl-scope-feature-copy small,.cl-measure-settings-copy small,.cl-measure-manager-head small,
 .cl-math-pot-card>small,.cl-scope-setting-row span,.cl-selected-math-operation-field>span,.cl-math-header-summary
 ){color:var(--cl-theme-muted)!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-channel-badge,.cl-display-state-badge,.cl-measure-settings-count){background:var(--cl-theme-panel-soft)!important;border-color:var(--cl-theme-line)!important;color:var(--cl-theme-muted)!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-scope-settings-actions button,.cl-scope-segments button,.cl-measure-chip,.cl-scope-auto-toggle,.cl-scope-pot,.cl-channel-add,.cl-channel-close){background:var(--cl-theme-panel-soft)!important;border-color:var(--cl-theme-line)!important;color:var(--cl-theme-ink)!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-settings-close,.cl-selected-channel-editor input:not([type="color"]),.cl-selected-channel-editor select,.cl-scope-field input,.cl-scope-field select,.cl-channel-color-field input[type="color"]){background:var(--cl-theme-input)!important;border-color:var(--cl-theme-line)!important;color:var(--cl-theme-ink)!important;-webkit-text-fill-color:var(--cl-theme-ink)!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-selected-channel-editor>label>span,.cl-scope-field>span:first-child,.cl-scope-unit-input>span){color:var(--cl-theme-muted)!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-measure-settings-toggle,.cl-measure-settings-card>.cl-measure-manager,.cl-math-pot-card){background:var(--cl-theme-panel-soft)!important;border-color:var(--cl-theme-line)!important;color:var(--cl-theme-ink)!important}
[data-theme="dark"] .circuit-lab-app .cl-measure-settings-toggle:hover{background:var(--cl-theme-accent-soft)!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-measure-settings-icon,.cl-display-feature-icon){background:#18384b!important;border-color:#315f78!important;color:#79c9ee!important;box-shadow:none!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-measure-channel-tag,.cl-scope-feature-badge){background:var(--cl-theme-panel-soft)!important;border-color:var(--cl-theme-line)!important;color:var(--cl-theme-muted)!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-measure-settings-copy strong,.cl-scope-feature-copy strong){color:var(--cl-theme-ink)!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-measure-settings-count small,.cl-scope-feature-copy small,.cl-measure-manager-label){color:var(--cl-theme-muted)!important}
[data-theme="dark"] .circuit-lab-app .cl-math-control-divider{color:#b6acd3!important}
[data-theme="dark"] .circuit-lab-app .cl-math-control-divider::before,
[data-theme="dark"] .circuit-lab-app .cl-math-control-divider::after{background:#514b66!important}
[data-theme="dark"] .circuit-lab-app .cl-math-switch-track{background:#455463!important}
[data-theme="dark"] .circuit-lab-app .cl-math-switch-track i{background:#edf5fa!important}
[data-theme="dark"] .circuit-lab-app .cl-math-power-toggle:disabled .cl-math-switch-track{background:#34414d!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-scope-settings-actions button,.cl-scope-segments button,.cl-measure-chip,.cl-scope-pot).active,
[data-theme="dark"] .circuit-lab-app .cl-measure-chip.selected{background:var(--cl-theme-accent-soft)!important;border-color:var(--cl-theme-accent-line)!important;color:var(--cl-theme-accent)!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-scope-pot-face,.cl-scope-big-knob,.cl-math-pot,.cl-math-pot-face,.cl-trigger-pot,.cl-trigger-pot-face){background:radial-gradient(circle at 38% 32%,#385064 0 10%,#263b4c 46%,#172633 100%)!important;border-color:#4a6476!important;box-shadow:0 3px 10px rgba(0,0,0,.3)!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-scope-knob-meta span,.cl-scope-pot-value){color:var(--cl-theme-ink)!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-scope-screen-head,.cl-scope-knob-panel,.cl-channel-drawer,.cl-channel-strip,.cl-scope-control-group){background:var(--cl-theme-panel)!important;border-color:var(--cl-theme-line)!important;color:var(--cl-theme-ink)!important;box-shadow:none!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-scope-screen-head .cl-scope-control-chip,.cl-scope-screen-head .cl-scope-quick-chip,.cl-scope-screen-head .cl-scope-settings-button,.cl-channel-drawer-toggle,.cl-channel-add,.cl-channel-close){background:transparent!important;border-color:transparent!important;color:var(--cl-theme-muted)!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-scope-screen-head .cl-scope-control-chip,.cl-scope-screen-head .cl-scope-quick-chip,.cl-scope-screen-head .cl-scope-settings-button,.cl-channel-drawer-toggle,.cl-channel-add,.cl-channel-close):hover{background:var(--cl-theme-accent-soft)!important;border-color:var(--cl-theme-accent-line)!important;color:var(--cl-theme-accent)!important}
[data-theme="dark"] .circuit-lab-app .cl-scope-screen-head .cl-scope-control-chip.active{background:var(--cl-theme-accent-soft)!important;border-color:var(--cl-theme-accent-line)!important;color:var(--cl-theme-accent)!important}
[data-theme="dark"] .circuit-lab-app .cl-scope-quick-chip small,
[data-theme="dark"] .circuit-lab-app :where(.cl-scope-knob-meta strong,.cl-scope-knob-meta small){color:var(--cl-theme-muted)!important}
[data-theme="dark"] .circuit-lab-app .cl-channel-drawer .cl-channel-strip{background:var(--cl-theme-panel)!important}

/* Source pickers and menus. Accent identities remain distinct. */
[data-theme="dark"] .circuit-lab-app :where(.cl-trigger-source-select,.cl-measure-source-select,.cl-selected-channel-select,.cl-math-source-select,.cl-math-operation-select,.cl-selected-math-operation-summary){
 background:linear-gradient(135deg,var(--cl-theme-panel-soft),var(--cl-theme-panel))!important;border-color:var(--cl-theme-line)!important;color:var(--cl-theme-ink)!important;box-shadow:0 3px 10px rgba(0,0,0,.18)!important
}
[data-theme="dark"] .circuit-lab-app :where(.cl-trigger-source-menu,.cl-measure-source-menu,.cl-selected-channel-menu,.cl-math-source-menu,.cl-math-operation-menu){
 background:var(--cl-theme-glass-strong)!important;border-color:var(--cl-theme-line)!important;box-shadow:0 14px 34px rgba(0,0,0,.38)!important
}
[data-theme="dark"] .circuit-lab-app :where(.cl-trigger-source-option,.cl-measure-source-option,.cl-selected-channel-option,.cl-math-source-option,.cl-math-operation-option){background:var(--cl-theme-panel-soft)!important;border-color:transparent!important;color:var(--cl-theme-ink)!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-trigger-source-option,.cl-measure-source-option,.cl-selected-channel-option,.cl-math-source-option,.cl-math-operation-option):hover,
[data-theme="dark"] .circuit-lab-app :where(.cl-trigger-source-option,.cl-measure-source-option,.cl-selected-channel-option,.cl-math-source-option,.cl-math-operation-option):focus-visible{background:var(--cl-theme-accent-soft)!important;border-color:var(--cl-theme-accent-line)!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-trigger-source-option,.cl-measure-source-option,.cl-selected-channel-option,.cl-math-source-option,.cl-math-operation-option).active{background:var(--cl-theme-accent-soft)!important;border-color:var(--cl-theme-accent-line)!important;color:var(--cl-theme-accent)!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-trigger-source-select-copy>strong,.cl-measure-source-select-copy>strong,.cl-selected-channel-select-copy>strong,.cl-math-source-select-copy strong,.cl-math-operation-select-copy strong,.cl-selected-math-result-name input,.cl-selected-math-summary-source b){color:var(--cl-theme-ink)!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-trigger-source-select-copy>small,.cl-measure-source-select-copy>small,.cl-selected-channel-select-copy>small,.cl-math-source-select-copy small,.cl-math-operation-select-copy small){color:var(--cl-theme-muted)!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-trigger-source-chevron,.cl-measure-source-chevron,.cl-selected-channel-chevron){background:var(--cl-theme-accent-soft)!important;color:var(--cl-theme-accent)!important}

/* Math and trigger keep their meaning through accent color, with dark surfaces. */
[data-theme="dark"] .circuit-lab-app :where(.cl-math-feature-icon,.cl-math-state-badge,.cl-math-power-toggle,.cl-selected-math-operation,.cl-selected-math-summary-op){background:#28233b!important;border-color:#51466f!important;color:#c3b2ff!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-math-settings-card.math-off .cl-math-source-menu,.cl-math-settings-card.math-off .cl-math-operation-menu,.cl-math-settings-card.math-off .cl-math-source-option,.cl-math-settings-card.math-off .cl-math-operation-option){background:var(--cl-theme-panel)!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-selected-math-expression,.cl-selected-math-result-name input[readonly]){background:linear-gradient(135deg,#1d202d,#28233b)!important;border-color:#51466f!important;color:var(--cl-theme-ink)!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-trigger-feature-icon,.cl-trigger-state-badge,.cl-trigger-source-chevron){background:#35271f!important;border-color:#6b4b39!important;color:#f0aa78!important}
[data-theme="dark"] .circuit-lab-app .cl-trigger-level-control{background:linear-gradient(135deg,#211b19,#2d231e)!important;border-color:#604737!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-trigger-source-select-copy>strong,.cl-trigger-level-copy>strong){color:#efb083!important}
[data-theme="dark"] .circuit-lab-app :where(.cl-trigger-source-select-copy>small,.cl-trigger-level-copy>span){color:#bd9278!important}
[data-theme="dark"] .circuit-lab-app .cl-bottom-tools .cl-bottom-fit{background:linear-gradient(180deg,#1b3445,#172b39)!important;border-color:#3b6d89!important;color:#79c9ee!important;box-shadow:0 2px 8px rgba(0,0,0,.25)!important}
[data-theme="dark"] .circuit-lab-app .cl-bottom-tools .cl-bottom-fit:active{background:#203f52!important}

/* Scope settings can occupy the page on mobile and must follow the selected theme. */
[data-theme="dark"] body.cl-scope-settings-page-mode,
[data-theme="dark"] body.cl-scope-settings-page-mode .app-shell,
[data-theme="dark"] body.cl-scope-settings-page-mode main,
[data-theme="dark"] body.cl-scope-settings-page-mode #view-circuit,
[data-theme="dark"] body.cl-scope-settings-page-mode #view-circuit.active,
[data-theme="dark"] .circuit-lab-app.cl-scope-settings-mode,
[data-theme="dark"] .circuit-lab-app.cl-scope-settings-mode :where(.cl-workspace,.cl-instrument-dock,.cl-instrument-display,.cl-instrument-settings.cl-scope-settings.cl-scope-settings-inline){
 background:#111c27!important;background-color:#111c27!important;color:#eaf2f7!important
}

/* Native controls, scrollbars and focus remain readable in both modes. */
.circuit-lab-app :where(input,select,textarea){color-scheme:inherit}
.circuit-lab-app :where(.cl-panel,.cl-inst-body,.cl-modal-card,.cl-trigger-source-menu,.cl-measure-source-menu,.cl-selected-channel-menu,.cl-math-source-menu,.cl-math-operation-menu){scrollbar-color:var(--cl-theme-scroll) transparent}
[data-theme="dark"] .circuit-lab-app :where(.cl-trigger-source-menu,.cl-measure-source-menu,.cl-math-source-menu,.cl-math-operation-menu)::-webkit-scrollbar-thumb{background:var(--cl-theme-scroll)!important}
[data-theme="dark"] .circuit-lab-app :where(button,input,select,textarea):focus-visible{outline-color:var(--cl-theme-accent)!important}

@media(prefers-contrast:more){
 [data-theme="dark"] .circuit-lab-app{--cl-theme-line:#536b7c;--cl-theme-muted:#c0ced8}
}
