/* ==========================================================================
   HMC IoT · Chiller PdM Console
   Light industrial console. One surface colour, hairline separation, colour
   reserved for data and status. Nothing decorative competes with the numbers.
   ========================================================================== */

:root {
  color-scheme: light;

  /* surfaces & ink */
  --page:            #f4f4f1;
  --surface-1:       #fcfcfb;
  --surface-2:       #f7f7f4;
  --surface-sunken:  #f0efec;
  --text-primary:    #0b0b0b;
  --text-secondary:  #52514e;
  --text-muted:      #898781;
  --grid:            #e1e0d9;
  --axis:            #c3c2b7;
  --border:          rgba(11, 11, 11, 0.10);
  --border-strong:   rgba(11, 11, 11, 0.18);

  /* categorical series (validated order) */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #4a3aa7;
  --series-8: #e34948;

  /* status - reserved, never used for a series */
  --status-good:     #0ca30c;
  --status-warning:  #fab219;
  --status-serious:  #ec835a;
  --status-critical: #d03b3b;
  --status-good-bg:     #eaf6ea;
  --status-warning-bg:  #fdf3dd;
  --status-serious-bg:  #fceee7;
  --status-critical-bg: #fbeaea;
  --status-neutral-bg:  #eeeeea;

  --accent: #1c5cab;

  --radius: 8px;
  --radius-sm: 5px;
  --font: system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
  --shadow-pop: 0 8px 28px rgba(11, 11, 11, 0.13), 0 1px 2px rgba(11, 11, 11, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--page);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button { font-family: inherit; font-size: inherit; color: inherit; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #d6d5ce; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #bfbeb6; }
::-webkit-scrollbar-track { background: transparent; }

/* --------------------------------------------------------------- shell -- */

.app {
  display: grid;
  grid-template-rows: auto auto 1fr;
  height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 18px;
  height: 52px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: baseline; gap: 9px; }
.brand-mark {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.11em;
  color: var(--text-primary);
}
.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.topbar-spacer { flex: 1; }

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 20px;
}
.meta-item { display: flex; flex-direction: column; gap: 1px; }
.meta-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.075em;
  color: var(--text-muted);
}
.meta-value {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* Signed-in identity, sat beside the sign-out control. Reuses the topbar meta
   scale so it reads as status, not as a control. */
.signed-in { display: flex; flex-direction: column; gap: 1px; }
.signed-in-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.075em;
  color: var(--text-muted);
}
.signed-in-user {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}
.live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--status-good);
  box-shadow: 0 0 0 3px rgba(12, 163, 12, 0.16);
}
.live-pill[data-state='down'] .live-dot { background: var(--status-critical); box-shadow: 0 0 0 3px rgba(208,59,59,0.16); }
.live-pill[data-state='live'] .live-dot { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-sunken); color: var(--text-primary); }
.icon-btn[aria-pressed='true'] { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ------------------------------------------------------------ kpi strip -- */

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
}
.kpi {
  background: var(--surface-1);
  padding: 11px 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.kpi-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.075em;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-value {
  font-size: 25px;
  font-weight: 620;
  line-height: 1.06;
  letter-spacing: -0.015em;
}
.kpi-value .unit {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 3px;
  letter-spacing: 0;
}
.kpi-foot {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 16px;
}
.kpi-spark { width: 100%; height: 20px; display: block; margin-top: 1px; }

/* ----------------------------------------------------------------- body -- */

.body {
  display: grid;
  grid-template-columns: 268px 1fr;
  min-height: 0;
}

/* ------------------------------------------------------------ asset rail -- */

.rail {
  border-right: 1px solid var(--border);
  background: var(--surface-2);
  overflow-y: auto;
  min-height: 0;
}
.rail-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px 9px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.rail-title {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.075em;
  color: var(--text-muted);
  font-weight: 600;
}
.rail-count { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.asset-card {
  width: 100%;
  text-align: left;
  display: block;
  padding: 11px 14px 12px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  background: transparent;
  cursor: pointer;
}
.asset-card:hover { background: rgba(11, 11, 11, 0.028); }
.asset-card[aria-selected='true'] {
  background: var(--surface-1);
  border-left-color: var(--accent);
}
.asset-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}
.asset-id { font-size: 13px; font-weight: 650; letter-spacing: -0.005em; }
.asset-name { font-size: 11px; color: var(--text-muted); }
.asset-card-alarm { margin-left: auto; display: flex; gap: 4px; align-items: center; }

.asset-meter {
  margin: 7px 0 6px;
  height: 5px;
  border-radius: 3px;
  background: var(--surface-sunken);
  overflow: hidden;
}
.asset-meter > i { display: block; height: 100%; border-radius: 3px; }

.asset-stats {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.asset-stats b { font-weight: 600; color: var(--text-primary); }
.asset-fault {
  margin-top: 6px;
  font-size: 10.5px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ----------------------------------------------------------------- main -- */

.main {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
  min-width: 0;
}

.asset-header {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  padding: 14px 22px 0;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
}
.asset-header-main { min-width: 0; }
.asset-header h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 640;
  letter-spacing: -0.017em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.asset-header-sub {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.asset-header-sub span::after { content: '·'; margin-left: 8px; color: var(--axis); }
.asset-header-sub span:last-child::after { content: ''; }

.tabs {
  display: flex;
  gap: 2px;
  margin-left: auto;
  align-self: flex-end;
}
.tab {
  appearance: none;
  border: 0;
  background: none;
  padding: 9px 13px 10px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tab:hover { color: var(--text-primary); }
.tab[aria-selected='true'] { color: var(--text-primary); border-bottom-color: var(--accent); }
.tab .tab-badge {
  display: inline-block;
  margin-left: 6px;
  min-width: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--status-critical);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.tab .tab-badge[data-level='warning'] { background: #b07d0a; }

.pane {
  overflow-y: auto;
  padding: 16px 22px 28px;
  min-height: 0;
}
.pane[hidden] { display: none; }

/* ---------------------------------------------------------------- cards -- */

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 15px 14px;
  min-width: 0;
}
.card-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}
.card-title {
  font-size: 12.5px;
  font-weight: 620;
  letter-spacing: -0.005em;
}
.card-sub {
  font-size: 11px;
  color: var(--text-muted);
}
.card-head .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.section-title {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 650;
  margin: 20px 0 9px;
}
.section-title:first-child { margin-top: 0; }

/* ------------------------------------------------------------ stat tile -- */

.tile {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 13px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.tile-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tile-value {
  font-size: 20px;
  font-weight: 620;
  line-height: 1.15;
  letter-spacing: -0.015em;
}
.tile-value .unit { font-size: 11px; font-weight: 500; color: var(--text-muted); margin-left: 3px; }
.tile-foot { font-size: 10.5px; color: var(--text-secondary); min-height: 15px; }
.tile-spark { width: 100%; height: 24px; display: block; margin-top: 4px; }

/* ----------------------------------------------------------------- hero -- */

.hero {
  display: flex;
  align-items: flex-start;
  gap: 26px;
}
.hero-figure {
  font-size: 54px;
  font-weight: 640;
  line-height: 1;
  letter-spacing: -0.03em;
}
.hero-figure .unit { font-size: 17px; font-weight: 500; color: var(--text-muted); margin-left: 4px; letter-spacing: 0; }
.hero-caption { font-size: 11.5px; color: var(--text-secondary); margin-top: 7px; max-width: 34ch; }

/* ---------------------------------------------------------------- chips -- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 19px;
  padding: 0 7px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.005em;
  white-space: nowrap;
  background: var(--status-neutral-bg);
  color: var(--text-secondary);
}
.chip svg { width: 10px; height: 10px; flex: none; }
.chip[data-level='normal'], .chip[data-level='good'] { background: var(--status-good-bg); color: #0a6b0a; }
.chip[data-level='advisory'] { background: #e8f0fb; color: #1c5cab; }
.chip[data-level='warning'] { background: var(--status-warning-bg); color: #8a6206; }
.chip[data-level='serious'] { background: var(--status-serious-bg); color: #a8451c; }
.chip[data-level='critical'] { background: var(--status-critical-bg); color: #a52b2b; }
.chip[data-level='offline'] { background: var(--status-neutral-bg); color: var(--text-muted); }

.dot {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--text-muted);
}
.dot[data-level='normal'], .dot[data-level='good'] { background: var(--status-good); }
.dot[data-level='advisory'] { background: var(--accent); }
.dot[data-level='warning'] { background: var(--status-warning); }
.dot[data-level='serious'] { background: var(--status-serious); }
.dot[data-level='critical'] { background: var(--status-critical); }

.swatch { width: 9px; height: 9px; border-radius: 2px; flex: none; display: inline-block; }
.line-key { width: 12px; height: 2px; border-radius: 1px; flex: none; display: inline-block; }

/* --------------------------------------------------------------- meters -- */

.meter {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-sunken);
  overflow: hidden;
}
.meter > i { display: block; height: 100%; border-radius: 3px; transition: width 0.4s ease; }

.meter-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 10px;
  align-items: center;
}

/* ---------------------------------------------------------------- chart -- */

.chart {
  position: relative;
  width: 100%;
  height: 190px;
}
.chart.tall { height: 250px; }
.chart.short { height: 128px; }
.chart-canvas { display: block; width: 100%; height: 100%; }

.chart-tooltip {
  position: absolute;
  z-index: 20;
  pointer-events: none;
  min-width: 138px;
  padding: 7px 9px 8px;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
  font-size: 11px;
}
.tt-head {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 5px;
  font-variant-numeric: tabular-nums;
}
.tt-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 1px 0; }
.tt-key { display: flex; align-items: center; gap: 6px; color: var(--text-secondary); }
.tt-key i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.tt-val { font-weight: 620; font-variant-numeric: tabular-nums; }
.tt-val em { font-style: normal; font-weight: 500; color: var(--text-muted); font-size: 10px; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 9px;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  background: none;
  border: 0;
  padding: 1px 0;
}
.legend-item[aria-pressed='false'] { opacity: 0.4; }
.legend-item .line-key.dashed {
  background: repeating-linear-gradient(90deg, currentColor 0 3px, transparent 3px 6px);
}

/* ---------------------------------------------------------------- table -- */

.table { width: 100%; border-collapse: collapse; font-size: 12px; }
.table th {
  text-align: left;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  font-weight: 650;
  padding: 0 10px 7px 0;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 7px 10px 7px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; padding-right: 0; }
/* a right-aligned column butts straight into the next one without this gutter */
.table th.num + th, .table td.num + td { padding-left: 16px; }
.table td.strong { color: var(--text-primary); font-weight: 600; }
.table tbody tr:hover td { background: rgba(11, 11, 11, 0.022); }
.table .muted { color: var(--text-muted); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 5px 14px; font-size: 12px; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 550; }

/* ------------------------------------------------------------ diagnosis -- */

.mode-list { display: flex; flex-direction: column; gap: 8px; }

.mode {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-1);
  overflow: hidden;
}
.mode-head {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) 128px 92px 84px 18px;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  background: none;
  border: 0;
  cursor: pointer;
  text-align: left;
}
.mode-head:hover { background: rgba(11, 11, 11, 0.022); }
.mode-name { font-size: 12.5px; font-weight: 600; }
.mode-sub { font-size: 10.5px; color: var(--text-muted); }
.mode-conf { font-size: 11px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.mode-rul { font-size: 11.5px; font-variant-numeric: tabular-nums; text-align: right; color: var(--text-secondary); }
.mode-rul b { font-weight: 650; color: var(--text-primary); }
.mode-caret { color: var(--text-muted); transition: transform 0.15s ease; justify-self: end; }
.mode[open] .mode-caret { transform: rotate(90deg); }
.mode-body {
  padding: 4px 14px 14px 40px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
}
.mode-body .evidence-title {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  font-weight: 650;
  margin: 12px 0 7px;
}

.evidence-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--surface-sunken);
  overflow: hidden;
  min-width: 46px;
}
.evidence-bar > i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }

