:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1b1f24;
  --muted: #5b6470;
  --border: #d5dae1;
  --accent: #0b5fd6;
  --critical: #c2410c;
  --stage-ready: #0f766e;
  --stage-not-ready: #5f6672;
  --stage-already-met: #4d7c0f;
  --stage-running: #1d4ed8;
  --stage-writing: #2563eb;
  --stage-test-review: #7c3aed;
  --stage-security-review: #b45309;
  --stage-architecture-review: #0e7490;
  --stage-waiting-on-owner: #be123c;
  --stage-queued: #64748b;
  --stage-merge-queue: #15803d;
  --stage-merged: #166534;
  --stage-blocked: #b91c1c;
  --radius: 8px;
  --space: 16px;
  --ease: 180ms ease;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151a;
    --surface: #1b2027;
    --text: #e8ebf0;
    --muted: #9aa4b2;
    --border: #2f3641;
    --accent: #6ea8ff;
    --critical: #fb923c;
    --stage-ready: #2dd4bf;
    --stage-not-ready: #9ca3af;
    --stage-already-met: #a3e635;
    --stage-running: #93c5fd;
    --stage-writing: #60a5fa;
    --stage-test-review: #a78bfa;
    --stage-security-review: #fbbf24;
    --stage-architecture-review: #22d3ee;
    --stage-waiting-on-owner: #fb7185;
    --stage-queued: #94a3b8;
    --stage-merge-queue: #4ade80;
    --stage-merged: #86efac;
    --stage-blocked: #f87171;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, sans-serif;
  transition: background var(--ease), color var(--ease);
}
.top, main { max-width: 960px; margin: 0 auto; padding: 0 var(--space); }
h1 { margin: var(--space) 0 0; }
h2 { font-size: 1.1rem; margin: calc(var(--space) * 1.5) 0 8px; }
.muted { color: var(--muted); margin: 4px 0; }
.stale { color: var(--critical); font-weight: 600; margin: 4px 0; }
.legend, .tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tasks { flex-direction: column; }
.chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 0.85rem;
  transition: background var(--ease), color var(--ease);
}
.task, .card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 6px solid var(--stage-color, var(--border));
  border-radius: var(--radius);
  padding: 10px 12px;
  transition: border-color var(--ease), box-shadow var(--ease);
}
.task { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.task:hover { box-shadow: 0 2px 8px rgb(0 0 0 / 0.15); }
.task .num { font-weight: 600; flex: none; }
.task .title { flex: 1 1 0; min-width: 0; overflow-wrap: anywhere; }
.task .chip { flex: none; white-space: nowrap; }
.task .why { flex: 1 0 100%; margin: 0; color: var(--muted); font-size: 0.9rem; overflow-wrap: anywhere; }
.age { font-size: 0.85rem; font-weight: 400; color: var(--muted); margin-left: 8px; }
.card .num, .card .title { margin-right: 8px; overflow-wrap: anywhere; }
.stage-ready { --stage-color: var(--stage-ready); color: var(--stage-ready); }
.stage-not-ready { --stage-color: var(--stage-not-ready); color: var(--stage-not-ready); }
.stage-already-met { --stage-color: var(--stage-already-met); color: var(--stage-already-met); }
.stage-running { --stage-color: var(--stage-running); color: var(--stage-running); }
.stage-writing { --stage-color: var(--stage-writing); color: var(--stage-writing); }
.stage-test-review { --stage-color: var(--stage-test-review); color: var(--stage-test-review); }
.stage-security-review { --stage-color: var(--stage-security-review); color: var(--stage-security-review); }
.stage-architecture-review { --stage-color: var(--stage-architecture-review); color: var(--stage-architecture-review); }
.stage-waiting-on-owner { --stage-color: var(--stage-waiting-on-owner); color: var(--stage-waiting-on-owner); }
.stage-queued { --stage-color: var(--stage-queued); color: var(--stage-queued); }
.stage-merge-queue { --stage-color: var(--stage-merge-queue); color: var(--stage-merge-queue); }
.stage-merged { --stage-color: var(--stage-merged); color: var(--stage-merged); }
.stage-blocked { --stage-color: var(--stage-blocked); color: var(--stage-blocked); }
.task .title { color: var(--text); }
.approve { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
code { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 2px 6px; overflow-wrap: anywhere; }
button {
  font: inherit;
  padding: 4px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  transition: background var(--ease), color var(--ease);
}
button:hover, button:focus-visible { background: var(--accent); color: var(--bg); }
.graph { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.graph svg { display: block; max-width: none; }
.graph text { fill: var(--text); font-size: 12px; }
.graph .node rect { fill: var(--surface); stroke: var(--stage-color, var(--border)); stroke-width: 2; }
.graph .edge { stroke: var(--muted); stroke-width: 1.5; fill: none; }
.graph .edge.critical, .graph .node.critical rect { stroke: var(--critical); stroke-width: 3; }
.graph .overlap { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 5 4; fill: none; }
.graph .arrow { fill: var(--muted); }
.graph .arrow.critical { fill: var(--critical); }
/* metrics panel */
.metrics[hidden] { display: none; }
.metrics h3 { font-size: 1rem; margin: var(--space) 0 8px; }
.metrics-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); font-size: 0.9rem; }
.metrics-table th, .metrics-table td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.metrics-table thead th { color: var(--muted); font-weight: 600; }
.metrics-table th[scope="row"] { font-weight: 400; color: var(--text); }
@media (max-width: 600px) {
  body { font-size: 15px; }
  .metrics-table { font-size: 0.85rem; }
  .metrics-table th, .metrics-table td { padding: 5px 6px; }
  .approve { flex-direction: column; align-items: stretch; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
