/* Factory control room v2. Light by default; dark from the system or the Theme button. */
:root {
  color-scheme: light;
  --bg: #f6f8fa;
  --panel: #ffffff;
  --panel-2: #f6f8fa;
  --fg: #1f2328;
  --muted: #59636e;
  --line: #d1d9e0;
  --accent: #0969da;
  --ok: #1a7f37;
  --ok-bg: #dafbe1;
  --warn: #7d4e00;
  --warn-bg: #fff8c5;
  --alert: #cf222e;
  --alert-bg: #ffebe9;
  --info: #0969da;
  --info-bg: #ddf4ff;
  --purple: #8250df;
  --code-bg: #eff2f5;
  --shadow: 0 1px 2px rgb(31 35 40 / 0.06), 0 3px 12px rgb(31 35 40 / 0.06);
  --s-ready: #8c959f;
  --s-picked: #6e7781;
  --s-running: #0969da;
  --s-pr-open: #8250df;
  --s-checks: #bf8700;
  --s-queued: #bc4c00;
  --s-merged: #1a7f37;
  --s-deployed: #116329;
  --radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
  line-height: 1.45;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1117;
    --panel: #151b23;
    --panel-2: #0d1117;
    --fg: #e6edf3;
    --muted: #9198a1;
    --line: #30363d;
    --accent: #4493f8;
    --ok: #3fb950;
    --ok-bg: #12261e;
    --warn: #d29922;
    --warn-bg: #2b2111;
    --alert: #f85149;
    --alert-bg: #2d1416;
    --info: #4493f8;
    --info-bg: #0c2d6b;
    --purple: #ab7df8;
    --code-bg: #1f2630;
    --shadow: 0 0 0 1px rgb(240 246 252 / 0.04);
    --s-ready: #6e7681;
    --s-picked: #8b949e;
    --s-running: #4493f8;
    --s-pr-open: #ab7df8;
    --s-checks: #d29922;
    --s-queued: #f0883e;
    --s-merged: #3fb950;
    --s-deployed: #2ea043;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1117;
  --panel: #151b23;
  --panel-2: #0d1117;
  --fg: #e6edf3;
  --muted: #9198a1;
  --line: #30363d;
  --accent: #4493f8;
  --ok: #3fb950;
  --ok-bg: #12261e;
  --warn: #d29922;
  --warn-bg: #2b2111;
  --alert: #f85149;
  --alert-bg: #2d1416;
  --info: #4493f8;
  --info-bg: #0c2d6b;
  --purple: #ab7df8;
  --code-bg: #1f2630;
  --shadow: 0 0 0 1px rgb(240 246 252 / 0.04);
  --s-ready: #6e7681;
  --s-picked: #8b949e;
  --s-running: #4493f8;
  --s-pr-open: #ab7df8;
  --s-checks: #d29922;
  --s-queued: #f0883e;
  --s-merged: #3fb950;
  --s-deployed: #2ea043;
}

* { box-sizing: border-box; }

/* Author display rules (e.g. .chip's inline-flex) must never un-hide [hidden] elements. */
[hidden] { display: none !important; }

html { font-size: 15px; }
body { margin: 0; background: var(--bg); color: var(--fg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.86em; }
.muted { color: var(--muted); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
/* Section containers take focus only as a fallback when their focused item disappears. */
[tabindex="-1"]:focus { outline: none; }
[tabindex="-1"]:focus-visible { outline: 2px dashed var(--accent); outline-offset: 4px; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg.i {
  width: 16px; height: 16px; flex: none; vertical-align: -3px;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.skip { position: absolute; left: -999px; top: 0.5rem; background: var(--panel); padding: 0.5rem 1rem; z-index: 20; }
.skip:focus { left: 0.5rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: 1480px; margin: 0 auto; padding: 0 28px 40px; }

/* ---- Sticky header ---------------------------------------------------- */
.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.hbar {
  max-width: 1480px; margin: 0 auto; padding: 8px 28px 10px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.brand h1 { margin: 0; font-size: 1rem; font-weight: 650; line-height: 1.2; }
.logo {
  width: 28px; height: 28px; border-radius: 8px; flex: none; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--s-running), var(--s-pr-open));
}
.logo svg.i { width: 16px; height: 16px; }
.updated { display: inline-flex; align-items: center; gap: 5px; font-size: 0.8rem; color: var(--muted); border-radius: 6px; padding: 1px 4px; }
.updated svg.i { width: 14px; height: 14px; }
.actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }

/* The glance line: the one prominent sentence. Each part is a chip with an icon, a word
   and a tooltip, so state never relies on colour alone. */
.glance { grid-column: 1 / -1; margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 1.3rem; font-weight: 650; line-height: 1.25; }
.glance .chip { font-size: 1em; font-weight: 650; padding: 3px 12px 3px 10px; gap: 8px; border-width: 1px; }
.glance .chip svg.i { width: 1.05em; height: 1.05em; stroke-width: 2.4; }
.glance a.chip:hover { text-decoration: none; filter: brightness(0.97); }
.sep { color: var(--muted); font-weight: 400; }
.sep:has(+ [hidden]) { display: none; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--fg);
  font-size: 0.8rem; white-space: nowrap; max-width: 100%;
}
.chip--ok { color: var(--ok); background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.chip--warn { color: var(--warn); background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 50%, var(--line)); }
.chip--alert { color: var(--alert); background: var(--alert-bg); border-color: color-mix(in srgb, var(--alert) 50%, var(--line)); }
/* Neutral: a deliberate state (factory off) or not known yet (loading). */
.chip--muted { color: var(--muted); }
.chip--info { color: var(--info); background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 45%, var(--line)); }

