/* ArthOS · Atul operations workspace.
   Light work canvas with a dark navigation rail only. Workspace language follows Spectrum
   (tokens, evidence strips, decision bands); process drawings follow the ArthSim line grammar
   (slate line art, colour means material, motion only where the twin reports flow). */

@font-face {
  font-family: Inter;
  src: url('../assets/fonts/Inter-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Inter;
  src: url('../assets/fonts/Inter-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: Inter;
  src: url('../assets/fonts/Inter-Bold.woff2') format('woff2');
  font-weight: 700 900;
  font-display: swap;
}

:root {
  --canvas: #f4f9ff;
  --surface: #ffffff;
  --soft: #f8fafc;
  --well: #f1f5f9;
  --line: rgba(148, 163, 184, 0.24);
  --line-strong: rgba(148, 163, 184, 0.36);
  --ink: #020617;
  --ink-2: #475569;
  --ink-3: #64748b;
  --accent: #0f766e;
  --accent-strong: #0b5756;
  --accent-soft: rgba(15, 118, 110, 0.12);
  --ok: #0d9488;
  --info: #0284c7;
  --warn: #d97706;
  --warm: #b45309;
  --bad: #dc2626;
  --muted: #94a3b8;
  --lab: #a21caf;
  --rail: #0f172a;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.045);
  --font: Inter, 'Segoe UI', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;
  --top: 56px;
  color-scheme: light;
}

/* Tone tokens shared by pills, dots, bands, notes and chart marks. */
.tone-ok { --tone: #0d9488; --tone-ink: #115e59; }
.tone-info { --tone: #0284c7; --tone-ink: #075985; }
.tone-warn { --tone: #d97706; --tone-ink: #92400e; }
.tone-bad { --tone: #dc2626; --tone-ink: #991b1b; }
.tone-muted { --tone: #94a3b8; --tone-ink: #475569; }
.tone-brand,
.tone-case { --tone: #0f766e; --tone-ink: #0b5756; }
.tone-lab { --tone: #a21caf; --tone-ink: #86198f; }
.tone-p1 { --tone: #dc2626; --tone-ink: #991b1b; }
.tone-p2 { --tone: #ea580c; --tone-ink: #9a3412; }
.tone-p3 { --tone: #d97706; --tone-ink: #92400e; }
.tone-p4 { --tone: #64748b; --tone-ink: #334155; }

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 400 13.5px/1.45 var(--font);
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
h1,
h2,
h3,
h4 {
  margin: 0;
}
p {
  margin: 0;
}
code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--well);
  padding: 1px 5px;
  border-radius: 4px;
}
.mono {
  font-family: var(--mono);
  font-size: 0.92em;
  letter-spacing: 0;
}
.ic {
  flex: none;
  vertical-align: -3px;
}
.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 200;
  background: var(--surface);
  padding: 8px 12px;
  border-radius: 8px;
}
.skip-link:focus {
  left: 8px;
}
.boot {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--ink-2);
  font-weight: 600;
}
noscript {
  display: block;
  padding: 24px;
}

/* ================================================================ shell */
#app {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100vh;
}
.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--rail);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  padding: 14px 10px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.3) transparent;
  z-index: 40;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 14px;
}
.brand span {
  display: flex;
  flex-direction: column;
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.1;
}
.brand small {
  color: #94a3b8;
  font-weight: 500;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}
.client {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 2px 6px;
  padding: 9px 10px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.06);
}
.mono-a {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #1e293b;
  color: #5eead4;
  font-weight: 800;
}
.client span:last-child {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.client b {
  color: #fff;
  font-size: 0.86rem;
}
.client small {
  color: #94a3b8;
  font-size: 0.7rem;
}
.rail nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.ng {
  margin: 14px 10px 5px;
  color: #64748b;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}
.nv {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: #cbd5e1;
  font-size: 0.84rem;
  font-weight: 500;
  text-align: left;
}
.nv:hover {
  background: rgba(148, 163, 184, 0.1);
  color: #fff;
}
.nv.on {
  background: rgba(45, 212, 191, 0.12);
  color: #fff;
  font-weight: 600;
}
.nv.on::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #2dd4bf;
}
.nv .ic {
  color: #94a3b8;
}
.nv.on .ic {
  color: #5eead4;
}
.nv span {
  flex: 1;
  min-width: 0;
}
.nv em {
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 700;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
}
.nv em.bad {
  background: #dc2626;
  color: #fff;
}
.nv.site small {
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 600;
}
.nv.on-site {
  color: #fff;
}
.nv.on-site small {
  color: #5eead4;
}
.rail .dot {
  margin: 0 2px;
}
.rail-foot {
  margin-top: auto;
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.twin {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.twin-h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
  color: #cbd5e1;
  font-weight: 600;
}
.twin-h b {
  color: #5eead4;
  font-family: var(--mono);
  font-size: 0.74rem;
}
.twin-b {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
}
.twin-b button {
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(148, 163, 184, 0.06);
  color: #e2e8f0;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 0;
}
.twin-b button:hover {
  background: rgba(148, 163, 184, 0.16);
}
.twin-b button.on {
  background: rgba(45, 212, 191, 0.18);
  border-color: rgba(45, 212, 191, 0.5);
  color: #fff;
}
.twin small {
  color: #94a3b8;
  font-size: 0.68rem;
}
.reset {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: none;
  color: #94a3b8;
  font-size: 0.74rem;
  padding: 4px 8px;
}
.reset:hover {
  color: #fff;
}

.main-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.top {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--top);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.menu {
  display: none;
}
.crumb {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 1 auto;
  color: var(--ink-3);
  font-size: 0.82rem;
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
}
.crumb b {
  color: var(--ink);
  font-weight: 600;
}
.crumb span:last-child {
  color: var(--ink);
  font-weight: 600;
}
.casechip {
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 440px;
  height: 32px;
  padding: 0 10px 0 6px;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--tone);
  border-radius: 8px;
  background: var(--surface);
  font-size: 0.78rem;
}
.casechip b {
  font-family: var(--mono);
  font-size: 0.76rem;
}
.casechip span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-2);
}
.top-r {
  margin-left: auto;
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alms {
  display: flex;
  gap: 4px;
  border: 0;
  background: none;
  padding: 0;
}
.alms .prio {
  height: 26px;
  padding: 0 8px;
  gap: 5px;
  font-size: 0.68rem;
  background: var(--surface);
  color: var(--tone-ink);
  border: 1px solid color-mix(in srgb, var(--tone) 45%, white);
}
.alms .prio.p1 { --tone: #dc2626; --tone-ink: #991b1b; }
.alms .prio.p2 { --tone: #ea580c; --tone-ink: #9a3412; }
.alms .prio.p3 { --tone: #d97706; --tone-ink: #92400e; }
.alms .prio b {
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}
.lens-sel,
.me {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-3);
}
.lens-sel select {
  border: 0;
  background: none;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
  max-width: 190px;
  outline: none;
}
.me input {
  border: 0;
  outline: none;
  width: 120px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
  background: none;
}
.clock {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
  white-space: nowrap;
}
.clock time {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}
.clock small {
  color: var(--ink-3);
  font-size: 0.72rem;
}
.twin-pill {
  height: 20px;
  padding: 0 7px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(15, 118, 110, 0.45);
  color: var(--accent);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

#main {
  width: 100%;
  max-width: 1760px;
  margin: 0 auto;
  padding: 20px 24px 48px;
  outline: none;
}

/* ================================================================ shared components */
.ph {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 14px;
}
.eyebrow {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.085em;
  color: var(--accent);
  text-transform: uppercase;
}
.ph h1 {
  font-size: clamp(1.45rem, 1.9vw, 2.05rem);
  font-weight: 760;
  line-height: 1.15;
  margin-top: 4px;
}
.ph p {
  color: var(--ink-2);
  max-width: 920px;
  margin-top: 6px;
  font-size: 0.86rem;
}
.ph-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin: 0 0 16px;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}
.strip > div {
  padding: 10px 14px;
  border-left: 1px solid var(--line);
  min-width: 0;
}
.strip > div:first-child {
  border-left: 0;
  padding-left: 2px;
}
.strip dt {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  text-transform: uppercase;
}
.strip dd {
  margin: 3px 0 0;
  font-size: 1.38rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.strip dd small {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ink-3);
  margin-left: 4px;
}
.strip span {
  display: block;
  margin-top: 2px;
  font-size: 0.72rem;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.strip > div[class*='tone-'] dd {
  color: var(--tone-ink);
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
}
.panel-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.panel-h h2 {
  font-size: 0.96rem;
  font-weight: 700;
  margin-top: 2px;
}
.panel-b {
  padding: 14px 16px;
}
.panel.flat {
  background: none;
  border: 0;
  box-shadow: none;
  border-radius: 0;
}
.panel.flat > .panel-h {
  padding: 4px 0 8px;
}
.panel.flat > .panel-b {
  padding: 8px 0 0;
}
.panel.constraint {
  border-left: 3px solid var(--warn);
}
.two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.two > .panel {
  margin: 0;
}
#main > .panel,
#main > section.panel {
  margin-bottom: 16px;
}
.hint {
  font-size: 0.74rem;
  color: var(--ink-3);
}
.fine {
  font-size: 0.74rem;
  color: var(--ink-3);
  margin-top: 10px;
  line-height: 1.45;
}
.empty {
  color: var(--ink-3);
  padding: 24px;
  text-align: center;
}
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 56px 24px;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}
.empty-state .ic {
  color: var(--accent);
}
.empty-state b {
  font-size: 1rem;
  color: var(--ink);
}
.empty-state p {
  max-width: 440px;
  font-size: 0.84rem;
}

/* buttons, pills, fields */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover:not(:disabled) {
  border-color: #94a3b8;
  background: var(--soft);
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.primary:hover:not(:disabled) {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}
.btn.sm {
  height: 28px;
  padding: 0 10px;
  font-size: 0.76rem;
}
.btn.xs {
  height: 24px;
  padding: 0 8px;
  font-size: 0.72rem;
  border-radius: 6px;
}
.btn.wide {
  width: 100%;
}
.ibtn {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-2);
}
.ibtn:hover {
  color: var(--ink);
  border-color: #94a3b8;
}
.tlink {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  text-align: left;
}
.tlink:hover {
  color: var(--accent-strong);
  text-decoration-style: solid;
}
.chipbtn {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: var(--surface);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ink-2);
}
.chipbtn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 11px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  background: color-mix(in srgb, var(--tone, #94a3b8) 13%, white);
  color: var(--tone-ink, #475569);
  border: 1px solid color-mix(in srgb, var(--tone, #94a3b8) 26%, white);
}
.pill.tone-p1,
.pill.tone-p2,
.pill.tone-p3,
.pill.tone-p4 {
  background: var(--tone);
  border-color: var(--tone);
  color: #fff;
}
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tone, #94a3b8);
  flex: none;
  margin-right: 6px;
  vertical-align: 1px;
}
.prio {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 20px;
  padding: 0 5px;
  border-radius: 5px;
  font-size: 0.68rem;
  font-weight: 800;
  color: #fff;
  background: #64748b;
}
.prio.p1 {
  background: #dc2626;
}
.prio.p2 {
  background: #ea580c;
}
.prio.p3 {
  background: #d97706;
}
.prio.p4 {
  background: #64748b;
}
.seg {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--soft);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.seg button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 11px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--ink-2);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.seg button:hover {
  color: var(--ink);
}
.seg button.on {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.1), 0 0 0 1px var(--line);
}
.seg button small {
  color: var(--ink-3);
  font-weight: 600;
  font-size: 0.68rem;
}
.site-seg {
  margin-bottom: 14px;
}
.site-seg button {
  height: 30px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
}
.field > span {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-3);
}
.field input,
.field select,
.field textarea,
.filters select,
.alm-actions input,
.alm-actions select,
.review input,
.ho-a select {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  font-size: 0.82rem;
  color: var(--ink);
  min-width: 0;
}
.field textarea {
  height: auto;
  padding: 8px 10px;
  resize: vertical;
}
.field.grow {
  flex: 1;
  min-width: 240px;
}
.search {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-3);
  min-width: 220px;
}
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: none;
  font-size: 0.82rem;
  color: var(--ink);
}
.note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 11px;
  margin: 8px 0;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--tone, #94a3b8) 32%, white);
  background: color-mix(in srgb, var(--tone, #94a3b8) 7%, white);
  color: var(--tone-ink, var(--ink-2));
  font-size: 0.78rem;
  font-weight: 500;
}
.note .ic {
  margin-top: 1px;
}
.note .btn {
  margin-left: auto;
}
.kv {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 5px 14px;
  margin: 10px 0 0;
  font-size: 0.78rem;
}
.kv dt {
  color: var(--ink-3);
}
.kv dd {
  margin: 0;
  font-weight: 600;
  min-width: 0;
}
.tl {
  list-style: none;
  padding: 0;
  margin: 0;
}
.tl li {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
  padding: 7px 0 7px 8px;
  border-bottom: 1px dashed var(--line);
  border-left: 2px solid var(--tone, transparent);
  font-size: 0.8rem;
}
.tl li:last-child {
  border-bottom: 0;
}
.tl time {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-3);
  padding-top: 1px;
}
.tl small {
  color: var(--ink-3);
}
.table-wrap {
  overflow: auto;
  max-width: 100%;
  border-radius: 8px;
}
.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.8rem;
}
.tbl th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 8px 10px;
  background: var(--soft);
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
.tbl td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.tbl td small {
  display: block;
  color: var(--ink-3);
  font-size: 0.72rem;
}
.tbl tr[data-act] {
  cursor: pointer;
}
.tbl tbody tr:hover {
  background: var(--soft);
}
.tbl tr.on {
  background: var(--accent-soft);
}
.num {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}
.sw {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 7px;
  vertical-align: -1px;
}
.evs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.evc {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 12px;
  border: 1px solid;
  font-size: 0.72rem;
  line-height: 1.35;
}
.evc b {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.evc .tlink {
  color: inherit;
}
.evc.sup {
  background: #f0fdfa;
  border-color: #99f6e4;
  color: #115e59;
}
.evc.con {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}
.evc.mis {
  background: var(--soft);
  border-color: var(--line-strong);
  color: var(--ink-2);
}
.perm {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 0.78rem;
}
.perm:last-child {
  border-bottom: 0;
}
.perm em {
  margin-left: auto;
  font-style: normal;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--ink-2);
}
.perm.ok .ic {
  color: var(--ok);
}
.perm.bad .ic,
.perm.bad em {
  color: var(--bad);
}
.perm.unk .ic {
  color: var(--ink-3);
}
.mini {
  padding: 5px 0;
  font-size: 0.78rem;
}
.mini small {
  display: block;
  color: var(--ink-3);
  margin-top: 2px;
}