.action {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 12px 12px;
  align-self: start;
}
.action h4 { margin: 0 0 6px; font-size: 12px; font-weight: 620; }
.action p { margin: 0 0 9px; font-size: 11.5px; color: var(--text-secondary); }
.action ul { margin: 0 0 10px; padding-left: 15px; font-size: 11.5px; color: var(--text-secondary); }
.action ul li { margin-bottom: 2px; }

.btn {
  height: 28px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-1);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-primary);
}
.btn:hover { background: var(--surface-sunken); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #17508f; }
.btn.sm { height: 23px; padding: 0 9px; font-size: 11px; }
.btn[disabled] { opacity: 0.45; cursor: default; }

.rul-band {
  position: relative;
  height: 26px;
  margin: 9px 0 4px;
}
.rul-track {
  position: absolute;
  inset: 10px 0 auto;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-sunken);
}
.rul-range {
  position: absolute;
  top: 10px;
  height: 6px;
  border-radius: 3px;
  background: rgba(28, 92, 171, 0.22);
}
.rul-point {
  position: absolute;
  top: 6px;
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--accent);
  transform: translateX(-1.5px);
}
.rul-scale {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------- alarms -- */

.filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filter-btn {
  height: 26px;
  padding: 0 10px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  font-size: 11.5px;
  font-weight: 550;
  color: var(--text-secondary);
  cursor: pointer;
}
.filter-btn[aria-pressed='true'] { background: var(--text-primary); border-color: var(--text-primary); color: #fff; }

.alarm-row td:first-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.alarm-cleared { opacity: 0.5; }

/* ------------------------------------------------------------- selector -- */

.seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-1);
}
.seg button {
  border: 0;
  background: none;
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 550;
  color: var(--text-secondary);
  cursor: pointer;
  border-right: 1px solid var(--border);
}
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed='true'] { background: var(--surface-sunken); color: var(--text-primary); }
.seg button:hover { color: var(--text-primary); }

