/* serverstats — ops console. One light theme, one accent, Geist + Geist
   Mono (self-hosted), tinted shadows, and a fixed radius scale:
   containers 10px · controls 7px · badges/LEDs pill. */

@font-face {
    font-family: 'Geist';
    src: url('fonts/geist-var.woff2') format('woff2-variations');
    font-weight: 100 900;
    font-display: swap;
}
@font-face {
    font-family: 'Geist Mono';
    src: url('fonts/geist-mono-var.woff2') format('woff2-variations');
    font-weight: 100 900;
    font-display: swap;
}

:root {
    --page:      #f9f9f7;
    --surface:   #fcfcfb;
    --ink:       #0b0b0b;
    --ink-2:     #52514e;
    --muted:     #898781;
    --hairline:  #e1e0d9;
    --border:    rgba(11, 11, 11, 0.10);
    --accent:    #2a78d6;
    --accent-deep: #1c5cab;
    --good:      #0ca30c;
    --good-text: #006300;
    --warn:      #fab219;
    --serious:   #ec835a;
    --crit:      #d03b3b;
    --sans: 'Geist', system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: 'Geist Mono', ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    --r-box: 10px;      /* cards, tiles, panels */
    --r-ctl: 7px;       /* buttons, inputs, segments */
    --shadow-1: 0 1px 2px rgba(28, 27, 24, 0.05);
    --shadow-2: 0 4px 14px rgba(28, 27, 24, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: light; scroll-behavior: smooth; }

body {
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--page);
    -webkit-font-smoothing: antialiased;
}

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

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.pad { padding: 16px; }

/* ---------------------------------------------------------------- shell */

.shell {
    display: grid;
    grid-template-columns: 236px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--hairline);
    padding: 20px 0 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 0 18px;
}
.brand .led { margin-top: 5px; flex: none; }
.brand-name {
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-2);
}
.brand-name b { color: var(--ink); font-weight: 700; }
.brand-host {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
    word-break: break-all;
}

.nav { display: flex; flex-direction: column; flex: 1; }
.nav-eyebrow {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 14px 18px 6px;
}
.nav a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 18px 7px 16px;
    border-left: 2px solid transparent;
    color: var(--ink-2);
    font-size: 13.5px;
    transition: background 0.15s ease, color 0.15s ease;
}
.nav a:hover { color: var(--ink); background: rgba(11, 11, 11, 0.03); text-decoration: none; }
.nav a.active {
    border-left-color: var(--accent);
    color: var(--ink);
    font-weight: 600;
    background: rgba(42, 120, 214, 0.06);
}
.nav-badge {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: var(--crit);
    border-radius: 99px;
    padding: 0 7px;
    line-height: 18px;
}

.sidebar-foot {
    padding: 0 18px;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 7px;
}

.main { padding: 20px 28px 48px; min-width: 0; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.topbar h1 { font-size: 21px; font-weight: 650; letter-spacing: -0.02em; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.stale-warn {
    font-family: var(--mono);
    font-size: 12px;
    color: #7a4a00;
    background: rgba(250, 178, 25, 0.15);
    border: 1px solid rgba(250, 178, 25, 0.5);
    border-radius: var(--r-ctl);
    padding: 3px 9px;
}
.btn-quiet {
    font-size: 13px;
    color: var(--ink-2);
    border: 1px solid var(--border);
    border-radius: var(--r-ctl);
    padding: 5px 12px;
    background: var(--surface);
    transition: border-color 0.18s ease, color 0.18s ease, transform 0.1s ease;
}
.btn-quiet:hover { color: var(--ink); text-decoration: none; border-color: var(--ink-2); }
.btn-quiet:active { transform: translateY(1px); }

/* ---------------------------------------------------------------- LEDs */

.led {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: none;
}
.led-good { background: var(--good); }
.led-warn { background: var(--warn); box-shadow: inset 0 0 0 1px rgba(122, 74, 0, .35); }
.led-crit { background: var(--crit); }
.led-pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(208, 59, 59, 0.45); }
    50%      { box-shadow: 0 0 0 5px rgba(208, 59, 59, 0); }
}
@media (prefers-reduced-motion: reduce) {
    .led-pulse { animation: none; }
}

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

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-box);
    box-shadow: var(--shadow-1);
    margin-bottom: 16px;
    overflow: hidden;
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--hairline);
}
.card-head h2 { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.card-sub { font-size: 12px; color: var(--muted); text-wrap: balance; text-align: right; }

/* --------------------------------------------------------------- tiles */

.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-box);
    box-shadow: var(--shadow-1);
    padding: 14px 16px;
    color: inherit;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
