:root { color-scheme: light; }
.settings-popover { max-height: calc(100vh - 60px); overflow-y: auto; }
#themeSelect {
  width: 100%; height: 34px; margin-top: 5px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 5px;
  background: #fff; color: #214b7a; font-size: 12px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  color: #dce7f6; background: #101a2b;
  --green: #65a9f2; --dark: #b3d3fc; --line: #344961; --muted: #9fb3cc;
  --pac: #efb349; --pvc: #f27f88; --blue: #73b6ed; --red: #ee9296; --wavegreen: #53c8a0;
  --chart-surface: #172538; --chart-grid: #223650; --chart-grid-major: #354e6c;
  --chart-label: #adc4df; --chart-muted: #9fb3cc;
  --chart-blue: #73b6ed; --chart-red: #ee9296; --chart-green: #53c8a0;
  --chart-average: #82acff;
  --chart-p: #493d25; --chart-qrs: #244737; --chart-t: #303c57;
}
[data-theme="dark"] :is(.panel,.signal-shell,.signal-foot,.segment-tachogram,.settings-popover,.help-popover,.reason-popover,.daily-table,.daily-empty,.recording-picker) {
  background: #172538; border-color: var(--line); color: #dce7f6;
}
[data-theme="dark"] :is(.tool,.select-tool,.filter,.class-btn,.arrow-controls button,.daily-head button,.kbd,.tachogram-controls button,.morph-actions select,.lead-settings select,.folder-controls input,.folder-controls select,.settings-popover input,#themeSelect) {
  background: #20324b; color: #d7e5f7; border-color: #3b5474;
}
[data-theme="dark"] :is(.tool:hover,.filter:hover,.event-row:hover,.class-btn:hover) { background: #2b4260; }
[data-theme="dark"] :is(.tool.active,.filter.active,.tachogram-controls button.active) { background: #1764b5; border-color: #65a9f2; color: white; }
[data-theme="dark"] .event-row { background: #172538; color: #d7e5f7; border-color: #293f5a; }
[data-theme="dark"] .event-row.active { background: #234774; }
[data-theme="dark"] :is(.event-row.active .event-time,.event-check,.review-status strong,.metric-table .emphasis td:last-child,.daily-jump,.undo-review) { color: #64d2ad; }
[data-theme="dark"] :is(.events-columns,.daily-table th,.daily-drawer,.report-bar,.reason) { background: #203550; color: #c1d5ee; border-color: var(--line); }
[data-theme="dark"] :is(.toolbar,.signal-foot,.tachogram-head,.metric-table td,.segment-table td,.daily-table td,.daily-table th,.detail-rule,.morph-measures,.settings-popover hr) { border-color: var(--line); }
[data-theme="dark"] :is(.context-time strong,.signal-foot b,.morph-measures b,.tachogram-head h3,.reason h3,.reason-popover h3,.settings-popover label) { color: #cfdef2; }
[data-theme="dark"] :is(.counter,.review-caption,.detail-date,.provenance .label,.section-heading span,.review-status,.metric-table td:first-child,.segment-table td:first-child,.legend,.signal-foot,.summary-item span,.summary-note,.compare,.morph-measures,.segment-sub,.event-time small,.list-footer,.empty-list,.daily-head p,.daily-method,.tachogram-head,.help-popover dd,.reason p,.reason small,.reason-popover p,.reason-popover small,.file-drop span,.folder-picker p,.recording-picker #fileStatus,.settings-popover #recordingTechnical) { color: var(--muted); }
[data-theme="dark"] .segment-section td { color: #b5dbc9!important; }
[data-theme="dark"] :is(.lead-map-note,.daily-table .partial) { color: #e4ba7b; }
[data-theme="dark"] .timeline-help { background: #172538dd; color: #adc4df; }
[data-theme="dark"] .review-track { background: #344961; }
[data-theme="dark"] :is(.pill.normal,.class-btn.selected.normal) { background: #204d39; color: #8ce4ba; border-color: #50a780; }
[data-theme="dark"] :is(.pill.pac,.class-btn.selected.pac) { background: #4d3b20; color: #ffd18b; border-color: #bc9049; }
[data-theme="dark"] :is(.pill.pvc,.class-btn.selected.pvc) { background: #4e2c32; color: #ffabb2; border-color: #bc6973; }
[data-theme="dark"] :is(.pill.other,.class-btn.selected.artifact) { background: #35413b; color: #c5d3cc; border-color: #70867a; }
[data-theme="dark"] :is(.settings-actions button,.settings-popover #cancelAnalysis,.settings-popover #rerunAnalysis,.daily-empty button,.report-bar button,.reason-help summary) { background: #244333; color: #b4e6cd; border-color: #4b735f; }
[data-theme="dark"] .settings-popover #cancelAnalysis { color: #ffabb2; }
[data-theme="dark"] .recording-warning { background: #493c22; color: #f3d08b; }
[data-theme="dark"] .file-drop.drag-over { background: #234774; }
