/* hmi-runtime.css — operator interface styling for an exported HMI.
   Follows the plant HMI in www/: navy command bar with a teal underline,
   light plant area, gradient START/STOP buttons and flashing trip alarms.
   Generated by HMI Studio. */

:root {
  --hmi-bg: var(--c-slate-50);
  --hmi-panel: var(--c-white);
  --hmi-text: var(--c-slate-900);
  --hmi-accent: var(--c-cyan-600);
  --hmi-head-1: var(--c-slate-900);
  --hmi-head-2: var(--c-ink-16a);
  --hmi-run: var(--c-green-600);
  --hmi-stop: var(--c-slate-400);
  --hmi-trip: var(--c-red-600);
  --hmi-manual: var(--c-cyan-600);
  --hmi-font: var(--font-ui);

  --hmi-border: var(--c-slate-200);
  --hmi-border-strong: var(--c-slate-300);
  --hmi-muted: var(--c-slate-500);
  --hmi-surface-2: var(--c-slate-100);

  --hmi-green-mid: var(--c-green-700);
  --hmi-green-dark: var(--c-green-900);
  --hmi-red-mid: var(--c-red-700);
  --hmi-red-dark: var(--c-red-900);

  --hmi-shadow-sm: 0 1px 3px var(--c-black-a08), 0 1px 2px var(--c-black-a05);
  --hmi-shadow-lg: 0 10px 32px var(--c-black-a12), 0 4px 8px var(--c-black-a07);
  --hmi-shadow-xl: 0 20px 60px var(--c-black-a18), 0 8px 20px var(--c-black-a10);
}

[data-hmi-theme="dark"] {
  --hmi-border: var(--c-ink-22);
  --hmi-border-strong: var(--c-slate-700);
  --hmi-muted: var(--c-slate-400);
  --hmi-surface-2: var(--c-ink-14);
  --hmi-shadow-sm: 0 1px 3px var(--c-black-a40);
  --hmi-shadow-lg: 0 10px 32px var(--c-black-a50);
  --hmi-shadow-xl: 0 20px 60px var(--c-black-a60);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--hmi-bg);
  color: var(--hmi-text);
  font-family: var(--hmi-font);
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
}

.hmi-root { display: flex; flex-direction: column; height: 100vh; }

.hmi-boot {
  margin: auto;
  padding: 40px;
  text-align: center;
  color: var(--hmi-muted);
  font-size: var(--fs-4);
}
.hmi-boot-error { color: var(--hmi-trip); }

/* ---------- command bar ---------- */

.hmi-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  background: linear-gradient(160deg, var(--hmi-head-1) 0%, var(--hmi-head-2) 100%);
  border-bottom: 3px solid var(--hmi-accent);
  box-shadow: 0 3px 18px var(--c-black-a22);
  flex: 0 0 auto;
  z-index: 10;
}

.hmi-title {
  font-size: var(--fs-3);
  font-weight: 800;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--c-slate-50);
  text-shadow: 0 1px 4px var(--c-black-a40);
  border: 1.5px solid var(--c-white-a22);
  border-radius: 7px;
  padding: 6px 18px;
  white-space: nowrap;
}

.hmi-tabs { display: flex; gap: 6px; overflow-x: auto; flex: 1 1 auto; padding: 2px 0; }
.hmi-tabs::-webkit-scrollbar { height: 4px; }
.hmi-tabs::-webkit-scrollbar-thumb { background: var(--c-white-a25); border-radius: 2px; }

.hmi-tab {
  appearance: none;
  border: 1px solid var(--c-white-a22);
  background: var(--c-white-a08);
  color: var(--c-slate-300);
  font: inherit;
  font-size: var(--fs-2);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 7px 15px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s ease;
}
.hmi-tab:hover {
  background: var(--hmi-accent);
  border-color: var(--hmi-accent);
  color: var(--c-white);
  transform: translateY(-1px);
  box-shadow: 0 3px 12px var(--c-cyan-600-a40);
}
.hmi-tab.is-active {
  background: linear-gradient(160deg, var(--c-cyan-700) 0%, var(--hmi-accent) 100%);
  border-color: var(--hmi-accent);
  color: var(--c-white);
  box-shadow: 0 2px 8px var(--c-cyan-600-a45), inset 0 1px 0 var(--c-white-a18);
}

.hmi-headright { display: flex; align-items: center; gap: 12px; margin-left: auto; }

.hmi-alarmcount {
  font-size: var(--fs-2);
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 6px 13px;
  border-radius: 20px;
  border: 1.5px solid var(--c-white-a25);
  color: var(--c-slate-300);
  white-space: nowrap;
  background: transparent;
  font-family: inherit;
  cursor: pointer;
}
.hmi-alarmcount.is-alarm {
  color: var(--c-white);
  border-color: transparent;
  background: linear-gradient(160deg, var(--hmi-red-mid), var(--hmi-trip));
  box-shadow: 0 3px 14px var(--c-red-600-a50);
}
/* ISA-18.2: only what is not yet acknowledged keeps flashing */
.hmi-alarmcount.is-unack { animation: hmi-pulse 1.1s ease-in-out infinite; }
/* the colour of the worst alarm in the summary, set by the runtime */
.hmi-alarmcount.is-alarm { background: var(--hmi-alarm, linear-gradient(160deg, var(--hmi-red-mid), var(--hmi-trip))); }