.btn, button, select, input {
  font: inherit; color: var(--fg); background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px;
}
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; font-size: 0.85rem; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--muted); text-decoration: none; }
.btn--icon { padding: 6px; }
.btn--icon svg.i { width: 18px; height: 18px; }
.btn--small { font-size: 0.78rem; padding: 2px 8px; }
select, input { padding: 4px 8px; }
select:disabled { opacity: 0.6; }

details#settings { position: relative; }
details#settings > summary { list-style: none; }
details#settings > summary::-webkit-details-marker { display: none; }
.token-form {
  position: absolute; right: 0; z-index: 15; width: min(26rem, 92vw); margin-top: 6px; padding: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 28px rgb(0 0 0 / 0.25);
  display: grid; gap: 8px;
}
.token-form .row { display: flex; gap: 6px; }
.token-form .hint { margin: 0; font-size: 0.8rem; }

/* ---- Tooltips ----------------------------------------------------------- */
/* Tooltip-only elements keep the normal cursor; only clickable things get the pointer. */
.has-tip { cursor: default; }
a.has-tip, button.has-tip, summary.has-tip { cursor: pointer; }
.tip {
  position: fixed; z-index: 30; max-width: min(24rem, calc(100vw - 16px)); padding: 8px 10px;
  background: var(--fg); color: var(--bg); border-radius: 8px; box-shadow: 0 6px 20px rgb(0 0 0 / 0.25);
  font-size: 0.8rem; font-weight: 400; line-height: 1.4; white-space: pre-line; overflow-wrap: anywhere; pointer-events: auto;
}
.info {
  display: inline-grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); cursor: pointer;
}
.info:hover { color: var(--accent); }
.info svg.i { width: 16px; height: 16px; }

/* ---- Layout ------------------------------------------------------------- */
main > section, main > .grid, main > .cols { margin-top: 24px; }
/* The glance board (Needs you, tiles, pipeline) ends here; details start a little apart. */
main > .cols { margin-top: 40px; }
h2 {
  font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
  margin: 0 0 10px; display: flex; align-items: center; gap: 8px; font-weight: 600;
}
.sec-h { display: flex; align-items: center; gap: 4px; margin: 0 0 8px; }
.sec-h h2 { margin: 0; }
.count { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; font-size: 0.75rem; letter-spacing: 0; text-transform: none; }
.count:empty { display: none; }
.count--muted { color: var(--muted); background: transparent; border-style: dashed; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; }
.grid > section { margin: 0; min-width: 0; }
.g-top { grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* Two independent column stacks: each column flows on its own, so no row is as tall as
   its tallest panel. One column below 1100 px, in DOM (and tab) order. */
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.col > section { margin: 0; min-width: 0; }
@media (max-width: 1100px) {
  .g-top, .g-2, .cols { grid-template-columns: minmax(0, 1fr); }
  .cols { gap: 24px; }
}

.hint { color: var(--muted); font-size: 0.8rem; margin: 8px 0 0; }
.hint.pad { padding: 0 14px; }
.problem { color: var(--alert); font-weight: 600; margin: 6px 0; }
.empty { margin: 0; padding: 10px 14px; color: var(--muted); font-size: 0.88rem; }
.panel > .empty { border: 0; }
/* Empty states and the idle agents line: one short line, not a tall box. */
.panel.panel--compact { padding: 0; }
.panel--compact > .empty { padding: 10px 14px; }

.linklike {
  background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-align: left;
  font-weight: inherit; overflow-wrap: anywhere;
}
.linklike:hover { text-decoration: underline; }

.tag {
  display: inline-block; font-size: 0.7rem; padding: 0 6px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); white-space: nowrap; font-weight: 500;
}
.tag--warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); }
.tag--fail { color: var(--alert); border-color: color-mix(in srgb, var(--alert) 55%, var(--line)); }
.tag--info { color: var(--info); border-color: color-mix(in srgb, var(--info) 50%, var(--line)); }

