/* Tokens. Dark is a selected set, not an inversion. Chart hues come from the validated
   categorical palette (blue, orange, aqua, yellow, magenta, green) — fixed order, never cycled. */
:root {
  color-scheme: light;
  --bg: #fbfaf7; --surface: #ffffff; --line: #e4e1d8;
  --ink: #16161a; --ink-2: #52514e; --ink-3: #85837a;
  --accent: #1f6f5c;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300;
  --good: #0ca30c; --warn: #fab219; --serious: #ec835a; --critical: #d03b3b;
  /* stage ramp: one hue, light→dark, so grayscale still orders the stages */
  --st1: #cde2fb; --st2: #9ec5f4; --st3: #5598e7; --st4: #256abf; --st5: #104281;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #141416; --surface: #1c1c1f; --line: #32323a;
    --ink: #f2f1ec; --ink-2: #b9b7ae; --ink-3: #8a8880;
    --accent: #6cc3a8;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300;
    --st1: #184f95; --st2: #256abf; --st3: #3987e5; --st4: #86b6ef; --st5: #cde2fb;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
header { position: sticky; top: 0; background: var(--bg); border-bottom: 1px solid var(--line); z-index: 5; }
.bar, nav, .filters, main, footer { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.bar { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-top: 14px; flex-wrap: wrap; }
h1 { font-size: 1.15rem; margin: 0; }
.who { color: var(--ink-3); font-size: .82rem; }
nav { display: flex; gap: 4px; padding-top: 10px; }
nav button {
  background: none; border: 0; border-bottom: 2px solid transparent; color: var(--ink-2);
  padding: 8px 10px; font: inherit; cursor: pointer; border-radius: 6px 6px 0 0;
}
nav button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.filters { display: flex; gap: 8px; padding: 10px 16px 12px; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { background: var(--surface); border: 0; padding: 6px 12px; font: inherit; color: var(--ink-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--bg); font-weight: 600; }
input, select, .ghost {
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 10px; font: inherit;
}
input { flex: 1 1 180px; min-width: 150px; }
.ghost { cursor: pointer; color: var(--ink-2); }
main { padding-top: 16px; padding-bottom: 40px; }
footer { color: var(--ink-3); font-size: .78rem; padding-top: 16px; padding-bottom: 32px; border-top: 1px solid var(--line); }

.empty { color: var(--ink-3); padding: 28px 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .74rem; font-weight: 700; white-space: nowrap; }
.p-idle { background: #f0efea; color: #52514e; } .p-wait { background: #dbeafe; color: #1d4ed8; }
.p-back { background: #fef3c7; color: #92400e; } .p-ok { background: #dcfce7; color: #166534; }
.p-done { background: #15803d; color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --pi: #34343a; } .p-idle { background: #34343a; color: #d1d5db; } .p-wait { background: #1e3a5f; color: #93c5fd; }
  .p-back { background: #4a3208; color: #fcd34d; } .p-ok { background: #14532d; color: #86efac; }
  .p-done { background: #4ade80; color: #052e16; } }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--ink-3); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.mine td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; align-items: start; }
.col h3 { font-size: .82rem; margin: 0 0 8px; color: var(--ink-2); display: flex; justify-content: space-between; }
.kanban .card { padding: 10px 12px; border-left: 3px solid var(--line); }
.kanban .card.age-3 { border-left-color: var(--warn); }
.kanban .card.age-7 { border-left-color: var(--serious); }
.kanban .card.age-14 { border-left-color: var(--critical); }
.title { font-weight: 600; margin: 0 0 4px; font-size: .92rem; }
.meta { color: var(--ink-3); font-size: .78rem; display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.charts { display: grid; gap: 18px; }
figure { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
figcaption { font-weight: 600; margin-bottom: 2px; }
.sub { color: var(--ink-3); font-size: .8rem; margin: 0 0 10px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: .78rem; color: var(--ink-2); margin-top: 8px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; margin-right: 5px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tile .n { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .l { color: var(--ink-3); font-size: .78rem; }
details.data { margin-top: 10px; } details.data summary { color: var(--ink-3); font-size: .8rem; cursor: pointer; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg { max-width: 100%; height: auto; display: block; }
svg text { fill: var(--ink-2); font-size: 11px; }
svg .axis line, svg .axis path { stroke: var(--line); }
.note { color: var(--ink-3); font-size: .78rem; margin-top: 8px; }
@media (prefers-reduced-motion: no-preference) { .card { transition: border-color .15s ease; } }