/* -------------------------------------------------------------- drawer -- */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 11, 11, 0.22);
  z-index: 40;
}
.drawer-backdrop[hidden] { display: none; }
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 392px;
  max-width: 92vw;
  background: var(--surface-1);
  border-left: 1px solid var(--border);
  box-shadow: -14px 0 40px rgba(11, 11, 11, 0.10);
  z-index: 41;
  display: flex;
  flex-direction: column;
}
.drawer[hidden] { display: none; }
.drawer-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.drawer-head h2 { margin: 0; font-size: 14px; font-weight: 640; }
.drawer-body { overflow-y: auto; padding: 14px 16px 24px; }
.drawer-note {
  font-size: 11.5px;
  color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  margin-bottom: 14px;
}

.fault-row { padding: 10px 0; border-bottom: 1px solid var(--border); }
.fault-row:last-child { border-bottom: 0; }
.fault-row-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fault-name { font-size: 12px; font-weight: 550; }
.fault-val { font-size: 11.5px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.fault-detail { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 18px;
  background: none;
  margin: 4px 0 0;
  cursor: pointer;
}
input[type='range']::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: var(--surface-sunken);
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px;
  margin-top: -4.5px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface-1);
  box-shadow: 0 0 0 1px var(--border-strong);
}

/* ---------------------------------------------------------------- misc -- */

