/* rz-hmi.css — HMI drawing register (R128 PRD §3; standarization/HMI_DRAWING_STANDARD.md)
 * ISA-101 high-performance HMI: grey line work, colour only for abnormal state, alarm hues used for nothing else.
 * No gradient, filter, shadow or glow anywhere in a drawing or an equipment modal (gate tools/test-dh-drawings.mjs H1).
 * Page chrome keeps the RZ register; the drawing frame is the ISA process grey in light, RZ graphite in dark. */

:root:not([data-theme="dark"]) {
  --hmi-bg: #d9dadc; --hmi-bg-2: #cfd0d2; --hmi-frame: #b9bbbe;
  --hmi-line: #44484e; --hmi-line-2: #74787e; --hmi-fill-run: #9fa3a8; --hmi-fill-run-2: #b4b7bb;
  --hmi-text: #16181b; --hmi-text-2: #4d5157; --hmi-text-3: #6b6f75;
  --hmi-alm-1: #c62a2f; --hmi-alm-2: #a35f00; --hmi-alm-3: #7d6e00; --hmi-info: #005f8c;
  --hmi-feed-a: #2a5cc0; --hmi-feed-b: #1f7a52;
  --hmi-m-htw: #8a5a24; --hmi-m-tcs-s: #1f6f86; --hmi-m-tcs-r: #8f4335; --hmi-m-chw: #2f5e96; --hmi-m-cw: #5b4a8a;
  --hmi-m-fw: #8a4b40; --hmi-m-pw: #2d7a86; --hmi-m-dr: #6b6152; --hmi-m-agent: #6a4f99; --hmi-m-fuel: #6e5a2c; --hmi-m-air: #5a6068; --hmi-m-data: #3d5a73; --hmi-m-dc: #5c4f2e;
  --hmi-tip-bg: #ffffff; --hmi-tip-line: #9a9da2; --hmi-panel: #e6e7e9;
}
[data-theme="dark"] {
  --hmi-bg: #16181b; --hmi-bg-2: #1c1e22; --hmi-frame: #2c2f34;
  --hmi-line: #8f949b; --hmi-line-2: #5f646b; --hmi-fill-run: #3b3f45; --hmi-fill-run-2: #2c3035;
  --hmi-text: #dadcdf; --hmi-text-2: #a0a5ab; --hmi-text-3: #7a7f86;
  --hmi-alm-1: #ef5a5f; --hmi-alm-2: #f0a43a; --hmi-alm-3: #e3d04d; --hmi-info: #56c2f5;
  --hmi-feed-a: #6f9cf2; --hmi-feed-b: #4cbf8a;
  --hmi-m-htw: #c8925a; --hmi-m-tcs-s: #62b5ca; --hmi-m-tcs-r: #cf7a6a; --hmi-m-chw: #78a2d6; --hmi-m-cw: #9b89c9;
  --hmi-m-fw: #c98a7c; --hmi-m-pw: #6cc0cc; --hmi-m-dr: #a89b86; --hmi-m-agent: #a58bd0; --hmi-m-fuel: #b09a66; --hmi-m-air: #8a9099; --hmi-m-data: #7d9bb5; --hmi-m-dc: #b5a06a;
  --hmi-tip-bg: #1f2125; --hmi-tip-line: #3a3d42; --hmi-panel: #1b1d21;
}

/* ── frame ─────────────────────────────────────────────────────────────────────────────────────── */
.hmi-frame { position: relative; background: var(--hmi-bg); border: 1px solid var(--hmi-frame); border-radius: 2px; color: var(--hmi-line); overflow: hidden; }
/* a sheet host clears the legacy floats of its box: the page's svg zoom buttons (.svg-zb, float right, 131 px) sat beside
   the frame, and the frame (overflow hidden, a block formatting context) narrowed to 227 of 362 px at 390 (Room Layout) */
.hmi-host { clear: both; }
.hmi-frame svg.hmi-svg { display: block; width: 100%; height: auto; touch-action: none; user-select: none; -webkit-user-select: none; }
.pn .bx .hmi-frame svg.hmi-svg, .ep .bx .hmi-frame svg.hmi-svg { min-width: 0 !important; }   /* the legacy page rules `.pn:not(#p-dash) .bx svg, .ep .bx svg { min-width:640px }` (max-width 600) forced every sheet to 640 px at 390 (R143 proof: svg 640 / host 362) */
.hmi-frame.is-panning svg.hmi-svg { cursor: grabbing; }
.hmi-bar { display: flex; align-items: center; gap: 4px; padding: 4px 6px; border-bottom: 1px solid var(--hmi-frame); background: var(--hmi-bg-2); font: 500 12px/1 'IBM Plex Sans', system-ui, sans-serif; color: var(--hmi-text-2); flex-wrap: wrap; }
.hmi-bar .hmi-sheet-no { font: 600 11px/1 'JetBrains Mono', ui-monospace, monospace; color: var(--hmi-text); margin-right: 6px; white-space: nowrap; flex: none; }   /* the sheet number never wraps (it broke into DH- / F- / 103 at 390 px); the Find list gives way instead */
.hmi-bar .hmi-sp { flex: 1 1 auto; }
.hmi-btn { min-width: 32px; min-height: 32px; padding: 0 8px; border: 1px solid var(--hmi-frame); border-radius: 2px; background: transparent; color: var(--hmi-text-2); font: 500 12px/1 'IBM Plex Sans', system-ui, sans-serif; cursor: pointer; }
.hmi-btn:hover { border-color: var(--hmi-line-2); color: var(--hmi-text); }
.hmi-btn[aria-pressed="true"] { border-color: var(--hmi-info); color: var(--hmi-text); }
.hmi-btn:focus-visible, .hmi-node:focus-visible { outline: 2px solid var(--hmi-info); outline-offset: 2px; }
@media (pointer: coarse) { .hmi-btn { min-width: 44px; min-height: 44px; } }

