:root {
  color-scheme: light;
  --bg: #f6f6f4; --surface: #fcfcfb; --surface-2: #f0efec; --border: #e2e1dc;
  --text: #0b0b0b; --text-2: #52514e; --text-3: #7d7c77;
  --accent: #2a78d6; --accent-soft: #e4effb;
  --bar: #2a78d6; --bar-today: #9ec5f4; --ref: #7d7c77;
  --good: #0ca30c; --warn: #b87800; --bad: #d03b3b; --violet: #6250d6;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #131312; --surface: #1a1a19; --surface-2: #242423; --border: #33332f;
    --text: #f0efec; --text-2: #c3c2b7; --text-3: #8f8e86;
    --accent: #3987e5; --accent-soft: #1b2a3d;
    --bar: #3987e5; --bar-today: #1c5cab; --ref: #8f8e86;
    --good: #0ca30c; --warn: #fab219; --bad: #e66767; --violet: #9085e9;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131312; --surface: #1a1a19; --surface-2: #242423; --border: #33332f;
  --text: #f0efec; --text-2: #c3c2b7; --text-3: #8f8e86;
  --accent: #3987e5; --accent-soft: #1b2a3d;
  --bar: #3987e5; --bar-today: #1c5cab; --ref: #8f8e86;
  --good: #0ca30c; --warn: #fab219; --bad: #e66767; --violet: #9085e9;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; background: var(--surface-2); padding: 0 .3em; border-radius: 4px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.top { background: var(--surface); border-bottom: 1px solid var(--border); padding: 18px 0 14px; }
h1 { font-size: 22px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 28px 0 10px; font-weight: 650; }
.sub { margin: 4px 0 0; color: var(--text-2); font-size: 13px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 18px 0; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.tile .k { color: var(--text-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.tile .v { font-size: 24px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tile .s { color: var(--text-3); font-size: 12px; margin-top: 2px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; font: inherit; color: var(--text-2); cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin: 8px 0 12px; }
.seg label { margin-right: 14px; color: var(--text-2); cursor: pointer; }
.seg input { accent-color: var(--accent); }
.seg b { color: var(--text); font-weight: 600; }
.hint { color: var(--text-3); font-size: 13px; margin: 0; }
.filters input, .filters select { font: inherit; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
.filters input { min-width: 280px; flex: 1; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.grid th { text-align: left; font-weight: 600; color: var(--text-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.grid td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.grid tr:last-child td { border-bottom: 0; }
.grid .num, .grid td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid td.nw { white-space: nowrap; }
.grid td.pos { color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums; }
.pr .t { display: block; font-weight: 500; }
.pr .m { display: block; color: var(--text-3); font-size: 12.5px; margin-top: 2px; }
.pr .m .n { color: var(--text-2); font-variant-numeric: tabular-nums; }
.chip { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); margin-left: 6px; vertical-align: 1px; }
.add { color: var(--good); } .del { color: var(--bad); }
.eta { font-weight: 600; white-space: nowrap; }
.eta.today { color: var(--good); } .eta.soon { color: var(--text); } .eta.far { color: var(--warn); } .eta.none { color: var(--text-3); font-weight: 400; }
.eta small { display: block; font-weight: 400; color: var(--text-3); }
.dim { color: var(--text-3); }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.badge.open { background: var(--accent-soft); color: var(--accent); }
.badge.merged { background: color-mix(in srgb, var(--violet) 14%, transparent); color: var(--violet); }
.badge.closed { background: var(--surface-2); color: var(--text-3); }
.badge.draft { background: var(--surface-2); color: var(--text-2); }
.badge.release { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }
.rev { font-size: 11px; margin-left: 6px; }
.rev.ok { color: var(--good); } .rev.chg { color: var(--bad); }
.drafts { margin-top: 14px; }
.drafts summary { cursor: pointer; color: var(--text-2); padding: 6px 0; }
.drafts .table-wrap { margin-top: 8px; }
.chart { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px 8px; position: relative; }
.legend { font-size: 12px; color: var(--text-2); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-bottom: 6px; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.sw-bar { background: var(--bar); } .sw-today { background: var(--bar-today); }
.sw-line { width: 18px; height: 0; border-top: 2px dashed var(--ref); border-radius: 0; }
.chart svg { display: block; width: 100%; height: 220px; }
.chart .bar { fill: var(--bar); } .chart .bar.today { fill: var(--bar-today); }
.chart .bar.hit { fill: color-mix(in srgb, var(--bar) 80%, var(--text)); }
.chart .hit-area { fill: transparent; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .ref-line { stroke: var(--ref); stroke-width: 2; stroke-dasharray: 5 4; }
.chart text { fill: var(--text-3); font-size: 11px; }
.chart text.val { fill: var(--text-2); font-weight: 600; }
.tooltip { position: absolute; pointer-events: none; background: var(--text); color: var(--bg); font-size: 12px; padding: 6px 9px; border-radius: 6px; white-space: nowrap; transform: translate(-50%, -100%); margin-top: -8px; }
.more { display: block; margin: 12px auto; font: inherit; padding: 8px 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer; }
.prose { max-width: 760px; } .prose p { color: var(--text-2); }
.foot { color: var(--text-3); font-size: 12.5px; padding: 24px 16px 40px; }
.empty { padding: 28px; text-align: center; color: var(--text-3); }
@media (max-width: 640px) {
  .tiles { grid-template-columns: 1fr 1fr; }
  .tile .v { font-size: 20px; }
  #queue-table th:nth-child(4), #queue-table td:nth-child(4), #queue-table th:nth-child(5), #queue-table td:nth-child(5) { display: none; }
  #all-table th:nth-child(4), #all-table td:nth-child(4) { display: none; }
  .grid td { padding: 8px 8px; } .grid th { padding: 8px; }
  .pr { overflow-wrap: anywhere; } .pr .m { font-size: 12px; }
  .eta { font-size: 13px; }
  .filters input { min-width: 0; width: 100%; }
}

/* header user + logout */
.top-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.me { color: var(--text-2); font-size: 13px; margin: 0; display: flex; gap: 8px; align-items: baseline; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.linkish:hover { text-decoration: underline; }
/* login page */
.login { display: flex; justify-content: center; padding-top: 10vh; }
.login form { width: 100%; max-width: 360px; padding: 22px 24px; }
.login h1 { font-size: 20px; }
.login label { display: block; margin: 14px 0 0; color: var(--text-2); font-size: 13px; }
.login input { width: 100%; margin-top: 4px; font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); }
.login button { margin-top: 18px; width: 100%; font: inherit; font-weight: 600; padding: 9px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; cursor: pointer; }
.err { color: var(--bad); font-size: 13px; margin: 10px 0 0; }
/* pins */
.pin-chip { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); margin-left: 6px; vertical-align: 1px; font-weight: 600; }
.pin-btn { font: inherit; font-size: 12px; padding: 3px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text-2); cursor: pointer; margin-top: 6px; }
.pin-btn:hover { border-color: var(--accent); color: var(--accent); }
.pin-btn.on { border-color: var(--warn); color: var(--warn); }
tr.pinned td { background: color-mix(in srgb, var(--warn) 6%, transparent); }