.hmi-pill {
  font-size: var(--fs-1);
  font-weight: 800;
  letter-spacing: .1em;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1.5px solid currentColor;
  white-space: nowrap;
}
.hmi-pill-on  { color: var(--c-green-400); background: var(--c-green-600-a18); }
.hmi-pill-off { color: var(--c-slate-300); background: var(--c-slate-400-a16); }
.hmi-pill-bad { color: var(--c-red-300); background: var(--c-red-600-a22); animation: hmi-pulse 1.1s ease-in-out infinite; }

.hmi-clock {
  font-size: var(--fs-2);
  font-weight: 600;
  color: var(--c-slate-200);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  letter-spacing: .02em;
}

/* ---------- plant area ---------- */

.hmi-stage { position: relative; flex: 1 1 auto; overflow: hidden; }

.hmi-canvas {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  transform-origin: center center;
}

.hw { position: absolute; }
/* the moving part of a machine, drawn over its still drawing (drawing economy) */
.hw-motion { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; }
.hw svg { display: block; overflow: visible; }
/* Hover: an outline, not a drop-shadow filter. A filter on a machine whose
   artwork moves is re-run on every motion step for as long as a mouse rests
   on it, which is costly on a small panel PC such as a Raspberry Pi 5. */
.hw.is-clickable { cursor: pointer; border-radius: 4px; transition: outline-color .14s ease; outline: 2px solid transparent; outline-offset: 2px; }
.hw.is-clickable:hover { outline-color: var(--c-cyan-600-a55); }
.hw.is-trip { animation: hmi-flash 1s steps(1, end) infinite; }
.hw.is-manual { outline: 1.5px dashed var(--hmi-manual); outline-offset: 3px; border-radius: 3px; }

/* Accessibility (T-029). The keyboard focus: a white ring inside a dark blue one, seen on a light
   plant and on a dark one; only for the keyboard (:focus-visible), never after a touch. */
.hw.is-clickable:focus-visible { outline: 3px solid var(--c-blue-700); outline-offset: 4px; box-shadow: 0 0 0 4px var(--c-white); border-radius: 4px; }
:where(button, select, summary, a[href], [role="button"], [role="tab"], input[type="checkbox"], input[type="radio"], input[type="range"], [tabindex]:not([tabindex="-1"])):focus-visible {
  outline: 3px solid var(--c-blue-600); outline-offset: 2px; }
/* State marks: a shape per state, top left (the lock badge is top right), so no state is told by
   colour alone. Running: a play triangle in a circle. Tripped: a warning triangle. Manual: an M
   in a square. No PLC link: a question mark. Stopped: no mark. Pure CSS: nothing is redrawn. */
.hw[data-st]::before { content: ""; position: absolute; left: -7px; top: -7px; width: var(--hmi-mark-size, 18px); height: var(--hmi-mark-size, 18px);
  border-radius: 50%; background: var(--c-slate-900) center / 100% no-repeat; box-shadow: 0 0 0 2px var(--c-white); pointer-events: none; z-index: 2; }
.hw[data-st="run"]::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9.5 7v10l8-5z' fill='white'/%3E%3C/svg%3E"); }
.hw[data-st="trip"]::before { border-radius: 0; box-shadow: none; background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.2 23.2 21.6H.8z' fill='%23b91c1c' stroke='white' stroke-width='1.6' stroke-linejoin='round'/%3E%3Crect x='10.9' y='8.4' width='2.2' height='7.2' rx='1' fill='white'/%3E%3Ccircle cx='12' cy='18.4' r='1.45' fill='white'/%3E%3C/svg%3E"); }
.hw[data-st="manual"]::before { border-radius: 4px; background-color: var(--c-orange-900);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6.8 17V7.4l5.2 6.2 5.2-6.2V17' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.hw[data-st="offline"]::before { background-color: var(--c-slate-600);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9.2 9.4a2.9 2.9 0 1 1 4.1 2.6c-.9.4-1.3 1-1.3 1.9v.5' fill='none' stroke='white' stroke-width='2.3' stroke-linecap='round'/%3E%3Ccircle cx='12' cy='17.7' r='1.4' fill='white'/%3E%3C/svg%3E"); }
@media (forced-colors: active) { .hw[data-st]::before { forced-color-adjust: none; } .hw.is-clickable:focus-visible { outline-color: Highlight; } }

@keyframes hmi-flash { 0%, 54% { opacity: 1; } 55%, 100% { opacity: .35; } }
@keyframes hmi-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* ---------- device popup: AUTO / MANUAL and START / STOP ----------
   A light instrument card: tinted header band, stat tiles, a two-way mode
   selector, two strong command buttons, and live PLC signal rows. It keeps
   its own light palette whatever the screen's theme, so it always reads as
   the same trusted control surface. */

.hmi-dialog {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--c-slate-900-a45);   /* dimmed, not blurred: the plant stays readable behind it */
}
.hmi-dialog[hidden] { display: none; }
.hmi-dialog [hidden] { display: none !important; }

.hmi-dialog-card {
  --ink: var(--c-ink-15);
  --ink-2: var(--c-ink-38);
  --ink-3: var(--c-ink-58);
  --line: var(--c-ink-90a);
  --line-2: var(--c-ink-84);
  --paper: var(--c-white);
  --paper-2: var(--c-ink-97);
  --cyan: var(--c-cyan-700);
  --manual: var(--c-cyan-700);
  --focus: var(--c-blue-600);
  --tone: var(--c-slate-500);
  --mono: var(--font-mono);
  position: relative;
  width: min(420px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font-ui);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  box-shadow: 0 24px 60px var(--c-ink-15-a28), 0 4px 14px var(--c-ink-15-a12);
  animation: hmi-pop .18s cubic-bezier(.2, .9, .3, 1.15);
}
.hmi-dialog-card:focus { outline: none; }
@keyframes hmi-pop { from { transform: translateY(8px) scale(.985); opacity: 0; } to { transform: none; opacity: 1; } }
.hmi-dialog-card svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- header band ---- */
.hmi-dlg-head {
  position: relative;
  padding: 18px 64px 16px 20px;
  background: linear-gradient(135deg, var(--c-ink-95) 0%, var(--c-ink-92) 100%);
  border-bottom: 1px solid var(--line);
}
.hmi-dlg-head::after {                 /* state colour along the band's foot */
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 3px;
  background: var(--tone);
  transition: background .25s;
}
.hmi-dlg-kicker {
  font-size: var(--fs-1);
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--cyan);
}
.hmi-dlg-title {
  margin: 4px 0 10px;
  font-size: var(--fs-5);
  font-weight: 800;
  letter-spacing: .01em;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.hmi-dlg-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 9px;
  border-radius: 6px;
  font-size: var(--fs-2);
  font-weight: 800;
  letter-spacing: .12em;
  color: color-mix(in srgb, var(--tone) 82%, var(--c-black));
  background: color-mix(in srgb, var(--tone) 12%, var(--c-white));
  border: 1px solid color-mix(in srgb, var(--tone) 45%, var(--c-white));
}
.hmi-dlg-badge i { width: 8px; height: 8px; border-radius: 50%; background: var(--tone); }
.hmi-dialog-card[data-state="trip"]:not(.no-flash) .hmi-dlg-badge i { animation: hmi-lamp 1s steps(2, jump-none) infinite; }
@keyframes hmi-lamp { 50% { opacity: .2; } }
.hmi-dlg-x {
  appearance: none;
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  padding: 9px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--c-white-a70);
  color: var(--ink-2);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.hmi-dlg-x:hover { background: var(--c-white); color: var(--ink); border-color: var(--ink-3); }