/* ── line work ─────────────────────────────────────────────────────────────────────────────────── */
.hmi-svg .hmi-edge { fill: none; stroke: var(--hmi-line); stroke-width: 1.4; stroke-linejoin: round; }
.hmi-svg .hmi-edge.w-main { stroke-width: 2.2; }
.hmi-svg .hmi-edge.w-signal { stroke-width: .8; stroke-dasharray: 4 2; stroke: var(--hmi-line-2); }
.hmi-svg .hmi-edge.w-bus { stroke-width: 3.2; }
.hmi-svg .hmi-edge.w-inst { stroke-width: 1; stroke: var(--hmi-line-2); }
.hmi-svg .hmi-edge[data-flow="stopped"] { stroke-dasharray: 6 4; }
.hmi-svg .hmi-edge[data-flow="unavailable"] { stroke-width: .6; stroke-dasharray: none; opacity: .7; }
.hmi-svg .m-htw { stroke: var(--hmi-m-htw); } .hmi-svg .m-tcs_s { stroke: var(--hmi-m-tcs-s); } .hmi-svg .m-tcs_r { stroke: var(--hmi-m-tcs-r); }
.hmi-svg .m-chw { stroke: var(--hmi-m-chw); } .hmi-svg .m-cw { stroke: var(--hmi-m-cw); } .hmi-svg .m-agent { stroke: var(--hmi-m-agent); }
.hmi-svg .m-fuel { stroke: var(--hmi-m-fuel); } .hmi-svg .m-air { stroke: var(--hmi-m-air); } .hmi-svg .m-data { stroke: var(--hmi-m-data); }
.hmi-svg .m-dc { stroke: var(--hmi-m-dc); } .hmi-svg .m-fw { stroke: var(--hmi-m-fw); } .hmi-svg .m-pw { stroke: var(--hmi-m-pw); } .hmi-svg .m-dr { stroke: var(--hmi-m-dr); } .hmi-svg .m-feed_a { stroke: var(--hmi-feed-a); } .hmi-svg .m-feed_b { stroke: var(--hmi-feed-b); }
.hmi-svg .m-power[data-flow="unavailable"], .hmi-svg .m-feed_a[data-flow="unavailable"], .hmi-svg .m-feed_b[data-flow="unavailable"] { stroke: var(--hmi-line-2); }
.hmi-svg .hmi-arrow { fill: currentColor; stroke: none; }
.hmi-svg .hmi-arrow.m-htw { color: var(--hmi-m-htw); } .hmi-svg .hmi-arrow.m-tcs_s { color: var(--hmi-m-tcs-s); } .hmi-svg .hmi-arrow.m-tcs_r { color: var(--hmi-m-tcs-r); }
.hmi-svg .hmi-arrow.m-chw { color: var(--hmi-m-chw); } .hmi-svg .hmi-arrow.m-fw { color: var(--hmi-m-fw); } .hmi-svg .hmi-arrow.m-pw { color: var(--hmi-m-pw); } .hmi-svg .hmi-arrow.m-dr { color: var(--hmi-m-dr); } .hmi-svg .hmi-arrow.m-cw { color: var(--hmi-m-cw); } .hmi-svg .hmi-arrow.m-feed { color: var(--hmi-m-fuel); } .hmi-svg .hmi-arrow.m-agent { color: var(--hmi-m-agent); } .hmi-svg .hmi-arrow.m-feed_a { color: var(--hmi-feed-a); } .hmi-svg .hmi-arrow.m-feed_b { color: var(--hmi-feed-b); }
.hmi-svg .hmi-flow { stroke-dasharray: 2 14; stroke-width: 1.4; opacity: .9; }
@media (prefers-reduced-motion: no-preference) {
  .hmi-svg .hmi-flow[data-flow="running"] { animation: hmi-march 1.6s linear infinite; }
}
@keyframes hmi-march { to { stroke-dashoffset: -16; } }
.hmi-svg .hmi-junction { fill: var(--hmi-line); stroke: none; }
.hmi-svg .hmi-zone { fill: none; stroke: var(--hmi-line-2); stroke-width: 1; stroke-dasharray: 8 4; }
.hmi-svg .hmi-zone-label, .hmi-svg .hmi-area-label { fill: var(--hmi-text-3); font: 500 9.5px 'IBM Plex Sans', system-ui, sans-serif; letter-spacing: .02em; }
.hmi-svg .hmi-box { fill: none; stroke: var(--hmi-line-2); stroke-width: .8; }
.hmi-svg .hmi-slot { fill: var(--hmi-bg-2); stroke: var(--hmi-line-2); stroke-width: .6; }