/* ---- Needs you ---------------------------------------------------------- */
.needs {
  padding: 12px 16px 14px; display: flex; flex-direction: column;
  border-color: color-mix(in srgb, var(--warn) 55%, var(--line));
  background: linear-gradient(180deg, var(--warn-bg), var(--panel) 75%);
}
.needs.needs--clear { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); background: linear-gradient(180deg, var(--ok-bg), var(--panel) 80%); }
.needs-clear { margin: 0; display: flex; gap: 8px; align-items: center; color: var(--ok); font-weight: 650; font-size: 1.1rem; }
.needs-note { margin: 0; display: flex; gap: 6px; align-items: center; color: var(--muted); font-weight: 600; font-size: 0.9rem; width: fit-content; border-radius: 6px; }
.needs-note--warn { color: var(--warn); }
.needs .sec-h h2 { color: var(--fg); }
.needs-head { display: flex; align-items: center; gap: 10px; }
.needs-head .big { font-size: 3rem; font-weight: 750; color: var(--warn); line-height: 1; }
.needs-cap { display: inline-flex; gap: 4px; align-items: center; color: var(--alert); font-weight: 650; font-size: 0.85rem; border-radius: 6px; }
.needs-head + .needs-note { margin-top: 8px; }
.needs-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.needs-list li {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto; gap: 10px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px 9px 12px; font-size: 0.95rem;
}
.needs-icon { color: var(--warn); display: inline-flex; }
.needs-icon--alert { color: var(--alert); }
.needs-ref { font-weight: 650; white-space: nowrap; }
.needs-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 4px; }
.age-chip {
  font-size: 0.75rem; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap;
  color: var(--warn); background: var(--warn-bg); border-radius: 999px; padding: 0 7px;
}
@media (max-width: 520px) {
  .needs-list li { grid-template-columns: auto auto minmax(0, 1fr) auto; }
  .needs-list li > :last-child { grid-column: 2 / -1; justify-self: start; }
}

/* ---- KPI tiles ---------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 700px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { padding: 14px 16px 10px; display: flex; flex-direction: column; min-width: 0; }
.kpi p, .kpi h3 { margin: 0; }
.kpi-t { font-size: 0.8rem; font-weight: 500; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi-v { font-size: 2.6rem; line-height: 1.15; font-weight: 700; letter-spacing: -0.01em; margin-top: 2px; display: flex; align-items: center; flex-wrap: wrap; gap: 0 6px; }
.kpi-v small { font-size: 0.9rem; font-weight: 500; color: var(--muted); }
.kpi-state { display: inline-flex; }
.kpi-state svg.i { width: 26px; height: 26px; stroke-width: 2.6; }
.kpi--ok .kpi-v { color: var(--ok); }
.kpi--warn { border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); background: linear-gradient(180deg, var(--warn-bg), var(--panel) 80%); }
.kpi--warn .kpi-v { color: var(--warn); }
.kpi--alert { border-color: color-mix(in srgb, var(--alert) 55%, var(--line)); background: linear-gradient(180deg, var(--alert-bg), var(--panel) 80%); }
.kpi--alert .kpi-v { color: var(--alert); }
.spark { width: 100%; height: 96px; display: block; margin-top: auto; padding-top: 6px; overflow: visible; }
.spark-base { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; stroke-dasharray: 3 3; }
.spark-line { fill: none; stroke: var(--tone); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.spark-area { fill: var(--tone); opacity: 0.12; }
.spark-dot { fill: var(--tone); opacity: 0.75; }
.spark-dot--last { opacity: 1; }
.spark--blue { --tone: var(--accent); }
.spark--green { --tone: var(--ok); }
.spark--purple { --tone: var(--purple); }

/* ---- Stage colours ------------------------------------------------------ */
.st-ready { --c: var(--s-ready); }
.st-picked { --c: var(--s-picked); }
.st-running { --c: var(--s-running); }
.st-pr-open { --c: var(--s-pr-open); }
.st-checks { --c: var(--s-checks); }
.st-queued { --c: var(--s-queued); }
.st-merged { --c: var(--s-merged); }
.st-deployed { --c: var(--s-deployed); }

