/* Live demo page only, v6. Loaded after site.v8.css. Chrome stays monochrome; the system colours of the home page
   building (--c-power, --c-climate, --c-lighting, --c-security, --c-network, --c-bms, defined in site.v8.css)
   appear only inside the simulation drawings, the 3D view and the operator screen. */

:root {
  --st-run: var(--c-climate);
  --st-alarm: var(--c-power);
  --st-wait: var(--c-lighting);
  --st-off: #6b6b6b;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --st-off: #8c8c8c; } }
:root[data-theme="dark"] { --st-off: #8c8c8c; }

/* Page frame */
.simtag { display: inline-flex; align-items: center; gap: 8px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0; border: 1.5px solid var(--ink); border-radius: 999px; padding: 3px 12px; white-space: nowrap; }
.simtag::before { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid currentColor; }
.simbar { position: sticky; top: 72px; z-index: 40; background: var(--bg); border-bottom: 1px solid var(--line); }
.simbar__in { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; min-height: 60px; padding-block: 8px; }
.simbar__nav { display: flex; gap: 4px; margin-right: auto; flex-wrap: wrap; }
.simbar__nav a { padding: 8px 12px; border-radius: 999px; text-decoration: none; font-weight: 500; font-size: 0.9375rem; }
.simbar__nav a:hover { background: var(--surface); }
.simbar__clock { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 0.9375rem; }
.demo { padding-block: clamp(40px, 6vw, 80px) 0; scroll-margin-top: 140px; }
.demo:last-of-type { padding-bottom: var(--section); }
.demo__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 12px 32px; margin-bottom: 24px; }
.demo__head .lead { margin-top: 12px; }
.demo-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(20px, 3vw, 36px); align-items: start; }
@media (max-width: 960px) { .demo-grid { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .simbar__nav { display: none; } .simbar__in { gap: 8px 10px; } }

/* Panels */
.panel { border: 1.5px solid var(--ink); min-width: 0; }
.panel__sec { padding: 16px 18px 18px; border-top: 1px solid var(--line); }
.panel__sec:first-child { border-top: 0; }
.panel h3, .sheet h3 { font-family: var(--font); font-size: 1rem; font-weight: 700; letter-spacing: 0; margin-bottom: 12px; }
.hint { font-size: 0.875rem; color: var(--ink-2); margin-top: 10px; }
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; }
.btnrow .btn { flex: 1 1 auto; }
.btnrow + .btnrow, .btnrow + .kv { margin-top: 10px; }
.btnrow--chips .chip { flex: 1 1 10rem; justify-content: center; }
.btn--line[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.chip.is-wide { width: 100%; justify-content: center; }
.chip:disabled, .btn:disabled { opacity: 0.45; cursor: not-allowed; }
.ctl { display: grid; gap: 6px; margin-top: 14px; }
.ctl > label, .ctl > .lbl { font-weight: 600; font-size: 0.9375rem; display: flex; justify-content: space-between; gap: 12px; }
.ctl output, .num { font-variant-numeric: tabular-nums; font-weight: 600; }
input[type="range"] { width: 100%; height: 32px; margin: 0; accent-color: var(--ink); cursor: pointer; }
input[type="number"] { width: 100%; min-height: 44px; padding: 8px 12px; font: inherit; font-size: 1rem; color: var(--ink); background: var(--bg); border: 1.5px solid var(--ink-2); border-radius: var(--radius); font-variant-numeric: tabular-nums; }
input[type="number"]:hover { border-color: var(--ink); }
input[type="number"]:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; border-color: var(--ink); }