/* ── symbols and states (ISA-101: filled = running, outline = stopped; alarm only by colour + shape) ── */
.hmi-svg .hmi-node { color: var(--hmi-line); cursor: pointer; }
.hmi-svg .hmi-node .b { fill: transparent; }
.hmi-svg .hmi-node[data-state="running"] .b, .hmi-svg .hmi-node[data-state="closed"] .b, .hmi-svg .hmi-node[data-state="open"] .b,
.hmi-svg .hmi-node[data-state="energized"] .b, .hmi-svg .hmi-node[data-state="on"] .b, .hmi-svg .hmi-node[data-state="up"] .b,
.hmi-svg .hmi-node[data-state="online"] .b, .hmi-svg .hmi-node[data-state="modulating"] .b, .hmi-svg .hmi-node[data-state="float"] .b,
.hmi-svg .hmi-node[data-state="connected"] .b, .hmi-svg .hmi-node[data-state="normal"] .b, .hmi-svg .hmi-node[data-state="clean"] .b { fill: var(--hmi-fill-run); }
.hmi-svg .hmi-node[data-state="open"][data-sym^="cb"] .b, .hmi-svg .hmi-node[data-state="open"][data-sym="disconnector"] .b { fill: transparent; }
.hmi-svg .hmi-node[data-state="standby"] .b { fill: var(--hmi-fill-run-2); }
.hmi-svg .hmi-node[data-alarm="1"] { color: var(--hmi-alm-1); }
.hmi-svg .hmi-node[data-alarm="2"] { color: var(--hmi-alm-2); }
.hmi-svg .hmi-node[data-alarm="3"] { color: var(--hmi-alm-3); }
.hmi-svg .hmi-node:hover, .hmi-svg .hmi-node:focus-visible { color: var(--hmi-text); }
.hmi-svg .hmi-node.is-traced, .hmi-svg .hmi-edge.is-traced { color: var(--hmi-info); stroke: var(--hmi-info); }
.hmi-svg .hmi-node.is-selected { color: var(--hmi-info); }
.hmi-svg .hmi-hit { fill: transparent; stroke: none; }
.hmi-svg .hmi-alm-mark { fill: none; stroke-width: 1.6; }
.hmi-svg .hmi-alm-mark.p1 { stroke: var(--hmi-alm-1); } .hmi-svg .hmi-alm-mark.p2 { stroke: var(--hmi-alm-2); } .hmi-svg .hmi-alm-mark.p3 { stroke: var(--hmi-alm-3); }
.hmi-svg .hmi-alm-txt { font: 700 9px 'JetBrains Mono', ui-monospace, monospace; fill: var(--hmi-bg); stroke: none; }

