:root {
  color-scheme: light;
  --bg: #f9f9f7; --surface: #fcfcfb; --raised: #ffffff; --code: #f1f0ec;
  --ink: #0b0b0b; --ink2: #52514e; --muted: #898781;
  --line: #e1e0d9; --axis: #c3c2b7; --ring: rgba(11,11,11,.10);
  --accent: #1c5cab; --sel: #e9f1fc; --hover: #f1f0ec;
  --pos: #2a78d6; --neg: #e34948;
  --good: #0ca30c; --crit: #d03b3b; --warn: #fab219;
  --add: #e3f4e3; --del: #fbe6e6; --chg: #fdf3d6;
  --shadow: 0 0 0 1px var(--ring), -18px 0 48px rgba(11,11,11,.14);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0d0d0d; --surface: #1a1a19; --raised: #201f1e; --code: #242422;
    --ink: #f0efec; --ink2: #c3c2b7; --muted: #898781;
    --line: #2c2c2a; --axis: #383835; --ring: rgba(255,255,255,.10);
    --accent: #86b6ef; --sel: #17293f; --hover: #232321;
    --pos: #3987e5; --neg: #e66767;
    --add: #12301a; --del: #3a1a1a; --chg: #3a2f10;
    --shadow: 0 0 0 1px var(--ring), -18px 0 48px rgba(0,0,0,.5);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); 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; }