/* ---- stat tiles ---- */
.hmi-dlg-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.hmi-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px 11px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 9px;
}
.hmi-tile span { font-size: var(--fs-1); font-weight: 600; color: var(--ink-3); }
.hmi-tile b {
  font-family: var(--mono);
  font-size: var(--fs-4);
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--ink);
}
.hmi-tile b[data-tone="ok"]   { color: var(--c-green-700); }
.hmi-tile b[data-tone="warn"] { color: var(--c-amber-700); }
.hmi-tile b[data-tone="bad"]  { color: var(--c-red-700); }
.hmi-tile b[data-tone="info"] { color: var(--manual); }

/* ---- sections ---- */
.hmi-dlg-sec { padding: 16px 20px; }
.hmi-dlg-rule { border-bottom: 1px solid var(--line); }
.hmi-dlg-label {
  margin-bottom: 10px;
  font-size: var(--fs-1);
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--cyan);
}

/* AUTO / MANUAL */
.hmi-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hmi-seg button {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink-2);
  font: inherit;
  font-size: var(--fs-4);
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
}
.hmi-seg button svg { width: 17px; height: 17px; flex: 0 0 auto; }
.hmi-seg button:not(:disabled):hover { border-color: var(--ink-3); color: var(--ink); }
.hmi-seg button[aria-checked="true"] {
  cursor: default;
  color: var(--ink);
  border-color: var(--c-ink-76);
  background: linear-gradient(180deg, var(--c-white) 0%, var(--c-ink-93) 100%);
  box-shadow: inset 0 1px 0 var(--c-white), 0 1px 2px var(--c-ink-15-a12);
}
.hmi-seg button[data-mode="manual"][aria-checked="true"] {
  color: var(--c-white);
  border-color: transparent;
  background: linear-gradient(180deg, var(--c-cyan-650) 0%, var(--manual) 100%);
  box-shadow: 0 2px 8px var(--c-cyan-700-a30);
}
.hmi-seg button:disabled { opacity: .5; cursor: not-allowed; }

/* START / STOP */
.hmi-cmds { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hmi-cmd {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  min-height: 76px;
  padding: 14px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--c-white);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .15s ease, filter .15s ease;
}
.hmi-cmd-top { display: flex; align-items: center; gap: 9px; }
.hmi-cmd-top svg { width: 17px; height: 17px; fill: currentColor; stroke: none; }
.hmi-cmd b { font-size: var(--fs-4); font-weight: 800; letter-spacing: .1em; }
.hmi-cmd small { font-size: var(--fs-2); font-weight: 600; opacity: .9; }
.hmi-cmd-start {
  background: linear-gradient(160deg, var(--c-green-500) 0%, var(--c-green-600) 50%, var(--c-green-700) 100%);
  border-color: var(--c-green-700);
  box-shadow: 0 4px 14px var(--c-green-600-a28), inset 0 1px 0 var(--c-white-a25);
}
.hmi-cmd-stop {
  background: linear-gradient(160deg, var(--c-ink-42) 0%, var(--c-ink-30) 55%, var(--c-ink-22a) 100%);
  border-color: var(--c-ink-22a);
  box-shadow: 0 4px 14px var(--c-slate-800-a25), inset 0 1px 0 var(--c-white-a15);
}
.hmi-cmd:not(:disabled):hover { filter: brightness(1.06); transform: translateY(-1px); }
.hmi-cmd:not(:disabled):active { transform: translateY(1px); filter: brightness(.97); }
/* the button that matches what the machine is doing is quieter: it is a fact, not an action */
.hmi-cmd[aria-pressed="true"] { filter: saturate(.75); box-shadow: inset 0 2px 6px var(--c-black-a22); }
.hmi-cmd[aria-pressed="true"] small::before { content: "\25CF  "; }
.hmi-cmd:disabled {
  cursor: not-allowed;
  color: var(--ink-3);
  background: var(--paper-2);
  border-color: var(--line);
  box-shadow: none;
}
.hmi-cmd.is-armed,
.hmi-seg button.is-armed {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  animation: hmi-arm .9s ease-in-out infinite;
}
.hmi-cmd.is-armed small { opacity: 1; font-weight: 800; }
@keyframes hmi-arm { 50% { outline-color: var(--c-blue-600-a25); } }

