/* Compact file actions share their meaning across reports, analysis and alarms. */
.file-action { display:inline-flex;align-items:center;justify-content:center;flex:none;width:34px;height:34px;min-height:34px;padding:5px!important;vertical-align:middle; }
.file-action svg { width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round; }
.file-action[data-file-format=xlsx] svg { color:#18794e; }
.file-action[data-file-format=pdf] svg { color:#b42336; }
html[data-content-theme=dark] .file-action[data-file-format=xlsx] svg { color:#6ee7b7; }
html[data-content-theme=dark] .file-action[data-file-format=pdf] svg { color:#fda4af; }
.file-action[aria-busy=true] { opacity:.5;cursor:wait; }
/* Screen-only theme roles include editors, transient panels and status states. */
@media screen {
  html[data-content-theme=dark] { color-scheme:dark; }
  html[data-content-theme=dark] main :is(.parameter-collection,.point-editor-expanded,.freshness-controls,.overview-footer) { background:#1b2a3f;color:#e2e8f0;border-color:#364b68; }
  html[data-content-theme=dark] main :is(.parameter-row,.parameter-add,.point-table-scroll,.audit-remark-entry,.analysis-series-row,.overview-weather-row,.overview-weather-selection,.quick-value,fieldset,#headerCardSettings,#deviceFormPanel[open]>form) { border-color:#364b68; }
  html[data-content-theme=dark] main :is(.device-entry p,.parameter-picker>span,#driverSelection,.reading-state,.analysis-series-identity,.analysis-legend-note,.overview-empty,.overview-level-empty,.overview-inverter-parameter,.overview-footer,.audit-remarks-history summary) { color:#a9bbd3; }
  html[data-content-theme=dark] main :is(.overview-footer strong) { color:#dbeafe; }
  html[data-content-theme=dark] main :is(.required-mark,.missing-fields,.parameter-controls button) { color:#fda4af; }
  html[data-content-theme=dark] main .parameter-controls .delete-icon:hover { background:#502b38;border-color:#fda4af; }
  html[data-content-theme=dark] main :is(.point-expand,.overview-count) { color:#c3d4ec;background:#26374f; }
  html[data-content-theme=dark] main .point-table-row input:read-only { color:#a9bbd3; }
  html[data-content-theme=dark] main :is(.point-table-row input,.point-table-row select):is(:hover,:focus) { background:#152238;border-color:#7dd3fc; }
  html[data-content-theme=dark] main .point-table-row :invalid { background:#502b38!important;border-color:#fda4af!important; }
  html[data-content-theme=dark] main :is(.point-invalid>td,td[data-state="Stale"],td[data-state="Bad quality"],td[data-state="Invalid source time"],.quick-value[data-state="Stale"],.quick-value[data-state="Bad quality"],.analysis-warning) { background:#49391e;color:#fde68a; }
  html[data-content-theme=dark] main td[data-state="No data"] { color:#a9bbd3; }
  html[data-content-theme=dark] main .driver-library .selected-driver td { background:#183e40; }
  html[data-content-theme=dark] main .audit-multiselect-options label:hover { background:#293e58; }
  html[data-content-theme=dark] main .analysis-presets button { background:#332655;color:#ddd6fe;border-color:#78659c; }
  html[data-content-theme=dark] main .analysis-presets button.active { background:#6d28d9;color:#fff; }
  html[data-content-theme=dark] main #analysis .analysis-range input { background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23c3d4ec' stroke-width='1.6'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v5M16 3v5M7 14h3M14 14h3M7 17h3'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 12px center; }
  html[data-content-theme=dark] main .badge { background:#183e40;color:#5eead4;border-color:#377571; }
  html[data-content-theme=dark] main #dashboard { color:#e2e8f0; }
  html[data-content-theme=dark] main #dashboard :is(.overview-count,.overview-scb-tooltip) { background:#26374f;color:#c3d4ec;border-color:#526783; }
  html[data-content-theme=dark] main #dashboard :is(td[data-state],.quick-value,.inverter-status-pill,.overview-status,[data-severity]) { background:transparent;color:inherit; }
  html[data-content-theme=dark] main .chart text { fill:#c3d4ec; }
  html[data-content-theme=dark] main .chart line { stroke:#364b68; }
  html[data-content-theme=dark] main #dashboard .chart :is(polyline,circle) { stroke:#7dd3fc; }
  html[data-content-theme=dark] main .chart circle { fill:#7dd3fc; }
  html[data-content-theme=dark] main .device-name-link:hover { color:#7dd3fc; }
  html[data-content-theme=dark] main #live .live-device-name { color:#e2e8f0; }
  html[data-content-theme=dark] main #parameterDisplay .display-rules-table input { background:#152238;color:#e2e8f0;border-color:#526783; }
  html[data-content-theme=dark] main #parameterDisplay .display-rules-table input::placeholder { color:#a9bbd3;opacity:1; }
  html[data-content-theme=dark] #reportGenerating { background:#1b2a3f;color:#e2e8f0;border-color:#526783; }
  html[data-content-theme=dark] .flatpickr-calendar { background:#1b2a3f;color:#e2e8f0;border:1px solid #526783;box-shadow:0 8px 32px #0006; }
  html[data-content-theme=dark] .flatpickr-calendar :is(.flatpickr-month,.flatpickr-weekday,.flatpickr-day,.flatpickr-time input,.flatpickr-time .flatpickr-am-pm,.flatpickr-time .flatpickr-time-separator,.flatpickr-current-month .flatpickr-monthDropdown-months) { color:#e2e8f0;fill:#e2e8f0; }
  html[data-content-theme=dark] .flatpickr-calendar :is(.flatpickr-prev-month,.flatpickr-next-month) { color:#c3d4ec;fill:#c3d4ec; }
  html[data-content-theme=dark] .flatpickr-calendar :is(.flatpickr-monthDropdown-months,.flatpickr-monthDropdown-month) { background:#1b2a3f; }
  html[data-content-theme=dark] .flatpickr-calendar .flatpickr-day:is(.prevMonthDay,.nextMonthDay,.flatpickr-disabled) { color:#879bb6; }
  html[data-content-theme=dark] .flatpickr-calendar .flatpickr-day:is(:hover,:focus) { background:#293e58;border-color:#526783; }
  html[data-content-theme=dark] .flatpickr-calendar .flatpickr-day.selected { background:#087f83;border-color:#2dd4bf;color:#fff; }
  html[data-content-theme=dark] .flatpickr-calendar .flatpickr-time { border-color:#364b68; }
  html[data-content-theme=dark] .flatpickr-calendar .flatpickr-time :is(input,.flatpickr-am-pm):is(:hover,:focus) { background:#293e58; }
  html[data-content-theme=dark] .flatpickr-calendar .numInputWrapper:hover { background:#293e58; }
  html[data-content-theme=dark] .flatpickr-calendar .numInputWrapper span { border-color:#526783; }
  html[data-content-theme=dark] .flatpickr-calendar .numInputWrapper .arrowUp::after { border-bottom-color:#c3d4ec; }
  html[data-content-theme=dark] .flatpickr-calendar .numInputWrapper .arrowDown::after { border-top-color:#c3d4ec; }
  html[data-content-theme=dark] .flatpickr-calendar::before { border-bottom-color:#526783; }
  html[data-content-theme=dark] .flatpickr-calendar::after { border-bottom-color:#1b2a3f; }
  html[data-content-theme=dark] main #sld .sld-canvas-background { fill:#111c2c; }
  html[data-content-theme=dark] main #sld #sld-dots circle { fill:#364b68; }
}
/* Shared UI roles. Keep page-specific layouts separate from typography. */
@media screen {
  html[data-content-theme=dark],html[data-content-theme=dark] body { background:#111c2c;color:#e2e8f0; }
  html[data-content-theme=dark] .login { color-scheme:dark; }
  html[data-content-theme=dark] .login .card { background:#1b2a3f;border-color:#364b68;color:#e2e8f0; }
  html[data-content-theme=dark] .login :is(h1,label) { color:#dbeafe; }
  html[data-content-theme=dark] .login :is(input,.secondary) { background:#152238;color:#e2e8f0;border-color:#526783; }
  html[data-content-theme=dark] .login p { color:#a9bbd3; }
  html[data-content-theme=dark] aside :is(.brand,.company-logo) { background:transparent; }
  html[data-content-theme=dark] main { color-scheme:dark;--ui-heading-color:#e2e8f0;--ui-label-color:#c3d4ec;--ui-table-heading-background:#26374f; }
  html[data-content-theme=dark] main :is(.card,.parameter-editor,.communication-group,.device-entry,.overview-block,.overview-metric,.audit-multiselect-options) { background:#1b2a3f;border-color:#364b68;color:#e2e8f0; }
  html[data-content-theme=dark] main :is(h1,h2,h3,label,legend,th,.metric-caption,.overview-legend) { color:#dbeafe; }
  html[data-content-theme=dark] main :is(input,select,textarea,.secondary,.audit-multiselect>summary) { background:#152238;color:#e2e8f0;border-color:#526783; }
  html[data-content-theme=dark] main :is(.muted,.eyebrow,.overview-note,small) { color:#a9bbd3; }
  html[data-content-theme=dark] main .analysis-empty { background:#152238;color:#a9bbd3; }
  html[data-content-theme=dark] main :is(td,th) { background:#1b2a3f;border-color:#364b68; }
  html[data-content-theme=dark] main th { background:#26374f; }
  html[data-content-theme=dark] main tbody tr:hover>td { background:#293e58; }
  html[data-content-theme=dark] main>header { border-color:#364b68; }
  html[data-content-theme=dark] main:has(#dashboard:not([hidden])) { background:#111c2c; }
  html[data-content-theme=dark] main>header h1 { color:#dbeafe; }
}
main:not(:has(#dashboard:not([hidden]))) #overviewCustomize { display:none; }
main>header:has(>.header-metrics:not([hidden])) { display:grid;grid-template-columns:minmax(140px,1fr) auto minmax(0,1fr) auto;gap:16px;align-items:center; }
main>header:has(>.header-metrics:not([hidden])) .header-customer-logos { justify-self:end;justify-content:flex-end;margin-left:0; }
.header-metrics { display:flex;justify-content:center;gap:10px;min-width:0; }
.header-metric { min-width:115px;padding:9px 14px;border:1px solid #d7e5ed;border-radius:10px;background:#fff;box-shadow:0 2px 8px #102d3b08; }
.header-metric span { display:block;font-size:11px;color:#61738b;margin-bottom:4px; }
.header-metric strong { display:block;font-size:18px;color:#087f83;white-space:nowrap;font-variant-numeric:tabular-nums; }
#headerCardSettings { margin:12px 0;border:1px solid #d7e5ed;border-radius:8px;padding:12px; }
:is(#settings,#system) #headerCardSettings .header-card-options { display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px; }
:is(#settings,#system) #headerCardSettings .inline { margin:0;min-width:0;gap:4px;align-items:center; }
:is(#settings,#system) #headerCardSettings input { flex:none; }
html[data-content-theme=dark] main .header-metric { background:#1b2a3f;border-color:#364b68; }
html[data-content-theme=dark] main .header-metric span { color:#a9bbd3; }
html[data-content-theme=dark] main .header-metric strong { color:#5eead4; }
@media(max-width:1100px) {
  main>header:has(>.header-metrics:not([hidden])) { grid-template-columns:minmax(0,1fr) auto; }
  .header-metrics { grid-row:2;grid-column:1 / -1; }
  main>header:has(>.header-metrics:not([hidden])) #connectionBadge { grid-column:2;grid-row:3;justify-self:end; }
}
@media(max-width:650px) {
  main>header:has(>.header-metrics:not([hidden])) { grid-template-columns:auto minmax(0,1fr);gap:10px; }
  main>header:has(>.header-metrics:not([hidden])) .header-customer-logos { grid-row:3;grid-column:1; }
  .header-metrics { gap:6px; }
  .header-metric { min-width:0;flex:1;padding:8px; }
  .header-metric strong { font-size:14px;white-space:normal;overflow-wrap:anywhere; }
}
/* Printed reports keep the logo intended for a white page. */
@media print {
  .report-enernexus-logo { content:url('./vrtex-enernexus-logo.png'); }
}
/* Settings tabs keep each group mounted so switching preserves form drafts. */
:is(#settings,#system):not([hidden]) { display:block; }
:is(#settings,#system) .settings-panel { min-width:0; }
#settingsBranding:not([hidden]),#systemDbOps:not([hidden]) { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;align-items:start; }
#systemDbOps :is(#diskCard,#usbBackupCard) { grid-column:1/-1; } /* Disk and USB backup span the row; the SQLite and InfluxDB cards share one. */
:is(#settings,#system) .settings-tabs { display:flex;flex-wrap:wrap;gap:4px;margin-bottom:16px;padding-bottom:4px;border-bottom:1px solid #c9d6e5; }
:is(#settings,#system) .settings-tabs button { background:transparent;color:#52677a;border:1px solid transparent;border-bottom:2px solid transparent;border-radius:6px 6px 0 0;padding:10px 16px;font-size:13px; }
:is(#settings,#system) .settings-tabs button[aria-selected=true] { background:#e8f1ff;color:#175fb3;border-bottom-color:#2369c5; }
html[data-content-theme=dark] :is(#settings,#system) .settings-tabs { border-bottom-color:#3a4c65; }
html[data-content-theme=dark] :is(#settings,#system) .settings-tabs button { background:transparent;color:#c9d8ec; }
html[data-content-theme=dark] :is(#settings,#system) .settings-tabs button[aria-selected=true] { background:#243f60;color:#9cc9ff;border-bottom-color:#72abf3; }
:is(#settings,#system) .card { margin:0;padding:16px;min-width:0;overflow-wrap:anywhere; }
:is(#settings,#system) .settings-access-stack,:is(#settings,#system) .settings-branding-stack { display:grid;grid-template-columns:minmax(0,1fr);gap:12px;min-width:0; }
:is(#settings,#system) #connectionCard,:is(#settings,#system) #opcuaCard { grid-column:auto; }
:is(#settings,#system) #opcuaCard .grid { grid-template-columns:repeat(4,minmax(0,1fr)); }
:is(#settings,#system) #configExpiryForm { display:grid;grid-template-columns:minmax(0,1fr);gap:8px;align-items:end; }
:is(#settings,#system) #configExpiryForm label { margin:0; }
:is(#settings,#system) h2 { font-size:16px;margin-bottom:10px; }
:is(#settings,#system) h3 { font-size:14px; }
:is(#settings,#system) p { font-size:12px;line-height:1.45;margin:8px 0; }
:is(#settings,#system) label { gap:5px;margin-bottom:10px;font-size:12px; }
:is(#settings,#system) :is(input,select,textarea) { width:100%;padding:7px; }
:is(#settings,#system) input[type=checkbox] { width:auto; }
:is(#settings,#system) button { padding:8px 10px;font-size:12px; }
:is(#settings,#system) .grid { grid-template-columns:repeat(2,minmax(0,1fr));gap:8px; }
:is(#settings,#system) .actions { justify-content:flex-start;flex-wrap:wrap;gap:8px; }
:is(#settings,#system) .date-range { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px; }
@media(min-width:1700px) { main:has(:is(#settings,#system):not([hidden])) { max-width:none; } }
@media(max-width:1200px) { :is(#settings,#system) #opcuaCard .grid { grid-template-columns:repeat(3,minmax(0,1fr)); } }
@media(max-width:760px) { #settingsBranding:not([hidden]),#systemDbOps:not([hidden]) { grid-template-columns:minmax(0,1fr); } :is(#settings,#system) #opcuaCard .grid { grid-template-columns:repeat(2,minmax(0,1fr)); } :is(#settings,#system) .settings-tabs button { padding:9px 12px; } }
@media(max-width:480px) { :is(#settings,#system) #opcuaCard .grid { grid-template-columns:minmax(0,1fr); } }
:root {
  --ui-heading-size:18px;
  --ui-text-size:13px;
  --ui-heading-color:#1c3559;
  --ui-label-color:#344d76;
  --ui-table-heading-background:#eaf1fc;
  --ui-emphasis-weight:600;
}

.audit-filter-field { display:flex;flex-direction:column;gap:4px;margin-bottom:10px;min-width:0;font-size:13px;font-weight:600; }
.audit-multiselect { position:relative;min-width:0;font-weight:400; }
.audit-multiselect > summary { cursor:pointer;padding:6px 28px 6px 8px;border:1px solid #c9d6de;border-radius:6px;background:#fff;color:#182e3c;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;list-style:none; }
.audit-multiselect > summary::after { content:'\25be';position:absolute;right:10px;top:6px; }
.audit-multiselect > summary:focus-visible { outline:3px solid #e7ae43;outline-offset:2px; }
.audit-multiselect-options { position:absolute;top:calc(100% + 4px);left:0;z-index:20;width:100%;min-width:220px;max-height:300px;overflow:auto;padding:6px;background:#fff;border:1px solid #c9d6de;border-radius:6px;box-shadow:0 6px 18px #18394826; }
#audit .audit-multiselect-options label { display:flex;flex-direction:row;align-items:center;gap:8px;margin:0;padding:7px 6px;font-weight:400;cursor:pointer;overflow-wrap:anywhere; }
.audit-multiselect-options label:hover { background:#eff6ff; }
.audit-multiselect-options input { flex-shrink:0; }
#auditPagination label { margin:0;gap:6px; }
@media screen {
  #audit #auditEvents { margin-top:8px;max-height:65vh; }
  #audit #auditEvents :is(th,td) { padding:4px 6px;line-height:1.3;vertical-align:top; }
  #audit #auditEvents th { position:sticky;top:0;z-index:1; }
  #audit #auditEvents .audit-remarks { min-width:220px;max-width:360px;white-space:normal; }
  #audit .audit-current-remark { max-width:320px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
  #audit .audit-current-remark:empty { display:none; }
  #audit .audit-remarks > button { padding:2px 6px;margin:2px 0 0;font-size:12px;line-height:1.3; }
  #audit .audit-remarks-history { display:inline-block;margin:2px 8px 0 0; }
  #audit .audit-remarks-history[open] { display:block;white-space:pre-wrap; }
  #audit .audit-remarks-history summary { cursor:pointer;color:#344d76;font-size:12px; }
  #audit .audit-remark-entry { margin:3px 0;padding:3px 0; }
}

/* Shared content colors; theme-aware sidebar colors are in navigation.css. */
@media screen {
  :root { background:#edf3fb; color:#192d4d; }
  body { background:radial-gradient(ellipse at 95% 0,#ddd6fe50,transparent 42%),radial-gradient(ellipse at 25% 45%,#cffafe50,transparent 50%),#edf3fb; min-height:100vh; }
  main { --page-accent:#2563eb; }
  main:has(#analysis:not([hidden])),main:has(#analysisSettings:not([hidden])) { --page-accent:#7c3aed; }
  main:has(#reports:not([hidden])),main:has(#reportSettings:not([hidden])) { --page-accent:#0891b2; }
  main:has(#devices:not([hidden])),main:has(#drivers:not([hidden])) { --page-accent:#0d9488; }
  main:has(#audit:not([hidden])),main:has(#users:not([hidden])) { --page-accent:#9333ea; }
  main>header { border-bottom:1px solid #c9d9ef; padding-bottom:14px; margin-bottom:14px; }
  main>header h1 { color:#162e56; letter-spacing:-.7px; }
  main>header .eyebrow { color:var(--page-accent); }
  main .card { border-color:#d5e1f1; box-shadow:0 4px 18px #234b7d09; border-top:3px solid color-mix(in srgb,var(--page-accent) 55%,white); }
  main .card h2 { color:#1c3559; }
  main button:not(.secondary):not(.delete-icon):not(.point-expand) { background:var(--page-accent); }
  main .secondary { color:var(--page-accent); background:#f7faff; border-color:#cbdcf1; }
  main button:hover { box-shadow:0 3px 10px #234b7d18; }
  main :is(input,select,textarea):focus { border-color:var(--page-accent); }
  main input[type=checkbox] { accent-color:var(--page-accent); }
  main th { background:#eaf1fc; color:#344d76; }
  main tbody tr:hover>td { background-color:#eff6ff; }
  main .badge { background:#d4f6e8; color:#096d4b; border:1px solid #ade6cf; }
  main .parameter-editor,main .communication-group,main .device-entry { border-color:#cadbed; background:#fbfdff; }
  main .communication-group legend { color:var(--page-accent); }
  main .analysis-presets button { background:#ede9fe; color:#6d28d9; border-color:#ddd6fe; }
  main .analysis-presets button.active { background:#7c3aed;color:white; }
  .login { background:radial-gradient(ellipse at 25% 20%,#176d88,transparent 55%),linear-gradient(140deg,#102d3b,#18346a); }
  #dashboard { --page-accent:#2563eb; }
  .overview-metrics { display:grid; grid-template-columns:repeat(8,minmax(0,1fr)); gap:10px; }
  #dashboard [data-accent=blue] { --accent:#2563eb; --tint:#eff6ff; }
  #dashboard [data-accent=teal] { --accent:#0d9488; --tint:#ecfdf5; }
  #dashboard [data-accent=violet] { --accent:#7c3aed; --tint:#f5f3ff; }
  #dashboard [data-accent=cyan] { --accent:#0891b2; --tint:#ecfeff; }
  #dashboard [data-accent=green] { --accent:#16a34a; --tint:#f0fdf4; }
  #dashboard [data-accent=amber] { --accent:#d97706; --tint:#fffbeb; }
  #dashboard [data-accent=rose] { --accent:#e11d48; --tint:#fff1f2; }
  #dashboard [data-overview-card] { border-top:3px solid var(--accent); min-width:0; margin:0; }
  #dashboard .overview-metric { padding:14px 12px; background:linear-gradient(135deg,var(--tint),#fff 85%); }
  .overview-metric .metric-caption { display:flex; align-items:center; gap:7px; min-height:34px; color:#425576; font-size:12px; line-height:1.3; font-weight:600; margin-bottom:8px; }
  .metric-icon { color:var(--accent); font-size:23px; flex-shrink:0; }
  .overview-metric strong { font-size:clamp(20px,1.7vw,30px); letter-spacing:-.7px; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
  .overview-metric div>span:not(.metric-icon):not(.metric-label) { font-size:11px; color:#60728c; }
  .overview-metric small { display:block; font-size:10px; color:#677991; margin-top:7px; }
  .overview-layout { display:grid; grid-template-columns:minmax(0,1.7fr) minmax(240px,.85fr) minmax(280px,.95fr); gap:12px; margin-top:14px; align-items:start; }
  #dashboard .overview-layout>.card { padding:16px; }
  #dashboard h2 { font-size:17px; margin:0; }
  #dashboard .toolbar { flex-wrap:wrap; }
  #dashboard .chart { margin-top:12px; }
  .overview-note { font-size:11px; line-height:1.5; }
  .overview-legend { display:inline-flex; align-items:center; gap:6px; font-size:11px; color:#526581; }
  .overview-legend i { width:24px; height:3px; background:#2563eb; border-radius:4px; }
  .overview-power { grid-column:1; }
  .overview-weather { grid-column:2; }
  .overview-inverters { grid-column:3; grid-row:1 / span 3; align-self:stretch; }
  .overview-inverters .table-wrap { max-height:720px; }
  .overview-inverters td,.overview-inverters th { padding:9px 6px; font-size:12px; }
  .overview-inverters td:first-child { white-space:normal; overflow-wrap:anywhere; }
  .overview-inverters td:last-child { text-align:right; }
  .overview-inverters th { position:sticky; top:0; }
  .overview-plant,.overview-alarms { grid-column:1 / span 2; }
  .overview-count { display:inline-block; border-radius:6px; background:#e9efff; color:#465e99; padding:4px 7px; font-size:11px; }
  .overview-blocks { display:grid; grid-template-columns:repeat(auto-fit,minmax(165px,1fr)); gap:10px; margin-top:12px; }
  .overview-block { border:1px solid #cfe0ee; background:linear-gradient(150deg,#edf8ff,#fff); border-radius:9px; padding:12px; min-width:0; }
  .overview-block h3 { margin:0; font-size:14px; }
  .overview-block p { margin:5px 0 10px; font-size:11px; }
  .overview-device-tiles { display:flex; flex-wrap:wrap; gap:5px; }
  .overview-device-tile { border-radius:4px; padding:5px 7px; font-size:11px; max-width:100%; overflow-wrap:anywhere; }
  .overview-status { display:inline-block; border-radius:5px; padding:3px 6px; font-size:10px; }
  .overview-state-legend { display:flex; justify-content:flex-end; flex-wrap:wrap; gap:7px; margin-top:10px; }
  .overview-state-legend span { border-radius:4px; font-size:10px; padding:3px 6px; }
  .weather-sun { color:#f59e0b; font-size:26px; }
  .overview-weather-values { max-height:300px; overflow:auto; margin-top:10px; }
  .overview-weather-values h3 { color:#a16207; font-size:12px; margin:10px 0; }
  .overview-weather-row { display:grid; grid-template-columns:1fr auto; gap:4px; padding:8px 4px; border-bottom:1px solid #e6edf5; font-size:12px; }
  .overview-weather-row small { grid-column:1 / -1; color:#61738b; font-size:10px; }
  .overview-weather-row strong { text-align:right; }
  .overview-weather-selection { display:grid; gap:2px; padding:4px 4px 10px; border-bottom:1px solid #e6edf5; }
  .overview-weather-values .overview-weather-selection h3 { margin:0; color:#a16207; font-size:13px; }
  .overview-weather-selection small { color:#61738b; font-size:11px; }
  .overview-weather-irradiance { font-size:26px; line-height:1.2; }
  .overview-weather-selection[data-quality=degraded] .overview-weather-status { color:#b45309; }
  .overview-weather-selection[data-quality=unavailable] .overview-weather-status { color:#b91c1c; }
  .overview-weather-row[data-quality=excluded] small { color:#b45309; }
  html[data-content-theme=dark] .overview-weather-selection[data-quality=degraded] .overview-weather-status,
  html[data-content-theme=dark] .overview-weather-row[data-quality=excluded] small { color:#fcd34d; }
  html[data-content-theme=dark] .overview-weather-selection[data-quality=unavailable] .overview-weather-status { color:#fca5a5; }
  .overview-weather-note { color:#61738b; font-size:11px; margin:0 0 6px; }
  .overview-empty { color:#687b94; font-size:12px; padding:24px 8px; line-height:1.7; margin:0; }
  .overview-footer { display:flex; align-items:center; flex-wrap:wrap; gap:14px; padding:12px 16px; border:1px solid #cddff0; border-radius:9px; margin-top:12px; background:#f8fbff; font-size:12px; color:#60738f; }
  .overview-footer strong { color:#284466; }
  .overview-footer>span:last-child { margin-left:auto; }
  .overview-footer-dot { width:8px; height:8px; border-radius:50%; background:#0891b2; }
  #dashboard .overview-settings { margin:0 0 14px; padding:18px; background:#f6f8ff; border-top-color:#7c3aed; }
  .overview-settings p { font-size:12px; }
  .overview-settings .checks { gap:10px; }
  .overview-settings label { margin:0; display:flex; flex-direction:row; align-items:center; padding:8px 10px; background:white; border:1px solid #d7e2f4; border-radius:7px; font-size:12px; }
  .overview-settings input { margin:0; }
  #overviewCardChoices { display:flex; flex-direction:column; gap:8px; }
  .overview-card-choice { display:flex; align-items:center; gap:6px; min-width:0; }
  .overview-card-choice label { flex:1; min-width:0; overflow-wrap:anywhere; }
  .overview-card-choice button { flex-shrink:0; padding:7px 10px; }
  .overview-card-choice button:disabled { opacity:.35; cursor:default; }
  .overview-card-drag { cursor:grab; touch-action:pan-y; }
  #dashboard .overview-metric .metric-caption { white-space:normal; overflow-wrap:anywhere; }
  #dashboard .overview-metric .metric-label { min-width:0; font:inherit; color:inherit; }
  #dashboard .overview-metric .metric-caption+div { display:flex; flex-wrap:wrap; align-items:baseline; gap:3px 5px; min-width:0; }
  #dashboard .overview-metric .metric-caption+div>* { min-width:0; max-width:100%; white-space:normal; overflow-wrap:anywhere; }
  #overviewPreferenceStatus:empty { display:none; }
  #dashboard .chart polyline { stroke:#2563eb; }
  #dashboard .overview-analysis-chart { overflow-x:auto; }
  #dashboard .overview-analysis-chart .overview-trend-plot { height:470px; min-width:720px; }
  @media(max-width:760px) { #dashboard .overview-analysis-chart .overview-trend-plot { height:420px; } }
  .overview-power>.toolbar { flex-wrap:wrap; }
  #dashboard .chart rect { fill:#0d9488; }
  #dashboard .overview-alarms .table-wrap { margin-top:12px; }
  #dashboard .overview-alarms td { white-space:normal; overflow-wrap:anywhere; }
  @media(min-width:1650px) { .overview-metric strong { font-size:30px; } }
  @media(max-width:1250px) { .overview-metrics { grid-template-columns:repeat(4,minmax(0,1fr)); } .overview-layout { grid-template-columns:minmax(0,1.5fr) minmax(260px,1fr); } .overview-inverters { grid-column:2; grid-row:2 / span 2; } .overview-weather { grid-column:2; } .overview-plant,.overview-alarms { grid-column:1; } }
  @media(max-width:750px) { .overview-layout { grid-template-columns:minmax(0,1fr); } #dashboard .overview-layout>.card { grid-column:1; grid-row:auto; } .overview-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); } .overview-metric strong { font-size:25px; } #dashboard .chart svg { min-width:440px; } .overview-toolbar>.actions { margin-left:auto; } .overview-inverters .table-wrap { max-height:400px; } .overview-blocks { grid-template-columns:repeat(auto-fit,minmax(135px,1fr)); } }
}


@media screen {
  #dashboard .overview-alarms [data-severity] { font-weight:600; }
  #dashboard .chart svg { height:260px; }
  #dashboard .overview-layout:has(>[hidden])>.card { grid-column:auto;grid-row:auto;align-self:start; }
}

@media screen {
  .overview-blocks { grid-template-columns:repeat(auto-fit,minmax(min(100%,280px),1fr)); align-items:start; }
  .overview-plant-level { border-top:1px solid #d3e3ee; padding-top:10px; margin-top:12px; }
  .overview-plant-level h4 { margin:0 0 8px; font-size:11px; letter-spacing:.5px; text-transform:uppercase; color:#4b6480; }
  .overview-device-tiles { display:grid; grid-template-columns:repeat(auto-fit,minmax(105px,1fr)); gap:8px; }
  .overview-device-tile { display:flex; flex-direction:column; gap:7px; padding:10px; border:1px solid #ffffff90; border-radius:8px; min-width:0; }
  .overview-tile-name { font-size:12px; line-height:1.4; overflow-wrap:anywhere; }
  .overview-tile-parameter { display:flex; flex-direction:column; gap:4px; font-size:10px; overflow-wrap:anywhere; }
  .overview-tile-parameter b { font-size:16px; font-variant-numeric:tabular-nums; }
  .overview-tile-state { font-size:9px; }
  .overview-level-empty { color:#697f96; font-size:11px; grid-column:1 / -1; padding:6px 0; }
  #overviewBlockSettings { font-size:11px; padding:6px 9px; margin-left:auto; }
}

@media screen {
  .overview-scb-dots { display:flex; flex-wrap:wrap; gap:10px; padding:6px 2px; }
  #dashboard .overview-scb-dot { display:block; position:relative; width:15px; height:15px; min-width:15px; border-radius:50%; padding:0; border:2px solid #fff; box-shadow:0 0 0 1px #c9d8e7; cursor:help; }
  #dashboard .overview-scb-dot[data-freshness=green] { background:#22c55e; }
  #dashboard .overview-scb-dot[data-freshness=orange] { background:#f59e0b; }
  #dashboard .overview-scb-dot[data-freshness=red] { background:#ef4444; }
  .overview-scb-tooltip { display:none; position:absolute; bottom:calc(100% + 9px); left:-5px; z-index:5; width:220px; max-width:70vw; padding:10px 12px; border-radius:8px; background:#142d4b; color:#fff; box-shadow:0 4px 18px #102d3b30; text-align:left; font-size:11px; line-height:1.5; font-weight:400; white-space:normal; pointer-events:none; }
  .overview-scb-tooltip>* { display:block; }
  .overview-scb-dot:hover .overview-scb-tooltip,.overview-scb-dot:focus .overview-scb-tooltip { display:block; }
  .overview-inverter-parameter { display:block; font-size:10px; color:#60738f; }
}


@media screen {
  .overview-state-legend [data-freshness=green] { color:#166534; background:#dcfce7; }
  .overview-state-legend [data-freshness=orange] { color:#92400e; background:#fef3c7; }
  .overview-state-legend [data-freshness=red] { color:#991b1b; background:#fee2e2; }
}

@media screen {
  .overview-scb-tooltip { position:fixed; bottom:auto; }
  #dashboard .overview-scb-dot:hover { filter:none; }
}

@media screen {
  .overview-blocks { grid-template-columns:repeat(var(--overview-columns,3),minmax(0,1fr)); }
  .overview-blocks>.overview-empty { grid-column:1 / -1; }
  .overview-block-counts { color:#60738f; overflow-wrap:anywhere; line-height:1.5; }
  .overview-block h3 { overflow-wrap:anywhere; }
  .overview-plant-level[data-plant-level=Meters] .overview-device-tiles { grid-template-columns:minmax(0,1fr); }
  .overview-plant-level[data-plant-level=Meters] .overview-device-tile { flex-direction:row; align-items:center; justify-content:space-between; gap:8px; padding:8px; }
  .overview-plant-level[data-plant-level=Meters] .overview-tile-name { flex:1; min-width:0; font-size:11px; }
  .overview-plant-level[data-plant-level=Meters] .overview-tile-parameter { flex-shrink:0; text-align:right; }
  .overview-plant-level[data-plant-level=Meters] .overview-tile-parameter b { font-size:13px; }
  @media(max-width:1100px) { .overview-blocks { grid-template-columns:repeat(min(var(--overview-columns,3),3),minmax(0,1fr)); } }
  @media(max-width:750px) { .overview-blocks { grid-template-columns:repeat(min(var(--overview-columns,3),2),minmax(0,1fr)); } }
  @media(max-width:500px) { .overview-blocks { grid-template-columns:minmax(0,1fr); } }
}

/* Compact SCADA composition based on the supplied overview reference. */
@media screen {
  main:has(#dashboard:not([hidden])) { padding:12px 16px; background:#f1f7fd; min-height:100vh; }
  main:has(#dashboard:not([hidden]))>header { min-height:42px; margin-bottom:8px; padding-bottom:8px; border-color:#d2dfef; }
  main:has(#dashboard:not([hidden]))>header .eyebrow { display:none; }
  main:has(#dashboard:not([hidden]))>header h1 { font-size:24px; margin:0; }
  main:has(#dashboard:not([hidden])) .header-customer-logos img { max-height:38px; }
  #dashboard { color:#142b49; }
  #dashboard [data-overview-card] { border:1px solid #cddbea; border-radius:8px; box-shadow:0 1px 3px #1b406b09; }
  #dashboard .overview-metrics { gap:6px; }
  #dashboard .overview-metric { padding:11px 10px; min-height:94px; background:linear-gradient(145deg,#fff,#f8fbff); }
  #dashboard .overview-metric .metric-caption { min-height:30px; margin-bottom:8px; font-size:11px; color:#25364e; gap:7px; }
  #dashboard .metric-icon { color:var(--accent); font-size:23px; }
  #dashboard .overview-metric strong { font-size:clamp(21px,1.6vw,27px); color:#10233e; letter-spacing:-.5px; }
  #dashboard .overview-metric small { display:none; }
  #dashboard .overview-layout { grid-template-columns:minmax(0,2fr) minmax(200px,.9fr) minmax(340px,1.1fr); gap:10px; margin-top:10px; }
  #dashboard .overview-layout>.card { padding:12px; }
  #dashboard h2 { font-size:18px; font-weight:700; color:#132643; }
  #dashboard .overview-power,#dashboard .overview-weather { min-height:270px; }
  #dashboard .overview-weather-values { margin-top:8px; max-height:215px; }
  #dashboard .overview-weather-row { grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:8px; padding:9px 3px; }
  #dashboard .overview-weather-row strong { text-align:right; font-size:17px; }
  #dashboard .overview-note { margin:7px 0; font-size:10px; }
  #dashboard .chart { margin-top:6px; min-height:195px; }
  #dashboard .chart svg { height:200px; min-width:360px; }
  #dashboard .overview-inverters { padding:12px 10px; }
  #dashboard .overview-inverters .table-wrap { margin-top:10px; max-height:620px; }
  #dashboard .overview-inverters table { table-layout:fixed; font-size:12px; }
  #dashboard .overview-inverters th { background:#e7eef8; color:#24364d; padding:5px 4px; font-size:10px; white-space:normal; }
  #dashboard .overview-inverters th:first-child { width:27%; }
  #dashboard .overview-inverters th:nth-child(2) { width:24%; }
  #dashboard .overview-inverters td { padding:6px 4px; font-size:11px; white-space:normal; overflow-wrap:anywhere; border-color:#e1e8f1; }
  #dashboard .overview-inverters td:nth-child(n+3),#dashboard .overview-inverters th:nth-child(n+3) { text-align:right; font-variant-numeric:tabular-nums; }
  .inverter-status-pill { display:inline-block; border-radius:4px; padding:3px 5px; font-size:10px; line-height:1.2; }
  #dashboard .overview-block { padding:10px; border-radius:6px; background:linear-gradient(140deg,#edf3fc,#fbfdff 65%); border-color:#ccd8e8; }
  #dashboard .overview-block h3 { font-size:14px; }
  #dashboard .overview-block-counts { margin:3px 0 7px; font-size:10px; color:#425775; }
  #dashboard .overview-blocks { gap:8px; margin-top:9px; }
  #dashboard .overview-plant-level { margin-top:8px; padding-top:8px; }
  #dashboard .overview-plant-level h4 { font-size:10px; margin-bottom:6px; }
  #dashboard .overview-plant-level[data-plant-level=Meters] .overview-device-tile { background:#fff; color:#1c3553; padding:6px; border-color:#dae5f1; border-radius:4px; }
  #dashboard .overview-device-tiles { gap:5px; }
  #dashboard .overview-scb-dots { gap:6px; padding:3px 1px; }
  #dashboard .overview-scb-dot { height:13px; width:13px; min-width:13px; }
  #dashboard .overview-state-legend { gap:5px; margin-top:6px; }
  #dashboard .overview-state-legend span { font-size:9px; padding:3px 5px; }
  #dashboard .overview-alarms .table-wrap { margin-top:7px; font-size:12px; }
  #dashboard .overview-alarms th { background:#dfe7f3; color:#233650; padding:5px 8px; }
  #dashboard .overview-alarms td { padding:6px 8px; font-size:12px; }
  #dashboard .overview-footer { padding:8px 12px; margin-top:10px; border-radius:6px; }
  #dashboard .overview-count { padding:3px 6px; background:#e0ebfb; }
  @media(max-width:1250px) {
    #dashboard .overview-metrics { grid-template-columns:repeat(4,minmax(0,1fr)); }
    #dashboard .overview-layout { grid-template-columns:minmax(0,1.5fr) minmax(300px,1fr); }
    #dashboard .overview-inverters { grid-column:2; grid-row:2 / span 2; }
  }
  @media(max-width:750px) {
    main:has(#dashboard:not([hidden])) { padding:12px; }
    #dashboard .overview-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
    #dashboard .overview-layout { grid-template-columns:minmax(0,1fr); }
    #dashboard .overview-layout>.card { grid-column:1; grid-row:auto; }
    #dashboard .overview-metric { min-height:92px; }
    #dashboard .overview-power,#dashboard .overview-weather { min-height:0; }
    #dashboard .overview-inverters .table-wrap { max-height:420px; }
  }
}


@media screen {
  #dashboard .metric-icon svg { display:block; width:23px; height:23px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
  .inverter-row-dot { display:inline-block; width:7px; height:7px; border-radius:50%; margin-right:6px; vertical-align:middle; }
  #dashboard .inverter-row-dot[data-health=good] { background:#22b42d; }
  #dashboard .inverter-row-dot[data-health=bad] { background:#ef4444; }
  #dashboard .inverter-row-dot[data-health=warning] { background:#f59e0b; }
  #dashboard .inverter-row-dot[data-health=none] { background:#94a3b8; }
}

@media screen {
  .overview-meter-dot { display:inline-block; width:7px; height:7px; border-radius:50%; margin-right:5px; vertical-align:middle; }
  #dashboard :is(.inverter-row-dot,.overview-meter-dot)[data-freshness=green] { background:#22c55e; }
  #dashboard :is(.inverter-row-dot,.overview-meter-dot)[data-freshness=orange] { background:#f59e0b; }
  #dashboard :is(.inverter-row-dot,.overview-meter-dot)[data-freshness=red] { background:#ef4444; }
  /* Data stays neutral in both themes; communication markers retain their colors. */
  #dashboard :is(td[data-state],.quick-value,.inverter-status-pill,.overview-status,[data-severity]) { background:transparent;color:inherit; }
  #dashboard :is(td[data-freshness],.overview-tile-parameter) { color:inherit; }
  #dashboard tbody tr:hover>td { background:transparent; }
  #dashboard .overview-scb-dot { display:inline-flex; align-items:center; justify-content:center; width:24px; height:22px; min-width:24px; border-radius:3px; border:1px solid #ffffffaa; box-shadow:none; font-size:10px; font-weight:700; }
  #dashboard .overview-scb-dot[data-freshness=green] { background:#bbf3c6; color:#14532d; }
  #dashboard .overview-scb-dot[data-freshness=orange] { background:#fde28a; color:#854d0e; }
  #dashboard .overview-scb-dot[data-freshness=red] { background:#fecaca; color:#991b1b; }
  #dashboard .overview-scb-dots { gap:4px; }
  .overview-scb-number { line-height:1; }
  .overview-scb-tooltip { background:#fff; color:#18334e; border:1px solid #cbdbea; }
}


@media screen {
  #overviewPlant { overflow-x:auto; padding-bottom:4px; }
  #overviewPlant.overview-blocks { grid-template-columns:repeat(var(--overview-columns,3),minmax(210px,1fr)); }
  #dashboard .overview-block h3 { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  #dashboard .overview-block-counts { white-space:nowrap; }
  #dashboard .overview-plant-level[data-plant-level=Meters] .overview-tile-name { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  #dashboard .overview-plant-level[data-plant-level=Meters] .overview-tile-parameter { white-space:nowrap; overflow-wrap:normal; }
  #dashboard .overview-plant-reading { display:inline-flex; align-items:baseline; white-space:nowrap; font-variant-numeric:tabular-nums; }
  #dashboard .overview-number-field { display:inline-block; min-width:10ch; text-align:right; font-family:Consolas,monospace; }
  #dashboard .overview-unit { white-space:pre; }
  @media(max-width:1100px) { #overviewPlant.overview-blocks { grid-template-columns:repeat(min(var(--overview-columns,3),3),minmax(210px,1fr)); } }
  @media(max-width:750px) { #overviewPlant.overview-blocks { grid-template-columns:repeat(min(var(--overview-columns,3),2),minmax(210px,1fr)); } }
  @media(max-width:500px) { #overviewPlant.overview-blocks { grid-template-columns:minmax(0,1fr); } }
}

/* Shared content roles take precedence over historical page-specific sizing.
   KPI totals and compact configuration editors keep their own visual hierarchy. */
@media screen {
  main > header h1 { font-size:24px; }
  main .page:is(#dashboard,.page) h2 {
    font-size:var(--ui-heading-size);
    font-weight:700;
    color:var(--ui-heading-color);
  }
  main .page:is(#dashboard,.page) .device-name-link,
  main #dashboard .overview-tile-name {
    font-size:var(--ui-text-size);
    font-weight:var(--ui-emphasis-weight);
    line-height:1.4;
  }
  main .page:is(#dashboard,.page) .table-wrap :is(th,td),
  main #live :is(.live-summary-table,.live-detail-table) :is(th,td) {
    font-size:var(--ui-text-size);
  }
  main .page:is(#dashboard,.page) th {
    color:var(--ui-label-color);
    background:var(--ui-table-heading-background);
    font-weight:var(--ui-emphasis-weight);
  }
  main #dashboard .overview-inverters :is(th,td) { padding:7px 8px; }
  main #dashboard .overview-inverters th:first-child { width:36%; }
  main #dashboard .overview-inverters th:nth-child(2) { width:27%; }
  main #dashboard .overview-inverters td:last-child,
  main #dashboard .overview-plant-reading,
  main #dashboard .overview-tile-parameter b,
  main #dashboard .overview-weather-values > strong,
  main #dashboard .overview-weather-row strong,
  main #live .live-device-row > td:nth-child(n+4) {
    font-size:var(--ui-text-size);
    font-weight:var(--ui-emphasis-weight);
    font-variant-numeric:tabular-nums;
    line-height:1.4;
  }
  main #dashboard .overview-number-field { font-family:inherit; }
  main #dashboard .inverter-status-pill {
    font-size:var(--ui-text-size);
    font-weight:var(--ui-emphasis-weight);
    line-height:1.4;
  }
}

/* Let the inverter list use its grid card's full height before scrolling. */
@media screen {
  #dashboard .overview-inverters {
    display:flex;
    flex-direction:column;
    min-height:300px;
  }
  #dashboard .overview-inverters > .toolbar { flex-shrink:0; }
  #dashboard .overview-inverters .table-wrap {
    flex:1 1 0;
    height:0;
    min-height:0;
    max-height:none;
    overflow:auto;
  }
  @media(max-width:750px) {
    #dashboard .overview-inverters { min-height:0; max-height:480px; }
    #dashboard .overview-inverters .table-wrap { flex-basis:auto; height:auto; }
  }
  html[data-content-theme=dark] main #dashboard :is(.overview-block,.overview-metric) {
    background:#1b2a3f;
    color:#e2e8f0;
    border-color:#364b68;
  }
  html[data-content-theme=dark] main #dashboard .overview-metric :is(.metric-caption,strong) { color:#e2e8f0; }
  html[data-content-theme=dark] main #dashboard .overview-metric div>span:not(.metric-icon):not(.metric-label) { color:#a9bbd3; }
  html[data-content-theme=dark] main #dashboard .overview-plant-level .overview-device-tile {
    background:#152238;
    color:#e2e8f0;
    border-color:#364b68;
  }
  html[data-content-theme=dark] main #dashboard :is(.overview-block-counts,.overview-plant-level h4) { color:#a9bbd3; }
  html[data-content-theme=dark] main #dashboard .overview-plant-level { border-color:#364b68; }
  html[data-content-theme=dark] main #dashboard .overview-settings { background:#1b2a3f;border-color:#364b68;border-top-color:#a78bfa; }
  html[data-content-theme=dark] main #dashboard .overview-settings label { background:#152238;border-color:#526783;color:#dbeafe; }
}

/* Match the diagram editor and monitor to the selected content theme. */
@media screen {
  html[data-content-theme=dark] main #sld { background:#111c2c;color:#e2e8f0;color-scheme:dark; }
  html[data-content-theme=dark] main #sld :is(.sld-heading,.sld-side,.toolbar,.sld-parts-toolbar,.sld-part-settings,footer) { background:#1b2a3f;border-color:#364b68; }
  html[data-content-theme=dark] main #sld :is(button,input:not([type=checkbox]),select) { background:#152238;color:#e2e8f0;border-color:#526783; }
  html[data-content-theme=dark] main #sld button:hover { background:#293e58;border-color:#5eead4; }
  html[data-content-theme=dark] main #sld :is(.primary,.sld-parts button.active) { background:#137e72;color:#fff;border-color:#2dd4bf; }
  html[data-content-theme=dark] main #sld :is(.primary,.sld-parts button.active):hover { background:#106b61; }
  html[data-content-theme=dark] main #sld :is(.subtitle,.hint,.device small,.field>span,.empty,#sld-part-description) { color:#a9bbd3; }
  html[data-content-theme=dark] main #sld :is(.equipment,.device,.sld-extra-properties) { border-color:#364b68; }
  html[data-content-theme=dark] main #sld :is(.device.assigned,.pill) { background:#183e40; }
  html[data-content-theme=dark] main #sld :is(a,.pill) { color:#5eead4; }
  html[data-content-theme=dark] main #sld .danger { color:#fda4af; }
  html[data-content-theme=dark] main #sld #sld-issues { color:#fcd34d; }
  html[data-content-theme=dark] main #sld .canvas-scroll { background:#111c2c; }
  html[data-content-theme=dark] main #sld .layer-bg { stroke:#364b68; }
  html[data-content-theme=dark] main #sld .layer-bg.active { fill:#183e40; }
  html[data-content-theme=dark] main #sld .node { color:#e2e8f0; }
  html[data-content-theme=dark] main #sld .node .selection { fill:#1b2a3f; }
  html[data-content-theme=dark] main #sld .node.selected .selection { fill:#183e40;stroke:#5eead4; }
  html[data-content-theme=dark] main #sld .node-label { fill:#dbeafe; }
  html[data-content-theme=dark] main #sld :is(.layer-label,.node-value,.node-timestamp) { fill:#a9bbd3; }
  html[data-content-theme=dark] main #sld .terminal { fill:#152238;stroke:#5eead4; }
  html[data-content-theme=dark] main #sld .terminal.pending { fill:#f3ad36; }
  html[data-content-theme=dark] main #sld .edge { stroke:#c3d4ec; }
  html[data-content-theme=dark] main #sld .edge.control { stroke:#c4b5fd; }
  html[data-content-theme=dark] main #sld .edge.metering { stroke:#7dd3fc; }
  html[data-content-theme=dark] main #sld .edge.selected { stroke:#fbbf24; }
  html[data-content-theme=dark] main #sld :is(.layer-boundary:hover,.layer-boundary:focus,.layer-boundary.resizing) .boundary-line { stroke:#5eead4; }
  html[data-content-theme=dark] main #sld.sld-monitor .sld-parts-toolbar { background:transparent; }
}

/* Overview: a compact KPI strip followed by a selectable card canvas. */
@media screen {
  #dashboard .overview-metrics { grid-template-columns:repeat(var(--kpi-columns,10),minmax(0,1fr)); }
  #dashboard .overview-metric { padding:10px 8px; }
  #dashboard .overview-metric .metric-caption { gap:5px; }
  #dashboard .overview-metric strong { font-size:clamp(18px,1.45vw,26px); }
  #dashboard .overview-canvas-group { margin-top:16px; }
  #dashboard #overviewCanvas { grid-template-columns:repeat(var(--canvas-columns,2),minmax(0,1fr)); align-items:start; gap:12px; margin-top:0; }
  #dashboard #overviewCanvas>.card { grid-column:auto; grid-row:auto; align-self:start; min-width:0; }
  #dashboard #overviewCanvas>.card[data-canvas-width=full] { grid-column:1 / -1; }
  #dashboard:has(#overviewCardSettings:not([hidden])) #overviewCanvas { padding:12px; border:1px dashed #91a5bb; border-radius:10px; background-image:radial-gradient(#91a5bb55 1px,transparent 1px); background-size:12px 12px; }
  #dashboard #overviewCanvasEmpty { text-align:center; padding:32px; border:1px dashed #91a5bb; border-radius:10px; }
  #overviewCardChoices.overview-choice-groups { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:24px; }
  .overview-choice-groups>section { min-width:0; }
  .overview-choice-groups h3 { font-size:14px; margin:0 0 8px; }
  #overviewKpiCount { font-weight:400; font-size:12px; }
  #overviewKpiChoices,#overviewCanvasChoices { display:flex; flex-direction:column; gap:8px; }
  .overview-card-choice { flex-wrap:wrap; }
  .overview-card-choice label { flex-basis:100px; }
  .overview-card-choice select { max-width:100%; padding:7px; font-size:12px; }
  #overviewCardSettings .overview-layout-choice { display:flex; justify-content:space-between; gap:12px; }
  @media(max-width:1250px) {
    #dashboard .overview-metrics { grid-template-columns:repeat(min(var(--kpi-columns,10),5),minmax(0,1fr)); }
    #dashboard #overviewCanvas { grid-template-columns:repeat(min(var(--canvas-columns,2),2),minmax(0,1fr)); }
    #overviewCardChoices.overview-choice-groups { grid-template-columns:minmax(0,1fr); gap:20px; }
  }
  @media(max-width:750px) {
    #dashboard .overview-metrics { grid-template-columns:repeat(min(var(--kpi-columns,10),2),minmax(0,1fr)); }
    #dashboard #overviewCanvas { grid-template-columns:minmax(0,1fr); }
    #dashboard:has(#overviewCardSettings:not([hidden])) #overviewCanvas { padding:6px; }
  }
}

/* The canvas editor changes only the lower group; KPI rules stay independent. */
@media screen {
  /* Design card canvas: soft cards on a quiet board; shared button sizing does not apply to areas. */
  #overviewCardSettings { --cg-accent:var(--page-accent,#2563eb); --cg-board:#f6f9fd; --cg-line:#d7e3f0; --cg-cell:#ffffff; --cg-text:#1e3a5f; --cg-muted:#64748b; --cg-empty:#94a3b8; }
  .canvas-grid-designer { margin-top:22px; padding-top:18px; border-top:1px solid var(--cg-line); }
  .canvas-grid-designer h3 { margin:0; font-size:15px; }
  .canvas-grid-actions { display:flex; flex-wrap:wrap; align-items:center; margin:12px 0; gap:10px 0; }
  .canvas-grid-group { display:flex; flex-wrap:wrap; align-items:center; gap:6px; padding:0 12px; border-left:1px solid var(--cg-line); }
  .canvas-grid-group:first-child { padding-left:0; border-left:0; }
  html body #overviewCardSettings .canvas-grid-actions button { --ui-control-height:32px; font-size:12px !important; padding:5px 11px !important; }
  html body #overviewCardSettings .canvas-grid-actions button:disabled { opacity:1; cursor:default; color:var(--cg-empty); background:transparent; border-color:transparent; box-shadow:none; }
  .canvas-grid-scroll { max-width:100%; overflow:auto; border:1px solid var(--cg-line); border-radius:12px; padding:12px; background:var(--cg-board); }
  .canvas-grid-editor { display:grid; grid-template-columns:repeat(var(--editor-columns,2),minmax(120px,1fr)); grid-template-rows:repeat(var(--editor-rows,2),minmax(76px,auto)); gap:10px; }
  html body #overviewCardSettings #canvasGridEditor button.canvas-grid-area { position:relative; min-width:0; height:auto !important; min-height:76px !important; padding:12px 14px !important; display:flex; flex-direction:column; align-items:flex-start; justify-content:center; gap:4px; text-align:left; overflow-wrap:anywhere; color:var(--cg-text); background:var(--cg-cell); border:1px solid var(--cg-line); border-left:3px solid color-mix(in srgb,var(--cg-accent) 45%,transparent); border-radius:10px; box-shadow:0 1px 2px rgba(15,23,42,.05); font-weight:400; cursor:pointer; transition:border-color .15s,box-shadow .15s,background-color .15s; }
  #overviewCardSettings .canvas-grid-area strong { font-size:13px; font-weight:700; line-height:1.3; }
  #overviewCardSettings .canvas-grid-area span { font-size:11.5px; font-weight:400; color:var(--cg-muted); }
  html body #overviewCardSettings #canvasGridEditor button.canvas-grid-area:hover { border-color:color-mix(in srgb,var(--cg-accent) 55%,var(--cg-line)); box-shadow:0 3px 10px rgba(15,23,42,.08); }
  html body #overviewCardSettings #canvasGridEditor button.canvas-grid-area:focus-visible { outline:2px solid var(--cg-accent); outline-offset:2px; }
  html body #overviewCardSettings #canvasGridEditor button.canvas-grid-area.is-empty { background:transparent; border:1px dashed var(--cg-empty); box-shadow:none; align-items:center; text-align:center; }
  html body #overviewCardSettings #canvasGridEditor button.canvas-grid-area.is-empty:hover { border-color:var(--cg-accent); background:color-mix(in srgb,var(--cg-accent) 5%,transparent); }
  #overviewCardSettings .canvas-grid-area.is-empty strong { font-weight:500; color:var(--cg-empty); }
  #overviewCardSettings .canvas-grid-area.is-empty span { color:var(--cg-empty); }
  html body #overviewCardSettings #canvasGridEditor button.canvas-grid-area[aria-pressed=true] { background:color-mix(in srgb,var(--cg-accent) 9%,var(--cg-cell)); border:1px solid var(--cg-accent); border-left:3px solid var(--cg-accent); box-shadow:0 0 0 3px color-mix(in srgb,var(--cg-accent) 18%,transparent); }
  html body #overviewCardSettings #canvasGridEditor button.canvas-grid-area[aria-pressed=true]::after { content:''; position:absolute; top:10px; right:10px; width:16px; height:16px; border-radius:50%; background:var(--cg-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center/10px no-repeat; }
  #overviewCardSettings .canvas-grid-assignment { display:flex; align-items:center; flex-wrap:wrap; justify-content:space-between; gap:12px; margin-top:12px; }
  .canvas-grid-assignment select { max-width:100%; }
  #canvasGridStatus:empty { display:none; }
  #dashboard #overviewCanvas[data-custom-grid=true] { grid-template-columns:repeat(var(--canvas-columns,2),minmax(0,1fr)); grid-template-rows:repeat(var(--canvas-rows,2),minmax(180px,auto)); }
  #dashboard #overviewCanvas[data-custom-grid=true]>.card { grid-column:var(--canvas-column,auto); grid-row:var(--canvas-row,auto); align-self:stretch; }
  html[data-content-theme=dark] main #overviewCardSettings { --cg-board:#0f1a2c; --cg-line:#2c3e58; --cg-cell:#16243a; --cg-text:#dbeafe; --cg-muted:#94a3b8; --cg-empty:#64748b; --cg-accent:#60a5fa; }
  html[data-content-theme=dark] main #overviewCardSettings #canvasGridEditor button.canvas-grid-area:not(.is-empty) { background:var(--cg-cell); color:var(--cg-text); }
  html[data-content-theme=dark] main #overviewCardSettings #canvasGridEditor button.canvas-grid-area[aria-pressed=true] { background:color-mix(in srgb,var(--cg-accent) 16%,var(--cg-cell)); }
  html[data-content-theme=dark] main #overviewCardSettings .canvas-grid-actions button:disabled { background:transparent; color:var(--cg-empty); border-color:transparent; }
  @media(max-width:750px) {
    .canvas-grid-group { padding:0; border-left:0; width:100%; }
    .canvas-grid-editor { grid-template-columns:repeat(var(--editor-columns,2),minmax(96px,1fr)); }
  }
  @media(max-width:750px) {
    #dashboard #overviewCanvas[data-custom-grid=true] { grid-template-columns:minmax(0,1fr); grid-template-rows:none; }
    #dashboard #overviewCanvas[data-custom-grid=true]>.card { grid-column:1; grid-row:auto; }
  }
}

.status-yaml-cell {min-width:260px;}
.status-yaml-cell select,.status-yaml-cell input {width:100%;max-width:280px;}
.status-yaml-info {display:block;white-space:normal;line-height:1.4;}
.status-yaml-cell input[readonly] {font-family:monospace;font-size:11px;}

/* Overview > KPI data sources (RC finding F15): the outer section and one card per KPI,
   caption above a full-width select, columns that fit the width. */
@media screen {
  html main #dashboard #overviewKpiSources { min-width:0; margin:14px 0 0; padding:12px 16px 16px; border:1px solid #cddff0; border-radius:10px; background:#fbfdff; }
  html main #dashboard #overviewKpiSources>legend { padding:0 6px; font-weight:700; font-size:14px; color:#284466; }
  html main #dashboard #overviewSourceChoices { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(300px,100%),1fr)); gap:12px; align-items:start; margin:10px 0 14px; }
  html main #dashboard #overviewSourceChoices>fieldset { min-width:0; margin:0; padding:8px 14px 14px; border:1px solid #d7e2f4; border-radius:9px; background:#ffffff; display:grid; gap:10px; }
  html main #dashboard #overviewSourceChoices>fieldset>legend { padding:0 6px; font-weight:700; color:#284466; }
  html main #dashboard #overviewSourceChoices>fieldset>label { display:flex; flex-direction:column; align-items:stretch; gap:4px; margin:0; padding:0; background:none; border:0; border-radius:0; font-size:12px; font-weight:600; }
  html main #dashboard #overviewSourceChoices>fieldset>label>select { width:100%; max-width:100%; min-width:0; margin:0; }
  html[data-content-theme=dark] main #dashboard #overviewKpiSources { background:#162436; border-color:#364b68; }
  html[data-content-theme=dark] main #dashboard #overviewKpiSources>legend,
  html[data-content-theme=dark] main #dashboard #overviewSourceChoices>fieldset>legend { color:#e2e8f0; }
  html[data-content-theme=dark] main #dashboard #overviewSourceChoices>fieldset { background:#152238; border-color:#364b68; }
  html[data-content-theme=dark] main #dashboard #overviewSourceChoices>fieldset>label { background:none; border:0; color:#dbeafe; }
  html main #dashboard #overviewKpiSources>.grid>label { min-width:0; }
}
@media screen and (max-width:640px) {
  html main #dashboard #overviewKpiSources { padding:10px 10px 12px; }
  html main #dashboard #overviewKpiSources>.grid>label { flex-wrap:wrap; gap:4px; }
  html main #dashboard #overviewKpiSources>.grid>label>:is(select,input) { width:100%; max-width:100%; min-width:0; }
}