/* ================================================================ charts */
.chart {
  position: relative;
  min-width: 0;
}
.chart-h {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
  min-width: 0;
}
.chart-h b {
  font-size: 0.78rem;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chart-h small {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--ink-3);
  white-space: nowrap;
}
.chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  font-family: var(--font);
}
.chart .g {
  stroke: #e2e8f0;
  stroke-dasharray: 4 4;
}
.chart .gx {
  stroke: #eef2f7;
}
.chart .ty,
.chart .tx {
  font-size: 10px;
  fill: #64748b;
  font-variant-numeric: tabular-nums;
}
.chart .ty {
  text-anchor: end;
}
.chart .tx {
  text-anchor: middle;
}
.chart .ln {
  fill: none;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.chart .ln.dash {
  stroke-dasharray: 6 4;
}
.chart .area {
  fill-opacity: 0.08;
  stroke: none;
}
.chart .bandfill {
  fill-opacity: 0.13;
  stroke: none;
}
.chart .band {
  fill: var(--tone);
  fill-opacity: 0.07;
}
.chart .band.tone-case {
  fill-opacity: 0.05;
}
.chart .band-l {
  font-size: 9.5px;
  fill: #64748b;
}
.chart .future {
  fill: #f8fafc;
}
.chart .now {
  stroke: #0f172a;
  stroke-width: 1;
  stroke-dasharray: 2 3;
}
.chart .th {
  stroke: var(--tone);
  stroke-width: 1;
  stroke-dasharray: 5 4;
}
.chart .th-l {
  fill: var(--tone-ink);
  font-size: 9.5px;
  font-weight: 600;
  text-anchor: end;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 3px;
}
.chart .ev line {
  stroke: var(--tone);
  stroke-opacity: 0.4;
  stroke-width: 1;
}
.chart .ev path {
  fill: var(--tone);
}
.chart .ev:hover line {
  stroke-opacity: 0.9;
}
.chart .cursor {
  stroke: #0f172a;
  stroke-opacity: 0.4;
  stroke-width: 1;
  pointer-events: none;
}
.chart-tip {
  position: absolute;
  top: 26px;
  z-index: 6;
  min-width: 180px;
  max-width: 280px;
  padding: 7px 9px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.1);
  font-size: 0.72rem;
  pointer-events: none;
}
.chart-tip small {
  display: block;
  color: var(--ink-3);
  font-family: var(--mono);
  margin-bottom: 3px;
}
.chart-tip div {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.chart-tip b {
  margin-left: auto;
  padding-left: 8px;
  font-variant-numeric: tabular-nums;
}
.chart-tip i,
.legend i {
  display: inline-block;
  width: 10px;
  height: 3px;
  border-radius: 2px;
  flex: none;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--ink-2);
}
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.legend small {
  color: var(--ink-3);
}
.spark path {
  fill: none;
  stroke-width: 1.5;
  stroke-linejoin: round;
}
.spark-th {
  stroke: #dc2626;
  stroke-opacity: 0.6;
  stroke-dasharray: 3 3;
}
.bullet .track {
  position: relative;
  height: 8px;
  border-radius: 4px;
  background: var(--well);
}
.bullet .okband {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(13, 148, 136, 0.25);
}
.bullet .mark {
  position: absolute;
  top: -3px;
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--ink);
}
.bullet.out .mark {
  background: var(--bad);
}
.bullet .bl {
  display: flex;
  justify-content: space-between;
  font-size: 0.66rem;
  color: var(--ink-3);
}
/* chart cards */
.hist-charts > .chart,
.ml-charts > .chart,
.ctl-cols > div > .chart,
#main > .chart,
.alm-detail > .chart {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px 8px;
}