/* Segmented buttons (mode, fan speed) */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); border: 1.5px solid var(--ink); border-radius: 999px; overflow: hidden; }
.seg button { min-height: 40px; border: 0; border-left: 1px solid var(--line-2); background: transparent; color: var(--ink); font: inherit; font-size: 0.875rem; font-weight: 600; cursor: pointer; padding: 0 6px; }
.seg button:first-child { border-left: 0; }
.seg button:hover { background: var(--surface); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.seg button:focus-visible { outline: 2px solid var(--ink); outline-offset: -4px; }
.seg button[aria-pressed="true"]:focus-visible { outline-color: var(--bg); }

.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper button { width: 40px; height: 40px; border-radius: 999px; border: 1.5px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer; font-size: 1.125rem; line-height: 1; display: grid; place-items: center; }
.stepper button:hover { background: var(--ink); color: var(--bg); }
.stepper output { min-width: 7.5em; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }

.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0; border-top: 1px solid var(--line); margin-top: 12px; }
.kv > div { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.kv > .kv__wide { grid-column: 1 / -1; }
.kv dt { font-size: 0.8125rem; color: var(--ink-2); }
.kv dd { margin: 2px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Status text with a shape so colour is never the only signal: dot running, triangle alarm, dashed ring waiting, ring off */
.st { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 0.875rem; }
.st::before { content: ""; flex: none; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--st-off); }
.st[data-st="run"]::before { background: var(--st-run); border-color: var(--st-run); }
.st[data-st="alarm"]::before { border-radius: 0; border: 0; width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 10px solid var(--st-alarm); }
.st[data-st="wait"]::before { border-style: dashed; border-color: var(--st-wait); border-width: 2px; }

/* Alarm severity: shape and word, never colour alone. High triangle, medium diamond, low circle */
.sev { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 0.8125rem; white-space: nowrap; }
.sev::before { content: ""; flex: none; }
.sev[data-sev="high"]::before { width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 11px solid var(--c-power); }
.sev[data-sev="medium"]::before { width: 9px; height: 9px; background: var(--c-lighting); transform: rotate(45deg); margin: 0 1px; }
.sev[data-sev="low"]::before { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--c-bms); }
.hint .sev { vertical-align: -1px; }