.hmi-cmd:focus-visible,
.hmi-seg button:focus-visible,
.hmi-dlg-x:focus-visible,
.hmi-dlg-close:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* password */
.hmi-pin {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  margin-top: 12px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--paper-2);
  color: var(--ink-3);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.hmi-pin svg { width: 17px; height: 17px; flex: 0 0 auto; }
.hmi-pin:focus-within { background: var(--c-white); border-color: var(--focus); box-shadow: 0 0 0 3px var(--c-blue-600-a15); }
.hmi-pin input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-4);
  letter-spacing: .1em;
}
.hmi-pin input::placeholder { letter-spacing: normal; font-size: var(--fs-3); color: var(--ink-3); }

/* feedback */
.hmi-dlg-msg {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 12px;
  font-size: var(--fs-3);
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink-2);
}
.hmi-dlg-msg:empty { display: none; }
/* monitoring only: no buttons, so the section is just its message, if any */
.hmi-dlg-sec.is-ro { padding-top: 0; padding-bottom: 0; }
.hmi-dlg-sec.is-ro .hmi-dlg-msg { margin: 12px 0; }
.hmi-dlg-sec.is-ro:has(.hmi-dlg-msg:empty) { border-bottom: 0; }
.hmi-dlg-msg::before { content: ""; flex: 0 0 auto; width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: currentColor; }
.hmi-dlg-msg.is-ok    { color: var(--c-green-700); }
.hmi-dlg-msg.is-arm   { color: var(--focus); }
.hmi-dlg-msg.is-arm::before { animation: hmi-lamp 1s steps(2, jump-none) infinite; }
.hmi-dlg-msg.is-busy  { color: var(--focus); }
.hmi-dlg-msg.is-busy::before {
  width: 12px; height: 12px; margin-top: 3px;
  background: none;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: hmi-spin .8s linear infinite;
}
@keyframes hmi-spin { to { transform: rotate(360deg); } }
.hmi-dlg-msg.is-warn,
.hmi-dlg-msg.is-error {
  padding: 10px 12px;
  border-radius: 8px;
  border-left: 3px solid currentColor;
}
.hmi-dlg-msg.is-warn  { color: var(--c-amber-800); background: var(--c-amber-50); }
.hmi-dlg-msg.is-error { color: var(--c-red-700); background: var(--c-red-50); }
.hmi-dlg-msg.is-warn::before, .hmi-dlg-msg.is-error::before { display: none; }

/* PLC signal rows, after the reference's interlock list */
.hmi-sigs { display: flex; flex-direction: column; gap: 6px; }
.hmi-sig {
  --edge: var(--c-ink-84);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
  padding: 7px 12px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--edge);
  border-radius: 7px;
  font-size: var(--fs-3);
}
.hmi-sig span { font-weight: 600; color: var(--ink); }
.hmi-sig em { margin-left: 6px; font-style: normal; font-family: var(--mono); font-size: var(--fs-2); color: var(--ink-3); }
.hmi-sig b { font-family: var(--mono); font-size: var(--fs-2); font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.hmi-sig[data-tone="ok"]   { --edge: var(--c-green-600); }
.hmi-sig[data-tone="ok"] b { color: var(--c-green-700); }
.hmi-sig[data-tone="warn"] { --edge: var(--c-amber-600); background: var(--c-amber-50); }
.hmi-sig[data-tone="warn"] b { color: var(--c-amber-700); }
.hmi-sig[data-tone="info"] { --edge: var(--manual); }
.hmi-sig[data-tone="info"] b { color: var(--manual); }

/* footer */
.hmi-dlg-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px 14px;
  border-top: 1px solid var(--line);
  background: var(--paper-2);
}
.hmi-dlg-foot-note { font-size: var(--fs-2); color: var(--ink-3); }
.hmi-dlg-close {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--c-red-800);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--c-crimson-800) 0%, var(--c-red-750) 100%);
  color: var(--c-white);
  font: inherit;
  font-size: var(--fs-4);
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px var(--c-red-750-a25);
}
.hmi-dlg-close svg { width: 15px; height: 15px; stroke-width: 2.6; }
.hmi-dlg-close:hover { filter: brightness(1.07); }

@media (max-width: 400px) {
  .hmi-dlg-tiles { gap: 6px; padding: 12px 14px; }
  .hmi-dlg-sec { padding: 14px; }
  .hmi-tile b { font-size: var(--fs-4); }
}
@media (prefers-reduced-motion: reduce) {
  .hmi-dialog-card, .hmi-cmd, .hmi-cmd.is-armed, .hmi-seg button.is-armed,
  .hmi-dlg-badge i, .hmi-dlg-msg::before { animation: none !important; transition: none !important; }
}


