/* Shared semantic colors. Component layout stays in its original stylesheet. */
:root{
  --surface:#fff;--surface-subtle:#f1f6fc;--surface-deep:#e7eff9;
  --chart-1:#087786;--chart-2:#996209;--chart-3:#7052ad;--chart-4:#276aaf;
  --chart-5:#b63e63;--chart-6:#237558;--chart-7:#975b30;--chart-8:#526c88;
}
html[data-theme="dark"]{background:#203a61;color-scheme:dark}
html[data-theme="light"]{background:#eef4fc;color-scheme:light}
body.dark{
  --bs-primary:#69b7ff;--bs-primary-rgb:105,183,255;--bs-link-color:#69b7ff;--bs-link-color-rgb:105,183,255;
  --bs-link-hover-color:#91caff;--bs-link-hover-color-rgb:145,202,255;
  --brand:#69b7ff;--brand-dark:#2061ad;--brand-soft:#294b76;--nav:#192f51;
  --ink:#eaf4ff;--muted:#b8cce6;--line:#54739b;--bg:#203a61;
  --surface:#294873;--surface-subtle:#30517d;--surface-deep:#233f67;
  --red:#ff9faa;--amber:#ffd184;--green:#7be3c0;--blue:#91caff;
  --danger-text:#ffabb6;--danger-soft:#603449;--danger-border:#9a6378;
  --warning-text:#ffda94;--warning-soft:#55472e;--warning-border:#9a8154;
  --success-text:#83e5bd;--success-soft:#244e4c;--success-border:#4e8c7d;
  --teal-text:#81e4e4;--teal-soft:#254d63;--teal-border:#4f8595;
  --blue-text:#91caff;--blue-soft:#2b4f7e;--violet-text:#ccbeff;--violet-soft:#453f70;--violet-border:#8176b1;
  --chart-1:#80e6e6;--chart-2:#ffd184;--chart-3:#d2bdff;--chart-4:#91caff;
  --chart-5:#ffabbc;--chart-6:#83e5bd;--chart-7:#efba92;--chart-8:#c1d2e8;
  color:var(--ink);background-color:#203a61;
  background-image:radial-gradient(ellipse at 92% 8%,#3889e040,#0000 56%),radial-gradient(ellipse at 5% 65%,#6576c326,#0000 55%),linear-gradient(145deg,#29466f,#203a61 46%,#1b3154);
  background-repeat:no-repeat;background-attachment:fixed;
}
body.light{--muted:#526b88;--brand:var(--brand-light,#066573);--red:#a63249;--amber:#875500;--green:#176c4f;--blue:#24588a;color:var(--ink);background:#eef4fc;color-scheme:light}
body.dark .acq{--acq-ink:var(--ink)}
body.dark .shell{background:transparent}
body.light .sidebar{background:#e1ebf8;color:#486487;border-right:1px solid #c3d3e7}
body.light .brand{color:#18375e}
body.light .workspace{background:#edf4fe;border-color:#c3d3e7;color:#294c72}
body.light :is(.nav-item,.sidebar-toggle){color:#385779}
body.light :is(.nav-item.active,.nav-item.active:hover){background:#c8dff8;color:#153d69}
body.light :is(.nav-item:hover,.sidebar-toggle:hover){background:#d3e3f6;color:#153d69}
body.light .nav-item.active:before{background:#286eb6}
body.light :is(.nav-item.active .nav-count,.nav-count){background:#f5dbe2;color:#a63249}
body.light .sidebar-footer{border-color:#c3d3e7}
body.light .prototype-flag{background:#edf4fe;border-color:#c3d3e7;color:#385779}
body.light :is(.sidebar-version,.brand-sub,.nav-group-label){color:#526b88}
body.dark .topbar{background:#20395ff5}
body.dark :is(input,select,textarea){color:var(--ink);background-color:var(--surface-deep);border-color:var(--line);accent-color:var(--brand)}
body.dark input::placeholder,body.dark textarea::placeholder{color:#a8c0df;opacity:1}
body.dark :is(input,textarea)[readonly]{background-color:var(--surface-subtle);color:var(--muted)}
body.dark :is(.btn.primary,.btn.primary:hover,.cp-workspace .btn.primary,.btn.active){background:#2363ad;color:#fff;border-color:#69a5e0}
body.dark .rate-card .metric-value{color:var(--ink)}
body.dark .trend-zoom-tools>small{color:var(--muted)}
body.light .trend-zoom-tools>small{color:var(--muted)}
body.light .rate-card .metric-value{color:var(--ink)}
body.light .module-report-tabs button.active{background:#d9e9fc;color:#153d69}
body.dark :is(.nav-item.active,.nav-item.active:hover){background:#295384;color:#f1f7ff}
body.dark :is(.nav-item:hover,.sidebar-toggle:hover){background:#29496e;color:#f1f7ff}
body.dark .modal-backdrop{background:#294b79aa}
body.dark .toast{background:#294c73;color:#f1f7ff;border:1px solid #5076a0}
body.dark .status{border:1px solid transparent}
body.dark :is(.status.normal,.status.success,.acq-badge.good){color:var(--success-text);background:var(--success-soft)}
body.dark :is(.status.alarm,.status.warning,.acq-badge.warn){color:var(--warning-text);background:var(--warning-soft)}
body.dark :is(.status.fault,.status.danger,.acq-badge.bad){color:var(--danger-text);background:var(--danger-soft)}
body.dark :is(.status.stopped,.status.neutral){color:#c5d4e8;background:#3b506b}
body.dark :is(.tag-link,.link-btn,.text-link){color:#91caff}
body.dark svg text{fill:var(--muted)}
body.dark svg :is(.chart-grid,.grid-line),body.dark .trend-chart line{stroke:#4a688f}
body.dark .trend-chart :is(text,.trend-axis-title){fill:#c1d4eb}
body.dark .pa-donut-total{fill:var(--ink)}
body.dark .pa-donut-caption{fill:var(--muted)}
body.dark .trend-series{color:var(--ink)}
body.dark :is(button,a,input,select,textarea,[tabindex]):focus-visible{outline-color:#91caff}
.theme-toggle{width:33px;height:33px;flex:none;border:1px solid var(--line);color:var(--brand);background:var(--surface);border-radius:7px}
.theme-toggle .icon{width:17px;height:17px}
.theme-toggle:hover{background:var(--brand-soft)}
.theme-toggle[aria-pressed="true"]{color:#ffda94}

/* The same dashboard structure supports both themes, including charts and map labels. */
body.dark{
  --cp-surface:#223e66;--cp-surface-end:#20395f;--cp-subtle:#294a75;--cp-active:#2b5079;
  --cp-border:#4a6b95;--cp-text:#eaf4ff;--cp-muted:#b8cee9;--cp-grid:#4d6d94;
  --cp-chart-bg:#203b63;--cp-chart-end:#233f68;--cp-bar-start:#4c9cdd;--cp-bar-end:#8cd9ff;
  --cp-title:#f0f7ff;--cp-accent:#8dcfff;--cp-track:#47648b;--cp-rate-card:#29466e;
}
body.light{
  --cp-surface:#fff;--cp-surface-end:#f3f7fe;--cp-subtle:#eaf2fd;--cp-active:#dcecff;
  --cp-border:#b6cce5;--cp-text:#1a365b;--cp-muted:#486487;--cp-grid:#c5d7ec;
  --cp-chart-bg:#f8fbff;--cp-chart-end:#edf4ff;--cp-bar-start:#286eb6;--cp-bar-end:#3c94ca;
  --cp-title:#18375e;--cp-accent:#2265ab;--cp-track:#d2e0f1;--cp-rate-card:#f2f7ff;
}
body.cockpit-active{background-color:var(--bg)}
body.light.cockpit-active{background:radial-gradient(ellipse at 92% 8%,#badbff66,#0000 56%),linear-gradient(145deg,#eef5ff,#e8f0fb 46%,#e1ebfa)}
body.cockpit-active .cp-stage-frame,body.cockpit-active main.cp-screen{background:transparent}
body .cp-map{background:#2b4872}
body .cockpit-launcher{background:linear-gradient(145deg,#366391,#244875);border-color:#8cc6f2;color:#eaf4ff}
body :is(.cp-video,.cp-platform,.cctv-stage){background:#29456e}
body.dark :is(.acq-console,.ex-preview-text){background:#29456e;color:#eaf4ff}
body.light :is(.acq-console,.ex-preview-text){background:#e6effb;color:#1a365b}
body .cctv-error{background:#29456ef0;color:#eaf4ff}
body .cp-workspace{color:var(--cp-text);--cp-border:var(--line);--cp-muted:var(--muted)}
body.cockpit-active .cp-screen .cp-panel,body.cockpit-active .cp-screen .cp-station-card,body .cp-rate-panel{
  background:linear-gradient(145deg,var(--cp-surface),var(--cp-surface-end));border-color:var(--cp-border);box-shadow:0 3px 12px #0c214c0a;
}
body.cockpit-active .cp-screen :is(.cp-system-name,.cp-panel-title h2,.cp-station-heading h2,.trend-heading h3){color:var(--cp-title)}
body.cockpit-active .cp-screen .cp-panel-title h2{border-left-color:var(--cp-accent)}
body :is(.cp-path-clock,.cp-workspace h1,.cp-workspace h2,.cp-workspace h3){color:var(--cp-title)}
body.cockpit-active .cp-screen :is(.cp-panel-title small,.cp-instrument-foot,.cp-health-legend small,.cp-empty,.cp-anomaly-empty,.cp-distribution-axis,.cp-map-legend){color:var(--cp-muted)}
body.cockpit-active .cp-screen :is(.cp-metrics>div,.cp-instrument-tile,.cp-patrol>button,.cp-abnormal-list>button){background:var(--cp-subtle);border-color:var(--cp-border);color:var(--cp-text)}
body.cockpit-active .cp-screen .cp-metrics strong{color:var(--cp-title)}
body.cockpit-active .cp-screen :is(.cp-metrics span,.cp-metrics small){color:var(--cp-muted)}
body.cockpit-active .cp-screen :is(.cp-instrument-tile.active,.cp-instrument-tile:hover,.cp-patrol>button.selected,.cp-abnormal-list>button:hover){background:var(--cp-active);border-color:var(--cp-accent)}
body.cockpit-active .cp-screen :is(.cp-instrument-select,.cp-measurement-list .trend-value){color:var(--cp-title)}
body.cockpit-active .cp-screen :is(.cp-measurement-list .trend-value-label,.cp-abnormal-list .cp-anomaly-zone){color:var(--cp-muted)}
body.cockpit-active .cp-screen .cp-measurement-list .trend-value:hover{background:var(--cp-active)}
body.cockpit-active .cp-screen .cp-health-legend li>span{color:var(--cp-muted)}
body.cockpit-active .cp-screen .cp-health-legend strong{color:var(--cp-title)}
body.cockpit-active .cp-screen .cp-health-pie path{stroke:var(--cp-surface)}
body.cockpit-active .cp-screen .cp-rate{background:var(--cp-rate-card);border-color:var(--cp-border)}
body.cockpit-active .cp-screen .cp-rate-track{stroke:var(--cp-track)}
body.cockpit-active .cp-screen .cp-rate-ticks{stroke:var(--cp-grid)}
body.cockpit-active .cp-screen .cp-rate-marker{stroke:var(--cp-title)}
body.cockpit-active .cp-screen .cp-rate-value{fill:var(--cp-title)}
body.cockpit-active .cp-screen .cp-rate-unit{fill:var(--cp-muted)}
body.cockpit-active .cp-screen .cp-rate>strong{color:var(--cp-title)}
body.cockpit-active .cp-screen .cp-rate-target{color:var(--cp-muted)}
body.dark .cp-rate-result.passed{color:#83e5bd}body.dark .cp-rate-result.missed{color:#ffda94}
body.light .cp-rate-result.passed{color:#1c6c50}body.light .cp-rate-result.missed{color:#875500}
body.cockpit-active .cp-screen :is(.cp-home,.btn,.cp-inline select,.cp-filterbar select,.cp-filterbar input,.trend-actions select){background:var(--cp-subtle);border-color:var(--cp-border);color:var(--cp-text)}
body.cockpit-active .cp-screen :is(.cp-home,.btn):hover{background:var(--cp-active)}
body.cockpit-active .cp-screen>.cp-toolbar .cp-filterbar .btn,body.cockpit-active .cp-screen .cp-detail .trend-actions .btn{background:var(--cp-subtle);border-color:var(--cp-border);color:var(--cp-text)}
body.cockpit-active .cp-screen .cp-home{background:var(--cp-subtle);border-color:var(--cp-border);color:var(--cp-text)}
body.cockpit-active .cp-screen .cp-home .icon{color:var(--cp-accent)}
body.cockpit-active .cp-screen .theme-toggle{height:27px;width:28px;padding:3px;background:var(--cp-subtle);color:var(--cp-accent);border-color:var(--cp-border)}
body.cockpit-active .cp-screen .cp-filterbar input::placeholder{color:var(--cp-muted)}
body.cockpit-active .cp-screen .cp-wall-head{background:var(--cp-active);color:var(--cp-title)}
body.cockpit-active .cp-screen .cp-wall-feed{border-color:var(--cp-border)}
body.cockpit-active .cp-screen .cp-wall-row{background:var(--cp-surface);border-color:var(--cp-border);color:var(--cp-text)}
body.cockpit-active .cp-screen .cp-wall-row:nth-child(even){background:var(--cp-subtle)}
body.cockpit-active .cp-screen .cp-wall-row strong{color:var(--cp-title)}
body.cockpit-active .cp-screen .cp-wall-row :is(.tag-link,.link-btn){color:var(--cp-accent)}
body.cockpit-active .cp-screen .cp-wall-new{background:var(--cp-active);box-shadow:inset 3px 0 #e9b659}
body.cockpit-active .cp-screen .cp-detail .cp-selected-device>.trend-panel{background:linear-gradient(145deg,var(--cp-chart-bg),var(--cp-chart-end));border-color:var(--cp-border)}
body.cockpit-active .cp-screen .cp-detail .trend-chart :is(text,.trend-axis-title){fill:var(--cp-muted)}
body.cockpit-active .cp-screen .cp-detail .trend-chart line{stroke:var(--cp-grid)}
body.cockpit-active .cp-screen .cp-distribution-name{color:var(--cp-text)}
body.cockpit-active .cp-screen .cp-distribution-scroll li>strong{color:var(--cp-title)}
body.cockpit-active .cp-screen .cp-distribution-track{border-color:var(--cp-grid);background:repeating-linear-gradient(to right,transparent 0,transparent calc(33.333333% - 1px),var(--cp-grid) 33.333333%)}
body.cockpit-active .cp-screen .cp-distribution-track>i,body.cockpit-active .cp-screen .cp-distribution-scroll li:hover .cp-distribution-track>i{background:linear-gradient(90deg,var(--cp-bar-start),var(--cp-bar-end))}
body.cockpit-active .cp-screen .cp-distribution-scroll{scrollbar-color:var(--cp-border) var(--cp-surface)}
body.cockpit-active .cp-screen .pa-pagination{color:var(--cp-muted)}
body.cockpit-active .cp-screen .pa-pagination button{background:var(--cp-subtle);border-color:var(--cp-border);color:var(--cp-text)}
body.light .cp-screen .cp-status{color:var(--state-text-light)}
body.dark .cp-screen .cp-status{color:var(--state-text-dark)}
body.light .cp-rate[data-cp-rate="fault"] .cp-rate-arc{stroke:#c34560}
body.light .cp-rate[data-cp-rate="service"] .cp-rate-arc{stroke:#087786}
body.light .cp-rate[data-cp-rate="leak"] .cp-rate-arc{stroke:#996209}
body.light .cp-rate[data-cp-rate="intact"] .cp-rate-arc{stroke:#7052ad}
body .cp-map-tools{background:#234265f5;border-color:#7194b6}
body .cp-map-tools .btn.small{background:#2a4d73;border-color:#7194b6;color:#f0f7ff}
body .cp-map-tools output{color:#f0f7ff}
body.light .cp-map-tools .btn.small{background:#2a4d73;border-color:#7194b6;color:#f0f7ff}
body .cp-map-scene>img{opacity:.85;filter:saturate(.65) contrast(1.05)}
body .cp-pin span{background:#1c3658f0;border-color:#7792af}
body .cp-pin i{background:#203c60f5}
body.light .cp-pin{color:var(--state)}
body.dark .cp-map-no-match{background:#203b63f0;border-color:var(--line);color:var(--ink)}
body.light .cp-map-no-match{background:#f4f8fff0;border-color:var(--cp-border);color:var(--ink)}
body .cp-map-no-match>strong{color:inherit}
body.dark .cp-workspace :is(th,td){color:var(--ink);border-color:var(--line)}
body.dark .cp-workspace th{background:var(--surface-subtle)}
body.dark .cp-calendar-grid article{background:var(--surface);border-color:var(--line)}
body.dark .cp-calendar-grid{border-color:var(--line)}
@media(max-width:780px){.topbar-tools{gap:6px}.theme-toggle{width:30px;height:30px}.cp-screen .theme-toggle{flex:none}}
body .settings-choice{min-width:0;margin:0;padding:12px;border:1px solid var(--line);border-radius:6px;background:var(--surface-subtle)}
body .settings-choice legend{padding:0 5px;color:var(--ink);font-size:12px;font-weight:700}
body .settings-choice-grid{display:flex;flex-wrap:wrap;gap:5px 14px}
body .settings-choice-grid .check-row{margin:0;white-space:nowrap}
body .settings-rule-list{display:grid;gap:8px;margin-top:16px}
body .settings-rule-row{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:12px;border:1px solid var(--line);border-radius:6px;background:var(--surface)}
body .settings-rule-row>div:first-child{min-width:0}
body .settings-rule-row .rule-actions{display:flex;flex:none;gap:6px}
body .settings-rule-row .tiny{overflow-wrap:anywhere}
.settings-communication-summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin:15px 0 20px}
.settings-communication-summary>div{display:flex;flex-direction:column;gap:7px;padding:14px;border:1px solid var(--line);border-radius:6px;background:var(--surface-subtle)}
.settings-communication-summary span{color:var(--muted);font-size:12px}
.settings-communication-summary strong{color:var(--ink);font-size:19px}
body.light .status.normal{color:#176c4f}
body.light .danger-text{color:#a63249}
body.light .metric-card.alarm .metric-value,body.light .rate-card .metric-value{color:var(--ink)}
body.light .cp-status{color:var(--state-text-light)!important}
@media(max-width:780px){body .settings-rule-row{align-items:flex-start;flex-direction:column}body .settings-rule-row .rule-actions{flex-wrap:wrap}body .settings-choice-grid{gap:4px 10px}}
@media(max-width:640px){.settings-communication-summary{grid-template-columns:repeat(2,minmax(0,1fr))}.settings-communication-summary>div{padding:10px}.settings-communication-tabs{margin-bottom:14px}}
@media print{body{background:white!important;color:#183343!important}}
