/* Spacelab supplies Bootstrap's dark variables; adapt the app's custom surfaces. */
html[data-bs-theme="dark"] body { background: var(--bs-body-bg); }
html[data-bs-theme="dark"] :is(.card-header,.card-footer,.active-config-bar,.metric,.tool-placeholder,.usage-location,.variable-value,.stream-graph-toolbar,.script-pane-label) {
  background: var(--bs-tertiary-bg); border-color: var(--bs-border-color);
}
html[data-bs-theme="dark"] .active-card { background: linear-gradient(135deg,var(--bs-body-bg),var(--bs-primary-bg-subtle)); }
html[data-bs-theme="dark"] :is(.metric span,.metric small,.tool-placeholder span,.detail-list dt,.finding-filter-form .form-label,.stream-graph-node-class,.stream-graph-node-uuid,.stream-graph-empty,.script-pane-label) { color: var(--bs-secondary-color); }
html[data-bs-theme="dark"] thead th { color: var(--bs-secondary-color) !important; }
html[data-bs-theme="dark"] :is(.finding-groups,.deprecated-worklist,.deprecated-grouped-worklist,.source-quality-card .source-box,.stream-graph-property,.stream-graph-property-value) { background: var(--bs-body-bg); border-color: var(--bs-border-color); }
html[data-bs-theme="dark"] :is(.finding-group-heading,.deprecated-stream-heading,.deprecated-stream-cell,.stream-graph-property-key) { background: var(--bs-secondary-bg); border-color: var(--bs-border-color); color: var(--bs-body-color); }
html[data-bs-theme="dark"] :is(.finding-item,.stream-graph-node) { background: var(--bs-tertiary-bg); color: var(--bs-body-color); border-color: var(--bs-border-color); }
html[data-bs-theme="dark"] :is(.finding-item.finding-status-reviewed,.deprecated-node-item.finding-status-reviewed,.deprecated-node-compact.finding-status-reviewed) { background: var(--bs-success-bg-subtle); border-left-color: var(--bs-success); }
html[data-bs-theme="dark"] :is(.finding-item.finding-status-ignored,.deprecated-node-item.finding-status-ignored,.deprecated-node-compact.finding-status-ignored) { background: var(--bs-secondary-bg); border-color: var(--bs-border-color); }
html[data-bs-theme="dark"] :is(.deprecated-node-item,.deprecated-node-compact,.selected-deprecated-node,.metric-link:hover) { background: var(--bs-warning-bg-subtle); border-color: var(--bs-warning-border-subtle); }
html[data-bs-theme="dark"] :is(.deprecated-stream-row,.deprecated-stream-group + .deprecated-stream-group) { border-color: var(--bs-border-color); }
html[data-bs-theme="dark"] .status-open { background: var(--bs-secondary-bg); color: var(--bs-body-color); }
html[data-bs-theme="dark"] :is(.table > tbody > tr.variable-unused > *,.table-danger-soft > *) { background-color: var(--bs-danger-bg-subtle) !important; }
html[data-bs-theme="dark"] .table-warning-soft > * { background-color: var(--bs-warning-bg-subtle) !important; }
html[data-bs-theme="dark"] .stream-graph-canvas {
  border-color: var(--bs-border-color); background-color: var(--bs-body-bg);
  background-image: linear-gradient(var(--bs-secondary-bg) 1px,transparent 1px),linear-gradient(90deg,var(--bs-secondary-bg) 1px,transparent 1px);
}
html[data-bs-theme="dark"] .stream-graph-node-start { background: var(--bs-primary-bg-subtle); border-color: var(--bs-primary-text-emphasis); }
html[data-bs-theme="dark"] .stream-graph-node-deprecated { background: var(--bs-danger-bg-subtle); border-color: var(--bs-danger); }
html[data-bs-theme="dark"] .stream-graph-node-active { border-color: var(--bs-primary-text-emphasis); }
html[data-bs-theme="dark"] .stream-graph-node-selected { border-color: var(--bs-warning); }
html[data-bs-theme="dark"] .stream-graph-node-variable { border-color: var(--bs-info); }
html[data-bs-theme="dark"] .stream-area-fx { background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); }
html[data-bs-theme="dark"] .stream-area-io { background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); }
html[data-bs-theme="dark"] .stream-area-co { background: var(--bs-warning-bg-subtle); color: var(--bs-warning-text-emphasis); }
html[data-bs-theme="dark"] .stream-area-hk { background: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); }
html[data-bs-theme="dark"] .stream-area-unknown { background: var(--bs-secondary-bg); color: var(--bs-secondary-color); }
html[data-bs-theme="dark"] .text-bg-light { background-color: var(--bs-secondary-bg) !important; color: var(--bs-body-color) !important; }
html[data-bs-theme="dark"] .text-primary { color: var(--bs-primary-text-emphasis) !important; }
html[data-bs-theme="dark"] .text-danger { color: var(--bs-danger-text-emphasis) !important; }
html[data-bs-theme="dark"] .dashboard-link-card .lucide { color: var(--bs-primary-text-emphasis); }
html[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: var(--bs-primary-text-emphasis); --bs-btn-border-color: var(--bs-primary-text-emphasis); }
html[data-bs-theme="dark"] .btn-outline-secondary { --bs-btn-color: var(--bs-secondary-text-emphasis); --bs-btn-border-color: var(--bs-border-color); }
html[data-bs-theme="dark"] :is(.operation-progress,.script-dialog) { background: var(--bs-body-bg); color: var(--bs-body-color); }
.theme-toggle [data-theme-mode] { display: none; }
.theme-toggle .theme-option-active { display: inline-flex; }