::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--hmi-surface-2); }
::-webkit-scrollbar-thumb { background: var(--hmi-border-strong); border-radius: 3px; }

@media (max-width: 760px) {
  .hmi-title { font-size: var(--fs-1); letter-spacing: .12em; padding: 5px 10px; }
  .hmi-clock { display: none; }
}

/* ---------------------------------------------------------------- *
 * Alarm & event panel (alarm summary, journal, run hours)
 * ---------------------------------------------------------------- */
.hmi-ap {
  position: fixed; inset: 0; z-index: 110;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: var(--c-slate-900-a45);
}
.hmi-ap[hidden] { display: none; }
.hmi-ap-card {
  width: min(1100px, 100%); max-height: min(780px, 100%);
  display: flex; flex-direction: column;
  background: var(--c-white); color: var(--c-ink-15); border-radius: 14px;
  box-shadow: 0 24px 60px var(--c-slate-900-a35);
  font-family: var(--hmi-font, inherit); overflow: hidden;
  animation: hmi-pop .16s ease-out;
}
.hmi-ap-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px 0 18px; border-bottom: 1px solid var(--c-ink-90a); }
.hmi-ap-tabs { display: flex; gap: 2px; flex: 1; }
.hmi-ap-tabs button {
  border: 0; background: transparent; padding: 10px 16px 12px; font: inherit; font-size: var(--fs-4); font-weight: 700;
  color: var(--c-ink-58); cursor: pointer; border-bottom: 3px solid transparent;
}
.hmi-ap-tabs button.is-active { color: var(--c-ink-15); border-bottom-color: var(--hmi-accent, var(--c-cyan-600)); }
/* the close button sits in the header row here, not in the device card's corner */
.hmi-ap-head .hmi-dlg-x {
  position: static; flex: 0 0 auto; margin: 0 0 6px auto;
  border: 1px solid var(--c-ink-84); background: var(--c-white); color: var(--c-ink-38);
}
.hmi-ap-head .hmi-dlg-x:hover { color: var(--c-ink-15); border-color: var(--c-ink-58); }
.hmi-ap-head .hmi-dlg-x svg { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.hmi-ap-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 18px; border-bottom: 1px solid var(--c-ink-95a); background: var(--c-ink-97); }
.hmi-ap-tools select, .hmi-ap-acts select {
  font: inherit; font-size: var(--fs-3); padding: 6px 8px; border: 1px solid var(--c-ink-84); border-radius: 8px; background: var(--c-white); color: var(--c-ink-15);
}
.hmi-ap-btn {
  font: inherit; font-size: var(--fs-3); font-weight: 700; padding: 7px 14px; min-height: 34px;
  border: 1px solid var(--c-ink-84); border-radius: 8px; background: var(--c-white); color: var(--c-ink-15); cursor: pointer;
}
.hmi-ap-btn:hover:not([disabled]) { border-color: var(--c-ink-58); }
.hmi-ap-btn[disabled] { opacity: .45; cursor: default; }
.hmi-ap-primary { background: var(--c-ink-15); border-color: var(--c-ink-15); color: var(--c-white); }
.hmi-ap-note { margin-left: auto; font-size: var(--fs-2); color: var(--c-ink-58); }
/* ISA-18.2: flood banner, first out / chattering marks, rationalisation, out of service */
.hmi-ap-flood { flex-basis: 100%; padding: 6px 10px; border-radius: 6px; background: var(--c-red-800); color: var(--c-white); font-weight: 600; font-size: var(--fs-2); }
.hmi-ap-flood .hmi-ap-btn { margin-left: 8px; padding: 2px 8px; }
.hmi-ap-mark { display: inline-block; margin-left: 6px; padding: 0 5px; border: 1px solid currentColor; border-radius: 4px; font-size: var(--fs-1); font-weight: 700; letter-spacing: .03em; }
.hmi-ap-mark.is-chat { border-style: dashed; }
.hmi-ap-why { margin-top: 2px; font-size: var(--fs-2); color: var(--c-ink-58); }
.hmi-ap-sub { margin: 14px 0 4px; font-size: var(--fs-2); font-weight: 700; color: var(--c-ink-58); text-transform: uppercase; letter-spacing: .04em; }
.hmi-ap-table tr.is-oos td { color: var(--c-ink-58); font-style: italic; }
.hmi-ap-link { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }
.hmi-ap-body { overflow: auto; flex: 1; }
.hmi-ap-empty { padding: 48px 16px; text-align: center; color: var(--c-ink-58); font-size: var(--fs-4); }
.hmi-ap-table { width: 100%; border-collapse: collapse; font-size: var(--fs-3); }
.hmi-ap-table th {
  position: sticky; top: 0; z-index: 1; background: var(--c-white); text-align: left; font-size: var(--fs-1); letter-spacing: .06em;
  text-transform: uppercase; color: var(--c-ink-58); padding: 10px 12px; border-bottom: 1px solid var(--c-ink-90a);
}
.hmi-ap-table td { padding: 9px 12px; border-bottom: 1px solid var(--c-ink-95a); vertical-align: middle; }
.hmi-ap-table tr.is-unack.is-active td { font-weight: 700; }
.hmi-ap-table tr.is-unack td:first-child { box-shadow: inset 4px 0 0 var(--hmi-trip, var(--c-red-600)); animation: hmi-flash 1s steps(1) infinite; }
.hmi-ap-table tr.is-rtn td { color: var(--c-ink-38); }
.hmi-ap-table tr.is-shelved td { opacity: .6; }
.hmi-ap-num { text-align: right; font-variant-numeric: tabular-nums; }
.hmi-ap-acts { white-space: nowrap; text-align: right; }
.hmi-ap-acts > * { margin-left: 6px; }
.hmi-ap-pri {
  display: inline-block; min-width: 72px; text-align: center; padding: 3px 8px; border-radius: 6px;
  font-size: var(--fs-1); font-weight: 800; letter-spacing: .05em; color: var(--c-white); background: var(--p, var(--c-slate-500));
}
@media (max-width: 720px) {
  .hmi-ap-tabs button { padding: 10px 8px 12px; font-size: var(--fs-3); }
  .hmi-ap-table th:nth-child(4), .hmi-ap-table td:nth-child(4) { display: none; }
  .hmi-dlg-tiles { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- tag status page (F9 / the Plant | Tags switch) ---------- */

.hmi-tv-switch {
  position: fixed; left: 12px; bottom: 12px; z-index: 90;
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px;
  border: 1px solid var(--c-white-a14); border-radius: 999px; cursor: pointer;
  /* no backdrop blur: it would be redrawn on every motion step of the plant under it */
  background: var(--c-slate-900-a82); color: var(--c-slate-300); font: 600 var(--fs-2)/1 var(--hmi-font); letter-spacing: .04em;
  opacity: .5; transition: opacity .2s;
}
.hmi-tv-switch:hover, .hmi-tv-switch:focus-visible, .hmi-tv-switch.is-on { opacity: 1; }
.hmi-tv-switch.in-header { position: static; opacity: 1; background: var(--c-white-a08); }
.hmi-tv-switch.in-page { position: static; flex: none; height: 38px; }
.hmi-tv-sw-track {
  position: relative; width: 34px; height: 20px; border-radius: 999px;
  background: var(--c-slate-600); transition: background .2s;
}
.hmi-tv-sw-knob {
  position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--c-white); box-shadow: 0 1px 3px var(--c-black-a35); transition: transform .2s;
}
.hmi-tv-switch.is-on .hmi-tv-sw-track { background: var(--hmi-accent); }
.hmi-tv-switch.is-on .hmi-tv-sw-knob { transform: translateX(14px); }
.hmi-tv-sw-lbl[data-side="plant"] { color: var(--c-white); }
.hmi-tv-switch.is-on .hmi-tv-sw-lbl[data-side="plant"] { color: var(--c-slate-400); }
.hmi-tv-switch.is-on .hmi-tv-sw-lbl[data-side="tags"] { color: var(--c-white); }

.hmi-tv {
  flex: 1 1 auto; overflow: auto; padding: 20px 24px 64px;
  background: var(--hmi-bg); color: var(--hmi-text);
  -webkit-user-select: text; user-select: text;
}
.hmi-tv[hidden] { display: none; }
.hmi-tv-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.hmi-tv-title { flex: 1 1 280px; min-width: 0; }
.hmi-tv-title h2 { margin: 0; font-size: var(--fs-5); font-weight: 800; letter-spacing: -.01em; }
.hmi-tv-sub { margin: 4px 0 0; color: var(--hmi-muted); font-size: var(--fs-3); }
.hmi-tv-search {
  flex: 0 1 340px; min-width: 200px; height: 38px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--hmi-border-strong); background: var(--hmi-panel); color: var(--hmi-text);
  font: var(--fs-4) var(--hmi-font); outline: none;
}
.hmi-tv-search:focus { border-color: var(--hmi-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--hmi-accent) 22%, transparent); }