/* ---- Pipeline ----------------------------------------------------------- */
.pipe { padding: 12px; }
.pipe:has(> #pipeline > .empty) { padding: 0; }
.lanes-wrap { overflow-x: auto; border-radius: 10px; }
/* Lanes with cards share the width; empty lanes shrink to a narrow column. */
.lanes { display: flex; gap: 10px; }
.lane { flex: 1 1 0; min-width: 130px; min-height: 15rem; /* room for 3 cards and "+N" */ background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px; position: relative; }
.lane--empty { flex: 0 0 78px; min-width: 0; }
.lane:not(:last-child)::after {
  content: ""; position: absolute; right: -9px; top: 16px; width: 8px; height: 8px;
  border-top: 2px solid var(--line); border-right: 2px solid var(--line); transform: rotate(45deg);
}
.lane-h { display: flex; align-items: flex-start; gap: 6px; font-size: 0.8rem; font-weight: 600; margin: 0 0 6px; }
.lane-h .dot { width: 9px; height: 9px; border-radius: 3px; background: var(--c); flex: none; margin-top: 4px; }
.lane-h .n { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.lane--empty .lane-h { flex-direction: column; gap: 2px; color: var(--muted); }
.lane--empty .lane-h .dot { margin-top: 0; }
.lane--empty .lane-h .n { margin-left: 0; font-size: 1.1rem; }
.lane-note { display: inline-flex; color: var(--warn); margin: 0 0 6px; border-radius: 4px; }
.lane-note svg.i { width: 15px; height: 15px; }
.lane-cards { display: grid; gap: 6px; max-height: 30rem; overflow-y: auto; scrollbar-width: thin; padding: 1px; }
.task {
  display: flex; align-items: center; gap: 6px; min-width: 0;
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--c);
  border-radius: 8px; padding: 7px 9px; font-size: 0.92rem;
}
.task > a, .task > .linklike { font-weight: 650; min-width: 0; overflow-wrap: anywhere; }
.task .age-chip { margin-left: auto; color: var(--muted); background: var(--panel-2); }
.flag { display: inline-flex; border: 0; padding: 0; }
.flag svg.i { width: 15px; height: 15px; stroke-width: 2.4; }
.flag.tag--fail { color: var(--alert); }
.flag.tag--warn { color: var(--warn); }
.flag.tag--info { color: var(--info); }
.more {
  justify-self: start; font-size: 0.8rem; font-weight: 650; padding: 2px 10px; border-radius: 999px;
  color: var(--accent); background: var(--panel); border: 1px dashed var(--line); cursor: pointer;
}
.more:hover { border-color: var(--accent); }
@media (max-width: 700px) {
  .lanes { flex-direction: column; }
  .lane, .lane--empty { flex: none; min-width: 0; min-height: 0; }
  .lane--empty .lane-h { flex-direction: row; align-items: center; margin: 0; }
  .lane--empty .lane-h .n { margin-left: auto; font-size: inherit; }
  .lane-cards { max-height: 20rem; }
  .lane:not(:last-child)::after { right: 50%; top: auto; bottom: -9px; transform: rotate(135deg); }
}

/* ---- Agents ------------------------------------------------------------- */
.agents { display: grid; gap: 10px; padding: 0 14px 14px; }
.agents-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; font-size: 0.9rem; }
.agents-n { font-weight: 600; }
.panel--compact .agents-n { color: var(--muted); font-weight: 500; }
.agent {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.agent p { margin: 0; }
.agent .n1 { font-weight: 600; overflow-wrap: anywhere; }
.agent .n2 { font-size: 0.8rem; color: var(--muted); }
.spin { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--info-bg); border-top-color: var(--accent); animation: spin 1.1s linear infinite; }
.spin--repair { border-color: var(--warn-bg); border-top-color: var(--warn); }
.agent-unknown { width: 28px; height: 28px; display: grid; place-items: center; color: var(--muted); border: 2px dashed var(--line); border-radius: 50%; }
@keyframes spin { to { transform: rotate(360deg); } }
.bar { height: 5px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); margin-top: 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.bar > i.late { background: var(--warn); }
.el { text-align: right; font-variant-numeric: tabular-nums; font-size: 0.85rem; }
.slots { display: inline-flex; gap: 5px; align-items: center; }
.slot { width: 22px; height: 8px; border-radius: 3px; background: var(--panel-2); border: 1px solid var(--line); }
.slot--on { background: var(--accent); border-color: var(--accent); }
.slot--over { background: var(--alert); border-color: var(--alert); }
.slot--unknown { background: repeating-linear-gradient(45deg, var(--line) 0 3px, transparent 3px 6px); }

