/* DARMINS: guide-sign green for the station rail, asphalt for the work area, warning plates for alarms. */
@font-face { font-family: "Overpass"; font-weight: 400; font-display: swap; src: url("/vendor/overpass/overpass-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Overpass"; font-weight: 600; font-display: swap; src: url("/vendor/overpass/overpass-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Overpass"; font-weight: 800; font-display: swap; src: url("/vendor/overpass/overpass-latin-800-normal.woff2") format("woff2"); }

:root {
  --sign: #0b5e3c;
  --sign-deep: #084a2f;
  --sign-hi: #11704a;
  --on-sign: #ffffff;
  --on-sign-2: #cfe8db;

  --ground: #12171b;
  --surface: #1a2126;
  --surface-2: #222b31;
  --surface-3: #2c363d;
  --ink: #eef2f3;
  --ink-2: #b3bfc5;
  --ink-3: #8c999f;

  --warn: #f2c200;
  --on-warn: #14130c;
  --bad: #e0362c;
  --bad-ink: #ff8f86;
  --ok: #3fd08a;
  --late: #f2c200;
  --off: #ff6b61;
  --idle: #7c888e;
  --advisory: #a9b8ff;
  --pipe: #66737c;
  --line: #2a3339;

  --f: "Overpass", system-ui, sans-serif;
  --s-xs: 14px;
  --s-sm: 16px;
  --s-md: 18px;
  --s-lg: 22px;
  --s-xl: 28px;
  --r: 8px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--ground);
  color: var(--ink);
  font: 400 var(--s-sm)/1.45 var(--f);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
::selection { background: var(--warn); color: var(--on-warn); }
:focus-visible { outline: 3px solid var(--warn); outline-offset: 2px; }
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
svg { width: 20px; height: 20px; flex-shrink: 0; }

.app { height: 100%; display: grid; grid-template-columns: 400px minmax(0, 1fr); position: relative; }

/* ---------- the sign rail ---------- */
.rail {
  background: var(--sign);
  color: var(--on-sign);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  min-height: 0;
}
.sign { border: 3px solid var(--on-sign); border-radius: 12px; }
.sign-head { padding: 14px 16px 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; }
.roundel { width: 52px; height: 52px; border-radius: 50%; background: #fff; display: grid; place-items: center; flex-shrink: 0; }
.brand h1 { font-size: var(--s-xl); font-weight: 800; line-height: 1; letter-spacing: -0.01em; }
.brand p { font-size: var(--s-xs); color: var(--on-sign-2); margin-top: 4px; line-height: 1.25; }
.brand p strong { color: #fff; font-weight: 800; }
.brand .icon-btn { margin-left: auto; }
.clockline { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.clock { font-size: var(--s-xl); font-weight: 800; line-height: 1; }
.fresh { font-size: var(--s-xs); color: var(--on-sign-2); text-align: right; }
.fresh.err { color: var(--warn); font-weight: 600; }
.counts { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: var(--s-sm); color: var(--on-sign-2); }
.count { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.count b { font-size: var(--s-lg); font-weight: 800; color: #fff; line-height: 1; padding-top: 3px; }

.filters { display: grid; gap: 10px; }
.search { display: flex; align-items: center; gap: 8px; background: #fff; color: #1d2a24; border-radius: var(--r); padding: 0 12px; }
.search input { flex: 1; border: 0; background: none; font: inherit; font-size: var(--s-md); color: #10201a; padding: 10px 0; min-width: 0; }
.search input:focus { outline: none; }
.search:focus-within { outline: 3px solid var(--warn); outline-offset: 2px; }
.search input::placeholder { color: #5d6e66; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--sign-deep); border-radius: var(--r); padding: 3px; gap: 3px; }
.seg button { background: none; border: 0; border-radius: 6px; padding: 7px 4px 5px; font-weight: 600; color: var(--on-sign-2); }
.seg button:hover { color: #fff; background: var(--sign-hi); }
.seg button[aria-pressed="true"] { background: #fff; color: var(--sign); }
.check { display: flex; align-items: center; gap: 8px; font-size: var(--s-sm); color: var(--on-sign-2); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--warn); margin: 0; }

.sign-list { flex: 1; min-height: 0; overflow: hidden; display: flex; }
.station-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; scrollbar-color: var(--sign-hi) transparent; }
.station-list::-webkit-scrollbar-thumb { background: var(--sign-hi); }
.station-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 12px;
  align-items: baseline;
  padding: 9px 10px 8px;
  border-radius: 7px;
  cursor: pointer;
}
.station-list li + li { margin-top: 2px; }
.station-list li:hover, .station-list li.hl { background: var(--sign-hi); }
.station-list li.sel { background: #fff; color: var(--sign); }
.station-list li.sel .meta, .station-list li.sel .val u { color: #2f5c48; }
.station-list .nm { font-size: var(--s-md); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.station-list .val { font-size: 25px; font-weight: 800; text-align: right; white-space: nowrap; line-height: 1.1; }
.station-list .val.age.offline { color: #ffd2cd; }
.station-list .val.age.delayed { color: var(--warn); }
.station-list li.sel .val.age.offline { color: #b3241b; }
.station-list .val u, .u { text-decoration: none; font-size: var(--s-xs); font-weight: 400; color: var(--on-sign-2); margin-left: 3px; }
.station-list .meta { grid-column: 1 / 3; display: flex; justify-content: space-between; gap: 8px; font-size: var(--s-xs); color: var(--on-sign-2); }
.station-list .meta .st-off { color: #ffd2cd; font-weight: 600; }
.station-list .meta .st-late { color: var(--warn); font-weight: 600; }
.station-list li.sel .meta .st-off { color: #b3241b; }
.station-list li.sel .meta .st-late { color: #8a6d00; }
.station-list .flag { display: inline-flex; flex-shrink: 0; }
.station-list .flag svg { width: 20px; height: 20px; }
.station-list .empty { color: var(--on-sign-2); cursor: default; display: block; }
.station-list .empty:hover { background: none; }

/* status marks: shape plus colour, never colour alone */
.mk { display: inline-block; width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; background: var(--ok); }
.mk.delayed { background: var(--late); border-radius: 2px; transform: rotate(45deg) scale(0.85); }
.mk.offline { background: var(--off); border-radius: 2px; }
.mk.inactive { background: none; box-shadow: inset 0 0 0 2px var(--idle); }
.mk.size { width: 15px; height: 15px; background: none; box-shadow: inset 0 0 0 2px var(--ink-2); }
.mk.fac { border-radius: 2px; background: #59646c; box-shadow: inset 0 0 0 1.5px #a4afb5; }
.mk.pipe { width: 18px; height: 4px; border-radius: 2px; background: var(--pipe); }

/* ---------- work area ---------- */
.work { display: grid; grid-template-rows: 60px minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); min-width: 0; }
.bar { display: flex; align-items: center; gap: 8px; padding: 0 16px; background: var(--surface); min-width: 0; }
.bar-name { font-weight: 800; font-size: var(--s-lg); }
.tabs { display: flex; height: 100%; gap: 4px; min-width: 0; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  background: none;
  border: 0;
  padding: 4px 18px 0;
  font-size: var(--s-md);
  font-weight: 600;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: inset 0 -4px 0 transparent;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--ink); box-shadow: inset 0 -4px 0 var(--warn); }
.badge { background: var(--warn); color: var(--on-warn); border-radius: 5px; padding: 1px 7px 0; font-size: var(--s-xs); font-weight: 800; }
.badge:empty { display: none; }
.icon-btn { background: none; border: 0; width: 40px; height: 40px; border-radius: var(--r); display: grid; place-items: center; color: inherit; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.1); }
.only-narrow { display: none; }

.views { position: relative; min-height: 0; }
.view { position: absolute; inset: 0; overflow: auto; }

/* ---------- map ---------- */
#map { position: absolute; inset: 0; background: #151b20; }
.leaflet-container { font: var(--s-xs)/1.4 var(--f); background: #151b20; }
.leaflet-bar { border: 0 !important; }
.leaflet-control-zoom a { font: 800 22px/36px var(--f) !important; }
.leaflet-bar a { background: var(--surface-2) !important; color: var(--ink) !important; border-color: var(--line) !important; width: 36px !important; height: 36px !important; line-height: 36px !important; }
.leaflet-bar a.home-btn { display: grid; place-items: center; }
.leaflet-bar a.home-btn svg { width: 18px; height: 18px; }
.leaflet-bar a:hover { background: var(--surface-3) !important; }
.leaflet-control-layers { background: var(--surface-2) !important; color: var(--ink) !important; border: 0 !important; border-radius: var(--r) !important; box-shadow: none !important; font-size: var(--s-sm); }
.leaflet-control-layers-toggle { filter: invert(1) brightness(0.9); }
.leaflet-control-attribution { background: rgba(18, 23, 27, 0.8) !important; color: var(--ink-3) !important; }
.leaflet-control-attribution a { color: var(--ink-2) !important; }
.leaflet-tooltip.tip { background: var(--surface-2); color: var(--ink); border: 0; border-radius: var(--r); padding: 7px 10px; font-size: var(--s-sm); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45); }
.leaflet-tooltip.tip::before { display: none; }
.tip b { display: block; font-weight: 600; }
.tip small { display: block; color: var(--ink-2); font-size: var(--s-xs); }
.tip strong { font-weight: 800; }
.fac-icon { display: block; width: 10px; height: 10px; border-radius: 2px; background: #59646c; box-shadow: inset 0 0 0 1.5px #a4afb5; }

.plates { position: absolute; top: 14px; left: 14px; right: 64px; z-index: 600; display: flex; flex-wrap: wrap; gap: 10px; pointer-events: none; }
.plate {
  pointer-events: auto;
  background: var(--warn);
  color: var(--on-warn);
  border: 3px solid var(--on-warn);
  outline: 2px solid var(--warn);
  border-radius: 9px;
  padding: 6px 11px 5px;
  text-align: left;
  min-width: 220px;
  max-width: 320px;
}
.plate.high { background: #fff; color: #1a1a1a; border: 4px solid var(--bad); outline: 0; padding: 5px 10px 4px; }
.plate b { display: block; font-size: var(--s-md); font-weight: 800; line-height: 1.2; }
.plate span { display: block; font-size: var(--s-sm); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plate:hover { transform: translateY(-1px); }
.plate.more { background: var(--surface-2); color: var(--ink); border-color: var(--surface-2); outline: 0; min-width: 0; display: grid; place-items: center; }
.plate.calm { background: var(--sign); color: #fff; border-color: #fff; outline: 0; pointer-events: none; }

.legend {
  position: absolute;
  left: 14px;
  bottom: 26px;
  z-index: 500;
  background: rgba(26, 33, 38, 0.94);
  border-radius: var(--r);
  padding: 10px 12px;
  font-size: var(--s-xs);
  color: var(--ink-2);
  display: grid;
  gap: 6px;
}
.legend span { display: flex; align-items: center; gap: 9px; }

/* ---------- pages (process, alarms, table) ---------- */
.page { padding: 24px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; align-content: start; max-width: 1800px; }
.page h2 { font-size: var(--s-lg); font-weight: 800; margin-bottom: 4px; }
.page .lead { color: var(--ink-2); font-size: var(--s-sm); margin-bottom: 16px; max-width: 70ch; }

.tag-plate { font-size: var(--s-xs); font-weight: 800; padding: 2px 8px 1px; border-radius: 4px; background: var(--warn); color: var(--on-warn); white-space: nowrap; }
.tag-plate.low { background: var(--surface-3); color: var(--ink); }
.tag-plate.high { background: #fff; color: #b3241b; box-shadow: inset 0 0 0 2px var(--bad); }

.spark { width: 72px; height: 22px; display: block; }
.spark path { fill: none; stroke: var(--ok); stroke-width: 1.5; }



/* ---------- tables ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .seg { background: var(--surface); }
.toolbar .seg button { color: var(--ink-2); padding: 7px 14px 5px; }
.toolbar .seg button:hover { background: var(--surface-2); color: var(--ink); }
.toolbar .seg button[aria-pressed="true"] { background: var(--ink); color: var(--ground); }
.toolbar .note { color: var(--ink-3); font-size: var(--s-xs); }
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: 12px; }
table.data { width: 100%; border-collapse: collapse; font-size: var(--s-sm); }
table.data th, table.data td { padding: 10px 14px 9px; text-align: left; white-space: nowrap; }
table.data td { border-top: 1px solid var(--line); }
table.data th { color: var(--ink-2); font-weight: 600; font-size: var(--s-xs); position: sticky; top: 0; background: var(--surface); }
table.data th button { background: none; border: 0; padding: 0; font-weight: 600; color: inherit; display: inline-flex; gap: 4px; }
table.data th button:hover { color: var(--ink); }
table.data .num { text-align: right; }
table.data th.num button { justify-content: flex-end; }
table.data tbody tr { cursor: pointer; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data td.dim { color: var(--ink-2); }
table.data td u { text-decoration: none; color: var(--ink-3); font-size: var(--s-xs); margin-left: 3px; }
.status { display: inline-flex; align-items: center; gap: 8px; }
.empty-state { padding: 40px 16px; text-align: center; color: var(--ink-2); }

/* ---------- station detail ---------- */
.detail { position: absolute; right: 0; top: 0; bottom: 0; z-index: 1500; width: min(460px, 100%); background: var(--surface); overflow-y: auto; box-shadow: -10px 0 30px rgba(0, 0, 0, 0.45); }
.detail-head { background: var(--sign); color: #fff; padding: 14px; position: sticky; top: 0; z-index: 3; }
.detail-head .sign { padding: 12px 14px 14px; }
.detail-head .title { display: flex; gap: 10px; align-items: flex-start; }
.detail-head h2 { font-size: var(--s-xl); font-weight: 800; line-height: 1.1; flex: 1; }
.detail-head .sub { display: grid; gap: 3px; margin-top: 8px; font-size: var(--s-sm); color: var(--on-sign-2); }
.detail-head .sub .st { display: inline-flex; align-items: center; gap: 8px; color: #fff; font-weight: 600; }
.detail section { padding: 18px 18px 6px; }
.detail h3 { font-size: var(--s-md); font-weight: 800; margin-bottom: 10px; }
.detail .alarm-plates { display: grid; gap: 8px; }
.detail .alarm-plates .plate { max-width: none; min-width: 0; cursor: default; outline-offset: 0; margin: 2px; }
.detail .alarm-plates .plate.low { background: var(--surface-2); color: var(--ink); border-color: var(--surface-2); outline: 0; }
.detail .alarm-plates .plate:hover { transform: none; }
.range { margin-bottom: 12px; background: var(--surface-2) !important; }
.range button { color: var(--ink-2) !important; }
.range button[aria-pressed="true"] { background: var(--ink) !important; color: var(--ground) !important; }
.chart { margin-bottom: 16px; }
.chart .cap { font-size: var(--s-xs); color: var(--ink-3); margin-bottom: 4px; }
.tag-table { width: 100%; border-collapse: collapse; }
.tag-table td { padding: 8px 0 7px; vertical-align: top; border-top: 1px solid var(--line); }
.tag-table td.pick { width: 30px; padding-top: 9px; }
.tag-table td.pick input { width: 17px; height: 17px; accent-color: var(--ok); margin: 0; }
.tag-table .tn small { display: block; color: var(--ink-3); font-size: var(--s-xs); }
.tag-table td.v { text-align: right; white-space: nowrap; padding-left: 12px; font-weight: 600; font-size: var(--s-md); }
.tag-table td.v u { text-decoration: none; color: var(--ink-3); font-size: var(--s-xs); font-weight: 400; margin-left: 3px; }
.tag-table td.age { text-align: right; color: var(--ink-3); font-size: var(--s-xs); white-space: nowrap; padding-left: 12px; width: 1%; padding-top: 10px; }
.tag-table tr.stale td { color: var(--ink-3); }
.note { color: var(--ink-3); font-size: var(--s-xs); margin-top: 8px; }
details summary { cursor: pointer; font-weight: 600; color: var(--ink-2); padding: 4px 0; }
details summary:hover { color: var(--ink); }
.uplot { font-family: var(--f); }
.u-legend { font-size: var(--s-xs); color: var(--ink-2); text-align: left; }
.u-legend .u-marker { border-radius: 3px; }
.u-legend th { font-weight: 400; }
.u-select { background: rgba(242, 194, 0, 0.12); }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #fff; color: #1a1a1a; padding: 10px 16px; border-radius: var(--r); box-shadow: inset 0 0 0 3px var(--bad), 0 8px 24px rgba(0, 0, 0, 0.5); z-index: 3000; font-weight: 600; max-width: calc(100% - 32px); }

/* ---------- smaller screens ---------- */
@media (max-width: 1280px) {
  .app { grid-template-columns: 340px minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .only-narrow { display: inline-grid; }
  span.only-narrow { display: inline; }
  .rail { position: fixed; left: 0; top: 0; bottom: 0; z-index: 1600; width: min(380px, 92%); transform: translateX(-102%); visibility: hidden; transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0.2s; }
  .rail.open { transform: none; visibility: visible; box-shadow: 10px 0 30px rgba(0, 0, 0, 0.45); }
  .bar { padding: 0 8px; }
  .tabs { overflow-x: auto; margin-left: auto; }
  .tabs button { padding: 4px 12px 0; }
  .page { padding: 16px; gap: 32px; }
  .legend { display: none; }
  .plates { right: 56px; }
  .plate { min-width: 0; max-width: 100%; flex: 1 1 200px; }
}
@media (max-width: 520px) {
  .toolbar .seg { grid-template-columns: repeat(2, 1fr); width: 100%; }
  .fig { min-width: 0; }
  .tankbar { width: 64px; }
  .line .spark { display: none; }
  .bar-name { display: none !important; }
  .bar { padding: 0 4px; gap: 2px; }
  .tabs { gap: 0; flex: 1 1 auto; justify-content: space-between; }
  .tabs button { font-size: var(--s-sm); padding: 4px 7px 0; gap: 5px; flex-shrink: 0; white-space: nowrap; }
  .plates .plate:nth-child(n + 3):not(.more) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .beacon::after { display: none; }
  .beacon::before { animation: none !important; transform: scale(1.35); opacity: 1; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* warning diamond: the Indonesian rambu peringatan */
.diamond path:first-child { fill: var(--warn); stroke: var(--on-warn); stroke-width: 1.6; stroke-linejoin: round; }
.diamond .ex { fill: none; stroke: var(--on-warn); stroke-width: 2.2; stroke-linecap: round; }
.diamond.high path:first-child { fill: #fff; stroke: var(--bad); stroke-width: 2.2; }
.diamond.high .ex { stroke: var(--bad); }

/* alarm signal on a map point: a beacon that pulses outward from the station */
.beacon { position: relative; display: grid; place-items: center; width: var(--d); height: var(--d); }
.beacon::before, .beacon::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2.5px solid var(--warn);
  animation: beacon 1.8s cubic-bezier(0.2, 0.7, 0.3, 1) infinite;
}
.beacon::after { animation-delay: 0.9s; }
.beacon.high::before, .beacon.high::after { border-color: var(--off); animation-duration: 1.2s; }
.beacon.high::after { animation-delay: 0.6s; }
.beacon .diamond { position: absolute; top: -12px; right: -12px; width: 20px; height: 20px; }
@keyframes beacon { from { transform: scale(0.75); opacity: 1; } to { transform: scale(2.3); opacity: 0; } }
.beacon-key { width: 15px; height: 15px; border-radius: 50%; border: 2.5px solid var(--off); display: inline-block; box-shadow: 0 0 0 3px rgba(255, 107, 97, 0.35); }

/* process view: guide-sign boards and sign lines */
.boards { columns: 380px; column-gap: 16px; }
.board { break-inside: avoid; background: var(--surface); border-radius: 12px; overflow: hidden; margin-bottom: 16px; display: block; }
/* Set by layoutBoards(): each board spans as many 4px rows as it is tall, so the next board drops into the shortest column. */
.boards.masonry { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(380px, 100%), 1fr)); grid-auto-rows: 4px; grid-auto-flow: row dense; column-gap: 16px; }
.boards.masonry > .board { align-self: start; margin-bottom: 0; }
.board.dim { opacity: 0.6; }
.board-head { background: var(--sign); color: #fff; display: flex; align-items: center; gap: 10px; padding: 10px 14px 8px; cursor: pointer; }
.board-head:hover { background: var(--sign-hi); }
.board-head.static { cursor: default; }
.board-head.static:hover { background: var(--sign); }
.board-head h3 { font-size: var(--s-md); font-weight: 800; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-age { display: inline-flex; align-items: center; gap: 6px; font-size: var(--s-xs); color: var(--on-sign-2); white-space: nowrap; }
.lines { padding: 6px 6px 8px; }
.line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 7px 0 6px; }
.lines > .line:nth-child(even), .lines > .line-wrap:nth-child(even) { background: #1e262c; }
.lines > .line { padding-left: 8px; padding-right: 8px; border-radius: 6px; }
.line-wrap { cursor: pointer; border-radius: 6px; padding: 0 8px; }
.line-wrap:hover { background: var(--surface-2) !important; }
.ln { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ln small { display: block; font-size: var(--s-xs); color: var(--ink-3); }
.fig { font-size: var(--s-lg); font-weight: 800; text-align: right; white-space: nowrap; min-width: 92px; }
.fig u { text-decoration: none; font-size: var(--s-xs); font-weight: 400; color: var(--ink-3); margin-left: 3px; }
.line.warn .fig { color: var(--warn); }
.line.bad .fig { color: var(--bad-ink); }
.line.frozen .fig { color: var(--idle); }
.line.sub { padding-top: 0; }
.line.sub .ln { color: var(--ink-3); padding-left: 14px; font-size: var(--s-xs); }
.line.sub .fig { font-size: var(--s-md); }
.line .spark { grid-column: 2; }
.tankbar { width: 110px; height: 12px; border-radius: 3px; background: var(--surface-3); overflow: hidden; display: block; }
.tankbar i { display: block; height: 100%; background: #3f7fae; }
.line.warn .tankbar i { background: var(--warn); }
.pstate { font-size: var(--s-xs); font-weight: 800; padding: 2px 8px 1px; border-radius: 4px; background: var(--surface-3); color: var(--ink-2); }
.pumpline.run .pstate { background: #164a33; color: var(--ok); }
.pumpline.stop .pstate { background: var(--warn); color: var(--on-warn); }
.lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.lists .board { margin: 0; }
.more-note { color: var(--ink-3); font-size: var(--s-xs); padding: 0 14px 12px; }

/* process sub-menus: one parameter per list, laid out in columns so it never runs far down */
.process-page { gap: 16px; }
.subtabs { display: flex; flex-wrap: wrap; background: var(--surface); justify-self: start; max-width: 100%; }
.subtabs button { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px 7px; color: var(--ink-2); font-size: var(--s-md); }
.subtabs button:hover { background: var(--surface-2); color: var(--ink); }
.subtabs button[aria-selected="true"] { background: var(--sign); color: #fff; }
.subtabs .n { font-size: var(--s-xs); font-weight: 400; color: inherit; opacity: 0.75; }
.process-page > .lead { margin: 0; }
.lines.cols { columns: 300px; column-gap: 16px; padding: 0; background: none; }
.lines.cols > .line-wrap { break-inside: avoid; background: var(--surface); margin-bottom: 4px; }
.lines.cols > .line-wrap:nth-child(even) { background: var(--surface); }
.lines.cols > .line-wrap:hover { background: var(--surface-2) !important; }
@media (max-width: 520px) {
  .subtabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  .subtabs button { justify-content: center; flex-wrap: wrap; gap: 2px 5px; padding: 8px 4px 6px; font-size: var(--s-sm); min-width: 0; }
  .subtabs .tag-plate { padding-left: 5px; padding-right: 5px; }
}
.lines.cols .line { padding-top: 5px; padding-bottom: 4px; }
.lines.cols .fig { min-width: 0; font-size: 20px; }

/* ---------- analysis ---------- */
.analysis-page { gap: 24px; }
.analysis-page .toolbar { margin: 0; }
.analysis-page .toolbar .seg { display: inline-grid; grid-auto-flow: column; grid-template-columns: none; }
h3.sec { font-size: var(--s-lg); font-weight: 800; margin-bottom: 4px; }
.point-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.point-head h3 { font-size: var(--s-xl); font-weight: 800; line-height: 1.1; }
.ghost { background: var(--surface-2); border: 0; border-radius: var(--r); padding: 9px 14px 7px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.ghost:hover { background: var(--surface-3); }
.ghost.wide { width: 100%; background: var(--sign); color: #fff; }
.ghost.wide:hover { background: var(--sign-hi); }
.findings { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; margin-bottom: 16px; }
.finding { display: flex; gap: 10px; background: var(--surface); border-radius: 10px; padding: 12px 14px; }
.finding svg { width: 22px; height: 22px; margin-top: 1px; }
.finding b { display: block; font-size: var(--s-md); font-weight: 800; margin-bottom: 2px; }
.finding p { color: var(--ink-2); max-width: 70ch; }
.finding.warn { background: #2a2610; }
.finding.warn b { color: var(--warn); }
.point-charts { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.chart-card { background: var(--surface); border-radius: 12px; padding: 14px 16px; min-width: 0; }
.chart-card h4 { font-size: var(--s-md); font-weight: 800; }
.chart-card .note { margin: 2px 0 10px; }

.heat-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: var(--s-xs); color: var(--ink-2); margin: 8px 0 10px; }
.heat-legend span { display: inline-flex; align-items: center; gap: 7px; }
.heat-legend .ramp i { width: 120px; height: 10px; border-radius: 3px; display: inline-block; }
.heat-legend .hc { width: 14px; height: 10px; }
.heat { background: var(--surface); border-radius: 12px; padding: 8px 10px; overflow-x: auto; }
.heat .hr { display: grid; grid-template-columns: 230px minmax(360px, 1fr) 96px; gap: 10px; align-items: center; padding: 2px 4px; border-radius: 6px; }
.heat.small .hr { grid-template-columns: 96px minmax(240px, 1fr); }
.heat .hn { font-size: var(--s-xs); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.2; }
.heat .hn small { display: block; font-weight: 400; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; }
.heat .hg { display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; }
.heat .head .hg b { font-size: 12px; font-weight: 400; color: var(--ink-3); }
.heat .hs { font-size: var(--s-xs); text-align: right; color: var(--ink-2); white-space: nowrap; }
.heat .hs .w { color: var(--warn); font-weight: 800; }
.heat .hs .flat { font-style: normal; color: var(--ink-3); }
.hc { display: block; height: 22px; border-radius: 3px; background: var(--surface-3); }
.heat.small .hc { height: 16px; }
.hc.none { background: transparent; box-shadow: inset 0 0 0 1px var(--surface-3); }
.hc.warn { background: var(--warn); }
.hc.bad { background: var(--bad); }
.hc[data-v]:hover { outline: 2px solid #fff; outline-offset: 0; }
.heat-tip { position: fixed; z-index: 3000; pointer-events: none; background: var(--surface-2); color: var(--ink); font-size: var(--s-xs); padding: 6px 10px; border-radius: 6px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45); white-space: nowrap; }
@media (max-width: 1100px) { .point-charts { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 700px) {
  .heat .hr { grid-template-columns: 110px minmax(300px, 1fr) 60px; }
  .point-head { flex-direction: column; }
}

.heat .hs b { color: var(--ink); }
.role-head { margin: 18px 0 8px; font-size: var(--s-md); }
.role-head:first-child { margin-top: 0; }
.role-head .note { font-weight: 400; margin-left: 6px; }

.point-actions { display: flex; gap: 8px; align-items: center; }

.analyse-btns { display: grid; gap: 8px; }

/* Keep channel identity visible across process, selection and analysis. */
.lines.cols .ln { white-space: normal; overflow-wrap: anywhere; line-height: 1.35; }
.lines.cols .ln small { margin-top: 4px; color: var(--ink-2); }
.lines.cols .line { grid-template-columns: minmax(0, 1fr) auto; padding-block: 10px; }
.tag-table .tn { overflow-wrap: anywhere; padding-right: 8px; }
.tag-table .tn small { margin-top: 4px; color: var(--ink-2); }
.value-age { display: block; margin-top: 4px; font-size: var(--s-xs); font-weight: 400; color: var(--ink-2); }
.analyse-btns .note { margin: 0 0 6px; color: var(--ink-2); }
.analyse-point { white-space: normal; text-align: left; line-height: 1.4; }
.analyse-point span { display: block; overflow-wrap: anywhere; }
.analyse-point small { display: block; margin-top: 4px; font-size: var(--s-xs); font-weight: 400; color: var(--on-sign-2); }
.point-station { margin-top: 8px; font-size: var(--s-md); color: var(--ink-2); }
.point-head h3 { overflow-wrap: anywhere; line-height: 1.25; }
@media (max-width: 1100px) { .analysis-page .point-charts { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) {
  .findings { grid-template-columns: minmax(0, 1fr); }
  .analysis-page .toolbar { flex-wrap: wrap; gap: 12px; }
  .chart-card { padding: 12px; }
  .lines.cols { columns: auto; }
}
.analyse-point small u { text-decoration: none; margin-left: 3px; }

.finding p { white-space: pre-line; }

.finding-action { margin-top: 10px; }
.finding-action strong { color: var(--ink); font-weight: 600; }

/* Evidence reports use the existing table and sign palette. */
.check-filters { display: flex; flex-wrap: wrap; gap: 4px; }
.anomaly-page .toolbar { flex-wrap: wrap; gap: 12px; align-items: center; }
.anomaly-page a.ghost { text-decoration: none; }
table.check-table { table-layout: fixed; }
table.check-table td { vertical-align: top; white-space: normal; overflow-wrap: anywhere; }
.check-table td:first-child { width: 28%; }
.check-table td:last-child { width: 30%; }
.check-meta { display: block; margin-top: 4px; font-size: var(--s-xs); color: var(--ink-2); }
.check-table .ghost { margin-top: 8px; font-size: var(--s-xs); }
.check-error { padding: 12px 14px; background: var(--surface); color: var(--warn); border-radius: var(--r); }
.check-scope p { color: var(--ink-2); max-width: 75ch; margin-top: 8px; }

.point-detections { margin: 16px 0; padding: 14px 16px; background: var(--surface); border-radius: 12px; }
.point-detections h4 { font-size: var(--s-md); }
.point-detections p { margin: 8px 0 12px; color: var(--ink-2); }

.anomaly-page { gap: 24px; }
@media (max-width: 900px) {
  table.check-table, table.check-table tbody { display: block; }
  table.check-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.check-table tr { display: block; padding: 12px 0; border-top: 1px solid var(--line); }
  table.check-table td, table.check-table td:first-child, table.check-table td:last-child { display: block; width: auto; border-top: 0; padding-top: 6px; padding-bottom: 6px; }
  table.check-table td[data-label]::before { content: attr(data-label); display: block; font-size: var(--s-xs); color: var(--ink-2); margin-bottom: 4px; }
}

/* ---------- station analysis page ---------- */
.analysis-page { gap: 18px; }
.point-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 6px; }
.point-title { font-size: var(--s-xl); font-weight: 800; line-height: 1.1; }
.point-sub { color: var(--ink-2); margin-top: 4px; }
.point-sub b { color: var(--ink); font-weight: 600; }
.qchip { flex-shrink: 0; font-size: var(--s-xs); font-weight: 800; padding: 4px 10px 3px; border-radius: 6px; background: #164a33; color: var(--ok); }
.qchip.limited { background: var(--warn); color: var(--on-warn); }
.qchip.insufficient { background: #fff; color: #b3241b; box-shadow: inset 0 0 0 2px var(--bad); }
.quality-note { color: var(--ink-3); font-size: var(--s-xs); max-width: 110ch; margin: 0 0 14px; }
.findings { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.finding .finding-action { color: var(--ink); margin-top: 8px; }
.finding .finding-action strong { display: block; font-size: var(--s-xs); color: var(--ink-3); font-weight: 600; margin-bottom: 1px; }
.finding.warn .finding-action strong { color: var(--warn); }
.analysis-page .point-charts { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; margin-top: 16px; }
.analysis-page .chart-card.wide { grid-column: 1 / -1; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: var(--s-xs); color: var(--ink-2); margin: 4px 0 10px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; }
.chart-legend i { width: 16px; height: 3px; border-radius: 2px; display: inline-block; }
.chart-legend i.band { height: 10px; background: rgba(57, 135, 229, 0.35); }
.analysis-page .heat.small .hr { grid-template-columns: 110px minmax(240px, 1fr); }
.analysis-page .heat.small .hc { height: 18px; }
@media (max-width: 1100px) { .analysis-page .point-charts { grid-template-columns: minmax(0, 1fr); } }

/* ---------- NRW ---------- */
.nrw-plate { position: absolute; right: 14px; bottom: 26px; z-index: 600; display: grid; gap: 2px; text-align: left; background: var(--sign); color: #fff; border: 3px solid #fff; border-radius: 12px; padding: 10px 14px 9px; min-width: 250px; cursor: pointer; }
.nrw-plate:hover { background: var(--sign-hi); }
.nrw-plate .np-label { font-size: var(--s-xs); color: var(--on-sign-2); font-weight: 600; }
.nrw-plate .np-value { font-size: 34px; font-weight: 800; line-height: 1.05; }
.nrw-plate .np-sub { font-size: var(--s-xs); color: var(--on-sign-2); }
.nrw-summary { display: grid; grid-template-columns: 1.3fr repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.nrw-summary > div { background: var(--surface); border-radius: 12px; padding: 12px 14px; display: grid; gap: 2px; align-content: start; }
.nrw-summary span { font-size: var(--s-xs); color: var(--ink-2); }
.nrw-summary b { font-size: var(--s-lg); font-weight: 800; }
.nrw-summary small { font-size: var(--s-xs); color: var(--ink-3); }
.nrw-summary .nrw-big { background: var(--sign); color: #fff; }
.nrw-summary .nrw-big span, .nrw-summary .nrw-big small { color: var(--on-sign-2); }
.nrw-summary .nrw-big b { font-size: 36px; line-height: 1.05; }
table.data.nrw-table td { white-space: normal; vertical-align: top; }
table.data.nrw-table td:last-child { min-width: 260px; }
table.data.nrw-table td:first-child small { max-width: 30ch; }
.nrw-table td small { display: block; color: var(--ink-3); font-size: var(--s-xs); max-width: 46ch; }
.nrw-table td.num small { max-width: none; }
.nrwbar { min-width: 150px; }
.nrwbar .bar { display: block; height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; margin: 6px 0 4px; }
.nrwbar .bar i { display: block; height: 100%; background: #3987e5; }
.nrwbar b { font-weight: 800; font-size: var(--s-md); }
.nstat { display: inline-block; font-size: var(--s-xs); font-weight: 800; padding: 2px 8px 1px; border-radius: 4px; background: #164a33; color: var(--ok); }
.nstat.warn { background: var(--warn); color: var(--on-warn); }
.nstat.muted { background: var(--surface-3); color: var(--ink-2); }
.nrw-method { margin-top: 14px; background: var(--surface); border-radius: 12px; padding: 12px 16px; }
.nrw-method p { color: var(--ink-2); max-width: 100ch; margin-top: 8px; }
@media (max-width: 1200px) { .nrw-summary { grid-template-columns: repeat(2, 1fr); } .nrw-summary .nrw-big { grid-column: 1 / -1; } }
@media (max-width: 900px) { .nrw-plate { left: 14px; right: 14px; bottom: 30px; min-width: 0; } }

/* ---------- tables as cards on a phone ---------- */
@media (max-width: 700px) {
  table.data.cards, table.data.cards tbody { display: block; }
  table.data.cards thead { display: block; }
  table.data.cards thead:not(:has(button)) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.data.cards thead tr { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 10px 14px; }
  table.data.cards th { position: static; padding: 0; }
  table.data.cards tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; padding: 12px 14px; border-top: 1px solid var(--line); }
  table.data.cards td { display: block; padding: 0; border: 0; white-space: normal; text-align: left; min-width: 0; overflow-wrap: anywhere; }
  table.data.cards td.num { text-align: left; }
  table.data.cards td[data-label]:not(.c-tag):not(.c-title):not(.c-msg)::before { content: attr(data-label); display: block; font-size: var(--s-xs); color: var(--ink-3); margin-bottom: 2px; font-weight: 600; }
  table.data.cards td.c-tag, table.data.cards td.c-title, table.data.cards td.c-msg, table.data.cards td.c-full { grid-column: 1 / -1; }
  table.data.cards td.c-title { font-weight: 800; font-size: var(--s-md); color: var(--ink); }
  table.data.cards td.c-title small { font-weight: 400; }
  table.data.cards td.c-msg { color: var(--ink); }
  table.data.nrw-table td:last-child, .nrwbar { min-width: 0; }
  .nrw-table td small, table.data.nrw-table td:first-child small { max-width: none; }
}