/* ── text roles (typography by role, PRD §3.3) ─────────────────────────────────────────────────── */
.hmi-svg text { stroke: none; }
.hmi-svg [data-role="name"] { fill: var(--hmi-text-2, var(--hmi-text)); font: 500 9px 'IBM Plex Sans', system-ui, sans-serif; letter-spacing: .04em; text-transform: uppercase; opacity: .82; }
.hmi-svg [data-role="legend"] { fill: var(--hmi-text); font: 500 9px 'JetBrains Mono', ui-monospace, monospace; }
.hmi-svg [data-role="tag"] { fill: var(--hmi-text); font: 600 10px 'JetBrains Mono', ui-monospace, monospace; }
/* tags and values sit on a halo of the canvas colour, so a line passing behind a tag never strikes through it (PME practice) */
.hmi-svg [data-role="tag"], .hmi-svg [data-role="value"], .hmi-svg [data-role="line"], .hmi-svg [data-role="name"], .hmi-svg [data-role="legend"] { paint-order: stroke; stroke: var(--hmi-bg); stroke-width: 3px; stroke-linejoin: round; }
.hmi-svg [data-role="value"] { fill: var(--hmi-text-2); font: 500 9.5px 'JetBrains Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.hmi-svg [data-role="value"][data-alarm="1"] { fill: var(--hmi-alm-1); font-weight: 700; }
.hmi-svg [data-role="value"][data-alarm="2"] { fill: var(--hmi-alm-2); font-weight: 700; }
.hmi-svg [data-role="line"] { fill: var(--hmi-text-3); font: 400 9px 'JetBrains Mono', ui-monospace, monospace; }
.hmi-svg [data-role="label"] { fill: var(--hmi-text-2); font: 400 9.5px 'IBM Plex Sans', system-ui, sans-serif; }
.hmi-svg [data-role="inst"] { fill: var(--hmi-text); font: 600 8.5px 'JetBrains Mono', ui-monospace, monospace; text-anchor: middle; }
.hmi-svg [data-role="titleblock"] rect { fill: var(--hmi-bg-2); stroke: var(--hmi-line-2); stroke-width: .8; }
.hmi-svg [data-role="titleblock"] line { stroke: var(--hmi-line-2); stroke-width: .6; }
.hmi-svg [data-role="titleblock"] text { fill: var(--hmi-text-2); font: 400 9px 'JetBrains Mono', ui-monospace, monospace; }
.hmi-svg [data-role="titleblock"] text.t { fill: var(--hmi-text); font: 600 10.5px 'IBM Plex Sans', system-ui, sans-serif; }
/* level of detail: secondary labels only once the sheet is zoomed in */
.hmi-svg.lod-1 [data-lod="2"], .hmi-svg.lod-2 [data-lod="3"] { display: none; }

/* ── tooltip ───────────────────────────────────────────────────────────────────────────────────── */
.hmi-tip { position: fixed; z-index: 9000; max-width: 300px; padding: 8px 10px; background: var(--hmi-tip-bg); border: 1px solid var(--hmi-tip-line); border-radius: 2px; color: var(--hmi-text); font: 400 12px/1.4 'IBM Plex Sans', system-ui, sans-serif; pointer-events: none; opacity: 0; transition: opacity 120ms var(--rz-ease-out, ease-out); }
.hmi-tip.is-on { opacity: 1; }
.hmi-tip .k { font: 600 11px 'JetBrains Mono', ui-monospace, monospace; }
.hmi-tip .s { color: var(--hmi-text-3); font-size: 11px; }
.hmi-tip table { border-collapse: collapse; margin-top: 4px; width: 100%; }
.hmi-tip td { padding: 1px 0; font: 400 11px 'JetBrains Mono', ui-monospace, monospace; color: var(--hmi-text-2); }
.hmi-tip td + td { text-align: right; color: var(--hmi-text); }
.hmi-tip .hint { margin-top: 4px; color: var(--hmi-text-3); font-size: 11px; }

/* ── minimap ───────────────────────────────────────────────────────────────────────────────────── */
.hmi-mini { position: absolute; left: 8px; bottom: 8px; width: 140px; border: 1px solid var(--hmi-frame); background: var(--hmi-bg-2); }
.hmi-mini svg { display: block; width: 100%; height: auto; }
.hmi-mini .vp { fill: none; stroke: var(--hmi-info); stroke-width: 6; }
.hmi-frame:not(.is-zoomed) .hmi-mini { display: none; }

/* ── equipment modal (ISA-101 L3) ──────────────────────────────────────────────────────────────── */
.hmi-modal-back { position: fixed; inset: 0; z-index: 8000; background: rgba(8, 9, 11, .55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.hmi-modal-back[hidden] { display: none; }
.hmi-modal { width: min(1180px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--hmi-panel); border: 1px solid var(--hmi-frame); border-radius: 2px; color: var(--hmi-text); display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
.hmi-modal > header { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--hmi-frame); }
.hmi-modal > header .tag { font: 600 14px 'JetBrains Mono', ui-monospace, monospace; }
.hmi-modal > header .cls { color: var(--hmi-text-2); font: 400 13px 'IBM Plex Sans', system-ui, sans-serif; }
.hmi-modal > header .state { font: 500 12px 'IBM Plex Sans', system-ui, sans-serif; color: var(--hmi-text-2); padding-left: 10px; border-left: 1px solid var(--hmi-frame); }
.hmi-modal > header .sp { flex: 1; }
.hmi-modal .hmi-m-draw .hmi-svg { max-height: calc(100vh - 250px); }
.hmi-modal .hmi-m-draw { padding: 10px; border-right: 1px solid var(--hmi-frame); min-width: 0; }
.hmi-modal .hmi-m-pts { padding: 6px 10px 10px; overflow: auto; }
.hmi-modal .hmi-m-foot { grid-column: 1 / -1; border-top: 1px solid var(--hmi-frame); padding: 8px 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hmi-pt { display: grid; grid-template-columns: minmax(7em, 1fr) minmax(0, max-content); gap: 2px 8px; align-items: baseline; padding: 5px 0; border-bottom: 1px solid var(--hmi-frame); }
.hmi-pt .pt-tag { font: 600 10.5px 'JetBrains Mono', ui-monospace, monospace; color: var(--hmi-text); }
.hmi-pt .pt-label { font: 400 12px 'IBM Plex Sans', system-ui, sans-serif; color: var(--hmi-text-2); min-width: 0; }
.hmi-pt .pt-val { font: 500 12.5px 'JetBrains Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; text-align: right; min-width: 0; overflow-wrap: anywhere; }   /* a long value wraps under itself; it never runs over its label (fire zone 'Detection means') */
.hmi-pt .pt-band { grid-column: 1 / -1; height: 6px; position: relative; }
.hmi-pt .pt-band i { position: absolute; top: 2px; left: 0; right: 0; height: 2px; background: var(--hmi-line-2); opacity: .35; }
.hmi-pt .pt-band b { position: absolute; top: 2px; height: 2px; background: var(--hmi-line-2); }
.hmi-pt .pt-band u { position: absolute; top: 0; width: 2px; height: 6px; background: var(--hmi-text); }
.hmi-pt[data-alarm="1"] .pt-val { color: var(--hmi-alm-1); } .hmi-pt[data-alarm="2"] .pt-val { color: var(--hmi-alm-2); }
.hmi-m-sec { font: 600 11px 'IBM Plex Sans', system-ui, sans-serif; color: var(--hmi-text-3); margin: 8px 0 2px; }
.hmi-trend svg { width: 100%; height: 64px; display: block; }
.hmi-trend-ax { display: flex; justify-content: space-between; font: 400 10.5px 'JetBrains Mono', ui-monospace, monospace; color: var(--hmi-text-3); }
.hmi-trend path { fill: none; stroke: var(--hmi-line); stroke-width: 1.2; }
.hmi-trend .lim { stroke: var(--hmi-line-2); stroke-dasharray: 3 3; stroke-width: .8; }
.hmi-evt { font: 400 11.5px 'JetBrains Mono', ui-monospace, monospace; color: var(--hmi-text-2); margin: 0; padding: 0; list-style: none; }
.hmi-evt li { padding: 2px 0; border-bottom: 1px solid var(--hmi-frame); }
@media (max-width: 860px) {
  .hmi-modal { grid-template-columns: minmax(0, 1fr); }
  .hmi-modal .hmi-m-draw { border-right: 0; border-bottom: 1px solid var(--hmi-frame); }
  .hmi-modal .hmi-m-foot { grid-template-columns: 1fr; }
}

/* ── phones (<= 760 px): one-column modal, one-line drawing bar ────────────────────────────────── */
@media (max-width: 760px) {
  .hmi-bar { flex-wrap: nowrap; }
  .hmi-bar .hmi-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hmi-bar .hmi-btn { min-height: 36px; min-width: 36px; height: 36px; flex: none; }
  .hmi-modal-back { padding: 0; align-items: stretch; }
  .hmi-modal { max-height: 100vh; height: 100%; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto auto; }
  .hmi-modal > header { flex-wrap: wrap; gap: 6px 8px; }
  .hmi-modal > header .cls { display: none; }
  .hmi-modal > header .sp { flex-basis: 100%; height: 0; }
  /* a header whose only button is Close keeps it on the first line (the wrap is for the CDU's two trace buttons) */
  .hmi-modal > header .sp:has(+ [data-close]) { flex-basis: 0; height: auto; }
  .hmi-modal .hmi-m-draw { border-right: 0; border-bottom: 1px solid var(--hmi-frame); padding: 6px; }
  .hmi-modal .hmi-m-draw .hmi-svg { max-height: 56vh; }
  .hmi-modal .hmi-m-pts { overflow: visible; }
  .hmi-modal .hmi-m-foot { grid-template-columns: minmax(0, 1fr); }
}

/* ── deep shading (owner R139/R140: "detail deep shader", "more immersive") ────────────────────────────
 * Default mode. Every painted thing here comes from the renderer's own <defs> (ids hmi-g-*, hmi-f-*) in the shared
 * `.hmi-defs` svg; the paint gate (tools/test-dh-drawings.mjs H1) accepts exactly those and nothing else.
 * Flat ISA-101 line work is the "Shade" button off (data-shade="flat"), persisted per browser.
 * Colour meaning is unchanged: shading adds depth, never a hue — alarm colours still belong to alarms only. */
:root:not([data-theme="dark"]) {
  --hmi-sh-run-0: #d3d6da; --hmi-sh-run-1: #a6aaaf; --hmi-sh-run-2: #7f838a;
  --hmi-sh-run2-0: #d2d4d7; --hmi-sh-run2-1: #bcbfc3; --hmi-sh-run2-2: #a5a8ad;
  --hmi-sh-off-0: #e6e7e9; --hmi-sh-off-1: #d6d7da; --hmi-sh-off-2: #c3c5c9;
  --hmi-sh-panel-0: #e2e3e6; --hmi-sh-panel-1: #d4d5d8; --hmi-sh-panel-2: #c6c8cc;
  --hmi-sh-zone-0: rgba(255,255,255,.32); --hmi-sh-zone-1: rgba(255,255,255,.12); --hmi-sh-zone-2: rgba(0,0,0,.05);
  --hmi-sh-canvas-0: #e0e1e3; --hmi-sh-canvas-2: #cdced1;
  --hmi-sh-tube-dk: rgba(0,0,0,.38); --hmi-sh-tube-hi: rgba(255,255,255,.55);
}
[data-theme="dark"] {
  --hmi-sh-run-0: #646a72; --hmi-sh-run-1: #3f444a; --hmi-sh-run-2: #22262a;
  --hmi-sh-run2-0: #41464c; --hmi-sh-run2-1: #30343a; --hmi-sh-run2-2: #23262b;
  --hmi-sh-off-0: #2a2d32; --hmi-sh-off-1: #1f2226; --hmi-sh-off-2: #15171a;
  --hmi-sh-panel-0: #24272c; --hmi-sh-panel-1: #1c1f23; --hmi-sh-panel-2: #141619;
  --hmi-sh-zone-0: rgba(255,255,255,.055); --hmi-sh-zone-1: rgba(255,255,255,.02); --hmi-sh-zone-2: rgba(0,0,0,.18);
  --hmi-sh-canvas-0: #1b1d21; --hmi-sh-canvas-2: #101214;
  --hmi-sh-tube-dk: rgba(0,0,0,.55); --hmi-sh-tube-hi: rgba(255,255,255,.3);
}
.hmi-defs .hmi-g-run .s0 { stop-color: var(--hmi-sh-run-0); } .hmi-defs .hmi-g-run .s1 { stop-color: var(--hmi-sh-run-1); } .hmi-defs .hmi-g-run .s2 { stop-color: var(--hmi-sh-run-2); }
.hmi-defs .hmi-g-run2 .s0 { stop-color: var(--hmi-sh-run2-0); } .hmi-defs .hmi-g-run2 .s1 { stop-color: var(--hmi-sh-run2-1); } .hmi-defs .hmi-g-run2 .s2 { stop-color: var(--hmi-sh-run2-2); }
.hmi-defs .hmi-g-off .s0 { stop-color: var(--hmi-sh-off-0); } .hmi-defs .hmi-g-off .s1 { stop-color: var(--hmi-sh-off-1); } .hmi-defs .hmi-g-off .s2 { stop-color: var(--hmi-sh-off-2); }
.hmi-defs .hmi-g-panel .s0 { stop-color: var(--hmi-sh-panel-0); } .hmi-defs .hmi-g-panel .s1 { stop-color: var(--hmi-sh-panel-1); } .hmi-defs .hmi-g-panel .s2 { stop-color: var(--hmi-sh-panel-2); }
.hmi-defs .hmi-g-zone .s0 { stop-color: var(--hmi-sh-zone-0); } .hmi-defs .hmi-g-zone .s1 { stop-color: var(--hmi-sh-zone-1); } .hmi-defs .hmi-g-zone .s2 { stop-color: var(--hmi-sh-zone-2); }
.hmi-defs .hmi-g-canvas .s0 { stop-color: var(--hmi-sh-canvas-0); } .hmi-defs .hmi-g-canvas .s2 { stop-color: var(--hmi-sh-canvas-2); }

/* flat mode: canvas rect invisible, tube strokes gone, nothing else changes */
.hmi-svg .hmi-canvas { fill: none; }
.hmi-svg .hmi-edge-shadow, .hmi-svg .hmi-edge-hi { display: none; fill: none; stroke-linejoin: round; stroke-linecap: round; }

/* deep mode */
.hmi-frame[data-shade="deep"] .hmi-svg .hmi-canvas { fill: url(#hmi-g-canvas); }
.hmi-frame[data-shade="deep"] .hmi-svg .hmi-zone { fill: url(#hmi-g-zone); }
.hmi-frame[data-shade="deep"] .hmi-svg .hmi-box { fill: url(#hmi-g-panel); filter: url(#hmi-f-lift); }
.hmi-frame[data-shade="deep"] .hmi-svg .hmi-slot { fill: url(#hmi-g-off); }
/* pipes and buses read as tubes: a dark under-stroke, the medium-coloured body, a thin light crest on top */
.hmi-frame[data-shade="deep"] .hmi-svg .hmi-edge-shadow { display: block; stroke: var(--hmi-sh-tube-dk); stroke-width: 3.6; transform: translate(0, .6px); }
.hmi-frame[data-shade="deep"] .hmi-svg .hmi-edge-shadow.w-main { stroke-width: 4.6; }
.hmi-frame[data-shade="deep"] .hmi-svg .hmi-edge-shadow.w-bus { stroke-width: 5.8; }
.hmi-frame[data-shade="deep"] .hmi-svg .hmi-edge-hi { display: block; stroke: var(--hmi-sh-tube-hi); stroke-width: .5; transform: translate(0, -.45px); }
.hmi-frame[data-shade="deep"] .hmi-svg .hmi-edge-hi.w-main { stroke-width: .7; transform: translate(0, -.7px); }
.hmi-frame[data-shade="deep"] .hmi-svg .hmi-edge-hi.w-bus { stroke-width: .9; transform: translate(0, -1px); }
.hmi-frame[data-shade="deep"] .hmi-svg .hmi-edge.w-main, .hmi-frame[data-shade="deep"] .hmi-svg .hmi-edge.w-branch, .hmi-frame[data-shade="deep"] .hmi-svg .hmi-edge.w-bus { stroke-linecap: round; }
/* symbol bodies: a vertical shade (light above, dark below) + a short soft shadow; alarms glow in their own hue */
.hmi-frame[data-shade="deep"] .hmi-svg .hmi-node .b { fill: url(#hmi-g-off); }
.hmi-frame[data-shade="deep"] .hmi-svg .hmi-node[data-state="running"] .b, .hmi-frame[data-shade="deep"] .hmi-svg .hmi-node[data-state="closed"] .b, .hmi-frame[data-shade="deep"] .hmi-svg .hmi-node[data-state="open"] .b,
.hmi-frame[data-shade="deep"] .hmi-svg .hmi-node[data-state="energized"] .b, .hmi-frame[data-shade="deep"] .hmi-svg .hmi-node[data-state="on"] .b, .hmi-frame[data-shade="deep"] .hmi-svg .hmi-node[data-state="up"] .b,
.hmi-frame[data-shade="deep"] .hmi-svg .hmi-node[data-state="online"] .b, .hmi-frame[data-shade="deep"] .hmi-svg .hmi-node[data-state="modulating"] .b, .hmi-frame[data-shade="deep"] .hmi-svg .hmi-node[data-state="float"] .b,
.hmi-frame[data-shade="deep"] .hmi-svg .hmi-node[data-state="connected"] .b, .hmi-frame[data-shade="deep"] .hmi-svg .hmi-node[data-state="normal"] .b, .hmi-frame[data-shade="deep"] .hmi-svg .hmi-node[data-state="clean"] .b { fill: url(#hmi-g-run); }
.hmi-frame[data-shade="deep"] .hmi-svg .hmi-node[data-state="open"][data-sym^="cb"] .b, .hmi-frame[data-shade="deep"] .hmi-svg .hmi-node[data-state="open"][data-sym="disconnector"] .b { fill: transparent; }
.hmi-frame[data-shade="deep"] .hmi-svg .hmi-node[data-state="standby"] .b { fill: url(#hmi-g-run2); }
/* one filter pass per layer, not one per symbol: 599 per-node drop shadows made the Room Layout tab take 25-36 s to
   ready in headless (software compositing); the union shadow of the layer reads the same (gate H17) */
.hmi-frame[data-shade="deep"] .hmi-svg .hmi-nodes { filter: url(#hmi-f-soft); }
.hmi-frame[data-shade="deep"] .hmi-svg .hmi-node[data-alarm="1"] > [data-sym], .hmi-frame[data-shade="deep"] .hmi-svg .hmi-node[data-alarm="2"] > [data-sym] { filter: url(#hmi-f-glow); }
.hmi-frame[data-shade="deep"] .hmi-svg [data-role="titleblock"] rect { fill: url(#hmi-g-panel); filter: url(#hmi-f-lift); }
.hmi-frame[data-shade="deep"] .hmi-svg .hmi-flow { opacity: 1; }
.hmi-btn-shade[aria-pressed="true"] { border-color: var(--hmi-line-2); color: var(--hmi-text); }
@media (prefers-reduced-motion: reduce) { .hmi-frame[data-shade="deep"] .hmi-svg .hmi-node > [data-sym] { filter: none; } }

/* plan-view zones and rooms are boundaries, never fills: outline only in both modes, label top-left */
.hmi-svg .hmi-node[data-sym="fire-zone"] .b, .hmi-svg .hmi-node[data-sym="room"] .b, .hmi-svg .hmi-node[data-sym="sec-zone"] .b { fill: transparent !important; stroke-dasharray: 8 4; stroke: var(--hmi-line-2); }
.hmi-svg .hmi-node[data-sym="fire-zone"][data-alarm="1"] .b { stroke: var(--hmi-alm-1); stroke-dasharray: none; } .hmi-svg .hmi-node[data-sym="fire-zone"][data-alarm="2"] .b { stroke: var(--hmi-alm-2); }   /* an impaired zone shows on its outline, not only its badge */
.hmi-svg .hmi-node[data-sym="fire-zone"]:hover .b, .hmi-svg .hmi-node[data-sym="fire-zone"].is-selected .b { stroke: var(--hmi-info); }
.hmi-frame[data-shade="deep"] .hmi-svg .hmi-node[data-sym="fire-zone"] > [data-sym], .hmi-frame[data-shade="deep"] .hmi-svg .hmi-node[data-sym="room"] > [data-sym] { filter: none; }
.hmi-svg .hmi-node[data-sym="rack-plan"] .b { stroke-width: .6; }

/* ── operator truth (owner brief "BMS_UIUX_Master_Prompt", PRD_BMS_OPERATOR_HMI O2–O5) ─────────────────────────── */
/* flow only with evidence: the dash march and arrows exist only on running lines; a line without evidence is dimmed */
.hmi-svg .hmi-flow:not([data-flow="running"]) { display: none; }
.hmi-svg .hmi-edge[data-flow="unknown"] { opacity: .5; }
.hmi-svg .hmi-edge[data-flow="stopped"] { opacity: .75; }
/* not instrumented: neutral outline, no fill, no state colour */
.hmi-svg .hmi-node[data-state="na"] .b { fill: transparent !important; }
.hmi-svg .hmi-node[data-state="na"] { color: var(--hmi-line-2); }
/* data quality: no sample = dashed outline around the symbol; partial = dotted */
.hmi-svg .hmi-node[data-quality="nosample"] .hmi-hit { stroke: var(--hmi-text-3); stroke-width: 1; stroke-dasharray: 3 2; fill: none; }
.hmi-svg .hmi-node[data-quality="partial"] .hmi-hit { stroke: var(--hmi-text-3); stroke-width: 1; stroke-dasharray: 1 2; fill: none; }
/* alarm badge: a diamond with the ISA priority digit — readable without colour; hollow once acknowledged */
.hmi-svg .hmi-alarm-badge path { stroke: var(--hmi-bg); stroke-width: 1.2; }
.hmi-svg .hmi-alarm-badge[data-prio="1"] path { fill: var(--hmi-alm-1); }
.hmi-svg .hmi-alarm-badge[data-prio="2"] path { fill: var(--hmi-alm-2); }
.hmi-svg .hmi-alarm-badge[data-prio="3"] path { fill: var(--hmi-alm-3); }
.hmi-svg .hmi-alarm-badge text { fill: #000; font: 700 9px 'JetBrains Mono', ui-monospace, monospace; }
.hmi-svg .hmi-alarm-badge[data-ack="1"] path { fill: var(--hmi-bg); stroke: var(--hmi-text); stroke-width: 1.4; }
.hmi-svg .hmi-alarm-badge[data-ack="1"] text { fill: var(--hmi-text); }

/* equipment finder in the sheet bar (O9) and the selected item */
.hmi-bar .hmi-find { max-width: 220px; min-width: 0; height: 26px; font: 500 11px 'JetBrains Mono', ui-monospace, monospace; color: var(--hmi-text); background: var(--hmi-bg); border: 1px solid var(--hmi-frame); border-radius: 2px; padding: 0 4px; }
@media (max-width: 600px) { .hmi-bar .hmi-find { max-width: 132px; height: 32px; font-size: 16px; } .hmi-bar .hmi-title { display: none; } }
.hmi-svg .hmi-node[data-selected] .hmi-hit { stroke: var(--hmi-info, var(--hmi-text)); stroke-width: 1.6; fill: none; }
/* a box node (zone, application, field group, tray) has no hit rect: its own outline carries the selection */
.hmi-svg .hmi-node[data-box][data-selected] rect.b { stroke: var(--hmi-info, var(--hmi-text)); stroke-width: 1.6; }

/* moving view: shed the shading cost until the view settles (180 ms) — text, lines, states and alarm badges stay */
.hmi-frame[data-moving] .hmi-svg .hmi-nodes, .hmi-frame[data-moving] .hmi-svg .hmi-node > [data-sym], .hmi-frame[data-moving] .hmi-svg .hmi-box { filter: none !important; }
.hmi-frame[data-moving] .hmi-svg .hmi-edge-shadows, .hmi-frame[data-moving] .hmi-svg .hmi-edge-his, .hmi-frame[data-moving] .hmi-svg .hmi-flow { display: none; }
.hmi-frame[data-moving] .hmi-svg { shape-rendering: optimizeSpeed; text-rendering: optimizeSpeed; }
.hmi-frame[data-moving] .hmi-svg { will-change: transform; }
/* SLD mimic modal with its feed one-line: the legacy zoom buttons drove the retired drawing — the sheet bar has its own */
#sldMimic:has(.hmi-host[data-hmi-sheet="sld-l3"]) #sldZoomIn, #sldMimic:has(.hmi-host[data-hmi-sheet="sld-l3"]) #sldZoomOut, #sldMimic:has(.hmi-host[data-hmi-sheet="sld-l3"]) #sldZoomFit { display: none; }

/* legibility floor (geometry gate G5: a label under 8.5 px on screen is texture, not data): a sheet never renders below
   the scale its smallest label needs; a narrower frame scrolls the sheet sideways inside the frame instead of
   shrinking it, as the legacy drawings did. The minimum width is set per sheet by the renderer (--hmi-min-w). */
.hmi-frame .hmi-vp { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.pn .bx .hmi-frame .hmi-vp > svg.hmi-svg, .ep .bx .hmi-frame .hmi-vp > svg.hmi-svg, .hmi-frame .hmi-vp > svg.hmi-svg { min-width: var(--hmi-min-w, 0) !important; }
/* PRD-ELECTRICAL-BMS R190 "Whole": the whole sheet on screen, both axes; the floor above is lifted for this overview only
   (the renderer sets the svg width from the stage height). Small labels drop by LOD. */
.hmi-frame.is-fit-all .hmi-vp > svg.hmi-svg, .pn .bx .hmi-frame.is-fit-all .hmi-vp > svg.hmi-svg, .ep .bx .hmi-frame.is-fit-all .hmi-vp > svg.hmi-svg { min-width: 0 !important; margin: 0 auto; display: block; }
/* the EPMS stage ends under the absolute 50 px status bar: Whole keeps the sheet above it */
#epms-sld-view .hmi-frame, #epms-lv-view .hmi-frame { --hmi-fit-inset: 50px; }

/* PRD-ELECTRICAL-BMS E3: breaker state glyph, lamp and value tag (IEC 60617 practice; colour only from the state tokens) */
.hmi-svg .hmi-brk rect[data-brk-glyph] { fill: none; stroke: var(--hmi-text-2); stroke-width: 1.2; }
.hmi-svg .hmi-brk rect[data-brk="closed"] { fill: var(--hmi-text-2); }
.hmi-svg .hmi-brk rect[data-brk="tripped"] { fill: var(--vfx-alarm, #f85149); stroke: var(--vfx-alarm, #f85149); transform-box: fill-box; transform-origin: center; transform: rotate(45deg); }
.hmi-svg .hmi-brk rect[data-brk="na"] { stroke-dasharray: 2 2; }
.hmi-svg .hmi-brk circle[data-lamp] { fill: none; stroke: var(--hmi-text-3); stroke-width: 1; }
.hmi-svg .hmi-brk circle[data-lamp-state="running"] { fill: var(--vfx-run, #3fb950); stroke: var(--vfx-run, #3fb950); }
.hmi-svg .hmi-brk circle[data-lamp-state="alarm"] { fill: var(--vfx-alarm, #f85149); stroke: var(--vfx-alarm, #f85149); }
.hmi-svg .hmi-brk-tag { font-size: 9px; }
/* PRD-ELECTRICAL-BMS E2: on an electrical sheet in the State view the moving flow overlay takes the running ink (lifted
   toward the text colour, as conv-live.css does for the fluids), never the feed-identity hue: a live bus reads green on
   both cockpits. Feed A / B stays in the label and the bus tag. */
.hmi-frame[data-vfx-mode]:not([data-vfx-mode="flat"]):not([data-vfx-mode="thermal"]) .hmi-svg .hmi-flow.m-power,
.hmi-frame[data-vfx-mode]:not([data-vfx-mode="flat"]):not([data-vfx-mode="thermal"]) .hmi-svg .hmi-flow.m-feed_a,
.hmi-frame[data-vfx-mode]:not([data-vfx-mode="flat"]):not([data-vfx-mode="thermal"]) .hmi-svg .hmi-flow.m-feed_b { stroke: color-mix(in oklch, var(--vfx-run, #3fb950) 55%, var(--hmi-text)); }
/* PRD-ELECTRICAL-BMS E2: in the State view a direction arrow on a conductor is ink (it shows which way power goes; the
   conductor itself carries the state), never the feed-identity hue, which read as a standby line on DC AI's incomer */
.hmi-frame[data-vfx-mode]:not([data-vfx-mode="flat"]):not([data-vfx-mode="thermal"]) .hmi-svg .hmi-arrow.m-power,
.hmi-frame[data-vfx-mode]:not([data-vfx-mode="flat"]):not([data-vfx-mode="thermal"]) .hmi-svg .hmi-arrow.m-feed_a,
.hmi-frame[data-vfx-mode]:not([data-vfx-mode="flat"]):not([data-vfx-mode="thermal"]) .hmi-svg .hmi-arrow.m-feed_b { color: var(--hmi-text-2, var(--hmi-text)); }
