/* SCADA Lab: demo SCADA screens on /scada (core.js, sps.js and one file per site type).
   Three screen styles on .hmi[data-theme]: dark, hp (high-performance, ISA-101 style), classic.
   .hmi[data-run="red"] swaps the running and stopped colours (a convention on many UK sites). */

/* ---------- Theme variables (screens and the app shell on /scada) ---------- */
.hmi, .app {
  --font-hmi: var(--font);
  --bg: #0c151e; --surface: #121e29; --surface-line: #223241; --text: #d9e4ee; --muted: #8ea3b5;
  --pipe: #2a3a49; --wall: #415567; --water: #1e6fa3;
  --run: #2fd37f; --stop: #4c5d6d; --off: #26333f; --line-c: #8ea3b5; --imp: #0c151e; --imp-stop: #8ea3b5;
  --fault: #ff5a5f; --fault-fill: #ff5a5f;
  --a1: #ff5a5f; --a2: #ffb020; --a3: #ffe066;
  --valve-open: #2fd37f; --valve-closed: #4c5d6d; --valve-move: #ffb020;
  --flow: #5cc6d3; --value: #8fdbe4; --box: #0f1b26; --box-line: #2a3d4e; --panel: #0f1b26; --panel-line: #223241;
  --btn: #1a2835; --btn-line: #2d4152; --btn-text: #d9e4ee; --btn-on: #5cc6d3; --btn-on-text: #061a29;
  --r: 8px; --frame-line: #1f2d3a;
  --tr-bg: #0f1b26; --tr-grid: #1d2b38; --tr-level: #5cc6d3; --tr-in: #8ea3b5; --tr-out: #2fd37f; --tr-sp: #ffb020;
  --raw: #3d7d84; --sewage: #6e5d40; --sludge: #4d3c27; --chem: #8a6fd1; --media: #9c8456; --air: #cfe8ff; --vessel: #172532;
  --land: #0f1923; --city: #132331; --river: #1d5f8c; --zone: rgba(92, 198, 211, .07); --zone-line: #22394b;
  --sewer: #a0764a; --tunnel: #c98a3c; --main: #5cc6d3; --bar: #5cc6d3; --bar-bg: #0f1b26;
}
.hmi {
  font-family: var(--font-hmi);
  background: var(--bg); color: var(--text);
  border: 1px solid var(--frame-line); border-radius: calc(var(--r) + 6px);
  padding: 10px;
  box-shadow: var(--shadow);
}
.hmi[data-run="red"], .app[data-run="red"] { --run: #ff5a5f; --stop: #1f9d5c; --valve-open: #ff5a5f; --valve-closed: #1f9d5c; --fault: #ffb020; --fault-fill: #ffb020; --tr-out: #ff5a5f; }

.hmi[data-theme="hp"], .app[data-theme="hp"] {
  --font-hmi: Arial, "Helvetica Neue", Helvetica, sans-serif;
  --bg: #d6d6d6; --surface: #e3e3e3; --surface-line: #b0b0b0; --text: #1c1c1c; --muted: #555;
  --pipe: #a2a2a2; --wall: #6e6e6e; --water: #aabdcb;
  --run: #3a3a3a; --stop: #fafafa; --off: #c4c4c4; --line-c: #3a3a3a; --imp: #fafafa; --imp-stop: #8a8a8a;
  --fault: #d9001b; --fault-fill: #fafafa;
  --a1: #d9001b; --a2: #f08c00; --a3: #e6c400;
  --valve-open: #3a3a3a; --valve-closed: #fafafa; --valve-move: #9a9a9a;
  --flow: transparent; --value: #10296b; --box: #efefef; --box-line: #9b9b9b; --panel: #dedede; --panel-line: #a8a8a8;
  --btn: #ececec; --btn-line: #8f8f8f; --btn-text: #1c1c1c; --btn-on: #4a4a4a; --btn-on-text: #fff;
  --r: 2px; --frame-line: #b8b8b8;
  --tr-bg: #e9e9e9; --tr-grid: #cdcdcd; --tr-level: #10296b; --tr-in: #8a8a8a; --tr-out: #3a3a3a; --tr-sp: #d9001b;
  --raw: #b4c3bc; --sewage: #c4b9a6; --sludge: #a99c85; --chem: #cbc1da; --media: #d3c9b2; --air: #f4f4f4; --vessel: #e6e6e6;
  --land: #dadada; --city: #cdcdcd; --river: #aabdcb; --zone: rgba(0, 0, 0, .03); --zone-line: #b9b9b9;
  --sewer: #8f7f68; --tunnel: #6f5d45; --main: #4a4a4a; --bar: #4a4a4a; --bar-bg: #f2f2f2;
}
.hmi[data-theme="classic"], .app[data-theme="classic"] {
  --font-hmi: Tahoma, Verdana, "Segoe UI", sans-serif;
  --bg: #b3b8c0; --surface: #d4d0c8; --surface-line: #808080; --text: #000; --muted: #262626;
  --pipe: #8d949c; --wall: #707070; --water: #2a6fdc;
  --run: #11b33a; --stop: #d91e1e; --off: #9a9a9a; --line-c: #1e1e1e; --imp: #fff; --imp-stop: #2a2a2a;
  --fault: #000; --fault-fill: #ffd400;
  --a1: #ff1a1a; --a2: #ffd400; --a3: #00b7ff;
  --valve-open: #11b33a; --valve-closed: #d91e1e; --valve-move: #ffd400;
  --flow: #e8f4ff; --value: #00ff66; --box: #000; --box-line: #505050; --panel: #c9ccd2; --panel-line: #6a6a6a;
  --btn: #d4d0c8; --btn-line: #808080; --btn-text: #000; --btn-on: #0a246a; --btn-on-text: #fff;
  --r: 0px; --frame-line: #6a6a6a;
  --tr-bg: #000; --tr-grid: #2a2a2a; --tr-level: #00ff66; --tr-in: #ffd400; --tr-out: #00b7ff; --tr-sp: #ff1a1a;
  --raw: #2f8f73; --sewage: #8b6a3c; --sludge: #5c4326; --chem: #b05cff; --media: #e2c27a; --air: #ffffff; --vessel: #c9ccd2;
  --land: #a9b9a2; --city: #cfc8b8; --river: #2a6fdc; --zone: rgba(255, 255, 255, .18); --zone-line: #8a8577;
  --sewer: #8b5a2b; --tunnel: #a8740a; --main: #0040c0; --bar: #00c050; --bar-bg: #000;
}
.hmi[data-theme="classic"][data-run="red"], .app[data-theme="classic"][data-run="red"] { --run: #d91e1e; --stop: #11b33a; --valve-open: #d91e1e; --valve-closed: #11b33a; --tr-out: #ff6b6b; }
.hmi[data-theme="hp"][data-run="red"], .app[data-theme="hp"][data-run="red"] { --run: #3a3a3a; --stop: #fafafa; --valve-open: #3a3a3a; --valve-closed: #fafafa; --fault: #d9001b; --tr-out: #3a3a3a; }

/* ---------- Top bar ---------- */
.hmi-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 10px 8px 14px; background: var(--surface); border: 1px solid var(--surface-line); border-radius: var(--r); font-size: 14px; }
.hmi-id b { margin-right: 6px; }
.hmi-sim { padding: 2px 8px; border: 1px solid currentColor; border-radius: 999px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.hmi-clock { margin-left: auto; color: var(--value); font-weight: 700; font-variant-numeric: tabular-nums; }
.hmi-alsum { min-height: 34px; padding: 0 12px; border: 1px solid var(--btn-line); border-radius: var(--r); background: var(--btn); color: var(--btn-text); font: 700 13.5px var(--font-hmi); cursor: pointer; }
.hmi-alsum.is-active { border-color: var(--a2); }
.hmi-alsum.is-unack { color: #000; border-color: transparent; animation: hmi-blink 1s steps(1) infinite; }
.hmi-alsum.is-unack.p1 { background: var(--a1); color: #fff; }
.hmi-alsum.is-unack.p2 { background: var(--a2); }
.hmi-alsum.is-unack.p3 { background: var(--a3); }

/* ---------- Mimic ---------- */
.hmi-screen { margin: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--r); }
.hmi svg.mimic { display: block; width: 100%; min-width: 680px; height: auto; }
.hmi-swipe { margin: 6px 2px 10px; color: var(--muted); font-size: 13px; }
.hmi svg text { font-family: var(--font-hmi); fill: var(--text); font-size: 14px; }
.hmi .t { fill: var(--muted); font-size: 13px; }
.hmi .tt { font-size: 13px; font-weight: 700; }
.hmi .tv { fill: var(--value); font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hmi .vbox { fill: var(--box); stroke: var(--box-line); stroke-width: 1; }
.hmi .panel { fill: var(--panel); stroke: var(--panel-line); stroke-width: 1; }
.hmi .pipe { fill: var(--pipe); }
.hmi .wall { fill: none; stroke: var(--wall); stroke-width: 8; }
.hmi .water { fill: var(--water); }
.hmi .marks line { stroke: var(--muted); stroke-width: 1.5; }
.hmi .marks text { fill: var(--muted); font-size: 11.5px; font-weight: 700; }
.hmi .inst circle { fill: var(--surface); stroke: var(--line-c); stroke-width: 1.5; }
.hmi .inst text { font-size: 10.5px; font-weight: 700; text-anchor: middle; }
.hmi .inst-line { fill: none; stroke: var(--line-c); stroke-width: 1.5; }
.hmi .sensor { fill: var(--line-c); }
.hmi .meter { fill: var(--surface); stroke: var(--line-c); stroke-width: 2; }
.hmi .beam { stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 3 4; }
.hmi .float line { stroke: var(--muted); stroke-width: 1.2; }
.hmi .float circle { fill: var(--surface); stroke: var(--line-c); stroke-width: 1.5; }
.hmi .float.on circle { fill: var(--a1); }

.hmi .flow { fill: none; stroke: var(--flow); stroke-width: 3; stroke-dasharray: 8 12; stroke-linecap: round; opacity: 0; }
.hmi .flow.on { opacity: .9; animation: hmi-flow .8s linear infinite; }
.hmi[data-theme="hp"] .flow { display: none; }

.hmi .pump, .hmi .valve { cursor: pointer; outline: none; }
.hmi .pump-body { fill: var(--stop); stroke: var(--line-c); stroke-width: 2.5; transition: fill .2s; }
.hmi .pump.is-run .pump-body { fill: var(--run); }
.hmi .pump.is-off .pump-body { fill: var(--off); }
.hmi .pump.is-fault .pump-body { fill: var(--fault-fill); stroke: var(--fault); stroke-width: 3.5; }
.hmi .pump:hover .pump-body, .hmi .pump:focus-visible .pump-body { stroke-width: 5; }
.hmi .shine { fill: url(#g-shine); pointer-events: none; display: none; }
.hmi .imp { fill: var(--imp-stop); transform-box: fill-box; transform-origin: center; }
.hmi .imp-hub { fill: none; stroke: none; }
.hmi .pump.is-run .imp { fill: var(--imp); animation: hmi-spin .6s linear infinite; }
.hmi[data-theme="hp"] .pump.is-run .imp { animation: none; }
.hmi .ind { display: none; }
.hmi .ind.p1, .hmi .ind.p2, .hmi .ind.p3 { display: inline; }
.hmi .ind path { stroke: #000; stroke-width: 1; fill: var(--a2); }
.hmi .ind.p1 path { fill: var(--a1); }
.hmi .ind.p3 path { fill: var(--a3); }
.hmi .ind text { fill: #000; font-size: 11px; font-weight: 800; text-anchor: middle; }
.hmi .ind.p1 text { fill: #fff; }
.hmi .ind.blink { animation: hmi-blink 1s steps(1) infinite; }

.hmi .valve-body { fill: var(--valve-closed); stroke: var(--line-c); stroke-width: 2; }
.hmi .valve.is-open .valve-body { fill: var(--valve-open); }
.hmi .valve.is-moving .valve-body { fill: var(--valve-move); animation: hmi-blink .8s steps(1) infinite; }
.hmi .valve:hover .valve-body, .hmi .valve:focus-visible .valve-body { stroke-width: 4; }
.hmi .stem { stroke: var(--line-c); stroke-width: 2; }
.hmi .act { fill: var(--surface); stroke: var(--line-c); stroke-width: 1.5; }
.hmi .act-t { font-size: 11px; font-weight: 700; text-anchor: middle; }
.hmi .nrv-body { fill: var(--valve-closed); stroke: var(--line-c); stroke-width: 1.5; }
.hmi .nrv.is-open .nrv-body { fill: var(--valve-open); }

.hmi .pbox .pb-state { font-size: 11px; }
.hmi .pbox.is-fault .pb-state { fill: var(--a1); }
.hmi .pb-m { font-size: 11.5px; }
.hmi .edm.on .panel { stroke: var(--a1); stroke-width: 3; }
.hmi .edm.on .edm-state { fill: var(--a1); animation: hmi-blink 1s steps(1) infinite; }

/* Classic: 3D pipes, water and pumps */
.hmi[data-theme="classic"] .pipe.h { fill: url(#g-pipe-h); }
.hmi[data-theme="classic"] .pipe.v { fill: url(#g-pipe-v); }
.hmi[data-theme="classic"] .water { fill: url(#g-water); }
.hmi[data-theme="classic"] .shine { display: inline; }
.hmi[data-theme="classic"] .wall { stroke: #5d5d5d; stroke-width: 10; }
.hmi[data-theme="classic"] .flow { stroke-width: 2.5; }
.hmi[data-theme="classic"] .t { fill: #1a1a1a; }
.hmi[data-theme="classic"] .tt { fill: #000; }
.hmi[data-theme="classic"] .pbox .tt, .hmi[data-theme="classic"] .pbox .t { fill: #e0e0e0; }
.hmi[data-theme="classic"] .marks text { fill: #fff; }
.hmi[data-theme="classic"] .marks line { stroke: #fff; }
.hmi[data-theme="classic"] .tv { fill: #0a246a; }
.hmi[data-theme="classic"] .vbox + .tv, .hmi[data-theme="classic"] .pbox .tv { fill: #00ff66; }
.hmi[data-theme="classic"] .pbox.is-fault .pb-state { fill: #ffd400; }
.hmi[data-theme="classic"] .hmi-clock { padding: 2px 8px; background: #000; color: #00ff66; }

/* Dark: glow on running equipment and water */
.hmi[data-theme="dark"] .water { fill: url(#g-water-dark); }
.hmi[data-theme="dark"] .pump.is-run .pump-body { filter: drop-shadow(0 0 6px var(--run)); }

/* ---------- Cards: alarms, faceplates, simulation, trend ---------- */
.hmi-card { background: var(--surface); border: 1px solid var(--surface-line); border-radius: var(--r); padding: 12px; font-size: 14px; }
.hmi-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 10px; }
.hmi-card-head b { font-size: 14.5px; }
.hmi-card-head .hmi-btn { margin-left: auto; }
.hmi-muted { color: var(--muted); font-size: 13px; }
.hmi-grid { display: grid; gap: 10px; margin: 10px 0; }

.hmi-btn { min-height: 38px; padding: 0 12px; border: 1px solid var(--btn-line); border-radius: var(--r); background: var(--btn); color: var(--btn-text); font: 650 13.5px var(--font-hmi); cursor: pointer; }
.hmi-btn:hover:not(:disabled) { border-color: var(--btn-on); }
.hmi-btn[aria-pressed="true"] { background: var(--btn-on); border-color: var(--btn-on); color: var(--btn-on-text); }
.hmi-btn:disabled { opacity: .45; cursor: not-allowed; }
.hmi-btn-wide { flex: 1; }
.hmi[data-theme="classic"] .hmi-btn { border: 2px outset #f4f4f4; }
.hmi[data-theme="classic"] .hmi-btn[aria-pressed="true"] { border-style: inset; border-color: #6c7bab; }
.hmi[data-theme="classic"] .hmi-card { border: 2px outset #f0f0f0; }

.hmi-al-list { list-style: none; margin: 0; padding: 0; }
.hmi-al-empty { padding: 8px 2px; color: var(--muted); }
.hmi-al button { display: grid; grid-template-columns: 64px 22px 58px 1fr; gap: 2px 10px; align-items: center; width: 100%; padding: 7px 8px; border: 0; border-top: 1px solid var(--surface-line); background: transparent; color: var(--text); font: 13.5px/1.35 var(--font-hmi); text-align: left; cursor: pointer; }
.hmi-al:first-child button { border-top: 0; }
.hmi-al button:hover { background: rgba(127, 127, 127, .14); }
.hmi-al .al-t { font-variant-numeric: tabular-nums; color: var(--muted); }
.hmi-al .al-p { position: relative; z-index: 0; display: grid; place-items: center; width: 22px; height: 22px; color: #000; font-weight: 800; font-size: 11px; }
.hmi-al .al-p::before { content: ""; position: absolute; inset: 4px; z-index: -1; border: 1px solid #000; background: var(--a2); transform: rotate(45deg); }
.hmi-al.p1 .al-p { color: #fff; }
.hmi-al.p1 .al-p::before { background: var(--a1); }
.hmi-al.p3 .al-p::before { background: var(--a3); }
.hmi-al .al-tag { font-weight: 700; }
.hmi-al .al-s { grid-column: 4; color: var(--muted); font-size: 12px; }
.hmi-al.is-active.is-unack .al-text { font-weight: 700; }
.hmi-al.is-active.is-unack .al-p { animation: hmi-blink 1s steps(1) infinite; }
.hmi-al.is-returned .al-text, .hmi-al.is-returned .al-tag { color: var(--muted); }

.hmi-fp.flash { animation: hmi-flash 1.2s ease-out; }
.fp-state { margin-left: auto; padding: 2px 10px; border-radius: 999px; background: var(--stop); color: #fff; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.hmi[data-theme="hp"] .fp-state { background: #fafafa; color: #1c1c1c; border: 1px solid #3a3a3a; }
.hmi-fp.is-run .fp-state { background: var(--run); color: #fff; }
.hmi[data-theme="dark"]:not([data-run="red"]) .hmi-fp.is-run .fp-state { color: #052e1a; }
.hmi-fp.is-fault .fp-state { background: var(--a1); color: #fff; animation: none; }
.fp-vals { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0 0 10px; }
.fp-vals dt { color: var(--muted); font-size: 13px; }
.fp-vals dd { margin: 0; text-align: right; color: var(--value); font-weight: 700; font-variant-numeric: tabular-nums; }
.hmi[data-theme="classic"] .fp-vals dd { color: #000; }
.fp-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.fp-row .hmi-btn { flex: 1 1 auto; }
.fp-sim { padding-top: 8px; border-top: 1px dashed var(--surface-line); margin-top: 10px; }
.fp-sim .hmi-muted { margin-right: 4px; }
.fp-msg { min-height: 1.2em; margin: 6px 0 0; color: var(--a1); font-size: 12.5px; font-weight: 700; }
.hmi[data-theme="classic"] .fp-msg { color: #a00000; }

.hmi-range { display: flex; justify-content: space-between; align-items: baseline; font-weight: 650; }
.hmi-range output { color: var(--value); font-variant-numeric: tabular-nums; }
.hmi[data-theme="classic"] .hmi-range output { color: #000; }
.hmi-station input[type="range"], .hmi input[type="range"][data-range] { width: 100%; margin: 8px 0 4px; accent-color: var(--btn-on); }

.hmi-trend .tr { display: block; width: 100%; height: 150px; background: var(--tr-bg); border: 1px solid var(--surface-line); }
.hmi-trend .tr-grid { fill: none; stroke: var(--tr-grid); stroke-width: 1; vector-effect: non-scaling-stroke; }
.hmi-trend .tr-sp { stroke: var(--tr-sp); stroke-width: 1; stroke-dasharray: 6 6; vector-effect: non-scaling-stroke; opacity: .8; }
.hmi-trend polyline { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.hmi-trend .tr-level { stroke: var(--tr-level); stroke-width: 2.5; }
.hmi-trend .tr-in { stroke: var(--tr-in); }
.hmi-trend .tr-out { stroke: var(--tr-out); }
.tr-key { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; }
.tr-key i { width: 16px; height: 3px; border-radius: 2px; }
.tr-key .k-level { background: var(--tr-level); }
.tr-key .k-in { background: var(--tr-in); }
.tr-key .k-out { background: var(--tr-out); }
.tr-foot { margin: 6px 0 0; }

/* ---------- Shared parts for every plant (core.js) ---------- */
.hmi .is-hidden { display: none; }
.hmi .pipe-p { fill: none; stroke: var(--pipe); stroke-linejoin: round; stroke-linecap: round; }
.hmi .pipe-p:not([stroke-width]) { stroke-width: 14; }
.hmi .vessel { fill: var(--vessel); stroke: var(--line-c); stroke-width: 2; }
.hmi .raw { fill: var(--raw); }
.hmi .sewage { fill: var(--sewage); }
.hmi .sludge { fill: var(--sludge); }
.hmi .chem { fill: var(--chem); }
.hmi .media { fill: var(--media); }
.hmi .air:not(.flow) { fill: var(--air); opacity: .7; }
.hmi .bar-bg { fill: var(--bar-bg); stroke: var(--box-line); stroke-width: 1; }
.hmi .bar { fill: var(--bar); }
.hmi .bar.warn { fill: var(--a2); }
.hmi .bar.alarm { fill: var(--a1); }
.hmi .t.small, .hmi .tv.small { font-size: 12px; }
.hmi .on-text { fill: var(--run); }
.hmi .flow.slow.on { animation-duration: 1.8s; }
.hmi .flow.sew { stroke: var(--sewer); }
.hmi .flow.air { stroke: var(--air); stroke-dasharray: 2 8; }
.hmi [data-act] { cursor: pointer; outline: none; }
.hmi svg [data-act]:hover > :first-child, .hmi svg [data-act]:focus-visible > :first-child { stroke-width: 4; }
.hmi[data-theme="classic"] .raw { fill: url(#g-raw); }
.hmi[data-theme="classic"] .pipe-p { stroke: #9aa2ab; }
.hmi[data-theme="dark"] .raw { fill-opacity: .9; }

.hmi-style { display: inline-flex; gap: 6px; }
.hmi-style select { min-height: 32px; max-width: 160px; padding: 0 6px; border: 1px solid var(--btn-line); border-radius: var(--r); background: var(--btn); color: var(--btn-text); font: 600 12.5px var(--font-hmi); cursor: pointer; }
.hmi-kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-top: 10px; }
.hmi-kpi { padding: 8px 10px; background: var(--surface); border: 1px solid var(--surface-line); border-radius: var(--r); }
.hmi-kpi span { display: block; color: var(--muted); font-size: 12px; line-height: 1.3; }
.hmi-kpi b { display: block; color: var(--value); font-size: 17px; font-variant-numeric: tabular-nums; }
.hmi[data-theme="classic"] .hmi-kpi b { color: #0a246a; }
.hmi-grid-2 { grid-template-columns: 1fr; }

.hmi .weir { fill: var(--wall); }
.hmi .screen rect { fill: var(--surface); stroke: var(--line-c); stroke-width: 1.5; }
.hmi .screen path { stroke: var(--line-c); stroke-width: 1; }
.hmi .screen.is-blind rect { fill: var(--a2); }
.hmi .marks-l { fill: none; stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; }
.hmi[data-theme] svg text.alarm-text { fill: var(--a1); }

/* City overview map */
.hmi .land { fill: var(--land); }
.hmi .cityarea { fill: var(--city); }
.hmi .river { fill: var(--river); }
.hmi .river-l { fill: none; stroke: var(--river); stroke-linecap: round; }
.hmi .zone { fill: var(--zone); stroke: var(--zone-line); stroke-width: 1; }
.hmi .zone.warn { fill: rgba(255, 176, 32, .35); }
.hmi .zone.alarm { fill: rgba(255, 90, 95, .5); animation: hmi-blink 1s steps(1) infinite; }
.hmi .ring { fill: none; stroke: var(--main); stroke-width: 5; stroke-dasharray: 14 8; opacity: .85; }
.hmi .trunk { fill: none; stroke: var(--main); stroke-width: 3; opacity: .7; }
.hmi .sewer { fill: none; stroke: var(--sewer); stroke-width: 3; }
.hmi .tunnel { fill: none; stroke: var(--tunnel); stroke-width: 7; stroke-dasharray: 18 6; }
.hmi .tunnel-fill { fill: none; stroke: var(--sewage); stroke-width: 4; }
.hmi .site { cursor: pointer; }
.hmi .mk { stroke: var(--bg); stroke-width: 2; }
.hmi .site.is-warn .res { stroke: var(--a2); stroke-width: 3; }
.hmi .mk-w { fill: var(--main); }
.hmi .mk-s { fill: var(--sewer); }
.hmi .mk-n { fill: var(--muted); }
.hmi .mk-st { fill: var(--tunnel); }
.hmi .site .ring-al { fill: none; stroke: var(--a1); stroke-width: 3; opacity: 0; }
.hmi .site.is-alarm .ring-al { opacity: 1; animation: hmi-blink 1s steps(1) infinite; }
.hmi .site.is-warn .ring-al { opacity: 1; stroke: var(--a2); }
.hmi .site:hover .mk, .hmi .site:focus-visible .mk { stroke: var(--text); stroke-width: 3; }
.hmi .site text { pointer-events: none; }
.hmi .lbl { font-size: 12.5px; font-weight: 700; fill: var(--text); paint-order: stroke; stroke: var(--bg); stroke-width: 3px; stroke-linejoin: round; }
.hmi .lbl-v { font-size: 12px; font-weight: 700; fill: var(--value); paint-order: stroke; stroke: var(--bg); stroke-width: 3px; stroke-linejoin: round; font-variant-numeric: tabular-nums; }
.hmi .lbl-area { font-size: 13px; font-weight: 700; fill: var(--muted); letter-spacing: .12em; text-transform: uppercase; }
.hmi[data-theme="classic"] .lbl, .hmi[data-theme="classic"] .lbl-v { stroke: #e8e4da; fill: #000; }
.hmi[data-theme="classic"] .lbl-v { fill: #0a246a; }
.hmi .layer { transition: opacity .2s; }
.hmi .layer.is-off { display: none; }
.hmi .mk-t { font-size: 12px; font-weight: 800; fill: var(--bg); pointer-events: none; }
.hmi[data-theme="hp"] .mk-t, .hmi[data-theme="classic"] .mk-t { fill: #fff; }
.hmi .en-i { fill: var(--a2); }
.hmi .trunk.rawm { stroke: var(--raw); }
.hmi .sewer.thin { stroke-width: 1.5; opacity: .7; }
.hmi .dma { cursor: pointer; }
.hmi .dma:hover .zone { stroke: var(--text); stroke-width: 2; }
.hmi .rain line { stroke: var(--air); stroke-width: 1.5; opacity: .5; }
.hmi .rain { display: none; }
.hmi .rain.on { display: inline; }
.hmi .rain.on line { animation: hmi-rain .6s linear infinite; }

@keyframes hmi-rain { from { transform: translate(0, -10px); } to { transform: translate(-6px, 14px); } }
@keyframes hmi-spin { to { transform: rotate(360deg); } }
@keyframes hmi-flow { to { stroke-dashoffset: -20; } }
@keyframes hmi-blink { 50% { opacity: .25; } }
@keyframes hmi-flash { 0% { box-shadow: 0 0 0 3px var(--btn-on); } 100% { box-shadow: 0 0 0 3px transparent; } }

@media (max-width: 599px) {
  .hmi-tools .seg-label { display: none; }
  .hmi-tools .seg button { padding: 0 11px; }
}
@media (min-width: 700px) {
  .hmi { padding: 12px; }
  .hmi-kpis { grid-template-columns: repeat(4, 1fr); }
  .hmi-grid-2 { grid-template-columns: 1.3fr 1fr; }
  .hmi-grid { grid-template-columns: repeat(2, 1fr); }
  .hmi-swipe { display: none; }
}
@media (min-width: 1060px) {
  .hmi-grid { grid-template-columns: repeat(4, 1fr); }
  .hmi-grid.hmi-grid-2 { grid-template-columns: 1.3fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .hmi *, .hmi { animation: none !important; }
}

/* telemetry */
.hmi[data-plant="telemetry"] .srv-l { fill: none; stroke: var(--line-c); stroke-width: 2; stroke-linecap: round; }
.hmi[data-plant="telemetry"] .srv.duty .vessel { stroke: var(--run); stroke-width: 3; }
.hmi[data-plant="telemetry"] .srv.failed .vessel { fill: var(--a1); }
.hmi[data-plant="telemetry"] .link { fill: none; stroke: var(--main); stroke-width: 3; opacity: .8; }
.hmi[data-plant="telemetry"] .link.thin { stroke-width: 1.5; opacity: .6; }
.hmi[data-plant="telemetry"] .link.failed { stroke: var(--a1); stroke-dasharray: 6 6; opacity: 1; }
.hmi[data-plant="telemetry"] .cloud { fill: var(--surface); stroke: var(--line-c); stroke-width: 2; }
.hmi[data-plant="telemetry"] .cloud.failed, .hmi[data-plant="telemetry"] .mast.failed { stroke: var(--a1); }
.hmi[data-plant="telemetry"] .mast { fill: none; stroke: var(--line-c); stroke-width: 2.5; stroke-linejoin: round; }
.hmi[data-plant="telemetry"] .mast-top { fill: var(--run); }
.hmi[data-plant="telemetry"] .mast-top.failed { fill: var(--a1); }
.hmi[data-plant="telemetry"] .st-dot { fill: var(--off); stroke: var(--line-c); stroke-width: 1; }
.hmi[data-plant="telemetry"] .st-dot.ok { fill: var(--run); }
.hmi[data-plant="telemetry"] .st-dot.late { fill: var(--a2); }
.hmi[data-plant="telemetry"] .st-dot.failed { fill: var(--a1); }
.hmi[data-plant="telemetry"] .sig { fill: var(--surface-line); }
.hmi[data-plant="telemetry"] .sig.on { fill: var(--value); }
.hmi[data-theme="classic"][data-plant="telemetry"] .sig.on { fill: #0a246a; }

/* city */
.hmi[data-plant="city"] svg.mimic { min-width: 900px; }

/* stw: sewage treatment works (stw.js) */
.hmi[data-plant="stw"] .bars { fill: none; stroke: var(--line-c); stroke-width: 2; }
.hmi[data-plant="stw"] .grit { fill: var(--media); }
.hmi[data-plant="stw"] .lane { fill: none; stroke: var(--wall); stroke-width: 3; }
.hmi[data-plant="stw"] .p-thin, .hmi[data-plant="stw"] .p-gas { fill: none; stroke: var(--pipe); stroke-width: 9; stroke-linejoin: round; }
.hmi[data-plant="stw"] .p-gas { stroke-width: 6; }
.hmi[data-plant="stw"] .p-sl { fill: none; stroke: var(--sludge); stroke-width: 7; stroke-linejoin: round; }
.hmi[data-plant="stw"] .air-pipe { fill: none; stroke: var(--pipe); stroke-width: 6; stroke-linejoin: round; }
.hmi[data-plant="stw"] .gasf { fill: var(--muted); opacity: .45; }
.hmi[data-plant="stw"] .flame { fill: var(--a2); stroke: var(--a1); stroke-width: 1.5; display: none; }
.hmi[data-plant="stw"] .flame.on { display: inline; animation: hmi-blink .4s steps(1) infinite; }
.hmi[data-theme="hp"][data-plant="stw"] .flame.on { animation: none; }
.hmi[data-plant="stw"] .flow.flow-air { stroke: var(--air); stroke-dasharray: 2 8; }

/* network: district meter area (network.js) */
.hmi[data-plant="network"] .main { fill: none; stroke: var(--pipe); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.hmi[data-plant="network"] .blk { fill: var(--city); stroke: var(--zone-line); stroke-width: 1; }
.hmi[data-plant="network"] .lg { fill: var(--surface); stroke: var(--line-c); stroke-width: 2; }
.hmi[data-plant="network"] .lg.low { fill: var(--a1); }
.hmi[data-plant="network"] .lg.high { fill: var(--a2); }
.hmi[data-plant="network"] .lg.flat { fill: var(--off); stroke-dasharray: 3 3; }
.hmi[data-plant="network"] .burst path { fill: var(--a1); stroke: var(--bg); stroke-width: 1.5; }
.hmi[data-plant="network"] .burst circle { fill: none; stroke: var(--a1); stroke-width: 2; animation: hmi-blink 1s steps(1) infinite; }

/* wtw: rapid gravity filters in backwash or queued, air bubbles */
.hmi[data-plant="wtw"] .filt.is-bw .vessel { stroke: var(--value); stroke-width: 3; }
.hmi[data-plant="wtw"] .filt.is-q .vessel { stroke: var(--a2); stroke-dasharray: 6 4; }
.hmi[data-plant="wtw"] .bub circle { animation: wtw-rise 1.2s linear infinite; }
.hmi[data-plant="wtw"] .bub circle:nth-child(2n) { animation-delay: -.6s; }
.hmi[data-plant="wtw"][data-theme="hp"] .bub circle { animation: none; }
@keyframes wtw-rise { from { transform: translateY(8px); opacity: .2; } to { transform: translateY(-12px); opacity: .9; } }

/* intake: red alarm text also in the classic style */
.hmi[data-plant="intake"][data-theme="classic"] svg text.alarm-text { fill: var(--a1); }
.hmi[data-plant="wtw"][data-theme="classic"] svg text.alarm-text { fill: var(--a1); }

/* energy: energy metering at the sewage works (energy.js) */
.hmi[data-plant="energy"] .cable { fill: none; stroke: var(--line-c); stroke-width: 3; }
.hmi[data-plant="energy"] .bus { fill: var(--line-c); }
.hmi[data-plant="energy"] .cb { fill: var(--surface); stroke: var(--line-c); stroke-width: 2; }
.hmi[data-plant="energy"] .cb.is-on { fill: var(--run); }
.hmi[data-plant="energy"] .tx { fill: none; stroke: var(--line-c); stroke-width: 2; }
.hmi[data-plant="energy"] .gen circle { fill: var(--stop); stroke: var(--line-c); stroke-width: 2.5; }
.hmi[data-plant="energy"] .gen text { fill: var(--text); font-size: 16px; font-weight: 800; text-anchor: middle; }
.hmi[data-plant="energy"] .gen.is-run circle { fill: var(--run); }
.hmi[data-plant="energy"] .gen.is-run text { fill: #fff; }
.hmi[data-theme="dark"]:not([data-run="red"])[data-plant="energy"] .gen.is-run text { fill: #052e1a; }
.hmi[data-plant="energy"] .gen.is-fault circle { fill: var(--fault-fill); stroke: var(--fault); stroke-width: 3.5; }
.hmi[data-plant="energy"] .gen.is-start circle { fill: var(--valve-move); animation: hmi-blink .8s steps(1) infinite; }
.hmi[data-plant="energy"] .pv { fill: var(--surface); stroke: var(--line-c); stroke-width: 1.5; }
.hmi[data-plant="energy"] .pv-g { fill: none; stroke: var(--line-c); stroke-width: 1; }
.hmi[data-plant="energy"] .flow { stroke-width: 2.5; }
.hmi[data-plant="energy"] .flow.rev.on { animation-direction: reverse; }
.hmi[data-plant="energy"] .band-g { fill: var(--value); opacity: .3; }
.hmi[data-plant="energy"] .band-a { fill: var(--a2); opacity: .4; }
.hmi[data-plant="energy"] .band-r { fill: var(--a1); opacity: .55; }
.hmi[data-plant="energy"] .band-t { fill: var(--text); font-size: 12px; font-weight: 700; text-anchor: middle; }
.hmi[data-plant="energy"] .now { stroke: var(--text); stroke-width: 3; }

/* tools: alarms, historian, reports (tools.js) */
.tool { display: grid; gap: 10px; font-family: var(--font-hmi); color: var(--text); font-size: 14px; }
.tool .hmi-card { min-width: 0; }
.tool .hmi-card-head { gap: 8px 12px; }
.tool .t-filters, .tool .t-actions, .tool .t-seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.tool .t-actions { margin-left: auto; }
.tool select { min-height: 34px; max-width: 100%; padding: 0 8px; border: 1px solid var(--btn-line); border-radius: var(--r); background: var(--btn); color: var(--btn-text); font: 600 13px var(--font-hmi); }
.tool .hmi-btn.t-small { min-height: 34px; padding: 0 10px; font-size: 13px; }
.tool .t-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.tool .t-tile { padding: 10px 12px; background: var(--surface); border: 1px solid var(--surface-line); border-radius: var(--r); }
.tool .t-tile span { display: block; color: var(--muted); font-size: 12px; }
.tool .t-tile b { display: block; color: var(--value); font-size: 20px; font-variant-numeric: tabular-nums; }
.tool .t-tile.is-warn { border-color: var(--a2); }
.tool .t-tile.is-alarm { border-color: var(--a1); }
.tool .t-tile.is-alarm b { color: var(--a1); }
.tool .t-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tool .t-tall { max-height: 460px; overflow-y: auto; }
.tool .t-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tool .t-table th { position: sticky; top: 0; z-index: 1; padding: 6px 8px; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 700; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--surface-line); }
.tool .t-table td { padding: 6px 8px; border-top: 1px solid var(--surface-line); vertical-align: middle; }
.tool .t-table tbody tr:hover td { background: rgba(127, 127, 127, .08); }
.tool .t-r, .tool .t-table th.t-r { text-align: right; }
.tool .t-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tool .t-code { font-weight: 700; white-space: nowrap; color: var(--value); }
.tool .t-b { font-weight: 700; white-space: nowrap; }
.tool .t-mute, .tool .is-returned td { color: var(--muted); }
.tool .is-unack td { font-weight: 700; }
.tool .t-empty { padding: 14px 8px; color: var(--muted); font-weight: 400 !important; }
.tool .t-ev { white-space: nowrap; }
.tool .ev-raised .t-ev { color: var(--a1); font-weight: 700; }
.tool .ev-acknowledged .t-ev { color: var(--value); }
.tool .ev-returned .t-ev { color: var(--muted); }
.tool .t-p { position: relative; z-index: 0; display: inline-grid; place-items: center; width: 22px; height: 22px; color: #000; font-size: 11px; font-weight: 800; }
.tool .t-p::before { content: ""; position: absolute; inset: 4px; z-index: -1; border: 1px solid #000; background: var(--a2); transform: rotate(45deg); }
.tool .t-p.p1 { color: #fff; }
.tool .t-p.p1::before { background: var(--a1); }
.tool .t-p.p3::before { background: var(--a3); }
.tool .t-note { margin: 6px 0 8px; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.tool .t-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 10px; }
.tool .t-lbl { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 700; }
.tool .t-lbl select { max-width: 260px; }
.tool .t-tags { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 10px; }
.tool .t-tag { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; font-size: 13px; font-weight: 650; cursor: pointer; }
.tool .t-tag input { width: 16px; height: 16px; accent-color: var(--btn-on); }
.tool .t-tag i, .tool .t-key, .tool .t-tip i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; background: currentColor; }
.tool .t-key { margin-right: 8px; vertical-align: middle; }
.tool .c0 { color: var(--tr-level); stroke: var(--tr-level); }
.tool .c1 { color: var(--tr-in); stroke: var(--tr-in); }
.tool .c2 { color: var(--tr-out); stroke: var(--tr-out); }
.tool .c3 { color: var(--a2); stroke: var(--a2); }
.tool .c4 { color: var(--a3); stroke: var(--a3); }
.tool .c5 { color: var(--run); stroke: var(--run); }
.tool .t-tag.c0, .tool .t-tag.c1, .tool .t-tag.c2, .tool .t-tag.c3, .tool .t-tag.c4, .tool .t-tag.c5 { color: var(--text); }
.tool .t-tag.c0 i { background: var(--tr-level); }
.tool .t-tag.c1 i { background: var(--tr-in); }
.tool .t-tag.c2 i { background: var(--tr-out); }
.tool .t-tag.c3 i { background: var(--a2); }
.tool .t-tag.c4 i { background: var(--a3); }
.tool .t-tag.c5 i { background: var(--run); }
.tool .t-chart { position: relative; min-height: 120px; touch-action: pan-y; }
.tool .t-chart.is-empty { min-height: 60px; }
.tool .t-chart svg { display: block; width: 100%; }
.tool .t-plot { fill: var(--tr-bg); stroke: var(--surface-line); }
.tool .t-grid { stroke: var(--tr-grid); stroke-width: 1; }
.tool .t-axis { fill: var(--muted); font: 600 11.5px var(--font-hmi); font-variant-numeric: tabular-nums; }
.tool .t-line { fill: none; stroke-width: 2; stroke-linejoin: round; }
.tool .t-cursor { stroke: var(--text); stroke-width: 1; stroke-dasharray: 3 3; }
.tool .t-dot { fill: var(--tr-bg); stroke-width: 2.5; }
.tool .t-tip { position: absolute; top: 14px; z-index: 2; display: grid; gap: 2px; min-width: 180px; max-width: 220px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--surface-line); border-radius: var(--r); box-shadow: 0 6px 18px rgba(0, 0, 0, .25); font-size: 12.5px; pointer-events: none; }
.tool .t-tip[hidden] { display: none; }
.tool .t-tip b { color: var(--text); }
.tool .t-tip span { display: flex; align-items: center; gap: 6px; color: var(--text); font-variant-numeric: tabular-nums; }
.tool .t-tip span.c0 i { background: var(--tr-level); }
.tool .t-tip span.c1 i { background: var(--tr-in); }
.tool .t-tip span.c2 i { background: var(--tr-out); }
.tool .rep-title { margin: 4px 0 2px; font-size: 19px; color: var(--text); }
.tool .rep-sub { margin: 0 0 10px; color: var(--muted); font-size: 12.5px; }
.tool .rep-block { margin-top: 14px; }
.tool .rep-block h3 { margin: 0 0 2px; font-size: 14.5px; color: var(--text); }
.tool .rep-table.has-total tbody tr:last-child td { font-weight: 800; border-top: 2px solid var(--surface-line); }
.tool .rep-table td:nth-child(n+2) { white-space: nowrap; }
.tool .rep-table td:nth-child(4) { white-space: normal; }
@media print {
  body.tool-printing * { visibility: hidden !important; overflow: visible !important; box-shadow: none !important; }
  body.tool-printing *:not(.rep-print):not(.rep-print *) { position: static !important; transform: none !important; height: auto !important; max-height: none !important; }
  body.tool-printing .tool .rep-print, body.tool-printing .tool .rep-print * { visibility: visible !important; color: #000 !important; background: none !important; }
  body.tool-printing .tool .rep-print { position: absolute; left: 0; top: 0; width: 100%; font: 10.5pt Arial, Helvetica, sans-serif; }
  body.tool-printing .tool .rep-print .t-table th, body.tool-printing .tool .rep-print .t-table td { border-color: #999 !important; padding: 3px 6px; position: static !important; }
  body.tool-printing .tool .rep-print .rep-block { break-inside: avoid; }
}

/* ---------- App shell on /scada: one-page SCADA with navigation (shell.js) ---------- */
.app-page, .app-page body { height: 100%; }
.app-page body { overflow: hidden; background: var(--navy-950); }
.app {
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 52px minmax(0, 1fr);
  height: 100vh; height: 100dvh;
  background: var(--bg); color: var(--text); font-family: var(--font-hmi);
}
.app .ico { width: 18px; height: 18px; }
.app a { color: var(--value); }
.app[data-theme="classic"] a { color: #0a246a; }

/* top bar */
/* Fixed, not a plain grid row: iOS 26 blurs the top of an installed web app unless a fixed bar with a solid
   background sits there, and then it takes the bar's colour instead */
.app-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 50; height: 52px; display: flex; align-items: center; gap: 10px; min-width: 0; padding: 0 10px; background: var(--surface); border-bottom: 1px solid var(--surface-line); }
.app-menu { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border: 1px solid var(--btn-line); border-radius: var(--r); background: var(--btn); color: var(--btn-text); cursor: pointer; }
.app-logo { display: flex; align-items: center; gap: 8px; flex: none; color: var(--text) !important; font-weight: 700; font-size: 16px; text-decoration: none; }
.app-logo .mark { width: 28px; height: 28px; border-radius: 7px; }
.app-logo i { font-style: normal; font-weight: 500; color: var(--value); }
.app[data-theme="classic"] .app-logo i { color: #0a246a; }
.app-title { display: none; color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.app-alarms { flex: 1 1 auto; min-width: 0; max-width: 560px; height: 36px; padding: 0 12px; overflow: hidden; border: 1px solid var(--btn-line); border-radius: var(--r); background: var(--btn); color: var(--muted); font: 700 13px var(--font-hmi); text-align: left; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; }
.app-alarms.is-active { color: var(--text); border-color: var(--a2); }
.app-alarms.is-unack { color: #000; border-color: transparent; animation: hmi-blink 1.2s steps(1) infinite; }
.app-alarms.is-unack.p1 { background: var(--a1); color: #fff; }
.app-alarms.is-unack.p2 { background: var(--a2); }
.app-alarms.is-unack.p3 { background: var(--a3); }
.app-style { display: none; gap: 6px; }
.app-style select, .app-nav-style select { min-height: 34px; padding: 0 6px; border: 1px solid var(--btn-line); border-radius: var(--r); background: var(--btn); color: var(--btn-text); font: 600 12.5px var(--font-hmi); cursor: pointer; }
.app-mail { display: none; min-height: 36px; padding: 0 14px; font-size: 14px; color: var(--navy-950) !important; }

/* navigation */
.app-nav, .app-main { grid-row: 2; }
.app-nav {
  position: fixed; top: 52px; bottom: 0; left: 0; z-index: 30; width: min(280px, 86vw);
  overflow-y: auto; padding: 8px 8px 16px;
  background: var(--surface); border-right: 1px solid var(--surface-line);
  transform: translateX(-102%); transition: transform .2s ease;
}
.app.nav-open .app-nav { transform: none; box-shadow: 12px 0 32px rgba(0, 0, 0, .35); }
.nav-i { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 6px 10px; border-radius: var(--r); color: var(--text) !important; font-size: 14px; font-weight: 600; text-decoration: none; }
.nav-i:hover { background: var(--box); }
.nav-i[aria-current="page"] { background: var(--btn-on); color: var(--btn-on-text) !important; }
.nav-i .dot { flex: none; width: 10px; height: 10px; margin-left: auto; border-radius: 50%; border: 1px solid transparent; }
.nav-i .dot.ok { background: var(--run); opacity: .55; width: 8px; height: 8px; }
.nav-i .dot.p1 { background: var(--a1); border-color: #000; }
.nav-i .dot.p2 { background: var(--a2); border-color: #000; }
.nav-i .dot.p3 { background: var(--a3); border-color: #000; }
.nav-i .dot.blink { animation: hmi-blink 1s steps(1) infinite; }
.app[data-theme="hp"] .nav-i .dot.ok { opacity: .35; }
.app-nav-style { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 10px 0; }
.app-legal { margin: 16px 10px 0; color: var(--muted); font-size: 11.5px; line-height: 1.45; }

/* main area and screens */
.app-main { position: relative; min-width: 0; overflow: auto; overflow-x: hidden; padding: 10px; container-type: inline-size; }
.app-screen[hidden] { display: none; }
.app .hmi { padding: 0; border: 0; border-radius: 0; box-shadow: none; background: transparent; }
.app-intro { margin: 2px 2px 10px; }
.app-intro h1, .app-h1 { margin: 2px 0 6px; color: var(--text); font-size: 20px; line-height: 1.25; letter-spacing: -.01em; }
.app-intro p { margin: 0; max-width: 900px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.hmi-info-btn { min-height: 32px; padding: 0 10px; border: 1px solid var(--btn-on); border-radius: var(--r); background: transparent; color: var(--text); font: 700 12.5px var(--font-hmi); cursor: pointer; }
.hmi-info-btn:hover { background: var(--btn-on); color: var(--btn-on-text); }
.app-pn { display: flex; justify-content: space-between; gap: 10px; margin: 12px 0 4px; }
.app-pn a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border: 1px solid var(--btn-line); border-radius: var(--r); background: var(--btn); color: var(--btn-text) !important; font-size: 14px; font-weight: 700; text-decoration: none; }
.app-pn a:hover { border-color: var(--btn-on); }

/* screen with a side column for controls and alarms */
.hmi-body { display: grid; gap: 10px; margin-top: 10px; }
.hmi-main { min-width: 0; }
.hmi-side { display: grid; gap: 10px; align-content: start; min-width: 0; }
.hmi-side .hmi-al-list { max-height: 300px; overflow-y: auto; }
.hmi-side .hmi-al button { grid-template-columns: 22px minmax(0, 1fr) auto; grid-template-areas: "p tag t" "p text text" "p s s"; }
.hmi-side .hmi-al .al-p { grid-area: p; align-self: start; }
.hmi-side .hmi-al .al-tag { grid-area: tag; }
.hmi-side .hmi-al .al-t { grid-area: t; font-size: 12px; }
.hmi-side .hmi-al .al-text { grid-area: text; }
.hmi-side .hmi-al .al-s { grid-area: s; grid-column: auto; }
.hmi-fps { margin: 10px 0; }
.app .hmi-trend .tr { height: 120px; }
@container (min-width: 820px) {
  .hmi-body { grid-template-columns: minmax(0, 1fr) 290px; align-items: start; }
  .hmi-fps { grid-template-columns: repeat(3, 1fr); }
}
@container (min-width: 1300px) {
  .hmi-body { grid-template-columns: minmax(0, 1fr) 320px; }
}

/* "What we automate here" */
.app-info {
  position: fixed; top: 52px; right: 0; bottom: 0; z-index: 40; width: min(460px, 100%);
  overflow-y: auto; padding: 18px 22px 28px;
  background: var(--surface); color: var(--text); border-left: 1px solid var(--surface-line);
  box-shadow: -14px 0 36px rgba(0, 0, 0, .35); font-size: 15px; line-height: 1.55;
}
.app-info[hidden] { display: none; }
.app-info-close { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border: 1px solid var(--btn-line); border-radius: var(--r); background: var(--btn); color: var(--btn-text); font-size: 22px; line-height: 1; cursor: pointer; }
.app-k { margin: 0 0 6px; color: var(--muted); font-size: 11.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.app-info h2 { margin: 0 44px 8px 0; color: var(--text); font-size: 21px; line-height: 1.25; }
.app-info h3 { margin: 18px 0 8px; color: var(--text); font-size: 15px; }
.app-info p { margin: 0 0 12px; color: var(--muted); }
.app-info .ticks li { font-size: 14.5px; }
.app-info .ticks li::before { border-color: var(--btn-on); }
.app .chips li { background: var(--box); border-color: var(--surface-line); color: var(--text); font-size: 13px; }
.app-info-more { font-size: 14px; }
.app-info .panel-cta a { color: var(--value); }

/* "What we deliver" */
.app-doc { max-width: 1100px; padding: 6px 4px 20px; }
.app-lead { max-width: 820px; margin: 0 0 18px; color: var(--muted); font-size: 15px; line-height: 1.55; }
.app-doc .cards { margin-bottom: 18px; }
.app-doc .card { background: var(--surface); border-color: var(--surface-line); border-radius: var(--r); }
.app-doc .card h3 { color: var(--text); }
.app-doc .card p, .app-doc .platforms .note { color: var(--muted); }
.app-doc .card .tile { background: var(--btn-on); color: var(--btn-on-text); }
.app-doc .platforms .k { color: var(--text); }
.app-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin: 18px 0; padding: 18px; border: 1px solid var(--surface-line); border-radius: var(--r); background: var(--surface); }
.app-cta > div { flex: 1 1 280px; }
.app-cta h2 { margin: 0 0 4px; color: var(--text); font-size: 19px; }
.app-cta p { margin: 0; color: var(--muted); }
.app-cta .btn { min-height: 44px; font-size: 15px; }
.app-cta .btn-primary { color: var(--navy-950) !important; }
.app-cta .btn-wa { color: #052e1a !important; }

@media (min-width: 700px) {
  .app-main { padding: 12px 14px; }
  .app-style { display: inline-flex; }
  .app-nav-style { display: none; }
}
@media (min-width: 1000px) {
  .app { grid-template-columns: 228px minmax(0, 1fr); }
  .app-nav { position: static; width: auto; transform: none; transition: none; }
  .app-menu { display: none; }
  .app-title { display: inline; }
  .app-mail { display: inline-flex; }
}
@media print {
  .app-page body { overflow: visible; }
  .app-bar { position: static; grid-column: 1 / -1; }
}

/* ---------- Site screens fit the window (shell.js adds .fit on .app-main) ---------- */
.app-hint { position: relative; margin: 0 0 8px; padding: 6px 40px 6px 12px; border: 1px solid var(--surface-line); border-radius: var(--r); background: var(--surface); color: var(--muted); font-size: 13px; line-height: 1.45; }
.app-hint[hidden] { display: none; }
.app-hint-close { position: absolute; top: 50%; right: 6px; width: 28px; height: 28px; transform: translateY(-50%); border: 0; border-radius: var(--r); background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; }
.app-hint-close:hover { background: var(--box); color: var(--text); }
.hmi-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.hmi-tabs button { flex: 1 1 auto; min-height: 34px; padding: 0 8px; border: 1px solid var(--btn-line); border-radius: var(--r); background: var(--btn); color: var(--btn-text); font: 700 12.5px var(--font-hmi); cursor: pointer; }
.hmi-tabs button[aria-selected="true"] { background: var(--btn-on); border-color: var(--btn-on); color: var(--btn-on-text); }
.hmi-side [data-tabpanel][hidden] { display: none; }
.app-mini { display: none; align-items: center; gap: 8px; width: 100%; min-height: 34px; margin: 0 0 4px; padding: 0 10px; border: 1px dashed var(--surface-line); border-radius: var(--r); background: transparent; color: var(--muted); font: 600 12.5px var(--font-hmi); cursor: pointer; }
.app-mini:hover { color: var(--text); border-color: var(--btn-line); }

@media (min-width: 1000px) {
  .app-mini { display: flex; }
  /* icons-only navigation */
  .app.nav-mini { grid-template-columns: 58px minmax(0, 1fr); }
  .app.nav-mini .app-nav { padding: 8px 6px; }
  .app.nav-mini .nav-i { position: relative; justify-content: center; padding: 6px 0; }
  .app.nav-mini .nav-i span, .app.nav-mini .app-mini span, .app.nav-mini .app-legal { display: none; }
  .app.nav-mini .nav-i .dot { position: absolute; top: 5px; right: 7px; width: 9px; height: 9px; margin: 0; }
  .app.nav-mini .app-mini { justify-content: center; padding: 0; }
  .app.nav-mini .nav-i .ico { width: 20px; height: 20px; }
}

@media (min-width: 1000px) and (min-height: 520px) {
  .app-main.fit { display: flex; flex-direction: column; overflow: hidden; padding: 8px 10px 10px; }
  .app-main.fit > .app-screen:not([hidden]) { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; }
  .app-main.fit .app-screen > .hmi-demo { display: flex; flex: 1 1 auto; min-height: 0; }
  .app-main.fit .app-screen > [data-plant] { flex: 1 1 auto; min-height: 0; }
  .app-main.fit .hmi {
    flex: 1 1 auto; min-height: 0; min-width: 0;
    display: grid; column-gap: 10px;
    grid-template-columns: minmax(0, 1fr) clamp(250px, 23vw, 340px);
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas: "bar bar" "kpi kpi" "main side";
  }
  .app-main.fit .hmi > .hmi-bar { grid-area: bar; margin-bottom: 8px; padding: 5px 8px 5px 12px; }
  /* the figures run across the full width, in one row, so their labels are not cut short */
  .app-main.fit .hmi > .hmi-kpis { grid-area: kpi; margin: 0 0 8px; grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
  .app-main.fit .hmi-kpi { padding: 5px 8px; }
  .app-main.fit .hmi-kpi span { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .app-main.fit .hmi-kpi b { font-size: clamp(12px, 1.05vw, 16px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .app-main.fit .hmi-body { display: contents; }
  .app-main.fit .hmi-main { grid-area: main; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
  .app-main.fit .hmi-screen { flex: 1 1 auto; min-height: 0; overflow: hidden; }
  .app-main.fit .hmi svg.mimic { width: 100%; height: 100%; min-width: 0; }
  .app-main.fit .hmi-swipe, .app-main.fit .app-pn { display: none; }
  .app-main.fit .hmi-side { grid-area: side; min-height: 0; overflow-y: auto; overscroll-behavior: contain; align-content: start; margin: 0; padding-right: 2px; }
  .app-main.fit .hmi-side .hmi-al-list { max-height: 34vh; }
  .app-main.fit .hmi-trend .tr { height: 72px; }
  .app-main.fit .hmi-trend .tr-key { font-size: 11.5px; }
  .app-main.fit .hmi-card { padding: 10px; }
}

/* ---------- Zoom on every mimic (shell.js): buttons in the screen's bar; while zoomed, one button back ---------- */
.app .hmi-screen { position: relative; }
.zoom-btns { display: flex; gap: 4px; }
.hmi-screen > .zoom-btns { position: absolute; right: 6px; bottom: 6px; z-index: 2; }
.zoom-btns button, .zoom-back { width: 30px; height: 30px; padding: 0; border: 1px solid var(--btn-line); border-radius: var(--r); background: var(--btn); color: var(--btn-text); font: 700 16px/1 var(--font-hmi); cursor: pointer; }
.zoom-btns button:hover, .zoom-back:hover { border-color: var(--btn-on); }
.zoom-back { position: absolute; right: 6px; bottom: 6px; z-index: 2; display: none; }
.app svg.mimic.is-zoomed ~ .zoom-back { display: block; }
@media (max-width: 999px) { .hmi-bar .zoom-btns { display: none; } }
.app svg.mimic.is-zoomed { cursor: grab; }
.app svg.mimic.is-zoomed:active { cursor: grabbing; }
.side-tabs { display: none; }

/* ---------- Phones and small tablets: the site screen fits the window too ---------- */
@media (max-width: 999px) {
  .app-main.fit { display: flex; flex-direction: column; overflow: hidden; padding: 6px; }
  .app-main.fit > .app-screen:not([hidden]) { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; }
  .app-main.fit .app-screen > .hmi-demo { display: flex; flex: 1 1 auto; min-height: 0; }
  .app-main.fit .app-screen > [data-plant] { flex: 1 1 auto; min-height: 0; }
  .app-main.fit .app-hint { margin-bottom: 6px; padding: 4px 34px 4px 10px; font-size: 12px; }
  .app-main.fit .hmi {
    flex: 1 1 auto; min-height: 0; min-width: 0;
    display: grid; row-gap: 6px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(110px, 1fr) auto;
    grid-template-areas: "bar" "kpi" "main" "side";
  }
  .app-main.fit .hmi-body { display: contents; }
  .app-main.fit .hmi > .hmi-bar { grid-area: bar; padding: 4px 6px 4px 10px; gap: 4px 8px; font-size: 13px; }
  .app-main.fit .hmi-id { flex: 1 1 140px; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .app-main.fit .hmi-sim { display: none; }
  .app-main.fit .hmi-info-btn { min-height: 30px; padding: 0 8px; font-size: 12px; }
  .app-main.fit .hmi-alsum { min-height: 30px; padding: 0 8px; font-size: 12px; }
  .app-main.fit .hmi-clock { margin-left: auto; font-size: 13px; }
  .app-main.fit .hmi > .hmi-kpis { grid-area: kpi; display: flex; gap: 6px; margin: 0; overflow-x: auto; scrollbar-width: none; }
  .app-main.fit .hmi-kpi { flex: 0 0 auto; padding: 4px 8px; }
  .app-main.fit .hmi-kpi span { font-size: 11px; }
  .app-main.fit .hmi-kpi b { font-size: 14px; white-space: nowrap; }
  .app-main.fit .hmi-main { grid-area: main; display: flex; flex-direction: column; min-height: 0; }
  .app-main.fit .hmi-screen { flex: 1 1 auto; min-height: 0; overflow: hidden; border: 1px solid var(--surface-line); }
  .app-main.fit .hmi svg.mimic { width: 100%; height: 100%; min-width: 0; touch-action: none; }
  .app-main.fit .hmi-swipe, .app-main.fit .app-pn { display: none; }
  .app-main.fit .zoom-back { width: 38px; height: 38px; }
  .app-main.fit .hmi-side { grid-area: side; height: 40vh; height: 40dvh; margin: 0; overflow-y: auto; overscroll-behavior: contain; align-content: start; gap: 8px; }
  .app-main.fit .hmi-side .hmi-al-list { max-height: none; }
  .app-main.fit .hmi-trend .tr { height: 110px; }
  .app-main.fit .side-tabs { position: sticky; top: 0; z-index: 3; display: flex; gap: 4px; padding-bottom: 2px; background: var(--bg); }
  .app-main.fit .side-tabs button { flex: 1; min-height: 36px; border: 1px solid var(--btn-line); border-radius: var(--r); background: var(--btn); color: var(--btn-text); font: 700 13px var(--font-hmi); cursor: pointer; }
  .app-main.fit .side-tabs button[aria-selected="true"] { background: var(--btn-on); border-color: var(--btn-on); color: var(--btn-on-text); }
  .app-main.fit .hmi-side[data-side="ctl"] > .hmi-alarms, .app-main.fit .hmi-side[data-side="ctl"] > .hmi-trend { display: none; }
  .app-main.fit .hmi-side[data-side="al"] > :not(.hmi-alarms):not(.side-tabs) { display: none; }
  .app-main.fit .hmi-side[data-side="tr"] > :not(.hmi-trend):not(.side-tabs) { display: none; }
}
/* phone held sideways: screen and panel side by side */
@media (max-width: 999px) and (min-aspect-ratio: 4/3) {
  .app-main.fit .hmi { grid-template-columns: minmax(0, 1fr) min(42%, 320px); grid-template-rows: auto auto minmax(0, 1fr); grid-template-areas: "bar bar" "kpi kpi" "main side"; column-gap: 8px; }
  .app-main.fit .hmi-side { height: auto; min-height: 0; }
  .app-main.fit .app-hint { display: none; }
}

/* ---------- "What we deliver" on /data ---------- */
.app-h2 { margin: 22px 0 10px; color: var(--text); font-size: 18px; }
.app-doc .flowline li { background: var(--surface); border-color: var(--surface-line); border-radius: var(--r); }
.app-doc .flowline h3 { color: var(--text); }
.app-doc .flowline p { color: var(--muted); }
.app-doc .mini { margin-bottom: 18px; }
.app-doc .mini article { background: var(--surface); border-color: var(--surface-line); border-radius: var(--r); }
.app-doc .mini h3 { color: var(--text); }
.app-doc .mini p { color: var(--muted); }
.app-doc .mini .tile { background: var(--btn-on); color: var(--btn-on-text); }

/* ---------- Tools on phones: filters wrap, alarm and journal rows become cards ---------- */
@media (max-width: 640px) {
  .tool .hmi-card-head > b { flex: 1 1 100%; }
  .tool .t-filters { flex: 1 1 100%; min-width: 0; }
  .tool .t-filters select { flex: 1 1 140px; min-width: 0; }
  .tool .t-actions { margin-left: 0; }
  .tool .t-cards { min-width: 0; }
  .tool .t-cards thead { display: none; }
  .tool .t-cards, .tool .t-cards tbody { display: block; }
  .tool .t-cards tr { display: grid; grid-template-columns: 24px auto minmax(0, 1fr) auto; grid-template-areas: "p site tag time" "p text text text" "p state state ack"; gap: 2px 8px; align-items: center; padding: 9px 2px; border-top: 1px solid var(--surface-line); }
  .tool .t-cards td { display: block; padding: 0; border: 0; min-width: 0; }
  .tool .t-cards .c-p { grid-area: p; align-self: start; padding-top: 2px; }
  .tool .t-cards .c-site { grid-area: site; }
  .tool .t-cards .c-tag { grid-area: tag; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tool .t-cards .c-time { grid-area: time; color: var(--muted); font-size: 12px; }
  .tool .t-cards .c-text { grid-area: text; font-size: 14px; line-height: 1.35; }
  .tool .t-cards .c-state { grid-area: state; color: var(--muted); font-size: 12px; }
  .tool .t-cards .c-ack { grid-area: ack; }
  .tool .t-cards .c-n { display: none; }
  .tool .t-cards td.t-empty { grid-column: 1 / -1; grid-row: 1; padding: 6px 0; }
  .tool .t-cards tbody tr:hover td { background: none; }
}

/* ---------- Switch between the two demos (top of the menu) ---------- */
.demo-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; margin: 0 0 8px; padding: 3px; border: 1px solid var(--surface-line); border-radius: calc(var(--r) + 3px); background: var(--box); }
.demo-switch a { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 4px 6px; border-radius: var(--r); color: var(--muted) !important; font-size: 12.5px; font-weight: 700; line-height: 1.15; text-align: center; text-decoration: none; }
.demo-switch a:hover { color: var(--text) !important; }
.demo-switch a[aria-current="page"] { background: var(--surface); color: var(--text) !important; box-shadow: 0 0 0 1px var(--surface-line); }
.demo-switch .ico { width: 16px; height: 16px; flex: none; }
.demo-switch span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 1000px) {
  /* the side menu is 228px: text only, or the labels run past the switch */
  .demo-switch a { padding: 4px; font-size: 12px; }
  .app:not(.nav-mini) .demo-switch .ico { display: none; }
  .app.nav-mini .demo-switch { grid-template-columns: 1fr; }
  .app.nav-mini .demo-switch span { display: none; }
}

/* ---------- Info button: text on wide screens, an "i" on phones ---------- */
.hmi-info-btn .ib-i { display: none; width: 22px; height: 22px; place-items: center; border-radius: 50%; border: 1.5px solid currentColor; font: italic 800 13px/1 Georgia, serif; }
@media (max-width: 999px) {
  .app-main.fit .hmi-info-btn { min-width: 34px; padding: 0 5px; border-radius: 999px; }
  .app-main.fit .hmi-info-btn .ib-t { display: none; }
  .app-main.fit .hmi-info-btn .ib-i { display: grid; }
  .app-main.fit .hmi-alsum { max-width: 118px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .app-main.fit .hmi > .hmi-bar { flex-wrap: nowrap; }
  .app-main.fit .hmi-clock { font-size: 12px; }
}
/* iPad held sideways and small laptops: the screen's header stays on one line, the side panel a little wider */
@media (min-width: 1000px) and (max-width: 1279px) and (min-height: 520px) {
  .app-main.fit .hmi { grid-template-columns: minmax(0, 1fr) 280px; }
  .app-main.fit .hmi-sim { display: none; }
  .app-main.fit .hmi-id { flex: 1 1 160px; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .app-main.fit .hmi > .hmi-bar { flex-wrap: nowrap; }
}

/* ---------- Install as an app (shell.js) ---------- */
.app-install { margin: 14px 10px 0; }
.app-install[hidden], .app-install-tip[hidden] { display: none; }
.app-install .hmi-btn { width: 100%; }
.app-install-tip { margin: 6px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.app.nav-mini .app-install { display: none; }

/* ---------- Menu: top block and collapsible groups (shell.js) ---------- */
.nav-top { margin: 0 0 6px; }
.nav-top .app-nav-style { margin: 0 0 6px; }
.nav-top .app-install { margin: 0 0 6px; }
.nav-i[href="#deliver"] { margin-bottom: 4px; border: 1px dashed var(--btn-on); }
.nav-i[href="#deliver"][aria-current="page"] { border-style: solid; }
.nav-g { margin-top: 2px; }
.nav-gh { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 36px; padding: 4px 10px; border: 0; border-radius: var(--r); background: transparent; color: var(--muted); font: 800 11.5px var(--font-hmi); letter-spacing: .1em; text-transform: uppercase; text-align: left; cursor: pointer; }
.nav-gh:hover { background: var(--box); color: var(--text); }
.nav-gh span { flex: 1; }
.nav-gh .dot { flex: none; width: 9px; height: 9px; border-radius: 50%; }
.nav-gh .dot.ok { background: var(--run); opacity: .5; width: 7px; height: 7px; }
.nav-gh .dot.p1 { background: var(--a1); } .nav-gh .dot.p2 { background: var(--a2); } .nav-gh .dot.p3 { background: var(--a3); }
.nav-gh .dot.blink { animation: hmi-blink 1s steps(1) infinite; }
.nav-g.open .nav-gh .dot { visibility: hidden; }
.nav-chev { width: 14px !important; height: 14px !important; flex: none; transition: transform .15s; }
.nav-g.open .nav-chev { transform: rotate(90deg); }
.nav-gi { display: none; padding-left: 4px; }
.nav-g.open .nav-gi { display: block; }
@media (min-width: 1000px) {
  .app.nav-mini .nav-gh { display: none; }
  .app.nav-mini .nav-gi { display: block; padding-left: 0; }
  .app.nav-mini .nav-g + .nav-g { border-top: 1px solid var(--surface-line); margin-top: 6px; padding-top: 6px; }
  .app.nav-mini .nav-i[href="#deliver"] { border: 0; }
}
.tool .t-note { margin: 0; color: var(--muted); font-size: 12.5px; }

/* ---------- Menu on phones: one line for the switch and the styles; "What we deliver" at the bottom ---------- */
.demo-switch a { white-space: nowrap; }
.nav-top .app-nav-style { display: flex; flex-wrap: nowrap; gap: 6px; }
.nav-top .app-nav-style select { flex: 1 1 0; min-width: 0; }
.nav-deliver-bottom { display: none; }
@media (max-width: 999px) {
  .demo-switch a { gap: 5px; padding: 4px; font-size: 12px; }
  .demo-switch .ico { width: 14px; height: 14px; }
  .nav-deliver-top { display: none; }
  .nav-deliver-bottom { display: flex; margin-top: 8px; }
}
@media (max-width: 359px) {
  .demo-switch .ico { display: none; }
}

/* network: logger call-in times (network.js) */
.hmi[data-plant="network"] .lgt { font-size: 11.5px; }
.hmi[data-plant="network"][data-theme="classic"] .lgt { fill: #c8c8c8; }

/* ---------- Legend (both demos) ---------- */
.app-legend-btn { display: none; min-height: 36px; padding: 0 12px; border: 1px solid var(--btn-line); border-radius: var(--r); background: var(--btn); color: var(--btn-text); font: 700 13px var(--font-hmi); cursor: pointer; }
.app-legend-btn:hover { border-color: var(--btn-on); }
.app-legend-nav { width: 100%; margin: 0 0 6px; }
@media (min-width: 700px) { .app-legend-btn { display: inline-block; } .app-legend-nav { display: none; } }
.app-legend .hmi.lg { padding: 0; border: 0; box-shadow: none; background: transparent; }
.lg-list { display: grid; gap: 6px; margin: 0 0 8px; padding: 0; list-style: none; }
.lg-list li { display: flex; align-items: center; gap: 12px; font-size: 14px; line-height: 1.4; color: var(--text); }
.lg-list svg { flex: none; width: 40px; height: 40px; overflow: visible; }
.lg-list svg.wide { width: 80px; }
.lg-list.lg-cols { grid-template-columns: 1fr 1fr; }
.lg-list.lg-cols svg { width: 32px; height: 32px; }
.app-legend .hmi .ind text { font-size: 13px; }
.lg-dots { display: inline-flex; gap: 4px; width: 40px; justify-content: center; flex: none; }
.lg-dot { display: inline-block; flex: none; width: 11px; height: 11px; border-radius: 50%; background: var(--muted); }
.lg-dot.ok { background: var(--run); } .lg-dot.p1 { background: var(--a1); } .lg-dot.p2 { background: var(--a2); }
.lg-dot.run { background: var(--tr-level); } .lg-dot.sel { background: var(--btn-on); }
.lg-text li { align-items: baseline; }
.lg-text .lg-dot { margin: 0 4px; }
.lg-line { display: inline-block; flex: none; width: 28px; border-top: 2px dashed var(--a2); margin: 0 4px 4px; }
.app-main.fit .app-legend .hmi.lg { display: block; }

/* energy: tariff bands from SLHMI.tariff (energy.js) */
.hmi[data-plant="energy"] .band-night { fill: var(--value); opacity: .3; }
.hmi[data-plant="energy"] .band-day { fill: var(--a2); opacity: .4; }
.hmi[data-plant="energy"] .band-peak { fill: var(--a1); opacity: .55; }
@media (min-width: 700px) { .nav-top .app-nav-style { display: none; } }
