:root {
    color-scheme: light;
    --page: #f9f9f7;
    --surface: #fcfcfb;
    --text: #0b0b0b;
    --text-2: #52514e;
    --muted: #898781;
    --grid: #e1e0d9;
    --axis: #c3c2b7;
    --border: rgba(11, 11, 11, .10);
    --accent: #2a78d6;
    --series-1: #2a78d6;
    --series-2: #eb6834;
    --good: #006300;
    --bad: #d03b3b;
    --wash: rgba(11, 11, 11, .05);
}
@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --page: #0d0d0d;
        --surface: #1a1a19;
        --text: #fff;
        --text-2: #c3c2b7;
        --grid: #2c2c2a;
        --axis: #383835;
        --border: rgba(255, 255, 255, .10);
        --accent: #3987e5;
        --series-1: #3987e5;
        --series-2: #d95926;
        --good: #0ca30c;
        --bad: #e66767;
        --wash: rgba(255, 255, 255, .07);
    }
}

* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--page);
    color: var(--text);
    font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.05rem; margin: 0; }
h1 .muted, h2 .muted { font-weight: 400; font-size: .85em; }
.muted { color: var(--muted); }
code { background: var(--wash); padding: .1em .35em; border-radius: 4px; font-size: .9em; }

.top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem 1.25rem;
    padding: .7rem 1.25rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; color: var(--text); }
.brand span { font-weight: 400; color: var(--text-2); }
.top nav { display: flex; flex-wrap: wrap; gap: .25rem; flex: 1; }
.top nav a { padding: .3rem .65rem; border-radius: 6px; color: var(--text-2); }
.top nav a:hover { background: var(--wash); text-decoration: none; }
.top nav a[aria-current] { background: var(--wash); color: var(--text); font-weight: 600; }
.search input { width: 11rem; }

main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.25rem;
    overflow-x: auto;
}
.card.narrow { max-width: 26rem; margin: 3rem auto; }
.card > * + * { margin-top: .9rem; }
.card-head, .page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem 1rem; }
.page-head { margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.crumb { margin: 0 0 .25rem; color: var(--muted); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 1.25rem; }
.flash { background: var(--wash); border-left: 3px solid var(--accent); padding: .6rem .9rem; border-radius: 6px; margin: 0 0 1.25rem; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1rem 1.25rem; display: flex; flex-direction: column; }
.tile .label { color: var(--text-2); font-size: .85rem; }
.tile strong { font-size: 1.6rem; font-weight: 650; }
.tile small { font-size: .6em; color: var(--muted); font-weight: 400; }
.delta { font-size: .85rem; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 500; font-size: .8rem; color: var(--muted); padding: .35rem .5rem; border-bottom: 1px solid var(--axis); white-space: nowrap; }
td { padding: .4rem .5rem; border-bottom: 1px solid var(--grid); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.muted { font-size: .85rem; }
.barcol { width: 22%; min-width: 80px; }
.bar { display: block; height: 10px; min-width: 2px; background: var(--series-1); border-radius: 0 4px 4px 0; }

input, select, textarea, button, .button {
    font: inherit;
    color: var(--text);
    background: var(--page);
    border: 1px solid var(--axis);
    border-radius: 6px;
    padding: .4rem .6rem;
    max-width: 100%;
}
textarea { width: 100%; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input.num { width: 9.5rem; text-align: right; font-variant-numeric: tabular-nums; }
td input.num { width: 7.5rem; }
td input[name="name"] { width: 100%; min-width: 11rem; }
button, .button { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; cursor: pointer; white-space: nowrap; }
button:hover, .button:hover { filter: brightness(1.08); text-decoration: none; }
button.ghost, .button.ghost { background: transparent; border-color: var(--axis); color: var(--text); font-weight: 500; }
button.ghost:hover, .button.ghost:hover { background: var(--wash); filter: none; }
button.danger { background: transparent; border-color: var(--bad); color: var(--bad); }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.row > input:not(.num):not([type="file"]) { flex: 1 1 12rem; }
.stack { display: flex; flex-direction: column; gap: .75rem; align-items: flex-start; }
.stack label { display: flex; flex-direction: column; gap: .25rem; width: 100%; color: var(--text-2); font-size: .9rem; }
.inline { display: inline-flex; gap: .3rem; align-items: center; }
details > summary { cursor: pointer; color: var(--text-2); }
details[open] > summary { margin-bottom: .75rem; }
details > form + form { margin-top: .75rem; }

.badge { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .85rem; font-weight: 600; border: 1px solid currentColor; white-space: nowrap; }
.badge.good { color: var(--good); }
.badge.bad { color: var(--bad); }

.ranges { display: inline-flex; gap: .25rem; }
.ranges button { background: transparent; border-color: transparent; color: var(--text-2); font-weight: 500; padding: .2rem .6rem; }
.ranges button:hover { background: var(--wash); filter: none; }
.ranges button[aria-pressed="true"] { background: var(--wash); color: var(--text); font-weight: 600; }
.viz-root { position: relative; }
.viz-root svg { display: block; width: 100%; height: 280px; }
.legend { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; font-size: .85rem; color: var(--text-2); margin-bottom: .5rem; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .4rem; }
.sw.s1 { background: var(--series-1); }
.sw.s2 { background: var(--series-2); }
.viz-root text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz-root .grid { stroke: var(--grid); stroke-width: 1; }
.viz-root .base { stroke: var(--axis); stroke-width: 1; }
.viz-root .cross { stroke: var(--axis); stroke-width: 1; }
.viz-root .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz-root .dot { stroke: var(--surface); stroke-width: 2; }
.viz-root .c1 { stroke: var(--series-1); }
.viz-root .c2 { stroke: var(--series-2); }
.viz-root .f1 { fill: var(--series-1); }
.viz-root .f2 { fill: var(--series-2); }
.viz-root .area { fill-opacity: .16; stroke: none; }
.viz-tip {
    position: absolute;
    top: 0;
    pointer-events: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .14);
    padding: .5rem .7rem;
    font-size: .85rem;
    white-space: nowrap;
    z-index: 2;
}
.viz-tip b { display: block; margin-bottom: .2rem; }
.viz-tip div { display: flex; justify-content: space-between; gap: 1.25rem; color: var(--text-2); }
.viz-tip div span:last-child { color: var(--text); font-variant-numeric: tabular-nums; }
.viz-tip .total { border-top: 1px solid var(--grid); margin-top: .25rem; padding-top: .25rem; font-weight: 600; }

@media (max-width: 640px) {
    .search input { width: 100%; }
    .top nav { flex-basis: 100%; order: 3; }
}