/* Room controller log */
.i3-log { margin-top: clamp(20px, 3vw, 36px); }
.log { list-style: none; padding: 0 18px; max-height: 280px; overflow-y: auto; margin: 0; }
.log li { display: grid; grid-template-columns: 4.2em 8.4em minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 0.9063rem; line-height: 1.45; }
.log li:last-child { border-bottom: 0; }
.log time { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.log .cat { font-size: 0.75rem; font-weight: 700; letter-spacing: 0; padding-top: 2px; }
@media (max-width: 480px) {
  .log li { grid-template-columns: 4em minmax(0, 1fr); }
  .log .cat { grid-column: 2; grid-row: 1; }
  .log li > span:last-child { grid-column: 1 / -1; }
}

/* Room Control Unit Simulation: 3D view. The view is an enhancement: the poster and the panel work without it.
   Indicator colours inside the view are the home page system colours in their brighter tones. */
.i3 { --i3-sky: #cdd9e0; --i3-climate: #76aaa1; --i3-lighting: #c9a95a; --i3-security: #ad88aa; --i3-power: #c4886f; --i3-bms: #8e9aa7; }
.demo-grid--i3 { grid-template-columns: minmax(0, 8fr) minmax(320px, 4fr); }
.demo-grid--i3 > .i3-stage { position: sticky; top: 148px; z-index: 1; background: var(--bg); }
@media (max-width: 1100px) { .demo-grid--i3 { grid-template-columns: 1fr; } .demo-grid--i3 > .i3-stage { position: static; } }
@media (max-height: 760px) { .demo-grid--i3 > .i3-stage { position: static; } }
.i3-view { position: relative; aspect-ratio: 3 / 2; background: var(--i3-sky); overflow: hidden; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
@media (max-width: 700px) { .i3-view { aspect-ratio: 8 / 7; } }
.i3-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: opacity 0.6s var(--ease); }
.i3-canvas, .i3-canvas canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.i3-canvas canvas { touch-action: none; cursor: grab; outline: none; }
.i3-canvas canvas:active { cursor: grabbing; }
.i3-view[data-state="live"] .i3-poster { opacity: 0; pointer-events: none; }
.i3-view:not([data-state="live"]) .i3-hots, .i3-view:not([data-state="live"]) .i3-canvas { visibility: hidden; }
.i3-gate { position: absolute; left: 12px; bottom: 12px; right: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 12px 14px; background: var(--bg); border: 1.5px solid var(--ink); border-radius: var(--radius); max-width: 34rem; }
.i3-gate__msg { font-weight: 600; flex: 1 1 14rem; }
.i3-gate__note { flex-basis: 100%; font-size: 0.8125rem; color: var(--ink-2); }
.i3-view[data-state="live"] .i3-gate { display: none; }
.i3-view[data-state="loading"] .i3-gate__msg::after { content: ""; display: inline-block; width: 0.9em; height: 0.9em; margin-left: 10px; vertical-align: -0.1em; border: 2px solid var(--line-2); border-top-color: var(--ink); border-radius: 50%; animation: spin 0.9s linear infinite; }
.i3-view[data-state="nogl"] .i3-gate__note { display: none; }
.i3-views { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 18px 14px; }
.i3-views__lbl { font-family: var(--mono); font-size: 0.8125rem; letter-spacing: 0; color: var(--ink-3); margin-right: 4px; }
.i3-views .btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Hotspots pinned to devices in the 3D view (pointer shortcuts; the panel holds the same controls) */
.i3-hots { position: absolute; inset: 0; pointer-events: none; }
.i3-hot { position: absolute; left: 0; top: 0; margin: -16px 0 0 -16px; width: 32px; height: 32px; padding: 0; border-radius: 999px; border: 1.5px solid color-mix(in srgb, var(--ink) 55%, transparent); background: color-mix(in srgb, var(--bg) 88%, transparent); color: var(--ink); display: grid; place-items: center; pointer-events: auto; cursor: pointer; transition: background-color 0.25s, border-color 0.25s, color 0.25s; will-change: transform; }
.i3-hot::before { content: ""; position: absolute; inset: -7px; border-radius: 999px; }
.i3-hot svg { width: 17px; height: 17px; }
.i3-hot:hover { border-color: var(--ink); }
.i3-hot__t { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); margin-top: 3px; font-size: 0.6875rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; padding: 0 5px; border-radius: 3px; background: color-mix(in srgb, var(--bg) 85%, transparent); line-height: 1.5; }
.i3-hot__t:empty { display: none; }
.i3-hot[data-st="on"] { border-color: var(--c-lighting); color: var(--c-lighting); }
.i3-hot--light[data-st="on"] svg { fill: color-mix(in srgb, var(--c-lighting) 30%, transparent); }
.i3-hot[data-st="cool"] { border-color: var(--c-climate); color: var(--c-climate); }
.i3-hot[data-st="secure"] { border-color: var(--c-security); color: var(--c-security); }
.i3-hot[data-st="alarm"] { border-color: var(--c-power); color: var(--c-power); border-width: 2.5px; border-style: dashed; }
@media (max-width: 560px) { .i3-hot { width: 30px; height: 30px; margin: -15px 0 0 -15px; } .i3-hot--card, .i3-hot--keypad, .i3-hot--ac, .i3-hot--door { display: none; } }
/* Status labels (Do not disturb, Make up room): a lit pill with icon and words, readable from the default view */
.i3-hot--status, .i3-hot--status[data-st] { width: auto; height: 30px; margin: -15px 0 0 0; padding: 0 12px 0 8px; gap: 6px; grid-auto-flow: column; border-width: 2px; border-style: solid; font-size: 0.8125rem; font-weight: 700; white-space: nowrap; translate: -50% 0; }
.i3-hot--status .i3-hot__t { position: static; transform: none; margin: 0; padding: 0; background: none; font-size: inherit; line-height: 1; }
.i3-hot--status[data-st="secure"] { background: var(--c-security); border-color: var(--c-security); color: var(--bg); }
.i3-hot--status[data-st="on"] { background: var(--c-lighting); border-color: var(--c-lighting); color: #111111; }
.i3-hot--status svg { fill: none; }
@media (max-width: 560px) { .i3-hot--status, .i3-hot--status[data-st] { height: 28px; margin-top: -14px; font-size: 0.75rem; padding: 0 10px 0 6px; } }
/* Mute button for the smoke alarm siren, over the 3D view while the alarm is on */
.i3-mute { position: absolute; top: 12px; right: 12px; z-index: 2; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px 0 10px; border-radius: 999px; border: 2px solid var(--c-power); background: var(--bg); color: var(--ink); font: inherit; font-size: 0.875rem; font-weight: 600; cursor: pointer; }
.i3-mute:hover { border-color: var(--ink); }
.i3-mute svg, .siren-btn svg { width: 18px; height: 18px; flex: none; }
.siren-btn { display: inline-flex; align-items: center; gap: 8px; }
[data-siren-mute] .snd-off, [data-siren-mute][aria-pressed="true"] .snd-on { display: none; }
[data-siren-mute][aria-pressed="true"] .snd-off { display: inline; }

/* Room panel */
.i3-lights { list-style: none; padding: 0; display: grid; gap: 6px; margin-top: 12px; }
.i3-lights li { display: grid; grid-template-columns: minmax(9rem, 10.5rem) minmax(0, 1fr); gap: 12px; align-items: center; }
.i3-lights .chip { justify-content: space-between; width: 100%; gap: 8px; }
.i3-lights .chip .num { font-size: 0.8125rem; }
.i3-lights__note { font-size: 0.8125rem; color: var(--ink-3); }
@media (max-width: 380px) { .i3-lights li { grid-template-columns: 1fr; gap: 2px; } }

/* ===== Building management system: operator screen ===== */
.bms { border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; background: var(--bg); box-shadow: var(--shadow); }
.bms__top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.bms__title { font-weight: 700; margin-right: auto; }
.bms__title span { font-weight: 400; color: var(--ink-3); font-size: 0.8125rem; margin-left: 8px; }
.bms__clock { font-family: var(--mono); font-size: 0.8125rem; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.bms__alarmbtn { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1.5px solid var(--ink-3); background: var(--bg); color: var(--ink); font: inherit; font-size: 0.875rem; cursor: pointer; }
.bms__alarmbtn svg { width: 14px; height: 14px; fill: none; stroke: var(--st-off); stroke-width: 2; stroke-linejoin: round; }
.bms__alarmbtn[data-st="alarm"] { border-color: var(--c-power); }
.bms__alarmbtn[data-st="alarm"] svg { fill: var(--c-power); stroke: var(--c-power); }
.bms__alarmbtn[data-st="wait"] svg { stroke: var(--c-lighting); }
.bms__alarmbtn:hover { border-color: var(--ink); }
.bms__body { display: grid; grid-template-columns: 208px minmax(0, 1fr); min-height: 540px; }
.bms__tree { border-right: 1px solid var(--line); background: var(--surface); padding: 14px 10px; font-size: 0.9063rem; }
.bms__site { font-family: var(--mono); font-size: 0.8125rem; letter-spacing: 0; color: var(--ink-3); padding: 0 8px 10px; }
.bms__tree ul { list-style: none; padding: 0; margin: 0; }
.bms__tree ul ul { padding-left: 10px; margin: 2px 0 6px 8px; border-left: 1px solid var(--line-2); }
.bms__gl { display: flex; align-items: center; gap: 8px; padding: 8px 8px 2px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0; color: var(--ink-2); }
.bms__gl::before { content: ""; width: 12px; height: 3px; border-radius: 2px; background: var(--c); }
.bms__tree button { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 36px; padding: 6px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-2); font: inherit; text-align: left; cursor: pointer; }
.bms__tree button:hover { background: var(--surface-2); color: var(--ink); }
.bms__tree button[aria-current="true"] { background: var(--ink); color: var(--bg); font-weight: 600; }
.bms__tree button:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.badge { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; border: 1px solid currentColor; font-size: 0.75rem; font-weight: 700; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.bms__main { min-width: 0; padding: 16px; display: grid; gap: 16px; align-content: start; }
.bms__h { font-family: var(--font); font-size: 1.0625rem; font-weight: 700; margin: 0 0 12px; outline: none; }
.bms__h:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.bms__pane[hidden] { display: none; }
.bms__cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; margin-bottom: 16px; }
.bms__card { border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; min-width: 0; }
.bms__card + .bms__card { margin-top: 16px; }
.bms__cols .bms__card + .bms__card { margin-top: 0; }
.bms__card h4 { font-size: 0.875rem; font-weight: 700; margin: 0 0 8px; }
.bms__scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; }
.bms__scroll:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.bms__ctls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 16px; align-items: end; }
.bms__room { margin-top: 16px; }
.bms__room .arrowlink { margin-top: 12px; }
.bms-faults { margin-top: clamp(20px, 3vw, 28px); }