.hmi-tv-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.hmi-tv-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--hmi-border); background: var(--hmi-panel); color: var(--hmi-text);
  font: 600 var(--fs-3) var(--hmi-font); cursor: pointer; box-shadow: var(--hmi-shadow-sm);
}
.hmi-tv-chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--hmi-muted)); }
.hmi-tv-chip b {
  min-width: 22px; padding: 2px 7px; border-radius: 999px; text-align: center; font-size: var(--fs-2);
  background: var(--hmi-surface-2); font-variant-numeric: tabular-nums;
}
.hmi-tv-chip.is-active { border-color: var(--c, var(--hmi-accent)); box-shadow: inset 0 0 0 1px var(--c, var(--hmi-accent)); }
.hmi-tv-chip.is-all { --c: var(--hmi-accent); }
.hmi-tv-chip.is-run { --c: var(--hmi-run); }
.hmi-tv-chip.is-stop { --c: var(--hmi-stop); }
.hmi-tv-chip.is-trip { --c: var(--hmi-trip); }
.hmi-tv-chip.is-manual { --c: var(--hmi-manual); }
.hmi-tv-chip.is-sensor { --c: var(--c-purple-500); }
.hmi-tv-chip.is-group { --c: var(--c-amber-500); }

.hmi-tv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.hmi-tv-card {
  --c: var(--hmi-stop);
  position: relative; padding: 14px 14px 12px 18px; border-radius: 14px; overflow: hidden;
  background: var(--hmi-panel); border: 1px solid var(--hmi-border); box-shadow: var(--hmi-shadow-sm);
}
.hmi-tv-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c); }
.hmi-tv-card.is-run, .hmi-tv-card.is-on { --c: var(--hmi-run); }
.hmi-tv-card.is-trip { --c: var(--hmi-trip); border-color: color-mix(in srgb, var(--hmi-trip) 45%, var(--hmi-border)); }
.hmi-tv-card.is-manual { --c: var(--hmi-manual); }
.hmi-tv-card.is-offline { --c: var(--hmi-border-strong); opacity: .75; }
.hmi-tv-card header { display: flex; align-items: center; gap: 9px; min-width: 0; }
.hmi-tv-dot {
  flex: none; width: 11px; height: 11px; border-radius: 50%; background: var(--c);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 22%, transparent);
}
.hmi-tv-card h3 { flex: 1; min-width: 0; margin: 0; font-size: var(--fs-4); font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hmi-tv-state {
  flex: none; padding: 3px 8px; border-radius: 6px; font-size: var(--fs-1); font-weight: 800; letter-spacing: .06em;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent);
}
.hmi-tv-card.is-stop .hmi-tv-state, .hmi-tv-card.is-off .hmi-tv-state, .hmi-tv-card.is-offline .hmi-tv-state { color: var(--hmi-muted); }
.hmi-tv-type { margin: 4px 0 10px 20px; font-size: var(--fs-2); color: var(--hmi-muted); }
.hmi-tv-type b { color: var(--hmi-text); }

