:root {
  color-scheme: light;
  --plane: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --border: rgba(11, 11, 11, 0.1);
  --good: #0ca30c;
  --bad: #d03b3b;
  --warn: #fab219;
  --nm: #898781;
  --waived: #c3c2b7;
  --engine: #2a78d6;
  --bench: #eb6834;
  --infra: #eda100;
  --accent: #2a78d6;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --plane: #0d0d0d;
    --surface: #1a1a19;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --grid: #2c2c2a;
    --border: rgba(255, 255, 255, 0.1);
    --waived: #52514e;
    --engine: #3987e5;
    --bench: #d95926;
    --infra: #c98500;
    --accent: #3987e5;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--plane);
  color: var(--ink);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select {
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 9px;
}
button { cursor: pointer; }
button:hover { border-color: var(--muted); }

#app { display: flex; flex-direction: column; height: 100vh; }

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--grid);
  background: var(--surface);
}
.topbar .brand { font-weight: 650; letter-spacing: 0.01em; }
.topbar .brand .dot { color: var(--good); }
.topbar nav { display: flex; gap: 4px; }
.topbar nav a {
  color: var(--ink-2);
  padding: 4px 10px;
  border-radius: 6px;
}
.topbar nav a.on { background: var(--plane); color: var(--ink); }
.topbar .spacer { flex: 1; }
.topbar .keybtn { color: var(--muted); border: none; background: none; font-size: 12px; }

.layout { display: flex; flex: 1; min-height: 0; }

.sidebar {
  width: 290px;
  min-width: 290px;
  overflow-y: auto;
  border-right: 1px solid var(--grid);
  background: var(--surface);
  padding: 8px;
}
.runrow {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 2px;
  color: inherit;
}
.runrow:hover { background: var(--plane); }
.runrow.on { background: var(--plane); outline: 1px solid var(--grid); }
.runrow .l1 { display: flex; gap: 8px; align-items: baseline; }
.runrow .when { font-weight: 600; font-variant-numeric: tabular-nums; }
.runrow .ref {
  color: var(--ink-2);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.badge {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-2);
  border: 1px solid var(--grid);
  border-radius: 999px;
  padding: 0 7px;
  white-space: nowrap;
}
.badge.sweep { color: var(--surface); background: var(--ink); border-color: var(--ink); }
.runrow .l2 { display: flex; align-items: center; gap: 8px; margin-top: 5px; }
.runrow .nums { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.minibar { display: flex; flex: 1; height: 6px; border-radius: 4px; overflow: hidden; gap: 2px; background: none; }
.minibar i { display: block; height: 100%; }

.main { flex: 1; overflow-y: auto; padding: 20px 26px 60px; }
.main .inner { max-width: 1060px; margin: 0 auto; }

h1 { font-size: 17px; margin: 0 0 2px; font-weight: 650; }
.meta { color: var(--ink-2); font-size: 12.5px; margin-bottom: 16px; }
.meta a { color: inherit; text-decoration: underline; text-decoration-color: var(--grid); }
.meta .sep { color: var(--grid); margin: 0 6px; }

.tiles { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.tile {
  background: var(--surface);
  border: 1px solid var(--grid);
  border-radius: 10px;
  padding: 10px 16px 9px;
  min-width: 108px;
}
.tile .v { font-size: 22px; font-weight: 650; }
.tile .k { font-size: 11.5px; color: var(--ink-2); display: flex; align-items: center; gap: 5px; }
.swatch { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

.card {
  background: var(--surface);
  border: 1px solid var(--grid);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 18px;
}
.card h2 { font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin: 0 0 10px; text-transform: uppercase; letter-spacing: 0.04em; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); margin-bottom: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }

.gbar { display: grid; grid-template-columns: 110px 1fr 120px; align-items: center; gap: 10px; margin: 3px 0; }
.gbar .name { font-size: 12.5px; color: var(--ink-2); text-align: right; }
.gbar .name a { color: inherit; }
.gbar .nums { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { display: flex; height: 14px; gap: 2px; }
.bar i { display: block; height: 100%; border-radius: 2px; min-width: 2px; }
.bar i:first-child { border-top-left-radius: 4px; border-bottom-left-radius: 4px; }
.bar i:last-child { border-top-right-radius: 4px; border-bottom-right-radius: 4px; }

.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.filters input[type="search"] { width: 240px; }
.chip {
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 12.5px;
  background: var(--surface);
}
.chip.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.filters .count { margin-left: auto; color: var(--muted); font-size: 12px; }

table.cases { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--grid); border-radius: 10px; overflow: hidden; }
table.cases th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid var(--grid);
}
table.cases td { padding: 7px 10px; border-bottom: 1px solid var(--grid); vertical-align: top; }
table.cases tr.case { cursor: pointer; }
table.cases tr.case:hover td { background: var(--plane); }
table.cases tr:last-child td { border-bottom: none; }
td.caseid { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.title { color: var(--ink-2); max-width: 420px; }
.vchip, .lchip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.vchip i, .lchip i { width: 8px; height: 8px; border-radius: 999px; }

tr.detail td { background: var(--plane); padding: 12px 16px 14px; }
.phases { display: flex; flex-direction: column; gap: 8px; }
.phase { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.phase .pname { font-weight: 600; min-width: 92px; font-variant-numeric: tabular-nums; }
.phase .pwall { color: var(--muted); font-size: 12px; }
.checkfails { margin: 4px 0 0 102px; display: flex; flex-direction: column; gap: 4px; }
.checkfail { font-size: 12.5px; color: var(--ink-2); }
.checkfail b { color: var(--ink); font-weight: 600; }
.detail .why { margin-top: 10px; font-size: 12.5px; color: var(--ink-2); }
.detail .links { margin-top: 8px; font-size: 12.5px; display: flex; gap: 12px; flex-wrap: wrap; }

.keygate { max-width: 380px; margin: 14vh auto; text-align: center; }
.keygate input { width: 100%; margin: 12px 0; }
.note { color: var(--muted); font-size: 12px; }

.trend { display: flex; align-items: flex-end; gap: 14px; height: 190px; padding: 8px 4px 0; overflow-x: auto; }
.trend .col { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 56px; cursor: pointer; }
.trend .stack { display: flex; flex-direction: column-reverse; gap: 2px; width: 30px; }
.trend .stack i { display: block; width: 100%; border-radius: 2px; }
.trend .stack i:last-child { border-top-left-radius: 4px; border-top-right-radius: 4px; }
.trend .xlab { font-size: 10.5px; color: var(--muted); white-space: nowrap; }

#tooltip {
  position: fixed;
  z-index: 10;
  pointer-events: none;
  background: var(--ink);
  color: var(--surface);
  font-size: 12px;
  border-radius: 6px;
  padding: 6px 9px;
  max-width: 340px;
  display: none;
}

.empty { color: var(--muted); padding: 30px 0; text-align: center; }
.histrow { display: grid; grid-template-columns: 150px 170px 110px 1fr; gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--grid); font-size: 13px; align-items: baseline; }
.histrow:last-child { border-bottom: none; }
.histrow .ref { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.histrow .r { color: var(--ink-2); font-size: 12.5px; }