/* Key figures */
.kpis { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.kpis li { border: 1px solid var(--line); border-top: 3px solid var(--c); border-radius: 6px; padding: 10px 12px; display: grid; gap: 2px; min-width: 0; }
.kpi__l { font-size: 0.8125rem; color: var(--ink-2); }
.kpi__v b { font-family: var(--font-display); font-size: clamp(1.5rem, 2.2vw, 2rem); font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi__v small { font-size: 0.875rem; color: var(--ink-2); }
.kpi__s { font-size: 0.8125rem; color: var(--ink-2); }
.kpi__s .st { font-size: 0.8125rem; }

/* Equipment list */
.eqlist { list-style: none; padding: 0; margin: 0; }
.eqlist li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0 8px 12px; border-bottom: 1px solid var(--line); font-size: 0.9063rem; position: relative; }
.eqlist li::before { content: ""; position: absolute; left: 0; top: 50%; width: 3px; height: 14px; margin-top: -7px; border-radius: 2px; background: var(--c); }
.eqlist li:last-child { border-bottom: 0; }
.eqlist .st { text-align: right; }

/* Alarm lists */
.alist { list-style: none; padding: 0; margin: 0; }
.alist li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: center; }
.alist li:last-child { border-bottom: 0; }
.alist .a-txt { font-size: 0.9375rem; }
.alist .a-meta { font-size: 0.8125rem; color: var(--ink-2); }
.alist .a-unack .a-txt { font-weight: 700; }
.alist-empty { color: var(--ink-2); font-size: 0.9375rem; padding: 6px 0; }
.alist-empty[hidden] { display: none; }