/* ---- Checks ------------------------------------------------------------- */
.checks { list-style: none; margin: 0; padding: 2px 0; }
.checks--all { max-height: 26rem; overflow-y: auto; }
.chk {
  display: grid; grid-template-columns: 20px minmax(0, 1fr) auto 3.6rem; gap: 10px; align-items: center;
  padding: 6px 14px; font-size: 0.86rem; border-top: 1px solid var(--line);
}
.chk:first-child { border-top: 0; }
.chk > a, .chk > b { font-weight: 650; justify-self: start; overflow-wrap: anywhere; }
.chk-icon { color: var(--muted); display: inline-flex; }
.chk--ok .chk-icon { color: var(--ok); }
.chk--fail .chk-icon { color: var(--alert); }
.chk-on { white-space: nowrap; }
.chk > .mono { text-align: right; }
.more--row { margin: 4px 14px 10px; display: inline-block; }

/* ---- Charts ------------------------------------------------------------- */
.chart { padding: 14px 16px; }
.srow, .crow { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr) 3.5rem; gap: 10px; align-items: center; margin: 7px 0; font-size: 0.82rem; }
.srow-label { min-width: 0; overflow-wrap: anywhere; }
.srow--avg { padding-bottom: 7px; border-bottom: 1px dashed var(--line); }
.track { min-width: 0; }
.stack { display: flex; height: 18px; border-radius: 5px; overflow: hidden; background: var(--panel-2); min-width: 2px; }
.seg { display: block; height: 100%; background: var(--c); }
.seg + .seg { border-left: 1px solid var(--panel); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 0.76rem; color: var(--muted); margin: 10px 0 0; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; background: var(--c); }
.insight { margin: 10px 0 0; font-size: 0.86rem; font-weight: 600; background: var(--info-bg); border-radius: 8px; padding: 7px 10px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; width: fit-content; }
.insight svg.i { color: var(--info); }
.insight > span + span::before { content: "·" / ""; margin-right: 10px; color: var(--muted); }
.insight--warn svg.i { color: var(--warn); }
.insight--warn { background: var(--warn-bg); }
.cbar { height: 14px; border-radius: 4px; background: var(--purple); min-width: 2px; }
.cbar--over { background: var(--alert); }
@media (max-width: 560px) {
  .srow, .crow { grid-template-columns: minmax(0, 1fr) auto; }
  .srow .track, .crow .track { grid-column: 1 / -1; grid-row: 2; }
}

/* ---- Folded sections: timeline and audit log ---------------------------- */
.fold > summary {
  cursor: pointer; padding: 12px 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; list-style: none;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after { content: "▸"; margin-left: auto; color: var(--muted); }
.fold[open] > summary::after { content: "▾"; }
.fold[open] > summary { border-bottom: 1px solid var(--line); }
.fold-body { padding: 12px 16px 16px; }
.verifier-line { margin: 0 0 10px; }
.field { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.field label { font-weight: 600; font-size: 0.85rem; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 0.82rem; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { position: sticky; top: 0; background: var(--panel); font-weight: 600; white-space: nowrap; }
tbody tr:nth-child(odd):not(.detail) { background: var(--panel-2); }
tbody tr:last-child td { border-bottom: 0; }
tr.detail td { background: var(--panel); }
.expander { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pill { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; font-size: 0.75rem; white-space: nowrap; }
.pill--ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); }
.pill--alert { color: var(--alert); border-color: color-mix(in srgb, var(--alert) 50%, var(--line)); }
.pill--info { color: var(--info); border-color: color-mix(in srgb, var(--info) 50%, var(--line)); }
.json {
  margin: 6px 0 0; padding: 10px; background: var(--code-bg); border-radius: 6px;
  white-space: pre-wrap; word-break: break-all; max-height: 22rem; overflow: auto;
}

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 7.5rem 6.5rem 10rem minmax(0, 1fr); gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 0.84rem; }
.timeline li:last-child { border-bottom: 0; }
.tl-gap { color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-detail { overflow-wrap: anywhere; }
@media (max-width: 700px) { .timeline li { grid-template-columns: 1fr 1fr; } }

.foot { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 0.8rem; padding-top: 0; }

/* ---- Small screens ------------------------------------------------------ */
@media (max-width: 700px) {
  .wrap { padding: 0 14px 32px; }
  .hbar { padding: 6px 14px 8px; gap: 4px 8px; }
  .brand h1 { font-size: 0.95rem; }
  .glance { font-size: 1rem; gap: 4px 6px; }
  .glance .chip { padding: 2px 9px 2px 8px; gap: 6px; }
  .actions .btn--icon { padding: 5px; }
  .spark { height: 52px; }
  .kpi-v { font-size: 2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .spin { animation: none; }
}