a.tile:hover {
    text-decoration: none;
    border-color: var(--ink-2);
    box-shadow: var(--shadow-2);
    transform: translateY(-1px);
}
a.tile:active { transform: translateY(0); }
.tile-label {
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}
.tile-value {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    font-size: 30px;
    font-weight: 650;
    letter-spacing: -0.02em;
    line-height: 1.25;
    margin-top: 2px;
}
.tile-value-sm { font-size: 22px; padding-top: 5px; }
.tile-note { font-size: 12px; color: var(--ink-2); }
.tile-alert { border-color: var(--crit); box-shadow: inset 3px 0 0 var(--crit); }
.tile-alert .tile-value { color: var(--crit); }

/* --------------------------------------------------------------- tables */

.live-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 16px;
    margin-bottom: 8px;
}

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td {
    text-align: left;
    padding: 7px 16px;
    border-bottom: 1px solid var(--hairline);
    vertical-align: middle;
}
table.data thead th {
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--muted);
    border-bottom: 1px solid var(--hairline);
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: rgba(11, 11, 11, 0.02); }
.user-link { color: inherit; }
.user-link:hover { color: var(--accent-deep); }
th.num, td.num { text-align: right; }
.spark { display: block; }
.table-scroll { overflow-x: auto; }
.table-foot {
    padding: 9px 16px;
    font-size: 12px;
    color: var(--muted);
    border-top: 1px solid var(--hairline);
}
.table-filter {
    font-family: var(--mono);
    font-size: 12.5px;
    color: var(--ink);
    background: var(--page);
    border: 1px solid var(--border);
    border-radius: var(--r-ctl);
    padding: 5px 10px;
    width: 220px;
    max-width: 50%;
    transition: border-color 0.15s ease;
}
.table-filter:focus { border-color: var(--accent); outline: none; }
.table-filter::placeholder { color: var(--muted); }

/* --------------------------------------------------------------- graphs */

.section-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 26px 0 12px;
}
/* Section labels: sentence case, quiet weight — the page had a small-caps
   eyebrow over every section, which reads as templated noise. */
.eyebrow {
    font-size: 14px;
    letter-spacing: -0.01em;
    color: var(--ink);
    font-weight: 650;
    flex: none;
}
.rule { flex: 1; border: 0; border-top: 1px solid var(--hairline); }

.graph-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(430px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}
/* Inside grids the grid gap is the spacing; a per-card margin would
   double the vertical gutters relative to the horizontal ones. */
.graph-grid .card, .live-grid .card { margin-bottom: 0; }

.range-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 26px 0 16px;
}