/* Tables */
.tablewrap { overflow-x: auto; }
.mtab { width: 100%; border-collapse: collapse; font-size: 0.9063rem; margin-top: 12px; }
.mtab caption { text-align: left; font-weight: 700; font-size: 0.875rem; padding-bottom: 6px; }
.mtab th, .mtab td { text-align: left; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.mtab thead th { font-size: 0.8125rem; color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.mtab td.num { font-variant-numeric: tabular-nums; text-align: right; }
.mtab tbody th { font-weight: 600; white-space: nowrap; }
.atab { min-width: 680px; margin-top: 0; }
.atab tr.is-unack td { font-weight: 600; }
.atab td:last-child { text-align: right; }
.rtab { min-width: 520px; margin-top: 0; }
.pane-alarms .btnrow { margin-top: 12px; }
#pane-alarms .btnrow { margin-top: 14px; }

/* Charts */
.chart { display: block; width: 100%; height: 180px; overflow: visible; }
.chart--tall { height: 220px; }
.chart .gl { stroke: var(--line); stroke-width: 1; }
.chart .ax { fill: var(--ink-3); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .ln { fill: none; stroke: var(--c); stroke-width: 2; stroke-linejoin: round; }
.chart .l2 { stroke-dasharray: 7 4; }
.chart .l3 { stroke-dasharray: 2 3; stroke-width: 2.2; }
.tlegend { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 8px 0 0; font-size: 0.875rem; list-style: none; margin: 0; }
.tlegend li { display: inline-flex; align-items: center; gap: 8px; }
.tlegend svg { width: 28px; height: 10px; }
.tlegend line { stroke: var(--c, var(--ink)); stroke-width: 2.4; }
.tlegend .l2 { stroke-dasharray: 7 4; }
.tlegend .l3 { stroke-dasharray: 2 3; }
.tvals { margin-top: 12px; font-size: 0.9063rem; }
.tvals summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.tvals table { border-collapse: collapse; margin-top: 8px; font-variant-numeric: tabular-nums; }
.tvals th, .tvals td { padding: 4px 14px 4px 0; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.tvals { overflow-x: auto; }

/* Single-line diagram: live conductors in the power colour, dead ones grey and dashed */
.sld { display: block; width: 100%; min-width: 720px; height: auto; }
.sld text { font-family: var(--font); font-size: 13px; fill: var(--ink); font-variant-numeric: tabular-nums; }
.sld .tag { font-weight: 700; font-size: 12.5px; letter-spacing: 0; }
.sld .tag--sm { font-size: 11.5px; fill: var(--ink-2); }
.sld .lbl2 { fill: var(--ink-2); font-size: 12px; }
.sld .val { font-weight: 600; font-size: 14px; }
.sld .load { fill: var(--ink-2); font-size: 12.5px; }
.sld .sym-t { font-weight: 700; font-size: 13px; }
.sld .sym { fill: var(--bg); stroke: var(--ink-3); stroke-width: 1.6; }
.sld .sym-in { fill: none; stroke: var(--ink-3); stroke-width: 1.6; }
.sld .w { fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-dasharray: 5 4; }
.sld .bus { fill: none; stroke: var(--ink-3); stroke-width: 6; stroke-dasharray: 10 6; }
.sld .box { fill: none; stroke: var(--line-2); stroke-width: 1.2; }
.sld .brk { fill: var(--bg); stroke: var(--ink-2); stroke-width: 1.6; }
.sld .blade { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; }
.sld .dot { fill: var(--ink); }
.sld [data-live="1"] .w, .sld [data-live="1"] .bus { stroke: var(--c-power); stroke-dasharray: none; }
.sld [data-live="1"] .sym, .sld [data-live="1"] .sym-in { stroke: var(--c-power); }
.sld #sl-main[data-live="1"] .brk, .sld [data-live="1"][data-brk="closed"] .brk { fill: var(--c-power); stroke: var(--c-power); }
.sld #sl-main[data-live="0"] .brk, .sld [data-live="0"][data-brk="closed"] .brk { fill: var(--ink-3); stroke: var(--ink-3); }
.sld [data-brk="tripped"] .brk { stroke: var(--c-power); stroke-width: 2.5; }
.sld__mark path { fill: var(--c-power); }
.sld__mark[data-on="0"] { display: none; }

/* Plant schematic: chilled water and air in the climate colour; return pipe dashed so colour is not the only cue */
.scada { display: block; width: 100%; min-width: 720px; height: auto; color: var(--ink); }
.scada text { font-family: var(--font); font-size: 13px; fill: var(--ink); font-variant-numeric: tabular-nums; }
.scada .lbl2 { fill: var(--ink-2); font-size: 12px; }
.scada .tag { font-weight: 700; font-size: 12px; letter-spacing: 0; }
.scada .big { font-size: 15px; font-weight: 600; }
.scada .eq { fill: var(--bg); stroke: var(--ink); stroke-width: 1.6; }
.scada .ln { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.scada .duct { fill: none; stroke: var(--ink-2); stroke-width: 1.6; }
.scada .thin { fill: none; stroke: var(--line-2); stroke-width: 1; }
.scada .coil { fill: none; stroke: var(--c-climate); stroke-width: 1.2; }
.scada .pipe { fill: none; stroke: var(--c-climate); stroke-width: 3.5; }
.scada .pipe.ret { stroke-dasharray: 9 5; stroke-width: 2.5; }
.scada .flow { fill: none; stroke: var(--bg); stroke-width: 1.4; stroke-dasharray: 3 11; }
.is-running .flow { animation: dflow 1.2s linear infinite; }
@keyframes dflow { to { stroke-dashoffset: -28; } }
.scada .air { fill: none; stroke: var(--c-climate); stroke-width: 1.2; stroke-dasharray: 6 8; }
.is-running .air { animation: dflow 1.4s linear infinite; }
.scada .blade { transform-box: fill-box; transform-origin: center; transition: transform 0.8s var(--ease); }
.scada .vbody { fill: var(--bg); stroke: var(--ink); stroke-width: 1.6; }
.scada .vfill { fill: var(--ink); }
.scada .is-tripped .eq { stroke: var(--c-power); stroke-width: 2.5; stroke-dasharray: 5 3; }
.spin { transform-box: fill-box; transform-origin: center; }
.is-running > .spin { animation: spin 1.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.mark { stroke-width: 1.5; }
[data-st="run"] > .mark { fill: var(--st-run); stroke: var(--st-run); }
[data-st="off"] > .mark { fill: var(--bg); stroke: var(--st-off); }
[data-st="alarm"] > .mark { fill: var(--st-alarm); stroke: var(--st-alarm); }
.mark-tri { display: none; }
[data-st="alarm"] > .mark-tri { display: inline; }
[data-st="alarm"] > .mark-dot { display: none; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* Operator screen on smaller screens: the system tree becomes a scrolling row above the content */
@media (max-width: 1180px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .bms__ctls { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .bms__body { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .bms__tree { border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 10px; overflow-x: auto; }
  .bms__site { display: none; }
  .bms__tree > ul { display: flex; gap: 4px; width: max-content; }
  .bms__tree ul ul { display: flex; gap: 4px; padding: 0; margin: 0; border: 0; }
  .bms__grp { display: flex; align-items: center; }
  .bms__gl { padding: 0 4px 0 10px; font-size: 0; gap: 0; }
  .bms__gl::before { width: 3px; height: 16px; }
  .bms__tree button { white-space: nowrap; width: auto; }
  .bms__cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .simbar { position: static; }
  .demo { scroll-margin-top: 80px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis li:last-child { grid-column: 1 / -1; }
  .bms__main { padding: 12px; }
  .bms__ctls { grid-template-columns: minmax(0, 1fr); }
  .bms__title span { display: block; margin: 0; }
}

/* Paused or reduced motion: drawings hold still, values keep updating */
.is-paused .spin, .is-paused .flow, .is-paused .air { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) {
  .spin, .flow, .air { animation: none !important; }
  .i3-poster { transition: none; }
  .i3-view[data-state="loading"] .i3-gate__msg::after { animation: none; }
}
@media print { .i3-canvas, .i3-hots, .i3-gate, .i3-views { display: none; } .i3-view[data-state="live"] .i3-poster { opacity: 1; } }

/* ===== v4: simple guest controls first, engineer controls folded away ===== */
.panel h3 .h3__val { float: right; font-weight: 600; font-size: 0.875rem; color: var(--ink-2); }
.bigrow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.big { min-height: 52px; border-radius: 10px; border: 1.5px solid var(--ink-3); background: transparent; color: var(--ink); font: inherit; font-size: 1rem; font-weight: 600; cursor: pointer; padding: 6px 10px; }
.big:hover { border-color: var(--ink); }
.big[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.big:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.bigstep { display: grid; grid-template-columns: 56px minmax(0, 1fr) 56px; align-items: center; gap: 8px; }
.bigstep button { height: 52px; border-radius: 10px; border: 1.5px solid var(--ink); background: transparent; color: var(--ink); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.bigstep button:hover { background: var(--ink); color: var(--bg); }
.bigstep output { text-align: center; font-family: var(--font-display); font-size: 1.75rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.i3-tabbtn { width: 100%; justify-content: center; }
.more { border-top: 1px solid var(--line); }
.more > summary { cursor: pointer; list-style: none; padding: 16px 18px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; min-height: 52px; }
.more > summary::-webkit-details-marker { display: none; }
.more > summary::after { content: "+"; font-size: 1.25rem; font-weight: 500; }
.more[open] > summary::after { content: "\2212"; }
.more > summary:focus-visible { outline: 2px solid var(--ink); outline-offset: -4px; }
.more .i3-views { padding: 12px 0 0; }
.i3-knx, .i3-log { margin-top: clamp(20px, 3vw, 36px); }
.i3-knx > summary { cursor: pointer; list-style: none; border-bottom: 0; }
.i3-knx > summary::-webkit-details-marker { display: none; }
.i3-knx > summary .sheet__title::before { content: "+ "; }
.i3-knx[open] > summary .sheet__title::before { content: "\2212  "; }
.i3-knx .tablewrap { padding: 0 18px; }
.knxtab { min-width: 600px; }
.knx-note { padding: 0 18px 16px; }
/* Guest tablet and keypad dialogs */
.dlg { border: 0; padding: 0; background: transparent; color: var(--ink); max-width: calc(100vw - 32px); }
.dlg::backdrop { background: rgba(0, 0, 0, 0.55); }
.tab { width: min(420px, calc(100vw - 32px)); background: #121416; color: #ece9e3; border-radius: 18px; padding: 18px; border: 8px solid #2b2d30; display: grid; gap: 12px; }
.tab__top, .kp__top { display: flex; align-items: center; gap: 12px; }
.tab__t, .kp__t { font-weight: 700; font-size: 1.125rem; margin-right: auto; }
.tab__clock { font-variant-numeric: tabular-nums; color: #9aa0a6; }
.tab__x { width: 44px; height: 44px; border-radius: 999px; border: 1px solid #4a4d51; background: transparent; color: inherit; font-size: 1.5rem; cursor: pointer; }
.tab__temp { display: grid; grid-template-columns: 56px minmax(0, 1fr) 56px; align-items: center; gap: 8px; }
.tab__temp output { text-align: center; font-size: 2.25rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.tab__temp button, .tab__grid button { min-height: 52px; border-radius: 10px; border: 1px solid #3a3d41; background: #1f2225; color: #ece9e3; font: inherit; font-weight: 600; cursor: pointer; }
.tab__temp button { font-size: 1.5rem; }
.tab__sub { color: #9aa0a6; font-size: 0.875rem; text-align: center; }
.tab__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tab__grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tab__grid button[aria-pressed="true"] { background: #ece9e3; color: #121416; }
.tab button:focus-visible { outline: 2px solid #ece9e3; outline-offset: 2px; }
@media (max-width: 420px) { .tab__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kp { width: min(340px, calc(100vw - 32px)); background: #1d1f22; color: #ece9e3; border-radius: 14px; padding: 16px; display: grid; gap: 12px; }
.kp__keys { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.kp-key { min-height: 84px; border-radius: 8px; border: 1px solid #3a3d41; background: #25282b; color: #ece9e3; font: inherit; font-weight: 600; letter-spacing: 0; font-size: 0.8125rem; cursor: pointer; display: grid; place-items: center; gap: 6px; padding: 10px 6px; }
.kp-led { width: 9px; height: 9px; border-radius: 50%; background: #45484c; }
.kp-key[aria-pressed="true"] .kp-led { background: #c9a95a; box-shadow: 0 0 8px #c9a95a; }
.kp-key:focus-visible { outline: 2px solid #ece9e3; outline-offset: 2px; }
.kp__note { font-size: 0.8125rem; color: #9aa0a6; }
/* Inspection 29 Oct: a 44 px tap area around each 3D hotspot, the drawn ring stays the same size */
.i3-hot::after { content: ""; position: absolute; inset: -7px; border-radius: 999px; }
