/* SMS v2 — Facility Closure Lead Tracker
   Palette roles per the dataviz reference instance.
   Colour jobs in use: STATUS (state) + one SEQUENTIAL hue (blue) for score/tier.
   No categorical series → no categorical palette shipped. */

:root {
    color-scheme: light;
    --surface-1: #fcfcfb;
    --page: #f9f9f7;
    --text-primary: #0b0b0b;
    --text-secondary: #52514e;
    --text-muted: #898781;
    --gridline: #e1e0d9;
    --baseline: #c3c2b7;
    --border: rgba(11, 11, 11, 0.10);

    /* status (fixed, never themed) */
    --good: #0ca30c;
    --warning: #fab219;
    --critical: #d03b3b;

    /* sequential blue — ordinal steps stay >= 250 on light */
    --seq-strong: #2a78d6;
    --seq-mid: #5598e7;
    --seq-soft: #86b6ef;
    --seq-wash: #cde2fb;
}

/* Dark mode intentionally disabled — this dashboard always renders light,
   regardless of OS/browser theme, because the client can't read dark UI. */

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0 0 64px;
    background: var(--page);
    color: var(--text-primary);
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

.wrap { max-width: 1400px; margin: 0 auto; padding: 0 24px; }

/* ---------- header ---------- */
.masthead { padding: 32px 0 20px; }
.masthead h1 { margin: 0 0 4px; font-size: 22px; font-weight: 650; letter-spacing: -0.01em; }
.masthead p { margin: 0; color: var(--text-secondary); font-size: 13px; }
.masthead a { color: inherit; }

/* ---------- stat tiles ---------- */
.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.tile {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
}
.tile .label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.tile .value { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.tile .sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* ---------- filters (one row above the data) ---------- */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
}
.filters label { font-size: 12px; color: var(--text-muted); margin-right: -4px; }
.filters select,
.filters input[type="search"] {
    font: inherit;
    font-size: 13px;
    padding: 6px 9px;
    border-radius: 7px;
    border: 1px solid var(--baseline);
    background: var(--surface-1);
    color: var(--text-primary);
}
.filters input[type="search"] { min-width: 200px; }
.filters button {
    font: inherit;
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 7px;
    border: 1px solid transparent;
    background: var(--seq-strong);
    color: #fff;
    cursor: pointer;
}
.filters .reset {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--baseline);
}

/* ---------- table ---------- */
.panel {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}
.tablescroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 600;
    padding: 11px 12px;
    border-bottom: 1px solid var(--gridline);
    white-space: nowrap;
}
thead th a { color: inherit; text-decoration: none; }
thead th a:hover { color: var(--text-primary); }
tbody td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--gridline);
    vertical-align: top;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--seq-wash) 26%, transparent); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.propname { font-weight: 600; color: var(--text-primary); text-decoration: none; display: block; }
.propname:hover { text-decoration: underline; }
.propsub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.flag {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--critical);
    border: 1px solid var(--critical);
    border-radius: 4px;
    padding: 0 4px;
    margin-left: 6px;
    vertical-align: 1px;
}

/* score: sequential magnitude, 4px rounded end anchored to baseline */
.score { display: flex; align-items: center; gap: 8px; }
.scoreval { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 22px; }
.scorebar { width: 60px; height: 6px; background: var(--gridline); border-radius: 3px; overflow: hidden; }
.scorebar > i { display: block; height: 100%; background: var(--seq-strong); border-radius: 3px; }

/* status: colour + icon + label, never colour alone */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; white-space: nowrap; }
.badge .dot { font-size: 10px; line-height: 1; }
.badge.is-good .dot { color: var(--good); }
.badge.is-warning .dot { color: var(--warning); }
.badge.is-muted .dot { color: var(--text-muted); }

.tier { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tier-1 { color: var(--seq-strong); }
.tier-2 { color: var(--seq-mid); }
.tier-3 { color: var(--seq-soft); }

.srno { color: var(--text-muted); font-weight: 600; width: 1%; }

.agebadge { font-size: 11px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.agebadge.is-fresh    { color: var(--text-secondary); }
.agebadge.is-due      { color: var(--warning); }
.agebadge.is-overdue  { color: var(--critical); font-weight: 600; }
.agebadge.is-upcoming { color: var(--text-muted); font-style: italic; }

.srccell { white-space: nowrap; }
.srclink {
    font-size: 12px;
    color: var(--seq-strong);
    text-decoration: none;
    border-bottom: 1px solid color-mix(in srgb, var(--seq-strong) 35%, transparent);
}
.srclink:hover { border-bottom-color: var(--seq-strong); }
.srcmore { display: block; font-size: 11px; color: var(--text-muted); text-decoration: none; margin-top: 2px; }
.srcmore:hover { color: var(--text-secondary); text-decoration: underline; }

.empty { padding: 40px; text-align: center; color: var(--text-secondary); }

/* ---------- detail page ---------- */
.back { display: inline-block; margin: 24px 0 12px; color: var(--text-secondary); font-size: 13px; }
.detail-head { margin-bottom: 20px; }
.detail-head h1 { margin: 0 0 6px; font-size: 24px; letter-spacing: -0.01em; }
.detail-head .meta { color: var(--text-secondary); font-size: 14px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .cols { grid-template-columns: 1fr; } }
.card {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px 20px;
    margin-bottom: 16px;
}
.card h2 {
    margin: 0 0 12px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 600;
}
dl.kv { margin: 0; display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 8px 16px; }
dl.kv dt { color: var(--text-secondary); font-size: 13px; }
dl.kv dd { margin: 0; font-size: 13px; font-variant-numeric: tabular-nums; }
.card p { margin: 0 0 10px; font-size: 13px; line-height: 1.6; color: var(--text-primary); }
.card p:last-child { margin-bottom: 0; }
.card.accent { border-left: 3px solid var(--seq-strong); }
.card.flagcard { border-left: 3px solid var(--critical); }
ul.sources { margin: 0; padding-left: 18px; }
ul.sources li { margin-bottom: 7px; font-size: 13px; }
ul.sources a { color: var(--seq-strong); }