/* ================================================================ command */
.cmd-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(300px, 24vw, 360px);
  gap: 16px;
  align-items: start;
}
.cmd-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.cmd-main .two {
  margin: 0;
}
.cmd-rail {
  position: sticky;
  top: calc(var(--top) + 16px);
}
.cmd-rail .panel-b {
  max-height: calc(100vh - var(--top) - 110px);
  overflow-y: auto;
}
.site-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.site-row {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(190px, 1.35fr) repeat(4, minmax(0, 0.62fr)) 22px;
  grid-template-areas:
    'id state m1 m2 m3 m4 go'
    'id c1 c2 c2 c3 c3 go';
  gap: 10px 14px;
  align-items: start;
  padding: 12px 12px 12px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--tone);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.site-row:hover {
  background: var(--soft);
  border-color: var(--line-strong);
  border-left-color: var(--tone);
}
.site-row > div:nth-of-type(1) { grid-area: id; }
.site-row > div:nth-of-type(2) { grid-area: state; }
.site-row > div:nth-of-type(3) { grid-area: m1; }
.site-row > div:nth-of-type(4) { grid-area: m2; }
.site-row > div:nth-of-type(5) { grid-area: m3; }
.site-row > div:nth-of-type(6) { grid-area: m4; }
.site-row > div:nth-of-type(7) { grid-area: c1; }
.site-row > div:nth-of-type(8) { grid-area: c2; }
.site-row > div:nth-of-type(9) { grid-area: c3; }
.sr-go {
  grid-area: go;
  align-self: center;
  color: var(--ink-3);
}
.sr-id {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.sr-name {
  display: flex;
  align-items: center;
  gap: 6px;
}
.sr-name b {
  font-size: 1rem;
}
.sr-id small {
  font-size: 0.72rem;
  color: var(--ink-3);
}
.sr-state {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.sr-state b {
  font-size: 0.86rem;
  font-weight: 650;
}
.sr-state span {
  font-size: 0.72rem;
  color: var(--ink-3);
}
.sr-state .more {
  color: var(--accent);
  font-weight: 600;
}
.sr-m,
.sr-c {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.sr-m span,
.sr-c span {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--ink-3);
  text-transform: uppercase;
  white-space: nowrap;
}
.sr-m b {
  font-size: 1.12rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.sr-m b small {
  font-size: 0.68rem;
  color: var(--ink-3);
  font-weight: 600;
  margin-left: 3px;
}
.sr-m b.stale {
  color: var(--warm);
}
.sr-m em,
.sr-c em {
  font-style: normal;
  font-size: 0.7rem;
  color: var(--ink-3);
}
.sr-c {
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}
.sr-c b {
  font-size: 0.8rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sr-c b.bad {
  color: var(--bad);
}
.sr-c b.ok {
  color: var(--ok);
}
.wrow {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) 96px;
  gap: 10px;
  align-items: center;
  margin-bottom: 9px;
  font-size: 0.8rem;
}
.wrow span {
  font-size: 0.72rem;
  color: var(--ink-3);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.wbar,
.ebar .bar,
.hrow .bar {
  display: flex;
  height: 14px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--well);
}
.wbar i,
.ebar .bar i,
.hrow .bar i {
  display: block;
  height: 100%;
}
.w-reuse {
  background: #0369a1;
}
.w-discharge {
  background: #94a3b8;
}
.w-divert {
  background: repeating-linear-gradient(45deg, #475569 0 3px, #64748b 3px 6px);
}
.w-fresh {
  background: repeating-linear-gradient(45deg, #38bdf8 0 3px, #7dd3fc 3px 6px);
}
.wlegend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--ink-2);
}
.wlegend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 5px;
  vertical-align: -1px;
}
.att {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.att article {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--tone);
  border-radius: 10px;
  background: var(--surface);
}
.att-h {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.att-h b {
  font-family: var(--mono);
  font-size: 0.74rem;
  margin-left: auto;
}
.att p {
  margin: 7px 0 3px;
  font-size: 0.82rem;
  font-weight: 600;
}
.att small {
  font-size: 0.72rem;
  color: var(--ink-3);
}
.att-a {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* ================================================================ plant / HMI */
.banners {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.case-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px 7px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--tone);
  border-radius: 10px;
  font-size: 0.8rem;
}
.case-banner b {
  font-family: var(--mono);
  font-size: 0.76rem;
}
.case-banner span:not(.pill) {
  flex: 1;
  min-width: 0;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.case-banner em {
  font-style: normal;
  font-size: 0.74rem;
  color: var(--ink-3);
  white-space: nowrap;
}
.zoom {
  display: inline-flex;
  gap: 4px;
}
.hmi-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(290px, 22vw, 340px);
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}
.hmi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-width: 0;
}
.hmi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.live {
  display: inline-flex;
  align-items: center;
  font-size: 0.74rem;
  color: var(--ink-2);
  font-weight: 600;
}
.live time {
  font-family: var(--mono);
  margin-left: 4px;
}
.hmi-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 0.7rem;
  color: var(--ink-2);
}
.hmi-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.hmi-legend i {
  display: inline-block;
  width: 20px;
  height: 0;
  border-top: 2.5px solid var(--m);
}
.hmi-legend .m-air,
.hmi-legend .m-steam {
  border-top-style: dashed;
}
.hmi-wrap {
  position: relative;
  overflow: hidden;
  background: #fff;
  cursor: grab;
  touch-action: pan-y pinch-zoom;
}
.hmi-wrap.dragging {
  cursor: grabbing;
}
.hmi-view {
  transform-origin: 0 0;
  will-change: transform;
}
.hmi-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  font-size: 0.72rem;
  color: var(--ink-3);
}
.qk {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin: 0 3px 0 6px;
  vertical-align: -1px;
  border: 1.5px solid;
}
.qk.late {
  border-color: #d97706;
  background: #fffbeb;
}
.qk.bad {
  border-color: #dc2626;
  background: #fef2f2;
  border-style: dashed;
}
.qk.lab {
  border-color: #a21caf;
  background: #fdf4ff;
}
.inspector {
  position: sticky;
  top: calc(var(--top) + 16px);
  max-height: calc(100vh - var(--top) - 32px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px 16px;
  min-width: 0;
}
.insp-h h3 {
  font-size: 1.08rem;
  font-weight: 750;
  margin: 3px 0 2px;
}
.insp-h h3:first-child {
  margin-top: 0;
}
.insp-h p {
  font-size: 0.8rem;
  color: var(--ink-2);
}
.insp-val {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 12px 0 4px;
}
.insp-val b {
  font-size: 1.9rem;
  font-weight: 760;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.insp-val small {
  color: var(--ink-3);
  font-weight: 600;
}
.insp-val .pill {
  margin-left: auto;
  align-self: center;
}
.insp-status {
  font-size: 0.74rem;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.insp-sec {
  margin-top: 14px;
}
.insp-sec h4,
.pend h4,
.eq-cmds h4,
.ho-group h4 {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.insp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 7px 8px;
  margin: 0 -8px;
  width: calc(100% + 16px);
  border: 0;
  border-radius: 8px;
  background: none;
  text-align: left;
  font-size: 0.8rem;
}
.insp-row:hover {
  background: var(--soft);
}
.insp-row > span {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.insp-row b {
  font-family: var(--mono);
  font-size: 0.76rem;
}
.insp-row small {
  font-size: 0.72rem;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.insp-row em {
  font-style: normal;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.insp-row em.q-Late,
.insp-row em.q-Suspect {
  color: var(--warm);
}
.insp-row em.q-Unavailable,
.insp-row em.q-Nodata {
  color: var(--bad);
}
.insp-row em.q-Lab {
  color: var(--lab);
}
.insp-row em.q-Caloverdue {
  color: var(--info);
}
.insp-act {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}
.cond-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--well);
  overflow: hidden;
}
.cond-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #dc2626, #d97706 45%, #0d9488 75%);
  background-size: 340px 100%;
}
.trend-strip .panel-b,
.trend-strip {
  padding: 12px 16px;
}
.strip-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.hmi-grid:fullscreen {
  background: var(--canvas);
  padding: 16px;
  margin: 0;
  overflow: auto;
  align-items: stretch;
}
.hmi-grid:fullscreen .hmi-card {
  display: flex;
  flex-direction: column;
}
.hmi-grid:fullscreen .hmi-wrap {
  flex: 1;
}
.hmi-grid:fullscreen .inspector {
  position: static;
  max-height: calc(100vh - 32px);
}

/* ---- HMI drawing (ArthSim grammar) */
.hmi-svg {
  display: block;
  width: 100%;
  height: auto;
  font-family: var(--font);
  user-select: none;
  -webkit-user-select: none;
}
.hmi-svg text {
  font-family: var(--font);
}
.hmi-svg .area {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  fill: #94a3b8;
}
.hmi-svg .lbl,
.hmi-svg .cap-l {
  font-size: 11.5px;
  font-weight: 650;
  fill: #334155;
}
.hmi-svg .sub-l {
  font-size: 10px;
  fill: #64748b;
}
.hmi-svg .m-l {
  font-size: 10px;
  font-weight: 650;
  fill: #475569;
}
.hmi-svg .m-st {
  font-size: 8.5px;
  font-weight: 750;
  letter-spacing: 0.04em;
  fill: #64748b;
}
.hmi-svg .st-l {
  font-size: 9.5px;
  fill: #64748b;
}
.hmi-svg .plbl {
  font-size: 10px;
  fill: #64748b;
  font-style: italic;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 3px;
}
.hmi-svg .dest-l,
.hmi-svg .src-l {
  font-size: 10.5px;
  font-weight: 650;
  fill: #475569;
}
.hmi-svg .lvl-t {
  font-size: 11px;
  font-weight: 750;
  fill: #0f172a;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 3px;
  font-variant-numeric: tabular-nums;
}
/* vessels and line art */
.hmi-svg .wall,
.hmi-svg .cap {
  fill: none;
  stroke: #475569;
  stroke-width: 2;
  stroke-linejoin: round;
}
.hmi-svg .hatch {
  stroke: #cbd5e1;
  stroke-width: 1;
}
.hmi-svg .shell,
.hmi-svg .frame {
  fill: #f8fafc;
  stroke: #475569;
  stroke-width: 1.6;
}
.hmi-svg .water {
  fill: rgba(2, 132, 199, 0.12);
}
.hmi-svg .water.held {
  fill: rgba(71, 85, 105, 0.16);
}
.hmi-svg .water-fill {
  fill: rgba(2, 132, 199, 0.08);
  stroke: none;
}
.hmi-svg .sludge {
  fill: rgba(161, 98, 7, 0.3);
}
.hmi-svg .cake {
  fill: rgba(120, 53, 15, 0.55);
}
.hmi-svg .rim {
  fill: none;
  stroke: #cbd5e1;
}
.hmi-svg .bridge {
  stroke: #475569;
  stroke-width: 3;
}
.hmi-svg .drive {
  fill: #e2e8f0;
  stroke: #475569;
}
.hmi-svg .shaft {
  stroke: #475569;
  stroke-width: 1.5;
}
.hmi-svg .rake,
.hmi-svg .well,
.hmi-svg .launder {
  fill: none;
  stroke: #64748b;
  stroke-width: 1.3;
}
.hmi-svg .diffusers ellipse {
  fill: #cbd5e1;
}
.hmi-svg .bub {
  fill: #fff;
  stroke: rgba(2, 132, 199, 0.5);
  stroke-width: 0.8;
  opacity: 0;
}
.hmi-svg .basin.flowing .bub {
  animation: rise 2.4s linear infinite;
}
.hmi-svg .twl,
.hmi-svg .bwl {
  stroke: #94a3b8;
  stroke-dasharray: 6 4;
}
.hmi-svg .decanter .arm {
  stroke: #334155;
  stroke-width: 3;
  stroke-linecap: round;
}
.hmi-svg .decanter .piv {
  fill: #fff;
  stroke: #334155;
  stroke-width: 1.5;
}
.hmi-svg .phase-card rect {
  fill: #fff;
  stroke: rgba(148, 163, 184, 0.6);
}
.hmi-svg .ph-l {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  fill: #64748b;
}
.hmi-svg .ph-v {
  font-size: 18px;
  font-weight: 800;
  fill: #0f172a;
  letter-spacing: 0.02em;
}
.hmi-svg .ph-t {
  font-size: 10px;
  fill: #64748b;
}
.hmi-svg .bars {
  stroke: #475569;
  stroke-width: 1.2;
}
.hmi-svg .rakebar {
  fill: #94a3b8;
}
.hmi-svg .rakebar.raking {
  animation: rake 3.2s ease-in-out infinite;
}
.hmi-svg .fibres {
  stroke: #cbd5e1;
  stroke-width: 1.6;
}
.hmi-svg .hdr,
.hmi-svg .inter {
  stroke: #475569;
  stroke-width: 1.6;
}
.hmi-svg .pv {
  fill: #fff;
  stroke: #475569;
  stroke-width: 1.3;
}
.hmi-svg .mode-t {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  fill: #075985;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 3px;
}
.hmi-svg .mode-t.sm {
  font-size: 8.5px;
}
.hmi-svg .eq[data-mode='4'] .frame,
.hmi-svg .eq[data-mode='4'] > .shell {
  stroke-dasharray: 5 4;
}
.hmi-svg .ro[data-mode='0'] .pv,
.hmi-svg .skid[data-mode='0'] .fibres {
  opacity: 0.45;
}
.hmi-svg .calandria {
  fill: #fff;
  stroke: #475569;
  stroke-width: 1.2;
}
.hmi-svg .tubes,
.hmi-svg .demist {
  fill: none;
  stroke: #94a3b8;
  stroke-width: 1.1;
}
.hmi-svg .effect .vapour {
  fill: none;
  stroke: #c026d3;
  stroke-width: 1.6;
  stroke-dasharray: 3 4;
}
.hmi-svg .jacket {
  stroke: #86198f;
  stroke-width: 1.4;
  stroke-dasharray: 3 4;
}
.hmi-svg .rotor {
  fill: none;
  stroke: #475569;
  stroke-width: 1.5;
}
.hmi-svg .media {
  fill: rgba(161, 98, 7, 0.14);
  stroke: rgba(161, 98, 7, 0.35);
}
.hmi-svg .grav {
  stroke: #94a3b8;
  stroke-dasharray: 2 2;
}
.hmi-svg .plates {
  stroke: #94a3b8;
  stroke-width: 1.4;
}
.hmi-svg .sleeve {
  fill: #f5f3ff;
  stroke: #c4b5fd;
  stroke-width: 1;
}
.hmi-svg .lamp {
  stroke: #8b5cf6;
  stroke-width: 3;
  stroke-linecap: round;
  opacity: var(--glow, 0.1);
}
.hmi-svg .lab-pt path {
  fill: #fdf4ff;
  stroke: #a21caf;
  stroke-width: 1.2;
}
.hmi-svg .dest-l {
  fill: #0369a1;
}
/* machines — state is text plus shape, never colour alone */
.hmi-svg .mach .body {
  fill: #fff;
  stroke: #475569;
  stroke-width: 1.6;
}
.hmi-svg .mach .glyph {
  fill: #e2e8f0;
  stroke: #475569;
  stroke-width: 1.3;
  stroke-linejoin: round;
}
.hmi-svg .mach .imp {
  fill: none;
  stroke: #475569;
  stroke-width: 1.2;
  stroke-dasharray: 2.2 1.6;
  transform-box: fill-box;
  transform-origin: center;
}
.hmi-svg .mach[data-state='run'] .body {
  fill: #e2e8f0;
}
.hmi-svg .mach[data-state='run'] .imp {
  animation: spin 1.1s linear infinite;
}
.hmi-svg .mach[data-state='trip'] .body,
.hmi-svg .mach[data-state='lock'] .body {
  fill: #fef2f2;
  stroke: #dc2626;
  stroke-width: 2;
}
.hmi-svg .mach[data-state='trip'] .m-st,
.hmi-svg .mach[data-state='lock'] .m-st {
  fill: #dc2626;
}
.hmi-svg .mach[data-state='loc'] .body {
  stroke: #d97706;
  stroke-dasharray: 3 2;
  stroke-width: 2;
}
.hmi-svg .mach[data-state='loc'] .m-st {
  fill: #b45309;
}
.hmi-svg .mach[data-state='iso'] .body {
  fill: url(#hatch);
  stroke: #94a3b8;
}
.hmi-svg .mach[data-state='run'] .m-st {
  fill: #0f766e;
}
.hmi-svg .valve path:first-child {
  fill: #fff;
  stroke: #475569;
  stroke-width: 1.4;
  stroke-linejoin: round;
}
.hmi-svg .valve[data-state='open'] path:first-child {
  fill: #475569;
}
.hmi-svg .valve .stem {
  fill: none;
  stroke: #475569;
  stroke-width: 1.2;
}
/* pipes: colour means material; dash rhythm means line class; motion only with flow */
.hmi-svg .pipe {
  --dash: 8 6;
  --cycle: -14;
}
.hmi-svg .pipe .casing {
  fill: none;
  stroke: #fff;
  stroke-width: 7;
  stroke-linejoin: round;
}
.hmi-svg .pipe .line {
  fill: none;
  stroke: var(--m, #64748b);
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.hmi-svg .pipe .motion {
  fill: none;
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 1.3;
  stroke-dasharray: var(--dash);
  stroke-linecap: round;
  display: none;
}
.hmi-svg .pipe.flowing .motion {
  display: inline;
  animation: flow 1.1s linear infinite;
}
.hmi-svg .pipe.idle .line {
  opacity: 0.32;
}
.hmi-svg .pipe.idle .plbl {
  opacity: 0.6;
}
.hmi-svg .pipe.hide {
  display: none;
}
.hmi-svg .pipe.recycle {
  --dash: 13 7;
  --cycle: -20;
}
.hmi-svg .m-sludge,
.hmi-svg .m-cake,
.hmi-svg .m-salt,
.hmi-svg .m-brine {
  --dash: 10 5 2 5;
  --cycle: -22;
}
.hmi-svg .m-air,
.hmi-svg .m-steam,
.hmi-svg .m-vapour,
.hmi-svg .m-chem,
.hmi-svg .m-fresh {
  --dash: 3 6;
  --cycle: -9;
}
.hmi-svg .m-air .line,
.hmi-svg .m-steam .line,
.hmi-svg .m-vapour .line {
  stroke-dasharray: 7 3;
}
.m-raw { --m: #78716c; }
.m-ml { --m: #8a6d3b; }
.m-tw { --m: #0ea5e9; }
.m-perm { --m: #0284c7; }
.m-reuse { --m: #0369a1; }
.m-fresh { --m: #38bdf8; }
.m-brine { --m: #1e3a8a; }
.m-sludge { --m: #a16207; }
.m-cake { --m: #78350f; }
.m-salt { --m: #57534e; }
.m-air { --m: #94a3b8; }
.m-steam { --m: #86198f; }
.m-vapour { --m: #c026d3; }
.m-cond { --m: #0891b2; }
.m-chem { --m: #14b8a6; }
.m-held { --m: #475569; }
.hmi-svg .sig {
  stroke: #94a3b8;
  stroke-width: 1;
  stroke-dasharray: 3 3;
}
.hmi-svg .bubble circle {
  fill: #fff;
  stroke: #475569;
  stroke-width: 1.2;
}
.hmi-svg .bubble .div {
  stroke: #475569;
}
.hmi-svg .b-isa {
  font-size: 8.5px;
  font-weight: 750;
  fill: #0f172a;
}
.hmi-svg .b-num {
  font-size: 8px;
  fill: #475569;
}
/* instrument readouts carry source quality */
.hmi-svg .vbox rect {
  fill: #fff;
  stroke: rgba(148, 163, 184, 0.7);
  stroke-width: 1;
}
.hmi-svg .vbox.critical rect {
  stroke: #475569;
  stroke-width: 1.4;
}
.hmi-svg .vb-lab {
  font-size: 8.5px;
  font-weight: 650;
  fill: #64748b;
}
.hmi-svg .vb-tag {
  font-family: var(--mono);
  font-size: 8.5px;
  fill: #64748b;
}
.hmi-svg .vb-v {
  font-size: 13px;
  font-weight: 760;
  fill: #0f172a;
  font-variant-numeric: tabular-nums;
}
.hmi-svg .vb-v .u {
  font-size: 9px;
  font-weight: 500;
  fill: #64748b;
}
.hmi-svg .vb-q {
  font-size: 8px;
  font-weight: 700;
  fill: #64748b;
}
.hmi-svg .vbox[data-q='Late'] rect,
.hmi-svg .vbox[data-q='Suspect'] rect {
  fill: #fffbeb;
  stroke: #d97706;
}
.hmi-svg .vbox[data-q='Suspect'] rect {
  stroke-dasharray: 4 3;
}
.hmi-svg .vbox[data-q='Late'] .vb-q,
.hmi-svg .vbox[data-q='Suspect'] .vb-q {
  fill: #b45309;
}
.hmi-svg .vbox[data-q='Unavailable'] rect,
.hmi-svg .vbox[data-q='No data'] rect {
  fill: #fef2f2;
  stroke: #dc2626;
  stroke-dasharray: 4 3;
}
.hmi-svg .vbox[data-q='Unavailable'] .vb-v,
.hmi-svg .vbox[data-q='No data'] .vb-v,
.hmi-svg .vbox[data-q='Unavailable'] .vb-q,
.hmi-svg .vbox[data-q='No data'] .vb-q {
  fill: #dc2626;
}
.hmi-svg .vbox[data-q='Unavailable'] .vb-v,
.hmi-svg .vbox[data-q='No data'] .vb-v {
  font-size: 11px;
}
.hmi-svg .vbox[data-q='Lab'] rect {
  fill: #fdf4ff;
  stroke: #a21caf;
}
.hmi-svg .vbox[data-q='Lab'] .vb-q {
  fill: #86198f;
}
.hmi-svg .vbox[data-q='Cal. overdue'] rect {
  stroke: #0284c7;
}
.hmi-svg .vbox[data-q='Cal. overdue'] .vb-q {
  fill: #075985;
}
/* control badges */
.hmi-svg .lbadge rect {
  fill: #f0fdfa;
  stroke: rgba(15, 118, 110, 0.45);
}
.hmi-svg .lb-id {
  font-size: 9.5px;
  font-weight: 750;
  fill: #0f172a;
}
.hmi-svg .lb-mode {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  fill: #0f766e;
}
.hmi-svg .lb-v {
  font-size: 10px;
  fill: #334155;
  font-variant-numeric: tabular-nums;
}
.hmi-svg .lbadge[data-mode='MANUAL'] rect {
  fill: #fffbeb;
  stroke: #d97706;
}
.hmi-svg .lbadge[data-mode='MANUAL'] .lb-mode {
  fill: #b45309;
}
.hmi-svg .lbadge[data-mode='HOLD'] rect,
.hmi-svg .lbadge[data-mode='LOCKED'] rect {
  fill: #fef2f2;
  stroke: #dc2626;
}
.hmi-svg .lbadge[data-mode='HOLD'] .lb-mode,
.hmi-svg .lbadge[data-mode='LOCKED'] .lb-mode {
  fill: #dc2626;
}
.hmi-svg .lbadge[data-mode='ADVISORY'] rect {
  fill: #f0f9ff;
  stroke: #0284c7;
}
.hmi-svg .lbadge[data-mode='ADVISORY'] .lb-mode {
  fill: #075985;
}
/* alarm markers: priority number in a diamond */
.hmi-svg .amark {
  pointer-events: none;
}
.hmi-svg .amark[data-p='0'] {
  display: none;
}
.hmi-svg .amark path {
  stroke: #fff;
  stroke-width: 1.5;
}
.hmi-svg .amark[data-p='1'] path {
  fill: #dc2626;
}
.hmi-svg .amark[data-p='2'] path {
  fill: #ea580c;
}
.hmi-svg .amark[data-p='3'] path {
  fill: #d97706;
}
.hmi-svg .amark[data-p='4'] path {
  fill: #64748b;
}
.hmi-svg .amark text {
  font-size: 10px;
  font-weight: 800;
  fill: #fff;
}
.hmi-svg .amark.unack path {
  animation: blink 1.4s steps(2, jump-none) infinite;
}
/* live explanation chips */
.hmi-svg .chip-bg {
  fill: #fff;
  stroke: var(--tone);
  stroke-width: 1.2;
}
.hmi-svg .chip-dot {
  fill: var(--tone);
}
.hmi-svg .chip-t {
  font-size: 11px;
  font-weight: 650;
  fill: #0f172a;
}
/* SBR schedule strip */
.hmi-svg .gantt .ph {
  stroke: #fff;
  stroke-width: 1;
}
.hmi-svg .gantt .ph-1 {
  fill: #dbeafe;
}
.hmi-svg .gantt .ph-2 {
  fill: #ccfbf1;
}
.hmi-svg .gantt .ph-3 {
  fill: #e2e8f0;
}
.hmi-svg .gantt .ph-4 {
  fill: #bae6fd;
}
.hmi-svg .gantt .ph-5,
.hmi-svg .gantt .ph-0 {
  fill: #f1f5f9;
}
.hmi-svg .gantt .ph.proj {
  fill-opacity: 0.55;
  stroke: #94a3b8;
  stroke-dasharray: 3 3;
}
.hmi-svg .gantt .ph.held {
  stroke: #dc2626;
  stroke-width: 1.6;
}
.hmi-svg .gantt .ph-t {
  font-size: 10px;
  font-weight: 650;
  fill: #334155;
  pointer-events: none;
}
.hmi-svg .gantt .g-l {
  font-size: 11px;
  font-weight: 800;
  fill: #334155;
}
.hmi-svg .gantt .g-now {
  stroke: #0f172a;
  stroke-width: 1.2;
  stroke-dasharray: 2 3;
}
.hmi-svg .gantt .g-t,
.hmi-svg .gantt .g-cap {
  font-size: 10px;
  fill: #64748b;
}
/* design-basis overlay */
.hmi-svg .design-ov rect {
  fill: rgba(255, 255, 255, 0.96);
  stroke: #0f766e;
  stroke-dasharray: 4 3;
}
.hmi-svg .design-ov text {
  font-size: 10.5px;
  font-weight: 650;
  fill: #0b5756;
}
/* selection */
.hmi-svg [data-sel] {
  cursor: pointer;
  outline: none;
}
.hmi-svg [data-sel]:hover,
.hmi-svg [data-sel]:focus-visible {
  filter: drop-shadow(0 0 2.5px rgba(15, 118, 110, 0.55));
}
.hmi-svg [data-sel].selected {
  filter: drop-shadow(0 0 1px #0f766e) drop-shadow(0 0 5px rgba(15, 118, 110, 0.55));
}
.hmi-svg .pipe[data-sel]:hover .line,
.hmi-svg .pipe.selected .line {
  stroke-width: 3.6;
}

/* ================================================================ historian / instruments */
.hist-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.picker {
  position: sticky;
  top: calc(var(--top) + 16px);
}
.picker .panel-b {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.picker .search {
  min-width: 0;
}
.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag-list {
  max-height: calc(100vh - var(--top) - 230px);
  overflow-y: auto;
  margin: 0 -6px;
}
.tag-opt {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.78rem;
}
.tag-opt:hover {
  background: var(--soft);
}
.tag-opt input {
  margin-top: 3px;
  accent-color: var(--accent);
}
.tag-opt span {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.tag-opt b {
  font-family: var(--mono);
  font-size: 0.74rem;
}
.tag-opt small {
  color: var(--ink-3);
  font-size: 0.72rem;
}
.hist-charts {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.view-instruments .table-wrap {
  max-height: calc(100vh - var(--top) - 290px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* ================================================================ modal */
#modal {
  width: min(880px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0 0 20px;
  border: 0;
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
  overflow-y: auto;
}
#modal::backdrop {
  background: rgba(15, 23, 42, 0.34);
}
#modal > *:not(.modal-h) {
  margin-left: 22px;
  margin-right: 22px;
}
.modal-h {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 22px 8px;
}
.modal-h h2 {
  font-family: var(--mono);
  font-size: 1.2rem;
  margin: 3px 0 2px;
}
.modal-h p {
  color: var(--ink-2);
  font-size: 0.82rem;
}
.modal-val {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.modal-val b {
  font-size: 1.9rem;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
}
.modal-val small {
  color: var(--ink-3);
  font-weight: 600;
}
.modal-val span:last-child {
  color: var(--ink-3);
  font-size: 0.76rem;
}
.lineage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}
.lineage > div {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 0;
}
.lineage b {
  display: block;
  font-size: 0.8rem;
  margin-top: 2px;
}
.lineage small {
  display: block;
  font-size: 0.72rem;
  color: var(--ink-3);
  overflow-wrap: anywhere;
}
.lineage > .ic {
  color: var(--ink-3);
}

/* ================================================================ cases */
.case-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.case-list {
  position: sticky;
  top: calc(var(--top) + 16px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.case-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--tone);
  border-radius: 10px;
  background: var(--surface);
  text-align: left;
}
.case-item:hover {
  background: var(--soft);
}
.case-item.on {
  border-color: rgba(15, 118, 110, 0.45);
  border-left-color: var(--tone);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.case-item > div {
  display: flex;
  align-items: center;
  gap: 6px;
}
.case-item .code {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.78rem;
}
.case-item > div small {
  margin-left: auto;
}
.case-item b {
  font-size: 0.84rem;
  font-weight: 650;
  line-height: 1.3;
}
.case-item small {
  font-size: 0.72rem;
  color: var(--ink-3);
}
.case-body {
  min-width: 0;
}
.decision {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--tone, var(--accent));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 18px;
  margin-bottom: 12px;
}
.d-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 0.76rem;
  color: var(--ink-2);
}
.d-top .mono {
  font-weight: 700;
  color: var(--ink);
}
.decision h2 {
  font-size: 1.18rem;
  font-weight: 750;
  margin: 8px 0 4px;
  line-height: 1.3;
}
.decision > p {
  color: var(--ink-2);
  font-size: 0.84rem;
  max-width: 1000px;
}
.d-ev {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px 14px;
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.d-ev dt {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.d-ev dd {
  margin: 2px 0 0;
  font-size: 0.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.d-ev dd .tlink {
  font-weight: 700;
}
.d-ev small {
  font-size: 0.7rem;
  color: var(--ink-3);
}
.lens {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.lens button {
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: var(--surface);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ink-2);
}
.lens button.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.lens-card {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: #f0fdfa;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: var(--radius);
}
.lens-card b {
  display: block;
  margin-top: 3px;
  font-size: 0.86rem;
}
.lens-card p {
  margin-top: 3px;
  font-size: 0.8rem;
  color: var(--ink-2);
}
.case-cols {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.case-cols > div {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.case-charts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hyp {
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.hyp:first-child {
  padding-top: 0;
}
.hyp header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hyp .rank {
  width: 22px;
  height: 22px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--well);
  font-size: 0.72rem;
  font-weight: 800;
}
.hyp header b {
  font-size: 0.84rem;
}
.hyp .score {
  margin-left: auto;
  width: 72px;
  height: 6px;
  flex: none;
  border-radius: 3px;
  background: var(--well);
  overflow: hidden;
}
.hyp .score i {
  display: block;
  height: 100%;
  background: var(--accent);
}
.hyp header em {
  width: 36px;
  text-align: right;
  font-style: normal;
  font-weight: 700;
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}
.hyp .mech {
  margin: 5px 0 2px;
  font-size: 0.8rem;
  color: var(--ink-2);
}
.opt {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.opt:first-child {
  padding-top: 0;
}
.opt:last-child {
  border-bottom: 0;
}
.opt b {
  font-size: 0.84rem;
}
.opt p {
  margin: 2px 0 3px;
  font-size: 0.78rem;
  color: var(--ink-2);
}
.opt .st {
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--tone-ink);
}
.opt-a {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}
.checks {
  list-style: none;
  padding: 0;
  margin: 0;
}
.checks li {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 0.8rem;
}
.checks li:last-child {
  border-bottom: 0;
}
.checks li > span {
  color: var(--ink-3);
}
.checks li.done > span {
  color: var(--ok);
}
.checks b {
  font-weight: 600;
}
.checks small {
  display: block;
  font-size: 0.72rem;
  color: var(--ink-3);
}

/* ================================================================ model lab */
.ml-grid {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.ml-grid > aside {
  position: sticky;
  top: calc(var(--top) + 16px);
}
.ml-grid > aside .field {
  width: 100%;
}
.ml-opts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0;
}
.ml-opt {
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}
.ml-opt:hover {
  border-color: var(--line-strong);
  background: var(--soft);
}
.ml-opt input {
  margin-top: 3px;
  accent-color: var(--accent);
}
.ml-opt span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ml-opt b {
  font-size: 0.8rem;
}
.ml-opt small {
  font-size: 0.72rem;
  color: var(--ink-2);
}
.ml-opt.blocked small {
  color: var(--warm);
}
.ml-res {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.ml-res > .note {
  margin: 0;
}
.ml-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 12px;
}
.ml-carry {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

/* ================================================================ control */
.exec {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px dashed rgba(15, 118, 110, 0.45);
  border-radius: 8px;
  background: #f0fdfa;
  color: #115e59;
  font-size: 0.76rem;
}
.ctl-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.loops {
  position: sticky;
  top: calc(var(--top) + 16px);
}
.loops .panel-b {
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: calc(100vh - var(--top) - 60px);
  overflow-y: auto;
}
.loop-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: none;
  text-align: left;
}
.loop-row:hover {
  background: var(--soft);
}
.loop-row.on {
  background: var(--accent-soft);
  border-color: rgba(15, 118, 110, 0.28);
}
.loop-row > div:first-child {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.loop-row b {
  font-size: 0.8rem;
}
.loop-row small {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--ink-3);
}
.lr-v {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex: none;
}
.lr-v span {
  font-size: 0.74rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.lr-v em {
  font-style: normal;
  font-size: 0.68rem;
  color: var(--warm);
}
.pend {
  margin-top: 8px;
  padding: 10px 6px 4px;
  border-top: 1px solid var(--line);
}
.pend-row {
  display: flex;
  flex-direction: column;
  padding: 4px 0;
  font-size: 0.78rem;
}
.pend-row b {
  font-family: var(--mono);
  font-size: 0.74rem;
}
.pend-row small {
  color: var(--ink-3);
}
.ctl-main {
  min-width: 0;
}
.chain {
  display: flex;
  align-items: stretch;
  gap: 4px;
  margin-bottom: 12px;
  overflow-x: auto;
}
.chain-n {
  flex: 1 1 0;
  min-width: 118px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--tone);
  border-radius: 10px;
}
.chain-n span {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.chain-n b {
  display: block;
  margin-top: 2px;
  font-size: 0.84rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.chain > i {
  align-self: center;
  color: var(--ink-3);
}
.ctl-cols {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}
.ctl-cols > div {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.form .row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}
.form-a {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.form-a small {
  color: var(--ink-3);
  font-size: 0.74rem;
  flex: 1;
  min-width: 200px;
}
.reviews {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}
.review {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px dashed #fcd34d;
  border-radius: 10px;
  background: #fffbeb;
}
.review > div {
  flex: 1;
  min-width: 220px;
  display: flex;
  flex-direction: column;
}
.review b {
  font-size: 0.82rem;
}
.review small {
  color: var(--ink-2);
  font-size: 0.74rem;
}
.review input {
  height: 30px;
  width: 160px;
}
.eq-cmds {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.eqc {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 0 10px;
}
.eqc b {
  font-size: 0.82rem;
}
.eqc small {
  color: var(--ink-2);
  font-size: 0.76rem;
}
.eqc > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ================================================================ alarms */
.alm-grid {
  display: grid;
  grid-template-columns: minmax(340px, 0.9fr) minmax(0, 1.4fr);
  gap: 16px;
  align-items: start;
}
.alm-list {
  position: sticky;
  top: calc(var(--top) + 16px);
}
.alm-list .panel-b {
  padding: 6px;
  max-height: calc(100vh - var(--top) - 110px);
  overflow-y: auto;
}
.alm-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  text-align: left;
}
.alm-row + .alm-row {
  border-top: 1px dashed var(--line);
}
.alm-row:hover {
  background: var(--soft);
}
.alm-row.on {
  background: var(--accent-soft);
}
.alm-row div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.alm-row b {
  font-size: 0.8rem;
  font-weight: 600;
}
.alm-row.unack b {
  font-weight: 750;
}
.alm-row small {
  font-size: 0.7rem;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.alm-detail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.alm-detail .decision,
.alm-detail .two {
  margin: 0;
}
.alm-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.alm-actions input[name='note'] {
  flex: 1;
  min-width: 180px;
}
.alm-actions input[name='by'] {
  width: 150px;
}

/* ================================================================ maintenance */
.assets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
}
.asset {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  min-width: 0;
}
.asset.warn {
  border-left: 3px solid var(--warn);
}
.asset.bad {
  border-left: 3px solid var(--bad);
}
.asset header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.asset header b {
  font-size: 0.82rem;
}
.asset header small {
  display: block;
  font-size: 0.7rem;
  color: var(--ink-3);
}
.asset .idx {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--ok);
  font-variant-numeric: tabular-nums;
}
.asset.warn .idx {
  color: var(--warm);
}
.asset.bad .idx {
  color: var(--bad);
}
.asset .spark {
  width: 100%;
  height: 36px;
}
.asset dl {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 3px 10px;
  margin: 0;
  font-size: 0.74rem;
}
.asset dt {
  color: var(--ink-3);
}
.asset dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}
.asset dd small {
  color: var(--ink-3);
  font-weight: 500;
}
.asset dd .bad {
  color: var(--bad);
}
.asset footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}
.cal {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.cal-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}
.cal-row > b {
  font-family: var(--mono);
  font-size: 0.72rem;
}
.cal-track {
  position: relative;
  height: 28px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.cal-scale .cal-track {
  height: 18px;
  background: none;
  border: 0;
  overflow: visible;
}
.cal-scale span {
  position: absolute;
  top: 0;
  padding-left: 4px;
  font-size: 0.68rem;
  color: var(--ink-3);
  border-left: 1px solid var(--line-strong);
}
.nowline {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--ink);
}
.cal .off {
  position: absolute;
  top: 0;
  bottom: 0;
  background: repeating-linear-gradient(45deg, rgba(148, 163, 184, 0.2) 0 4px, transparent 4px 8px);
}
.blk {
  position: absolute;
  top: 3px;
  bottom: 3px;
  padding: 0 5px;
  border: 1px solid;
  border-radius: 5px;
  font-size: 0.64rem;
  font-weight: 700;
  font-family: var(--mono);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-align: left;
  background: #e0f2fe;
  border-color: #7dd3fc;
  color: #075985;
}
.blk.st-Inprogress {
  background: #ccfbf1;
  border-color: #5eead4;
  color: #115e59;
}
.blk.st-Verifying {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}
.blk.st-Verified,
.blk.st-Closed {
  background: var(--well);
  border-color: var(--line-strong);
  color: var(--ink-2);
}
.blk.st-Followuprequired {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}
.mt-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 16px;
  align-items: start;
}
.mt-grid .table-wrap {
  max-height: 560px;
}
.wo-detail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.wo-detail .decision {
  margin: 0;
}
.wo-detail > .note {
  margin: 0;
}
.sched {
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.sched .row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
}
.wins {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}
.win {
  display: grid;
  grid-template-columns: 150px minmax(0, 1.1fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: 8px;
  font-size: 0.76rem;
}
.win.ok {
  border-left-color: var(--ok);
  background: #fbfffe;
}
.win > div:first-child b {
  display: block;
  font-variant-numeric: tabular-nums;
}
.win small {
  color: var(--ink-3);
  font-size: 0.7rem;
}
.win .imp {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  color: var(--ink-3);
  font-size: 0.72rem;
}
.win .imp b {
  color: var(--ink);
}
.win .why {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* ================================================================ handoff */
.ho-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr);
  gap: 16px;
  align-items: start;
}
.ho-grid > aside {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ho-grid .form .panel-b {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ho-group + .ho-group {
  margin-top: 14px;
}
.ho-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 0.8rem;
}
.ho-item > div:first-child {
  display: flex;
  align-items: baseline;
  min-width: 0;
}
.ho-a {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}
.ho-a select {
  height: 28px;
  font-size: 0.74rem;
}
.ho-pend,
.ho-log {
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 0.8rem;
}
.ho-pend small,
.ho-log small {
  display: block;
  color: var(--ink-3);
  font-size: 0.72rem;
  margin-bottom: 6px;
}
.ho-log p {
  font-size: 0.78rem;
  color: var(--ink-2);
}

/* ================================================================ resources / value / data */
.ebar,
.hrow {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) 170px;
  gap: 10px;
  align-items: center;
  margin-bottom: 9px;
  font-size: 0.78rem;
}
.ebar span,
.hrow span {
  font-size: 0.72rem;
  color: var(--ink-3);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.hrow .bar i {
  background: var(--tone);
}
.plist {
  margin: 0;
  padding-left: 18px;
  font-size: 0.8rem;
}
.plist li {
  margin: 4px 0;
}
.dgram {
  display: block;
  width: 100%;
  height: auto;
}
.dgram .dg-b rect {
  fill: #f8fafc;
  stroke: #475569;
  stroke-width: 1.2;
}
.dgram .dg-b.gated rect {
  fill: #fff;
  stroke: #94a3b8;
  stroke-dasharray: 5 4;
}
.dgram .dg-t {
  font-size: 13px;
  font-weight: 700;
  fill: #0f172a;
}
.dgram .dg-s {
  font-size: 11px;
  fill: #475569;
}
.dgram .dg-a {
  fill: none;
  stroke: #475569;
  stroke-width: 1.5;
}
.dgram .dg-a.gated {
  stroke: #94a3b8;
  stroke-dasharray: 4 7;
}
.dgram marker path {
  fill: #475569;
}
.contract {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.contract > div {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}
.contract b {
  font-size: 0.82rem;
}
.contract p {
  margin: 4px 0;
  font-size: 0.76rem;
  color: var(--ink-2);
}
.contract small {
  font-size: 0.7rem;
  color: var(--ink-3);
}

/* ================================================================ reports */
.rep-grid {
  display: grid;
  grid-template-columns: 370px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.rep-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.rep-form .panel-b {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.rep-form .row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.rep-form .field {
  min-width: 0;
  flex: 1;
}
.rep-form .fine {
  margin-top: 0;
}
.rep-parts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rep-part {
  margin: 0;
  padding: 6px 12px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--soft);
}
.rep-part.off {
  background: var(--surface);
}
.rep-part.off .rep-sec {
  color: var(--ink-3);
}
.rep-part legend {
  padding: 0 4px;
  font-size: 0.8rem;
  font-weight: 650;
}
.rep-part legend label,
.rep-sec {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.rep-sec {
  padding: 3px 0 3px 4px;
  font-size: 0.8rem;
}
.rep-part input,
.rep-sec input {
  accent-color: var(--accent);
}
.rep-sched {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
}
.rep-sched b {
  font-size: 0.82rem;
}
.rep-sched small {
  display: block;
  color: var(--ink-3);
  font-size: 0.72rem;
}
.rep-sched-r {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--ink-3);
  white-space: nowrap;
}
.rep-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.rep-main > .panel > .panel-b > .table-wrap {
  max-height: 340px;
}
.rep-act {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  white-space: nowrap;
}
.rep-preview-h {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.rpt {
  padding: 22px 26px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}
.rpt-head {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--accent);
}
.rpt-head h2 {
  font-size: 1.3rem;
  margin: 4px 0;
}
.rpt-head p {
  color: var(--ink-2);
  font-size: 0.84rem;
}
.rpt-head dl {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 3px 10px;
  margin: 0;
  font-size: 0.76rem;
}
.rpt-head dt {
  color: var(--ink-3);
}
.rpt-head dd {
  margin: 0;
  font-weight: 600;
}
.rpt-sec {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.rpt-sec h3,
.rpt-site-h h3 {
  font-size: 1.02rem;
}
.rpt-sum {
  margin-top: 10px;
}
.rpt-sum b {
  color: var(--accent);
  font-size: 0.86rem;
}
.rpt-sum ul,
.rpt-case ul {
  margin: 4px 0 0;
  padding-left: 18px;
  font-size: 0.82rem;
  color: var(--ink-2);
}
.rpt-sum li,
.rpt-case li {
  margin: 3px 0;
}
.rpt-site {
  margin-top: 8px;
  padding-top: 18px;
  border-top: 2px solid var(--line-strong);
}
.rpt-site-h {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.rpt-site-h span {
  color: var(--ink-3);
  font-size: 0.76rem;
}
.rpt-part {
  margin: 16px 0 6px;
  font-size: 0.92rem;
  color: var(--accent);
}
.rpt-block {
  margin: 10px 0 16px;
}
.rpt-block h5 {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.rpt-block .table-wrap,
.rpt-block .strip {
  margin-bottom: 8px;
}
.rpt-block .two {
  margin-bottom: 0;
}
.rpt-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
  margin: 8px 0 12px;
}
.rpt-line {
  margin: 5px 0;
  font-size: 0.8rem;
  color: var(--ink-2);
}
.rpt-case {
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
.rpt-case p {
  font-size: 0.82rem;
}
.rpt-foot {
  margin-top: 16px;
  font-size: 0.72rem;
  color: var(--ink-3);
}

/* ================================================================ toasts */
#toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: min(440px, calc(100vw - 32px));
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--tone, var(--accent));
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
  font-size: 0.8rem;
  font-weight: 500;
  animation: toast-in 0.18s ease-out;
  transition: opacity 0.5s, transform 0.5s;
}
.toast .ic {
  color: var(--tone, var(--accent));
  margin-top: 1px;
}
.toast.out {
  opacity: 0;
  transform: translateY(6px);
}

/* ================================================================ motion */
@keyframes flow {
  to {
    stroke-dashoffset: var(--cycle);
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes rise {
  0% {
    transform: translateY(0);
    opacity: 0;
  }
  15% {
    opacity: 0.9;
  }
  100% {
    transform: translateY(-70px);
    opacity: 0;
  }
}
@keyframes rake {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(28px);
  }
}
@keyframes blink {
  50% {
    opacity: 0.35;
  }
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .hmi-svg .pipe.flowing .motion {
    display: inline;
    animation: none;
  }
}

/* ================================================================ responsive */
@media (max-width: 1600px) {
  .me {
    display: none;
  }
  .casechip {
    max-width: 280px;
  }
}
/* Short screens keep the twin clock in view: the Site list lives in every Site tab bar. */
@media (max-height: 920px) and (min-width: 901px) {
  .client,
  .rail .ng-sites,
  .rail .nv.site {
    display: none;
  }
  .brand {
    padding-bottom: 8px;
  }
  .ng {
    margin: 10px 10px 4px;
  }
  .nv {
    padding: 5px 10px;
  }
  .rail-foot {
    padding-top: 10px;
  }
}
@media (max-width: 1440px) {
  .site-row {
    grid-template-columns: minmax(150px, 1fr) minmax(170px, 1.3fr) repeat(4, minmax(0, 0.7fr)) 18px;
  }
  .clock small {
    display: none;
  }
}
@media (max-width: 1280px) {
  .hmi-grid,
  .cmd-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .inspector,
  .cmd-rail {
    position: static;
    max-height: none;
  }
  .cmd-rail .panel-b {
    max-height: none;
  }
  .me {
    display: none;
  }
}
@media (max-width: 1100px) {
  .two,
  .case-cols,
  .ctl-cols,
  .mt-grid,
  .ho-grid,
  .case-grid,
  .hist-grid,
  .ml-grid,
  .ctl-grid,
  .alm-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .case-list,
  .picker,
  .ml-grid > aside,
  .loops,
  .alm-list {
    position: static;
  }
  .case-list {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .case-item {
    min-width: 250px;
  }
  .tag-list,
  .alm-list .panel-b,
  .loops .panel-b {
    max-height: 320px;
  }
  .rep-grid,
  .rpt-head {
    grid-template-columns: minmax(0, 1fr);
  }
  .lens-card {
    grid-template-columns: minmax(0, 1fr);
  }
  .site-row {
    grid-template-columns: minmax(0, 1.2fr) repeat(4, minmax(0, 1fr)) 18px;
    grid-template-areas:
      'id id state state state go'
      'm1 m1 m2 m3 m4 go'
      'c1 c1 c2 c2 c3 go';
  }
  .site-row > div:nth-of-type(3) { grid-area: m1; }
  .casechip {
    max-width: 260px;
  }
  .lens-sel select {
    max-width: 130px;
  }
}
@media (max-width: 900px) {
  #app {
    grid-template-columns: minmax(0, 1fr);
  }
  .rail {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 264px;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 0 0 40px rgba(15, 23, 42, 0.3);
  }
  .rail.open {
    transform: none;
  }
  .menu {
    display: inline-grid;
  }
  .top {
    padding: 0 16px;
    gap: 8px;
  }
  .crumb > span:first-child,
  .crumb > .ic:first-of-type {
    display: none;
  }
  .casechip {
    display: none;
  }
  .lens-sel {
    display: none;
  }
  .clock {
    border-left: 0;
    padding-left: 0;
  }
}
@media (max-width: 640px) {
  body {
    font-size: 13px;
  }
  #main {
    padding: 14px 16px 40px;
  }
  .ph {
    flex-direction: column;
    align-items: flex-start;
  }
  .ph-actions {
    justify-content: flex-start;
  }
  .strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .strip > div {
    border-left: 0;
    padding-left: 2px;
    border-top: 1px solid var(--line);
  }
  .strip > div:nth-child(-n + 2) {
    border-top: 0;
  }
  .site-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      'id id'
      'state state'
      'm1 m2'
      'm3 m4'
      'c1 c1'
      'c2 c2'
      'c3 c3';
  }
  .sr-go {
    display: none;
  }
  .alms .prio:not(.p1) {
    display: none;
  }
  .twin-pill {
    display: none;
  }
  .crumb {
    font-size: 0.76rem;
    overflow: hidden;
  }
  .crumb b {
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .lineage {
    grid-template-columns: minmax(0, 1fr);
  }
  .lineage > .ic {
    transform: rotate(90deg);
    justify-self: center;
  }
  .win {
    grid-template-columns: minmax(0, 1fr);
  }
  .wrow,
  .ebar,
  .hrow {
    grid-template-columns: 60px minmax(0, 1fr);
  }
  .wrow span,
  .ebar span,
  .hrow span {
    grid-column: 2;
    text-align: left;
  }
  .ml-charts,
  .strip-charts {
    grid-template-columns: minmax(0, 1fr);
  }
  .opt {
    grid-template-columns: minmax(0, 1fr);
  }
  .opt-a {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .ho-item {
    flex-direction: column;
    align-items: flex-start;
  }
  .hmi-foot span:last-child {
    display: none;
  }
  .review input,
  .alm-actions input[name='by'] {
    width: 100%;
  }
  .search {
    min-width: 0;
    width: 100%;
  }
}