.empty {
  padding: 40px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 12.5px;
}
.hint { font-size: 11px; color: var(--text-muted); }
.nowrap { white-space: nowrap; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

@media (max-width: 1500px) {
  .kpi-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi { padding: 9px 16px 10px; }
}
@media (max-width: 1200px) {
  .body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .rail { border-right: 0; border-bottom: 1px solid var(--border); max-height: 176px; }
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-2, .span-2 { grid-template-columns: minmax(0, 1fr); grid-column: auto; }
  .mode-body { grid-template-columns: minmax(0, 1fr); }
  .mode-head { grid-template-columns: 14px minmax(0,1fr) 80px 74px 18px; }
  .mode-head .mode-conf { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* details/summary used for the failure-mode rows */
summary.mode-head { list-style: none; }
summary.mode-head::-webkit-details-marker { display: none; }
summary.mode-head::marker { content: ''; }

/* Live value carried in the legend: the categorical hues that fall below 3:1 on
   the light surface must never be the only way to read a series' number. */
.legend-value {
  font-weight: 650;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  margin-left: 1px;
}

/* ------------------------------------------------------- OPC-UA data source -- */

.source-pill { gap: 7px; font-weight: 600; }
.source-pill[data-state='down'] { color: var(--text-muted); }

.code {
  margin: 0;
  padding: 10px 11px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.55;
  color: var(--text-secondary);
  overflow-x: auto;
  white-space: pre;
  max-height: 260px;
  overflow-y: auto;
}
code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: var(--surface-sunken);
  border-radius: 3px;
  padding: 1px 4px;
}

/* ingest path: the chain the data actually travels */
.pipeline {
  display: flex;
  align-items: stretch;
  gap: 8px;
  flex-wrap: wrap;
}
.pipe-step {
  flex: 1 1 140px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.pipe-name { font-size: 12px; font-weight: 600; }
.pipe-meta { font-size: 10.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.pipe-arrow {
  align-self: center;
  color: var(--axis);
  font-size: 15px;
  flex: none;
}
@media (max-width: 1200px) {
  .pipe-arrow { display: none; }
  .pipe-step { flex-basis: 45%; }
}

/* an indicator whose source tag arrived Bad: shown, struck through, never hidden */
.table tr.suppressed td { color: var(--text-muted); }
.table tr.suppressed td.num { text-decoration: line-through; }
