:root {
    color-scheme: light;
    --page: #f9f9f7;
    --surface: #fcfcfb;
    --ink: #0b0b0b;
    --ink-2: #52514e;
    --muted: #898781;
    --grid: #e1e0d9;
    --axis: #c3c2b7;
    --border: rgba(11, 11, 11, 0.10);
    --accent: #2a78d6;
    --accent-ink: #ffffff;
    --critical: #d03b3b;
    --radius: 12px;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --page: #0d0d0d;
        --surface: #1a1a19;
        --ink: #f0efec;
        --ink-2: #c3c2b7;
        --grid: #2c2c2a;
        --axis: #383835;
        --border: rgba(255, 255, 255, 0.10);
        --accent: #3987e5;
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #3987e5;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--page);
    color: var(--ink);
    line-height: 1.45;
}

h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: .95rem; margin-top: 1.25rem; color: var(--ink-2); }
p { margin: .25rem 0 .75rem; }

.muted, .hint { color: var(--ink-2); font-size: .875rem; }
.hint { margin-top: .25rem; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .75rem 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}
.brand { color: var(--ink); font-weight: 600; text-decoration: none; }
.brand span { color: var(--ink-2); font-weight: 400; }
.topbar-actions { display: flex; gap: .5rem; align-items: center; }
.topbar-actions form { margin: 0; }

.page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 16px 3rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
}
.page > * { min-width: 0; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    min-width: 0;
}

.grid-2, .grid-3 { display: grid; gap: 1rem; }
@media (min-width: 900px) {
    .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.overview { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
.overview > * { min-width: 0; }
@media (min-width: 900px) {
    .overview { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
}
.hero { display: flex; flex-direction: column; justify-content: center; }
.hero-value { font-size: 3.5rem; font-weight: 600; line-height: 1.1; margin: .25rem 0; }
.label { color: var(--ink-2); font-size: .875rem; }
.value { font-size: 1.6rem; font-weight: 600; margin-top: .15rem; }

.tiles { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
@media (min-width: 900px) {
    .overview .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.tiles .tile.card { padding: 1rem; }
.tiles-3 .tile { padding: .75rem 0; border-top: 1px solid var(--grid); }
@media (min-width: 700px) {
    .tiles-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .45rem .6rem; text-align: left; border-bottom: 1px solid var(--grid); white-space: nowrap; }
thead th { color: var(--ink-2); font-weight: 500; font-size: .8rem; }
tbody th { font-weight: 500; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.strong { font-weight: 600; }
table.compact th, table.compact td { padding: .4rem .25rem; }

.chart { margin: 0 0 .5rem; }
.chart figcaption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.chart-canvas { position: relative; height: 240px; }

.button {
    display: inline-block;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: var(--accent-ink);
    border-radius: 8px;
    padding: .45rem .9rem;
    font: inherit;
    font-size: .9rem;
    text-decoration: none;
    cursor: pointer;
}
.button-ghost { background: transparent; color: var(--ink); border-color: var(--border); }
.button:hover { filter: brightness(1.05); }

.login { max-width: 380px; width: 100%; margin: 3rem auto; }
.login form { display: grid; gap: .5rem; margin-top: 1rem; }
.login label { font-size: .875rem; color: var(--ink-2); }
.login input {
    font: inherit;
    padding: .55rem .7rem;
    border: 1px solid var(--axis);
    border-radius: 8px;
    background: var(--page);
    color: var(--ink);
}
.login button { margin-top: .75rem; }
.alert { color: var(--critical); font-weight: 500; }
