/* ── system.css — System · watchdog / bar quality · System → Overview (owner D) ──
   Cut verbatim from styles.css (UI 7.0 step 0). Loaded after styles.css and
   before the signals-*.css / boards.css sheets (see the <link> order in index.html). */

/* ── System ────────────────────────────────────────────────────────── */
.log { font: 11.5px/1.55 var(--mono); background: var(--code-bg); color: var(--code-text); border-radius: var(--r); padding: 11px 12px; height: 420px; overflow-y: auto; white-space: pre-wrap; word-break: break-word; }
.log .ts { color: #5A606C; } .log .w { color: #F0A93B; } .log .e { color: #FF6B7A; } .log .rej { color: #FF6B7A; font-weight: 600; } .log .fill { color: #3FCF8E; font-weight: 600; }
.sql textarea { font: 12px/1.55 var(--mono); background: var(--surface-2); min-height: 124px; }
.sql-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.results { border: 1px solid var(--border); border-radius: var(--r); max-height: 372px; overflow: auto; font-size: calc(12.5px * var(--zoom, 1)); }
.results table { width: 100%; border-collapse: collapse; }
.results th { position: sticky; top: 0; background: var(--surface-2); font-size: 10.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 7px 11px; border-bottom: 1px solid var(--border); }
.results td { font-family: var(--mono); font-size: 11.5px; padding: 5px 11px; border-bottom: 1px solid var(--border); white-space: pre-wrap; word-break: break-word; position: relative; vertical-align: top; }
.results.nowrap td { white-space: pre; }
.copy-cell { position: absolute; top: 3px; right: 3px; opacity: 0; font-size: 9.5px; padding: 1px 5px; border: 1px solid var(--border-2); background: var(--surface); border-radius: var(--r-xs); cursor: pointer; color: var(--muted); }
.results td:hover .copy-cell { opacity: 1; }
.tables { display: flex; flex-direction: column; }
.tables li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); font: 11.5px var(--mono); color: var(--muted); }
.tables li:last-child { border-bottom: none; }
.archive-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r); margin-bottom: 7px; flex-wrap: wrap; transition: border-color var(--dur), background var(--dur); }
.archive-row:hover { border-color: var(--border-2); background: var(--surface-hover); }
.archive-row .n { font-size: 12.5px; font-weight: 600; }
.archive-row .m { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.sig-events { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 7px; display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; }
.sig-events .ev { display: flex; gap: 9px; align-items: baseline; min-width: 0; }
.sig-events .ev .ts { color: var(--faint); flex: none; font-size: 10.5px; font-variant-numeric: tabular-nums; }
.sig-events .ev .msg { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sig-events .ev.warn .msg { color: var(--warn); }
.sig-events .ev.error .msg { color: var(--neg); }
.sig-events.full { border-top: 0; margin-top: 0; padding-top: 0; max-height: 420px; overflow: auto; gap: 0; }
.sig-events.full .ev { padding: 6px 0; border-bottom: 1px solid var(--border); }
.sig-events.full .ev .msg { white-space: normal; }
.sys-narrow { max-width: 470px; }

.lat-cols { grid-template-columns: repeat(auto-fit, minmax(408px, 1fr)); margin-top: var(--gap); }
.lat-val { display: inline-flex; align-items: baseline; gap: 4px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.lat-val i { font-style: normal; font-size: 8px; }
.lat-val.ok i { color: var(--pos); } .lat-val.warn i { color: var(--warn); } .lat-val.bad i { color: var(--neg); }
.lat-val.bad { color: var(--neg); }
.lat-matrix tr.headline td { background: var(--surface-2); font-weight: 600; }
.lat-matrix td.num { min-width: 112px; }
.lat-matrix td .sub { white-space: normal; }
.lat-th input { width: 84px; text-align: right; padding: 3px 6px; }
.lat-th { margin-bottom: 12px; }
.lat-details { border-top: 1px solid var(--border); }
.lat-details > summary { cursor: pointer; padding: 9px var(--pad); font-size: 11.5px; font-weight: 600; color: var(--muted); }
.wf-row { display: grid; grid-template-columns: 162px minmax(0, 1fr) 66px; align-items: center; gap: 10px; padding: 6px 0; }
.wf-label { font-size: 12px; font-weight: 600; }
.wf-label .sub { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.wf-track { display: flex; gap: 2px; height: 11px; }
.wf-track i { display: block; height: 100%; min-width: 2px; }
.wf-track i:first-child { border-radius: 3px 0 0 3px; } .wf-track i:last-child { border-radius: 0 3px 3px 0; } .wf-track i:only-child { border-radius: 3px; }
.wf-total { font-size: 12px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.up-strip { display: flex; flex-direction: column; gap: 4px; max-height: 408px; overflow-y: auto; }
.up-day { display: grid; grid-template-columns: 66px minmax(0, 1fr) 54px; gap: 10px; align-items: center; }
.up-label { font-size: 11px; color: var(--muted); white-space: nowrap; }
.up-track { display: flex; height: 13px; border-radius: 3px; overflow: hidden; background: var(--surface-3); gap: 2px; }
.up-track i { display: block; height: 100%; }
.up-track i.ok, .chart-legend i.up-ok { background: var(--pos); }
.up-track i.warn, .chart-legend i.up-warn { background: var(--warn); }
.up-track i.bad, .chart-legend i.up-bad { background: var(--neg); }
.up-track i.off, .chart-legend i.up-off { background: var(--border-2); }
.up-pct { font-size: 11.5px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

/* ── Signal watchdog · bar quality · gate preview · journal ──────────
   Four surfaces added together, sharing three small primitives that the
   design system did not have a name for yet. */

/* A card head that carries more than one control on its right — a state
   pill, a chip group and a refresh button — without them colliding at
   narrow widths. */
.head-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.head-acts .f { flex-direction: row; align-items: center; gap: 6px; margin: 0; }
.head-acts .f > span { color: var(--muted); font-weight: 500; white-space: nowrap; }
.head-acts input[type="time"] { width: 96px; }

/* A row that is itself the finding — a refused account, a stalled symbol, a
   silent strategy. Tinted rather than outlined so a table of them still
   reads as a table. */
.tbl tr.row-bad > td { background: color-mix(in srgb, var(--neg) 7%, transparent); }
.tbl tr.row-bad:hover > td { background: color-mix(in srgb, var(--neg) 12%, transparent); }


/* ── System → Overview ───────────────────────────────────────────────
   A board of verdicts. Each tile is a button because every one of them has
   somewhere to go; the colour is carried by a dot and a hairline rather than
   a filled card, so seven tiles side by side read as a board and not as
   seven alerts. */
.ov-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin-top: 12px; }
.ov-tile {
  position: relative; text-align: left; display: flex; flex-direction: column; gap: 4px;
  padding: 12px 13px 13px; border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface); cursor: pointer; font: inherit; color: inherit;
  transition: border-color var(--dur), background var(--dur), transform var(--dur) var(--spring);
}
.ov-tile:hover { border-color: var(--border-2); background: var(--surface-2); }
.ov-tile:active { transform: translateY(1px); }
.ov-tile:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.ov-head { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .02em; text-transform: uppercase; }
.ov-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-2); flex-shrink: 0; }
.ov-tile.ok .ov-dot { background: var(--pos); }
.ov-tile.warn .ov-dot { background: var(--warn); }
.ov-tile.bad .ov-dot { background: var(--neg); }
.ov-tile.unknown .ov-dot { background: var(--muted); }
/* Only a real problem earns a tinted card; "ok" and "idle" stay plain, or
   the board is a wall of colour with no hierarchy left. */
.ov-tile.bad { border-color: var(--neg-bd); background: var(--neg-bg); }
.ov-tile.warn { border-color: var(--warn-bd); background: var(--warn-bg); }
.ov-verdict-line { font-size: 12.5px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.35; margin-top: 2px; }
.ov-metric { font-size: 21px; font-weight: 650; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.1; margin-top: 2px; }
.ov-tile.bad .ov-metric { color: var(--neg); }
.ov-tile.warn .ov-metric { color: var(--warn); }
.ov-tile.ok .ov-metric { color: var(--pos); }
.ov-detail { font-size: 11px; color: var(--muted); line-height: 1.45; }
.ov-verdict { padding: 2px 0 2px; }
.ov-verdict-t { font-size: 15px; font-weight: 650; letter-spacing: -0.02em; }
.ov-verdict.bad .ov-verdict-t { color: var(--neg); }
.ov-verdict.warn .ov-verdict-t { color: var(--warn); }
.ov-verdict-s { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

@media (max-width: 640px) {
  .lat-cols { grid-template-columns: minmax(0, 1fr); }
  #upCount, #latCount { white-space: normal; }
  .wf-row { grid-template-columns: 104px minmax(0, 1fr) 54px; }
  .up-day { grid-template-columns: 50px minmax(0, 1fr) 48px; }
}