code, pre { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; }
code { background: var(--code); padding: 1px 5px; border-radius: 4px; white-space: nowrap; }
pre code { white-space: inherit; }
h1 { font-size: 22px; font-weight: 650; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 19px; font-weight: 650; margin: 0 0 4px; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h3 { font-size: 13px; font-weight: 650; margin: 26px 0 8px; }
.unit { color: var(--muted); font-weight: 400; font-size: 11px; margin-left: 5px; }
.err { color: var(--crit); background: var(--del); padding: 8px 12px; border-radius: 6px; }
.none { color: var(--muted); }
.note, .hint { color: var(--ink2); font-size: 12.5px; max-width: 78ch; }
.note { margin: 12px 2px; }

/* Top bar */
.top { display: flex; align-items: stretch; gap: 28px; padding: 0 24px; height: 48px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; }
.mark { width: 14px; height: 14px; border-radius: 4px; background: linear-gradient(135deg, var(--pos) 0 50%, var(--ink) 50% 100%); }
.top nav { display: flex; gap: 4px; }
.tab { display: flex; align-items: center; padding: 0 12px; color: var(--ink2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { text-decoration: none; color: var(--ink); }
.tab.on { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }

main { padding: 24px; max-width: 1500px; margin: 0 auto; }
.head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.sub { margin: 0; color: var(--ink2); }
.empty { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 18px 20px; }

/* Tables */
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 9px 12px; vertical-align: top; white-space: nowrap; }
th { font-size: 11.5px; font-weight: 600; color: var(--ink2); border-bottom: 1px solid var(--line); vertical-align: bottom; }
tbody tr + tr td { border-top: 1px solid var(--line); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
td.none { text-align: center; }
.runs tbody tr { cursor: pointer; }
.runs tbody tr:hover { background: var(--hover); }
.runs tbody tr.sel { background: var(--sel); }
.runs td.run { white-space: normal; min-width: 330px; }
.runs th .unit { display: block; margin: 1px 0 0; }
.runs th, .runs td { padding-left: 10px; padding-right: 10px; }
.indent { display: flex; gap: 8px; }
.indent.d1 { padding-left: 14px; } .indent.d2 { padding-left: 38px; } .indent.d3 { padding-left: 62px; } .indent.d4 { padding-left: 86px; }
.branch { color: var(--axis); font-size: 15px; line-height: 1.2; }
.title { font-weight: 600; color: var(--ink); }
.meta { color: var(--muted); font-size: 12px; margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
td > .meta { display: block; }
.meta code { background: none; padding: 0; color: var(--ink2); }
.fork, .kids { white-space: nowrap; }
.forkicon { width: 12px; height: 12px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.4; margin-right: 3px; vertical-align: -1px; }
.tag { border: 1px solid var(--line); border-radius: 10px; padding: 0 7px; font-size: 11px; color: var(--ink2); }
.when { color: var(--ink2); font-variant-numeric: tabular-nums; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--ink2); white-space: nowrap; }
.badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.st-done i { background: var(--good); } .st-failed i { background: var(--crit); }
.st-draft i { background: none; box-shadow: inset 0 0 0 1.5px var(--muted); }

/* Slide-in panel */
.backdrop { position: fixed; inset: 0; background: rgba(11,11,11,.28); opacity: 0; pointer-events: none; transition: opacity .18s ease; z-index: 10; }
.panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(1020px, 94vw); background: var(--surface); box-shadow: var(--shadow); transform: translateX(104%); transition: transform .22s cubic-bezier(.2,.7,.2,1); z-index: 11; display: flex; flex-direction: column; visibility: hidden; }
body.open .backdrop { opacity: 1; pointer-events: auto; }
body.open .panel { transform: none; visibility: visible; }
body.open { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .panel, .backdrop { transition: none; } }
.close { position: absolute; top: 14px; right: 16px; width: 30px; height: 30px; border: 0; border-radius: 6px; background: none; color: var(--ink2); font-size: 22px; line-height: 1; cursor: pointer; z-index: 2; }
.close:hover { background: var(--hover); color: var(--ink); }
#panel-body { overflow-y: auto; padding: 0 28px 48px; flex: 1; }
.ph { position: sticky; top: 0; background: var(--surface); padding: 20px 40px 0 0; margin-bottom: 18px; border-bottom: 1px solid var(--line); z-index: 1; }
.crumbs { font-size: 12px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; min-height: 4px; margin-bottom: 4px; }
.ph .meta { margin: 0 0 6px; }
.forkline { margin: 0 0 6px; color: var(--ink2); font-size: 13px; }
.forkline code { background: none; padding: 0; color: var(--muted); }
.chg { background: var(--chg); border-radius: 4px; padding: 0 5px; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.question { margin: 8px 0 0; max-width: 80ch; }
.tabs { display: flex; gap: 2px; margin-top: 14px; }
.tabs button { border: 0; background: none; font: inherit; color: var(--ink2); padding: 8px 12px; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
.count { margin-left: 6px; background: var(--code); border-radius: 9px; padding: 0 6px; font-size: 11px; font-weight: 500; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 22px; }
.tile { background: var(--raised); border: 1px solid var(--line); border-radius: 8px; padding: 11px 13px; }
.tile .label { color: var(--ink2); font-size: 12px; }
.tile .value { font-size: 21px; font-weight: 650; letter-spacing: -.01em; margin-top: 2px; white-space: nowrap; }
.tile .vs { color: var(--muted); font-size: 11.5px; margin-top: 2px; font-variant-numeric: tabular-nums; }

.md { max-width: 82ch; }
.md h1, .md h2 { font-size: 15px; font-weight: 650; margin: 22px 0 6px; display: block; }
.md h3 { font-size: 13px; margin: 18px 0 6px; }
.md p, .md li { color: var(--ink); }
.md ul, .md ol { padding-left: 20px; }
.md li { margin: 4px 0; }
.md table { width: auto; margin: 10px 0; border: 1px solid var(--line); border-radius: 6px; }
.md th, .md td { padding: 5px 10px; }
.md pre { background: var(--code); padding: 10px 12px; border-radius: 6px; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md em { color: var(--ink2); }

.kv { display: block; width: fit-content; max-width: 100%; overflow-x: auto; background: var(--raised); border: 1px solid var(--line); border-radius: 8px; }
.offscreen { position: fixed; left: -9999px; top: 0; }
.kv th { border: 0; font-weight: 400; color: var(--ink2); font-size: 13px; padding: 6px 14px; vertical-align: top; }
.kv td { padding: 6px 22px 6px 14px; font-weight: 550; }
.kv tr + tr th, .kv tr + tr td { border-top: 1px solid var(--line); }
.data th, .data td { padding: 6px 11px; font-size: 13px; }
.settings td { white-space: normal; }
.settings td:first-child { white-space: nowrap; }
.settings tr.changed td { background: var(--chg); }
.settings code { background: none; padding: 0; }

.codehead { display: flex; justify-content: space-between; align-items: center; background: var(--code); border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0; padding: 5px 8px 5px 12px; font-size: 12px; color: var(--ink2); margin-top: 8px; }
.actions { display: flex; gap: 10px; align-items: center; }
.codehead button { font: inherit; font-size: 12px; border: 1px solid var(--axis); background: var(--raised); color: var(--ink); border-radius: 5px; padding: 2px 10px; cursor: pointer; min-width: 58px; }
.codehead button:hover { border-color: var(--ink2); }
pre.code, pre.diff { margin: 0; border: 1px solid var(--line); border-radius: 0 0 8px 8px; background: var(--raised); padding: 12px 14px; overflow: auto; max-height: 520px; line-height: 1.5; tab-size: 4; }
pre.diff { border-radius: 8px; }
.diff span { display: block; white-space: pre; }
.diff .add { background: var(--add); } .diff .del { background: var(--del); } .diff .hunk { color: var(--muted); }

.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { margin-left: 13px; padding-left: 16px; border-left: 1px solid var(--axis); }
.node { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--raised); margin: 8px 0; }
.node.cur { border-color: var(--pos); box-shadow: 0 0 0 1px var(--pos); }
.node .meta { margin: 0; flex: 1; }

/* Chart */
.chart { width: 100%; height: auto; max-width: 820px; display: block; }
.chart .pos { fill: var(--pos); } .chart .neg { fill: var(--neg); }
.chart .grid { stroke: var(--line); stroke-width: 1; } .chart .base { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.chart .hit { fill: transparent; } .chart .hit:hover { fill: var(--ring); }
#tip { position: fixed; top: 0; left: 0; z-index: 30; pointer-events: none; background: var(--ink); color: var(--surface); padding: 5px 9px; border-radius: 6px; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
#tip[hidden] { display: none; }

@media (max-width: 720px) {
  main { padding: 16px 12px; } .top { padding: 0 12px; gap: 16px; }
  .panel { width: 100vw; } #panel-body { padding: 0 16px 40px; }
}

/* Signed-in user and the login page */
.who { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--ink2); font-size: 13px; }
.who button { font: inherit; font-size: 12.5px; border: 1px solid var(--axis); background: var(--raised); color: var(--ink); border-radius: 6px; padding: 3px 10px; cursor: pointer; }
.who button:hover { border-color: var(--ink2); }
body.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.card { width: min(360px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 26px 26px 28px; display: grid; gap: 14px; }
.card h1 { font-size: 20px; margin: 6px 0 2px; }
.card label { display: grid; gap: 5px; font-size: 12.5px; color: var(--ink2); }
.card input { font: inherit; font-size: 15px; padding: 9px 11px; border: 1px solid var(--axis); border-radius: 8px; background: var(--raised); color: var(--ink); }
.card input:focus-visible, .card button:focus-visible, .who button:focus-visible { outline: 2px solid var(--pos); outline-offset: 1px; }
.card button { font: inherit; font-weight: 600; padding: 10px; border: 0; border-radius: 8px; background: var(--ink); color: var(--surface); cursor: pointer; margin-top: 4px; }
.card .err { margin: 0; font-size: 13px; }
