*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "cv05" 1, "ss01" 1;
}

::selection {
    background: var(--accent-wash);
    color: var(--fg);
}

/* Digits must line up. Ragged columns are the clearest amateur tell in a dashboard. */
table,
.num,
.mono,
input[type="number"] {
    font-variant-numeric: tabular-nums;
}

.mono {
    font-family: var(--mono);
    font-size: 0.86em;
    letter-spacing: -0.01em;
}

h1,
h2,
h3 {
    margin: 0;
    font-weight: 600;
    letter-spacing: -0.011em;
}

h1 {
    font-size: 22px;
}

h2 {
    font-size: 17px;
}

h3 {
    font-size: 14px;
}

p {
    margin: 0 0 var(--s3);
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.dim {
    color: var(--muted);
}

.faint {
    color: var(--faint);
}

.tiny {
    font-size: 12px;
}

/* --- layout ----------------------------------------------------------- */

.app {
    display: grid;
    grid-template-columns: var(--rail) 1fr;
    min-height: 100vh;
}

.rail {
    border-right: 1px solid var(--line);
    background: var(--surface);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    padding: var(--s5) var(--s4) var(--s4);
    border-bottom: 1px solid var(--line);
}

.brand .mark {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
}

.brand .name {
    font-size: 15px;
    font-weight: 600;
    margin-top: 2px;
    letter-spacing: -0.015em;
}

.nav {
    padding: var(--s3) var(--s2);
    flex: 1;
    overflow-y: auto;
}

.nav a {
    display: flex;
    align-items: center;
    gap: var(--s3);
    padding: 9px var(--s3);
    border-radius: var(--radius-sm);
    color: var(--fg-dim);
    font-size: 13.5px;
    font-weight: 500;
    transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}

.nav a:hover {
    background: var(--surface-2);
    color: var(--fg);
    text-decoration: none;
}

.nav a.active {
    background: var(--accent-wash);
    color: var(--accent);
}

.nav a .key {
    margin-left: auto;
    font-family: var(--mono);
    font-size: 10px;
    color: var(--faint);
}

.nav a.active .key {
    color: var(--accent-dim);
}

.rail-status {
    border-top: 1px solid var(--line);
    padding: var(--s3) var(--s4) var(--s4);
    font-size: 11.5px;
    color: var(--muted);
    display: grid;
    gap: 5px;
}

.rail-status .row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--s2);
}

.rail-status .v {
    color: var(--fg-dim);
    font-family: var(--mono);
    font-size: 11px;
}

.dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--faint);
    flex: none;
}

.dot.ok {
    background: var(--approve);
    box-shadow: 0 0 0 3px var(--approve-wash);
}

.dot.bad {
    background: var(--decline);
    box-shadow: 0 0 0 3px var(--decline-wash);
}

.dot.warn {
    background: var(--warn);
    box-shadow: 0 0 0 3px var(--warn-wash);
}

main {
    padding: var(--s6) var(--s6) var(--s7);
    max-width: calc(var(--measure) + var(--s6) * 2);
    width: 100%;
}

.page-head {
    margin-bottom: var(--s5);
}

.page-head .label {
    display: block;
    margin-bottom: var(--s1);
}

.page-head p {
    color: var(--muted);
    max-width: 78ch;
    margin: var(--s2) 0 0;
}

/* --- cards ------------------------------------------------------------ */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: var(--s5);
}

.card + .card {
    margin-top: var(--s4);
}

.card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--s4);
    margin-bottom: var(--s4);
}

.card-head p {
    margin: var(--s2) 0 0;
    color: var(--muted);
    font-size: 13px;
    max-width: 76ch;
}

.grid-2 {
    display: grid;
    grid-template-columns: minmax(340px, 420px) 1fr;
    gap: var(--s4);
    align-items: start;
}

@media (max-width: 1100px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
    .app {
        grid-template-columns: 1fr;
    }
    .rail {
        position: static;
        height: auto;
    }
}