.hmi-tv-bits { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.hmi-tv-bits li {
  --l: var(--hmi-run);
  display: grid; grid-template-columns: 74px 1fr auto 26px; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 8px; background: var(--hmi-surface-2);
}
.hmi-tv-bits li.r-trip { --l: var(--hmi-trip); }
.hmi-tv-bits li.r-man { --l: var(--hmi-manual); }
.hmi-tv-bits li.r-cmd { --l: var(--hmi-accent); }
.hmi-tv-role { font-size: var(--fs-1); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--hmi-muted); }
.hmi-tv-bits code {
  font: 700 var(--fs-3) var(--font-mono); color: var(--hmi-text);
}
.hmi-tv-bits small { font-size: var(--fs-1); color: var(--hmi-muted); font-variant-numeric: tabular-nums; }
.hmi-tv-lamp {
  justify-self: end; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font: 800 var(--fs-1) var(--font-mono);
  color: var(--hmi-muted); border: 2px solid var(--hmi-border-strong); background: var(--hmi-panel);
}
.hmi-tv-bits li.is-1 .hmi-tv-lamp {
  color: var(--c-white); border-color: var(--l); background: var(--l);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--l) 25%, transparent), 0 0 10px color-mix(in srgb, var(--l) 55%, transparent);
}
.hmi-tv-bits li.is-na .hmi-tv-lamp { border-style: dashed; }
.hmi-tv-none, .hmi-tv-empty { color: var(--hmi-muted); font-size: var(--fs-3); padding: 6px 0 2px 20px; }
.hmi-tv-empty { grid-column: 1 / -1; text-align: center; padding: 48px 0; font-size: var(--fs-4); }
.hmi-tv-foot { margin-top: 18px; font-size: var(--fs-2); color: var(--hmi-muted); }
.hmi-tv-more { font: inherit; color: var(--hmi-accent, var(--c-cyan-700)); background: none; border: 1px solid currentColor; border-radius: 6px; padding: 4px 12px; margin-left: 4px; cursor: pointer; }

@media (max-width: 600px) {
  .hmi-tv { padding: 14px 16px 64px; }
  .hmi-tv-search { flex: 1 1 100%; }
  .hmi-tv-grid { grid-template-columns: 1fr; }
}

/* ---- History tab (historian) ---- */
.hmi-h-wrap { padding: 12px 18px 18px; }
.hmi-h-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 8px; font-size: var(--fs-3); color: var(--c-slate-900); }
.hmi-h-leg i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin: 0 5px -1px 0; }
.hmi-h-leg small { color: var(--c-slate-500); }
.hmi-h-chart { position: relative; }
.hmi-h-chart svg { display: block; font-family: inherit; }
.hmi-h-read { position: absolute; top: 8px; background: var(--c-slate-900-a92); color: var(--c-white); font-size: var(--fs-2); line-height: 1.5;
  padding: 6px 9px; border-radius: 6px; pointer-events: none; min-width: 170px; }
.hmi-h-picker { padding: 14px 18px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; }
.hmi-h-picker > div { grid-column: 1 / -1; }
.hmi-h-pick { font-size: var(--fs-3); color: var(--c-slate-900); display: flex; gap: 6px; align-items: center; }
.hmi-h-pick small { color: var(--c-slate-500); }