.apex-wrap { padding: 8px 10px 4px; }
.apex-wrap .apexcharts-legend-text { color: var(--ink-2) !important; }
.apex-incident-brush { margin-top: -8px; }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r-ctl); overflow: hidden; }
.seg-btn {
    font-family: var(--sans);
    font-size: 12px;
    color: var(--ink-2);
    background: var(--surface);
    border: 0;
    padding: 4px 12px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.seg-btn + .seg-btn { border-left: 1px solid var(--border); }
.seg-btn:hover { color: var(--ink); background: rgba(11, 11, 11, 0.03); }
.seg-btn:active { transform: translateY(1px); }
.seg-btn.active { background: var(--accent); color: #fff; font-weight: 600; }
.seg-btn.active:hover { background: var(--accent-deep); }
.filter-row { display: flex; gap: 0; margin-bottom: 16px; }
.filter-row .seg-btn { border: 1px solid var(--border); }
.filter-row .seg-btn:first-child { border-radius: var(--r-ctl) 0 0 var(--r-ctl); }
.filter-row .seg-btn:last-child { border-radius: 0 var(--r-ctl) var(--r-ctl) 0; }
.filter-row .seg-btn:not(:first-child) { border-left: 0; }
.filter-row a.seg-btn:hover { text-decoration: none; }

/* ------------------------------------------------------------- incidents */

.rail-crit { box-shadow: inset 3px 0 0 var(--crit); }
.rail-good { box-shadow: inset 3px 0 0 var(--good); }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    border-radius: 99px;
    padding: 2px 10px;
    border: 1px solid var(--border);
    white-space: nowrap;
}
.badge-ongoing  { color: var(--crit); border-color: rgba(208, 59, 59, 0.4); background: rgba(208, 59, 59, 0.07); }
.badge-resolved { color: var(--good-text); border-color: rgba(12, 163, 12, 0.35); background: rgba(12, 163, 12, 0.07); }
.badge-watching { color: #7a4a00; border-color: rgba(250, 178, 25, 0.5); background: rgba(250, 178, 25, 0.12); }
.badge-type     { color: var(--ink-2); background: rgba(11, 11, 11, 0.04); }
a.badge:hover { text-decoration: none; }

.incident-list { display: flex; flex-direction: column; gap: 0; }
.incident-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 18px;
    color: inherit;
}
a.incident-row {
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
a.incident-row:hover {
    text-decoration: none;
    border-color: var(--ink-2);
    box-shadow: var(--shadow-2);
    transform: translateY(-1px);
}
a.incident-row:active { transform: translateY(0); }
.incident-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.incident-user { font-size: 14px; font-weight: 700; }
.incident-reason { font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }

.incident-row-stats { display: flex; gap: 28px; flex: none; }
.incident-row-stats dt, .facts dt {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}
.incident-row-stats dd, .facts dd { font-size: 13px; }

.incident-detail { padding: 16px 18px; }
.incident-head { margin-bottom: 14px; }
.facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px 20px;
    border-top: 1px solid var(--hairline);
    padding-top: 14px;
}
.facts .peak { color: var(--crit); font-weight: 700; }
.crumb { margin-bottom: 12px; font-size: 13px; }

.empty-state {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 20px;
    color: var(--ink-2);
}

/* ------------------------------------------------------------- evidence */

.evidence {
    font-family: var(--mono);
    font-size: 11.5px;
    line-height: 1.55;
    color: var(--ink-2);
    background: var(--page);
    padding: 14px 16px;
    overflow-x: auto;
    white-space: pre;
}
.evidence-table { font-size: 12px; }
.query-cell { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; }
.evidence-table tr:hover .query-cell { white-space: normal; word-break: break-all; }
.userstat summary {
    padding: 10px 16px;
    font-size: 12.5px;
    color: var(--ink-2);
    cursor: pointer;
    border-top: 1px solid var(--hairline);
}
.stat-key {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
    font-weight: 400;
}

/* --------------------------------------------------------------- chart */

.tile-value small { font-size: 16px; font-weight: 600; color: var(--ink-2); }

/* --------------------------------------------------------------- login */

.login-body {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 20px;
}
.login-card {
    width: 100%;
    max-width: 360px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-box);
    box-shadow: var(--shadow-2);
    padding: 26px 26px 24px;
}
.login-brand { padding: 0; margin-bottom: 22px; }
.login-card label {
    display: block;
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
}
.login-card input {
    width: 100%;
    font-family: var(--mono);
    font-size: 15px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--r-ctl);
    background: var(--page);
    color: var(--ink);
    transition: border-color 0.15s ease;
}
.login-card input:focus { border-color: var(--accent); outline: none; }
.login-card button {
    width: 100%;
    margin-top: 14px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: 0;
    border-radius: var(--r-ctl);
    padding: 10px;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
}
.login-card button:hover { background: var(--accent-deep); }
.login-card button:active { transform: translateY(1px); }
.form-error {
    margin-top: 10px;
    font-size: 12.5px;
    color: var(--crit);
}

/* ----------------------------------------------------------- responsive */

@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar {
        position: static;
        height: auto;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        gap: 8px;
        padding: 12px 16px;
        border-right: 0;
        border-bottom: 1px solid var(--hairline);
    }
    .nav { flex-direction: row; align-items: center; flex-wrap: wrap; }
    .nav-eyebrow { display: none; }
    .nav a { border-left: 0; border-bottom: 2px solid transparent; padding: 6px 10px; }
    .nav a.active { border-bottom-color: var(--accent); background: none; }
    .sidebar-foot { margin-left: auto; }
    .main { padding: 16px 14px 40px; }
    .live-grid, .graph-grid { grid-template-columns: 1fr; }
    .incident-row { flex-direction: column; align-items: flex-start; gap: 10px; }
    .incident-row-stats { gap: 18px; flex-wrap: wrap; }
}
