/* Theme overrides load last. Light theme preserves the existing product palette. */
:root{color-scheme:light}.page-heading{flex-wrap:wrap}.theme-control{display:grid;grid-template-columns:auto minmax(120px,1fr);gap:4px 8px;align-items:center;font:500 11px/1.3 Inter,Arial,sans-serif;margin:0;max-width:220px;flex-shrink:0}.theme-control select{width:100%;margin:0;min-height:40px;padding:7px 8px;font:600 12px/1.3 Inter,Arial,sans-serif;border:1px solid #c9d6e3;border-radius:7px;background:#fff;color:#18344f;cursor:pointer}.theme-status{grid-column:2;font-size:10px;color:#546b80}body>main>.language-switch{flex-wrap:wrap}body>main>.language-switch .theme-control{margin-left:12px}.theme-control select:focus-visible{outline:3px solid #e7a91c;outline-offset:2px}
@media screen{
:root[data-theme=dark]{color-scheme:dark;--ink:#e4edf7;--blue:#226fc0;--line:#344357;--muted:#aab9cc;color:#e4edf7;background:#101720;--surface:#19232f;--raised:#212e3d;--subtle:#15202c;--link:#83c5ff}
html[data-theme=dark] body{background:#101720;color:#e4edf7}
[data-theme=dark] :is(aside,.card,.table-wrap,.empty,.location-root,.bms-card,.bms-kpis article,.ems-kpi,.graf-chart,dialog,button.card.plan-map-tile){background:var(--surface);color:var(--ink);border-color:var(--line);box-shadow:none}
[data-theme=dark] :is(h1,h2,h3,h4,.device-kpis strong,.ems-kpi strong,.empty h2){color:var(--ink)}
[data-theme=dark] :is(input,select,textarea,.theme-control select){background:#111c28;color:var(--ink);border-color:#465970}
[data-theme=dark] :is(input,textarea)::placeholder{color:#9babc0;opacity:1}
[data-theme=dark] :is(a,.point-open){color:var(--link)}
[data-theme=dark] :is(.muted,small,.filters label,.nav-label,.eyebrow,.sidebar-foot,.bms-location,.bms-readings>div>small,.bms-card dt,.ems-kpi p,.ems-axis,.chart-times,.chart-help,.theme-status,.intro>p:not(.eyebrow),.card>p,.plan-map-tile p){color:var(--muted)}
[data-theme=dark] :is(.secondary,.graf-chart .chart-tools button,.language-switch a){background:var(--raised);color:var(--ink);border-color:#465970}
[data-theme=dark] :is(.secondary:hover,.graf-chart .chart-tools button:hover,button.card.plan-map-tile:hover){background:#2a3c51;color:#fff}
[data-theme=dark] nav button{color:#b9c8d9;background:transparent}
[data-theme=dark] nav button:hover{background:#243448}
[data-theme=dark] nav button.active,[data-theme=dark] .language-switch a[aria-current=true]{background:#233e5b;color:#a4d7ff;border-color:#5e99c9}
[data-theme=dark] :is(th,.location-child,.chart-wrap,.io-channel,.plan-point-current,.plan-io-state,.bms-readings>div,.bms-checklist){background:var(--subtle);color:var(--ink);border-color:var(--line)}
[data-theme=dark] :is(td,th,.bms-card details,.ems-facts>div,.energy-phase dl>div){border-color:var(--line)}
[data-theme=dark] th{color:var(--muted)}
[data-theme=dark] tr:hover td{background:#ffffff04}
[data-theme=dark] :is(.note,.monitor-unit){background:#162e43;color:#c6e4ff;border-color:#4f9ed2}
[data-theme=dark] .device-environment{background:linear-gradient(120deg,#18373c,#1b3045)}
[data-theme=dark] .badge{background:#303e4f;color:#d0dbea}
[data-theme=dark] :is(.ONLINE,.alarm-clear,.io-on,.ems-status.good){background:#163d30;color:#a4edc2;border-color:#438c69}
[data-theme=dark] .io-on b{color:#a4edc2}
[data-theme=dark] :is(.OFFLINE,.ERROR,.CRITICAL,.alarm-active){background:#4b242c;color:#ffb1ba;border-color:#c36677}
[data-theme=dark] :is(.WARNING,.alarm-unknown,.ems-status){background:#42351c;color:#ffda89;border-color:#b68a32}
[data-theme=dark] :is(.danger,#form-error,.energy-stale){color:#ffbd82}
[data-theme=dark] #message:not(:empty){background:#183d30;color:#b4f0ce}
[data-theme=dark] #message.error{background:#4b242c;color:#ffb1ba}
[data-theme=dark] dialog::backdrop{background:#03080ecc}
[data-theme=dark] :is(.brand img,.intro img){background:#eaf1f7;border-radius:8px;padding:6px}
[data-theme=dark] .graf-chart .chart-reading{background:#132031;color:#d4e5f9;border-color:var(--line)}
[data-theme=dark] .graf-chart .chart-reading em{color:#ffda89}
[data-theme=dark] :is(.chart-range-caption,.chart-statistics th,.chart-statistics small,.graf-chart .chart-help,.graf-chart .chart-scrub-label){color:var(--muted)}
[data-theme=dark] .graf-chart .reading-chart text{fill:#b0c0d4}
[data-theme=dark] .graf-chart .reading-chart .chart-unit{fill:#dceafa}
[data-theme=dark] .chart-grid{stroke:#304052}
[data-theme=dark] .chart-zero{stroke:#9aacc1}
[data-theme=dark] :is(.chart-statistics,.chart-statistics td,.chart-statistics th){border-color:#344357}
[data-theme=dark] .chart-marker{stroke:#172331}
[data-theme=dark] .graf-chart .chart-scrubber{accent-color:#7cb8ff}
/* SVG plans and camera/video imagery keep their original colours. Only their UI is themed. */
[data-theme=dark] .plan-scroll{border-color:var(--line);background:#f8fafc}
[data-theme=dark] .plan-sensor-legend>button>span{color:var(--ink)}
[data-theme=dark] .plan-point-current{color:var(--ink)}
[data-theme=dark] .plan-mini-chart{background:#192e40}
[data-theme=dark] .plan-mini-chart text{fill:#d5e7f5}
[data-theme=dark] .plan-io-state.io-on{background:#163d30;color:#a4edc2;border-color:#438c69}
[data-theme=dark] .plan-io-state.io-off{background:var(--raised);color:var(--ink);border-color:var(--line)}
[data-theme=dark] .awex-lamp.ok,[data-theme=dark] .awex-summary [data-awex-filter=ok]{background:#174331!important;border-color:#61b887!important;color:#c0f5d4!important}
[data-theme=dark] .awex-lamp.fault,[data-theme=dark] .awex-summary [data-awex-filter=fault]{background:#5b2531!important;border-color:#ed7b8f!important;color:#ffd1d8!important}
[data-theme=dark] .awex-lamp.unknown,[data-theme=dark] .awex-summary [data-awex-filter=unknown]{background:#4d3b17!important;border-color:#d8ac4a!important;color:#ffe5a6!important}
[data-theme=dark] .awex-summary [aria-pressed=true]{background:#23415e}
[data-theme=dark] .awex-lamp[aria-pressed=true]{outline-color:#89c7ff}
[data-theme=dark] .hero,[data-theme=dark] .ems-hero,[data-theme=dark] .bms-hero{border:1px solid #355371}
[data-theme=dark] footer{color:var(--muted)}
[data-theme=dark] .skip{background:var(--surface);color:var(--ink)}
}
@media(max-width:600px){.page-heading{gap:10px}.page-heading .theme-control{flex:1 0 100%;grid-template-columns:auto minmax(120px,170px);max-width:none;justify-content:end}.theme-control select{min-height:44px}body>main>.language-switch .theme-control{margin-left:4px}}
@media print{.theme-control{display:none!important}}

/* Compact header appearance control; native select supports touch and keyboard. */
.page-heading{flex-wrap:nowrap;gap:16px}.page-heading>div{flex:1;min-width:0}
.theme-control.theme-compact,.page-heading .theme-control.theme-compact{position:relative;display:inline-flex;align-items:center;justify-content:center;flex:0 0 44px;width:44px;height:44px;max-width:44px;margin:0;border:1px solid #c9d6e3;border-radius:12px;background:#fff;color:#375671;cursor:pointer}
.theme-compact>svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;pointer-events:none}
.theme-compact select{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}
.theme-compact:focus-within{outline:3px solid #e7a91c;outline-offset:3px}.theme-compact:hover{background:#eaf2f9;border-color:#7898b5}
.theme-compact .theme-label,.theme-compact .theme-status{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
aside .sidebar-foot .language-switch{display:flex;align-items:center;gap:6px;margin:0 0 18px;padding-bottom:16px;border-bottom:1px solid var(--line);overflow:visible}
aside .sidebar-foot .language-switch>a{display:inline-flex;align-items:center;justify-content:center;margin:0;min-width:44px;min-height:44px;border-radius:9px;font-size:12px}
aside .sidebar-foot .language-switch>svg{display:block;width:19px;height:19px;margin-right:6px;fill:none;stroke:currentColor;stroke-width:1.6}
@media screen{[data-theme=dark] .theme-control.theme-compact{background:#212e3d;color:#c5def4;border-color:#465970}[data-theme=dark] .theme-control.theme-compact:hover{background:#2a3c51}}
@media(max-width:1100px){.page-heading{width:100%}.page-heading .theme-compact{margin-left:auto}}
@media print{.theme-control.theme-compact{display:none!important}}

/* Direct sun/moon toggle with explicit return to automatic mode. */
.theme-actions,.page-heading>.theme-actions{display:inline-flex;align-items:center;gap:5px;flex:0 0 auto;min-width:44px}
.theme-actions .theme-control.theme-compact{padding:0;min-height:44px}
.theme-actions .theme-auto{display:inline-flex;align-items:center;justify-content:center;min-width:44px;width:auto;min-height:44px;padding:5px;border:1px solid #c9d6e3;border-radius:10px;background:#fff;color:#375671;font:600 11px/1.2 Arial,sans-serif;box-shadow:none}
.theme-actions .theme-auto[hidden]{display:none!important}
@media screen{[data-theme=dark] .theme-actions .theme-auto{background:#212e3d;color:#c5def4;border-color:#465970}}
@media(max-width:450px){.control-welcome .language-switch:has(#theme-auto:not([hidden])) .welcome-brand img{width:110px}.control-welcome main>.language-switch .theme-control{margin-left:0}}
@media print{.theme-actions{display:none!important}}

/* Shared compact density across Control, without scaling the page or map coordinates. */
:root{font-size:14px}
.workspace{padding:18px 22px 0} .workspace>header{padding-bottom:14px;gap:14px}.workspace>main{padding:16px 0}
h1,#title{font-size:24px;line-height:1.2;letter-spacing:-.5px;margin-top:4px}h2{font-size:18px;margin-bottom:10px}h3{font-size:15px}p{line-height:1.5}
body>aside{padding:18px 14px}nav#nav{gap:3px}nav#nav button{padding:9px 12px;font-size:13px;min-height:36px}.nav-label{margin:20px 10px 10px}.sidebar-foot{padding-top:16px}
.hero,.ems-hero,.device-environment{padding:16px 18px;gap:16px;margin:12px 0;border-radius:12px}.hero h2,.ems-hero h2{font-size:22px;line-height:1.25;margin:4px 0 8px}.hero p,.ems-hero p{font-size:13px;margin:4px 0}.ems-mode{padding:6px 10px}
.cards,.grid,.monitor-grid{gap:12px}.cards{margin-bottom:16px}.card,.monitor-panel{padding:14px;border-radius:10px}.metric{font-size:25px;margin:8px 0 5px}.section-head{gap:10px;margin-bottom:10px}
.workspace button:not(.plan-marker):not(.awex-lamp):not([data-pz]){padding:8px 12px;font-size:13px}
input,select{min-height:36px;padding:8px 10px;margin-top:4px}label{font-size:12px}.filters,.range{gap:8px}.range{margin-bottom:12px}
th{padding:10px 12px}td{padding:10px 12px}.table-wrap{border-radius:9px}.note{padding:10px 14px;font-size:12px;line-height:1.5}
.location-root{padding:16px;margin-bottom:14px}.location-child{padding:12px}.location-children{gap:12px;padding-left:12px}.location-navigation{margin-bottom:14px}
.device-kpis{gap:10px;margin:12px 0 16px;grid-template-columns:repeat(auto-fit,minmax(175px,1fr))}.device-kpis article{gap:7px}.device-kpis strong{font-size:23px}.current-reading{gap:14px;margin-bottom:12px}.current-reading .metric{font-size:28px}.current-reading .metric span{font-size:17px}.device-environment h2{margin-bottom:4px}
.monitor-toolbar{gap:12px;margin-bottom:12px}.chart-wrap{padding:12px;margin:12px 0}.point-list{gap:12px}.device-alarm-status{padding:12px 14px;margin:12px 0}.device-alarm-status li+li{margin-top:7px}
.io-panel{margin:14px 0}.io-channel{padding:12px;gap:8px}.io-panel>h3{margin:18px 0 10px}.io-panel>.io-grid+h3{padding-top:14px;margin-top:18px}
.ems-toolbar{margin-bottom:12px;gap:10px}.ems-kpis{gap:10px;margin:12px 0}.ems-kpi{padding:14px;border-radius:10px}.ems-kpi strong{font-size:24px;margin:8px 0}.ems-status{padding:10px 12px;margin:10px 0}.ems-columns{gap:12px}.ems-facts>div{padding:8px 0}.ems-project-fields{gap:12px;padding:12px 0}#ems-result .card{margin-bottom:12px}
.pv-flow{padding:16px;margin:12px 0}.pv-diagram{gap:10px;padding:8px 0}.pv-diagram svg{height:68px;width:90px}.pv-diagram strong{font-size:24px}.pv-inverter{padding:12px}.pv-inverter strong{font-size:17px}
dialog{padding:20px;border-radius:12px}#fields{gap:12px;padding:8px 0 16px}.empty{padding:24px}footer{padding:12px 0}
@media(max-width:1100px){.workspace{padding:16px 18px 0}}
@media(max-width:760px){.workspace{padding:12px 10px 0}.workspace>main{padding:12px 0}h1,#title{font-size:22px}.hero h2,.ems-hero h2{font-size:20px}.hero,.ems-hero,.device-environment{padding:14px}.cards,.grid{gap:10px}.device-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}input,select{font-size:16px;min-height:44px}.workspace button:not(.plan-marker):not(.awex-lamp):not([data-pz]),nav#nav button{min-height:44px}.card{padding:12px}dialog{padding:16px}.pv-diagram svg{height:56px}}
@media(pointer:coarse){.workspace button:not(.plan-marker):not(.awex-lamp):not([data-pz]),nav#nav button,input,select{min-height:44px}}
.ems-bars button{padding:0!important;min-height:0!important}

/* Locations: one aligned row per place instead of nested cards. */
.location-compact-list{border:1px solid var(--line);border-radius:10px;overflow:hidden;background:var(--surface,transparent)}
.location-list-row{display:grid;grid-template-columns:28px minmax(0,1fr) minmax(170px,220px) 145px;gap:12px;align-items:center;padding:10px 14px 10px calc(14px + var(--location-depth)*18px);border-top:1px solid var(--line);min-width:0}
.location-list-row:first-child{border-top:0}.location-list-row.is-root{background:color-mix(in srgb,var(--blue) 6%,transparent)}
.location-list-icon{display:flex;color:var(--muted)}.location-list-icon svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.location-list-name{min-width:0}.location-list-name h2{font-size:15px;line-height:1.35;margin:0;font-weight:650;letter-spacing:0;overflow-wrap:anywhere}.location-list-name>small{display:block;font-size:10px;line-height:1.4;margin-bottom:2px}.location-list-name p{font-size:12px;line-height:1.4;margin:3px 0 0;color:var(--muted);overflow-wrap:anywhere}
.location-list-count{font-size:12px;line-height:1.4}.location-list-count small{display:block;font-size:10px;margin-top:2px}.location-list-action{text-align:right}.location-list-action button{font-size:12px!important;padding:7px 10px!important;white-space:normal;min-height:34px;width:100%}
@media(max-width:1000px){.location-list-row{grid-template-columns:24px minmax(0,1fr) 135px;gap:8px}.location-list-icon{grid-row:1/3;align-self:start;margin-top:2px}.location-list-name{grid-column:2}.location-list-count{grid-column:2;grid-row:2;font-size:11px}.location-list-count small{display:inline;margin-left:5px}.location-list-action{grid-column:3;grid-row:1/3}.location-list-row{padding:9px 10px 9px calc(10px + var(--location-depth)*12px)}}
@media(max-width:550px){.location-list-row{grid-template-columns:20px minmax(0,1fr) 104px;column-gap:7px;padding-left:calc(8px + var(--location-depth)*8px)}.location-list-name h2{font-size:14px}.location-list-name p{font-size:11px}.location-list-icon svg{width:18px;height:18px}.location-list-count small{display:block;margin-left:0}.location-list-action button{min-height:44px}}
@media(pointer:coarse){.location-list-action button{min-height:44px}}

/* Module density pass: shared spacing without shrinking map hit targets. */
#dashboard-products{margin-bottom:16px}.dashboard-products{gap:10px;grid-template-columns:repeat(auto-fit,minmax(min(100%,280px),1fr))}.dashboard-map-products{margin-top:10px}.dashboard-product{min-height:82px;padding:12px;gap:10px;border-radius:10px}.dashboard-product-icon{width:34px;height:34px;flex-basis:34px;border-radius:8px}.dashboard-product-icon svg{width:21px;height:21px}.dashboard-product-body{gap:4px}.dashboard-product-body strong{font-size:14px}.dashboard-product-body small,.dashboard-product-body>span{line-height:1.35}
.section-head p{margin:4px 0;font-size:13px}.monitor-kicker{margin-bottom:6px!important}.monitor-live p{margin-top:6px}.monitor-toolbar{margin-bottom:10px}.touch-chart{margin:10px 0 12px}.touch-chart .reading-chart{height:245px;min-height:245px}.chart-tools{margin:6px 0;gap:6px}.chart-times{font-size:11px}.chart-reading strong{font-size:16px}.chart-reading{padding:8px 10px}.chart-scrub-label{margin-top:8px}.reading-age{font-size:12px}
.awex-console,.awex-hmi-section{padding:14px}.awex-main-status{font-size:20px;margin-bottom:8px}.awex-console-top{gap:10px}.awex-console-body{gap:12px}.awex-hmi-counts,.awex-summary{gap:8px;margin:12px 0}.awex-hmi .awex-count{padding:10px}.awex-hmi .awex-count strong,.awex-summary strong{font-size:22px}.awex-hmi-layout{gap:12px}.awex-hmi-heading{margin-bottom:10px}.awex-hmi-lamps{gap:8px}.awex-hmi-lamp{padding:10px 6px;min-height:96px;gap:5px}.awex-registers{gap:8px;margin-top:12px}.awex-registers>div{padding:10px}.awex-registers dd{font-size:20px;margin:5px 0}.awex-legend{gap:10px;margin:10px 0}.awex-bulk{padding:10px;margin:10px 0}.awex-next-step{margin-top:12px;padding-top:10px}
.incident-item{padding:12px;margin:10px 0}.incident-sources{gap:5px;margin:8px 0}.incident-ack{gap:8px;margin:10px 0}.incident-timeline{gap:8px}.incident-clear{padding:9px 12px}.incident-head p{margin:4px 0}.incident-head h2{font-size:17px}.incident-head h3{font-size:15px}
.report-actions{gap:5px;min-width:140px}.report-actions button{min-height:36px;padding:7px 10px}.report-actions a{padding:5px 8px}.table-wrap td p{margin:5px 0}.table-wrap td small{line-height:1.4}.grant-user-picker{padding:10px;margin:8px 0 12px}.pager{margin-top:10px}.device-technical[open] summary{margin-bottom:12px}.device-technical .actions{margin-top:12px}.details{gap:7px}#fields textarea{min-height:80px}.plan-toolbar{gap:8px;margin-bottom:10px}.plan-fields{gap:10px}
@media(max-width:600px){.dashboard-product{min-height:78px}.touch-chart .reading-chart{height:220px;min-height:220px}.awex-console,.awex-hmi-section{padding:12px}.awex-hmi-lamp{min-height:96px}.report-actions button,.report-actions a{min-height:44px}.report-actions a{display:flex;align-items:center}.incident-ack button{min-height:48px}}
@media(pointer:coarse){.report-actions button,.report-actions a{min-height:44px}}
/* Keep navigation and repeated introductory copy from dominating small screens. */
#dashboard-monitoring .monitor-hero{padding:12px 14px;gap:10px}
#dashboard-monitoring .monitor-hero h2{font-size:18px;margin:3px 0}
#dashboard-monitoring .monitor-hero>div:first-child>p:not(.monitor-kicker){display:none}
#dashboard-monitoring .monitor-kicker{font-size:10px;margin:0 0 4px!important}
#dashboard-monitoring .monitor-live{min-width:0}#dashboard-monitoring .monitor-live p{margin:4px 0 0;font-size:11px}
@media(max-width:600px){.workspace>header .filters{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:7px;width:100%}.workspace>header .filters label{min-width:0}.workspace>header .filters input,.workspace>header .filters select{width:100%;max-width:100%;min-width:0}.workspace>header .filters>button{grid-column:2;justify-self:end;min-width:100px}.workspace>header{gap:10px;padding-bottom:10px}.workspace>header input,.workspace>header select{font-size:16px}#dashboard-monitoring .monitor-hero h2{font-size:16px}#dashboard-monitoring .monitor-hero small{margin-top:0}#dashboard-monitoring .monitor-live{display:flex;align-items:center;gap:8px;margin-top:8px}#dashboard-monitoring .monitor-live p{margin:0}}