/* ---------- setpoint change: value, review, result ---------- */
.hmi-sp { z-index: 120; }
.hmi-sp-card { width: min(440px, 100%); display: flex; flex-direction: column; }
/* recipes: the same dialog, wider, with a table that scrolls */
.hmi-sp-card.hmi-rc-card { width: min(760px, 100%); max-height: 92vh; }
.hmi-rc-card .hmi-sp-body { overflow: auto; min-height: 0; }
.hmi-rc-scroll { max-height: 52vh; overflow: auto; margin: 8px 0; }
.hmi-rc-in { width: 100%; box-sizing: border-box; padding: 7px 9px; margin-bottom: 8px; font: inherit; }
.hmi-rc-val { width: 96px; padding: 5px 7px; font: inherit; text-align: right; }
.hmi-rc-notes { font-size: var(--fs-2); opacity: .7; }
.hmi-rc-state.is-bad { color: var(--c-red-600); font-weight: 600; }
.hmi-rc-state.is-ok { color: var(--c-green-700); font-weight: 600; }
.hmi-sp-card .hmi-dlg-head { padding-bottom: 14px; }
.hmi-sp-card .hmi-dlg-head::after { background: var(--cyan); }
.hmi-sp-title { margin: 4px 0 0; font-size: var(--fs-5); font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; }
.hmi-sp-body { padding: 16px 20px 6px; overflow: auto; min-height: 0; }
.hmi-sp-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--line); background: var(--paper-2); }
.hmi-sp-foot .hmi-ap-btn { min-width: 96px; }
.hmi-sp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.hmi-sp-grid > div { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper-2); }
.hmi-sp-grid span { display: block; font-size: var(--fs-1); font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.hmi-sp-grid b { display: block; margin-top: 3px; font-size: var(--fs-4); font-family: var(--mono); color: var(--ink); overflow-wrap: anywhere; }
.hmi-sp-label { display: block; font-size: var(--fs-2); font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.hmi-sp-input { display: flex; align-items: stretch; gap: 6px; }
.hmi-sp-input input { flex: 1 1 auto; min-width: 0; font: 700 var(--fs-5)/1.2 var(--mono); padding: 10px 12px; text-align: right;
  border: 1.5px solid var(--line-2); border-radius: 8px; color: var(--ink); background: var(--c-white); }
.hmi-sp-input input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px var(--c-cyan-700-a18); }
.hmi-sp-units { align-self: center; font-size: var(--fs-4); font-weight: 700; color: var(--ink-2); padding: 0 2px; }
.hmi-sp-step { appearance: none; width: 48px; font-weight: 700; font-size: var(--fs-5); line-height: 1; font-family: inherit; border: 1.5px solid var(--line-2); border-radius: 8px; background: var(--paper-2); color: var(--ink); cursor: pointer; }
.hmi-sp-step:hover { border-color: var(--ink-3); }
.hmi-sp-msg { min-height: 20px; margin: 8px 0 6px; font-size: var(--fs-3); color: var(--ink-2); }
.hmi-sp-msg.is-bad { color: var(--c-red-700); font-weight: 600; }
.hmi-sp-review { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 14px 8px 4px; font-family: var(--mono); flex-wrap: wrap; }
.hmi-sp-old { font-size: var(--fs-5); color: var(--ink-3); text-decoration: line-through; text-decoration-thickness: 1px; }
.hmi-sp-arrow { font-size: var(--fs-5); color: var(--ink-3); }
.hmi-sp-new { font-size: var(--fs-6); font-weight: 800; color: var(--ink); }
.hmi-sp-delta { text-align: center; font-size: var(--fs-3); font-weight: 700; color: var(--cyan); margin-bottom: 10px; }
.hmi-sp-note { margin: 6px 0 4px; font-size: var(--fs-2); line-height: 1.5; color: var(--ink-2); }
.hmi-sp-write { background: var(--c-amber-700); border-color: var(--c-amber-700); color: var(--c-white); }
.hmi-sp-write:hover:not([disabled]) { background: var(--c-amber-800); border-color: var(--c-amber-800); }
.hmi-sp-result { margin: 4px 0 12px; padding: 12px 14px; border-radius: 8px; font-size: var(--fs-4); line-height: 1.5; }
.hmi-sp-result.is-ok { background: var(--c-green-600-a10); border: 1px solid var(--c-green-600-a45); color: var(--c-green-900); }
.hmi-sp-result.is-bad { background: var(--c-red-600-a08); border: 1px solid var(--c-red-600-a40); color: var(--c-red-900); }
.hmi-sp-table .hmi-sp-now { font-family: var(--font-mono); }
.hmi-sp-addr { font-style: normal; font-size: var(--fs-2); color: var(--c-ink-58); font-family: var(--font-mono); }
.hmi-sp-bad { color: var(--c-red-700); font-weight: 700; }
@media (max-width: 420px) { .hmi-sp-grid { grid-template-columns: 1fr; } }

/* maintenance lock: the bar in a machine's popup, and a padlock on the machine itself */
.hmi-lockbar { display: flex; align-items: center; gap: 10px; margin: 12px 20px 0; padding: 9px 12px; border-radius: 10px;
  background: var(--surface-2, var(--c-slate-500-a08)); color: var(--ink-2, inherit); font-size: var(--fs-3); }
.hmi-lockbar > svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; }
.hmi-lockbar > span { flex: 1; min-width: 0; }
.hmi-lock-btn { flex: none; font: inherit; font-size: var(--fs-3); font-weight: 600; padding: 6px 12px; border-radius: 8px; cursor: pointer;
  border: 1.5px solid currentColor; background: transparent; color: var(--c-amber-700); }
.hmi-lock-btn.is-force { color: var(--c-red-600); }
.hmi-lock-btn[hidden] { display: none; }
.hmi-dialog-card.is-locked .hmi-lockbar { background: var(--c-red-600-a12); color: var(--c-red-700); font-weight: 600; }
.hw.hmi-locked::after { content: ""; position: absolute; right: -4px; top: -4px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--c-red-600) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.4'%3E%3Crect x='5' y='10.5' width='14' height='10' rx='2.2'/%3E%3Cpath d='M8.5 10.5V7.8a3.5 3.5 0 0 1 7 0v2.7'/%3E%3C/svg%3E") center / 14px no-repeat;
  box-shadow: 0 0 0 2px var(--c-white); pointer-events: none; z-index: 2; }
