/* ============================================================
   TOKENS — canonical CSS custom properties
   ============================================================ */
:root {
    /* Slate scale */
    --slate-50:  #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;
    --slate-950: #020617;

    /* Brand */
    --red:        #c81e1e;
    --red-dark:   #7f1d1d;
    --gold:       #c89c1f;
    --gold-light: #e6b832;

    /* Semantic */
    --success: #166534;
    --warning: #d97706;
    --danger:  #7f1d1d;

    /* Surfaces & text */
    --bg:         var(--slate-50);
    --surface:    #ffffff;
    --surface-2:  var(--slate-100);
    --text:       var(--slate-900);
    --text-muted: var(--slate-500);

    /* Branded semantic aliases */
    --brand:    var(--red);
    --brand-fg: #ffffff;
    --accent:   var(--gold);

    /* Borders & rules */
    --border:     var(--slate-300);
    --rule:       var(--slate-900);
    --hairline:   var(--slate-200);
    --border-w:   1px;
    --rule-w:     4px;
    --hairline-w: 1px;

    /* Shadows (hard offset, no blur) */
    --shadow-color: var(--slate-900);
    --shadow-sm: 3px 3px 0 var(--shadow-color);
    --shadow-md: 5px 5px 0 var(--shadow-color);
    --shadow-lg: 8px 8px 0 var(--shadow-color);

    /* Typography */
    --font-display: 'Russo One', sans-serif;
    --font-body:    'IBM Plex Sans', system-ui, sans-serif;
    --font-mono:    'IBM Plex Mono', monospace;
    --display-weight: 400;

    /* Type scale — fluid via clamp() in usages, max sizes here */
    --fs-display: 56px;
    --fs-h1: 36px;
    --fs-h2: 26px;
    --fs-h3: 18px;
    --fs-h4: 14px;
    --fs-body: 16px;
    --fs-small: 14px;
    --fs-tiny:  12px;
    --fs-kicker: 11px;

    /* Headline treatment */
    --headline-tt: uppercase;
    --headline-ls: 0.04em;

    /* Spacing scale (4px base) */
    --space-1:  4px;
    --space-2:  8px;
    --space-3:  12px;
    --space-4:  16px;
    --space-5:  20px;
    --space-6:  24px;
    --space-8:  32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* Density — defaults are the MOBILE values; bumped at md/lg */
    --pad-card-x:   16px;
    --pad-card-y:   16px;
    --pad-button-y: 12px;
    --pad-button-x: 18px;
    --pad-input-y:  12px;
    --pad-input-x:  14px;
    --row-pad:      10px;
    --gap:          16px;

    /* Hit area floor — every interactive element ≥ 44×44 on mobile */
    --hit: 44px;

    /* Shape */
    --radius: 0px;

    color-scheme: light dark;
}

@media (min-width: 720px) {
    :root {
        /* Tablet+ density — more breathable */
        --pad-card-x:   20px;
        --pad-card-y:   20px;
        --pad-button-y: 13px;
        --pad-button-x: 22px;
        --pad-input-y:  12px;
        --pad-input-x:  16px;
        --row-pad:      12px;
        --gap:          20px;
    }
}

@media (min-width: 1024px) {
    :root {
        /* Desktop density — fully breathable */
        --pad-card-x:   24px;
        --pad-card-y:   24px;
        --pad-button-y: 14px;
        --pad-button-x: 24px;
        --gap:          24px;
    }
}

[data-theme="dark"] {
    --bg:         var(--slate-950);
    --surface:    #0e1729;
    --surface-2:  #1a2540;
    --text:       #e2e8f0;
    --text-muted: #94a3b8;
    --border:     #243352;
    --rule:       #e2e8f0;
    --hairline:   #1e293b;
    --shadow-color: #1e293b;
}

/* ============================================================
   RESET — mobile-first containment on root + body
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}
body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--font-body);
    font-size: var(--fs-body);
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
button { cursor: pointer; font: inherit; color: inherit; }
img, svg, video { max-width: 100%; display: block; }
input, select, textarea { font: inherit; color: inherit; }

/* ============================================================
   FLUID TYPOGRAPHY — clamp() does the work without media queries.
   Min target: phones at 360px. Max target: desktop at 1280px.
   ============================================================ */
.h1, .h2, .h3, .h4 {
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    color: var(--text);
    margin: 0;
    line-height: 1.05;
    text-transform: var(--headline-tt);
    letter-spacing: var(--headline-ls);
    overflow-wrap: anywhere;
    word-break: break-word;
}
.h1 {
    font-size: clamp(24px, 5.5vw + 8px, 36px);
    border-bottom: var(--rule-w) solid var(--rule);
    padding-bottom: var(--space-2);
    margin-bottom: var(--space-3);
}
.h2 {
    font-size: clamp(20px, 3.5vw + 8px, 26px);
    border-bottom: var(--rule-w) solid var(--rule);
    padding-bottom: var(--space-2);
    margin-bottom: var(--space-3);
}
.h3 { font-size: clamp(16px, 1.5vw + 12px, 18px); }
.h4 { font-size: var(--fs-h4); }
.display {
    font-family: var(--font-display);
    font-size: clamp(32px, 9vw + 4px, 56px);
    line-height: 1;
    text-transform: var(--headline-tt);
    letter-spacing: var(--headline-ls);
    overflow-wrap: anywhere;
}

.kicker {
    font-family: var(--font-mono);
    font-size: var(--fs-kicker);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--brand);
    font-weight: 600;
    margin: 0 0 var(--space-2);
}

p { margin: 0 0 var(--space-3); }
p:last-child { margin-bottom: 0; }
a { color: var(--brand); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { background: var(--brand); color: var(--brand-fg); }
strong { font-weight: 700; }
em { font-style: italic; }
code, .mono {
    font-family: var(--font-mono);
    font-size: 0.92em;
    background: var(--surface-2);
    padding: 1px 6px;
    color: var(--text);
    overflow-wrap: anywhere;
}

/* ============================================================
   BUTTONS — mobile-first: meet the 44px hit floor by default.
   .btn--block makes a button full-width (stack pattern).
   ============================================================ */
.btn {
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    font-size: var(--fs-tiny);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: var(--pad-button-y) var(--pad-button-x);
    min-height: var(--hit);
    border: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    text-decoration: none;
    border-radius: var(--radius);
    transition: transform 80ms, opacity 80ms;
    white-space: nowrap;
}
.btn--primary     { background: var(--brand); color: var(--brand-fg); }
.btn--primary:hover { transform: translate(-1px, -1px); }
.btn--primary:active { transform: translate(1px, 1px); }
.btn--secondary   { background: transparent; color: var(--text); border: var(--border-w) solid var(--rule); }
.btn--ghost       { background: transparent; color: var(--text); padding-left: var(--space-2); padding-right: var(--space-2); }
.btn--ghost:hover { color: var(--brand); background: transparent; text-decoration: none; }
.btn--destructive { background: var(--danger); color: #ffffff; }
.btn--sm { font-size: 10px; padding: 6px 12px; min-height: 32px; }
.btn--lg { font-size: 14px; padding: 18px 28px; min-height: 52px; }
.btn--block { display: flex; width: 100%; }
.btn[disabled] { opacity: 0.4; pointer-events: none; }

/* On wide viewports we no longer force the 44px floor — desktop pointers are precise. */
@media (min-width: 1024px) {
    .btn { min-height: 0; }
}

/* ============================================================
   PILLS / BADGES — same look across viewports
   ============================================================ */
.pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 3px 8px;
    border-radius: var(--radius);
    white-space: nowrap;
}
.pill--brand       { background: var(--brand);   color: var(--brand-fg); }
.pill--gold        { background: var(--accent);  color: var(--slate-900); }
.pill--success     { background: var(--success); color: #ffffff; }
.pill--warning     { background: var(--warning); color: #ffffff; }
.pill--destructive { background: var(--danger);  color: #ffffff; }
.pill--neutral {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
}

/* ============================================================
   FORM INPUTS — full-width by default; grid only above 720px
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
}
.input {
    font-family: var(--font-body);
    font-size: 16px; /* 16px prevents iOS auto-zoom on focus */
    padding: var(--pad-input-y) var(--pad-input-x);
    background: var(--surface);
    color: var(--text);
    border: var(--border-w) solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    min-height: var(--hit);
}
.input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 20%, transparent);
}
.input::placeholder { color: var(--text-muted); }
textarea.input { min-height: 96px; }

@media (min-width: 1024px) {
    .input { font-size: var(--fs-small); min-height: 0; }
}

/* Field grid — single column by default, 2-col at md, 3-col at lg */
.field-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-3); }
@media (min-width: 720px) {
    .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
}
@media (min-width: 1024px) {
    .field-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.checkbox, .radio {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    font-size: var(--fs-small);
    user-select: none;
    position: relative;
    min-height: var(--hit);
    padding: 4px 0;
}
.checkbox input, .radio input { position: absolute; opacity: 0; pointer-events: none; }
.checkbox-box {
    width: 22px; height: 22px;
    border: var(--border-w) solid var(--rule);
    background: var(--surface);
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
}
.checkbox input:checked ~ .checkbox-box { background: var(--brand); border-color: var(--brand); }
.checkbox input:checked ~ .checkbox-box::after {
    content: "";
    display: block;
    width: 6px; height: 12px;
    border: solid var(--brand-fg);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin: -2px 0 2px 0;
}
.radio-dot {
    width: 22px; height: 22px;
    border: var(--border-w) solid var(--rule);
    background: var(--surface);
    flex: none;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.radio input:checked ~ .radio-dot { border-color: var(--brand); }
.radio input:checked ~ .radio-dot::after { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--brand); }

@media (min-width: 1024px) {
    .checkbox-box, .radio-dot { width: 18px; height: 18px; }
    .checkbox input:checked ~ .checkbox-box::after { width: 5px; height: 10px; }
    .radio input:checked ~ .radio-dot::after { width: 10px; height: 10px; }
    .checkbox, .radio { min-height: 0; padding: 0; }
}

/* ============================================================
   CARDS — workhorse, mobile-first
   ============================================================ */
.card {
    background: var(--surface);
    color: var(--text);
    padding: var(--pad-card-y) var(--pad-card-x);
    border: var(--border-w) solid var(--rule);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius);
    position: relative;
    container-type: inline-size;
}
@media (min-width: 720px) { .card { box-shadow: var(--shadow-md); } }

.card-title {
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    font-size: var(--fs-h3);
    text-transform: var(--headline-tt);
    letter-spacing: var(--headline-ls);
    color: var(--text);
    margin: 0 0 var(--space-2);
    overflow-wrap: anywhere;
}
.card-marker {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    color: var(--brand);
    letter-spacing: 0.1em;
    margin: 0 0 var(--space-1);
}

/* Card header — wraps title above status pill on tight cards */
.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    margin: 0 0 var(--space-3);
    flex-wrap: wrap;
}
.card-header .card-title { margin: 0; flex: 1 1 auto; min-width: 0; }

/* Card footer — actions stack vertically inside narrow containers; row otherwise.
   Uses container queries so card behavior is independent of viewport. */
.card-footer {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    align-items: stretch;
    margin-top: var(--space-4);
    padding-top: var(--space-3);
    border-top: 1px solid var(--hairline);
}
.card-footer .grow { display: none; }
.card-footer .btn { width: 100%; justify-content: center; }
@container (min-width: 360px) {
    .card-footer { flex-direction: row; align-items: center; flex-wrap: wrap; }
    .card-footer .grow { display: block; flex: 1; }
    .card-footer .btn { width: auto; }
}

.card-icon {
    width: 40px; height: 40px;
    background: color-mix(in srgb, var(--brand) 12%, var(--surface));
    color: var(--brand);
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius);
    margin-bottom: var(--space-3);
}
.card-icon .icon { width: 20px; height: 20px; }

.card--stat .stat-num {
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    font-size: clamp(40px, 10vw, 56px);
    line-height: 1;
    color: var(--text);
    margin: 0;
    font-variant-numeric: tabular-nums;
}
.card--stat .stat-trend {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--success);
    margin: var(--space-2) 0 0;
    letter-spacing: 0.04em;
    font-weight: 600;
}
.card--stat .stat-trend.down { color: var(--danger); }

.card--featured::before,
.card--featured::after {
    content: "";
    position: absolute;
    width: 16px; height: 16px;
    pointer-events: none;
}
.card--featured::before {
    top: -2px; left: -2px;
    border-top: 4px solid var(--brand);
    border-left: 4px solid var(--brand);
}
.card--featured::after {
    bottom: -2px; right: -2px;
    border-bottom: 4px solid var(--brand);
    border-right: 4px solid var(--brand);
}

/* Auto-grid for collections of cards. Single column → 2 → 3 as room allows. */
.card-grid {
    display: grid;
    gap: var(--gap);
    grid-template-columns: 1fr;
}
@media (min-width: 480px) {
    .card-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
}

/* ============================================================
   ALERTS — flat informational chrome (no shadow). The colored
   left block is the semantic anchor; a competing offset shadow
   muddied the silhouette, so alerts intentionally sit flat
   versus cards (which keep their shadow).
   ============================================================ */
.alert {
    padding: var(--space-3) var(--space-4);
    border: var(--border-w) solid var(--rule);
    background: var(--surface);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    align-items: stretch;
    border-radius: var(--radius);
}
@media (min-width: 720px) {
    .alert { flex-direction: row; align-items: flex-start; }
}
.alert > .body { flex: 1 1 auto; min-width: 0; }
.alert-title {
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    font-size: var(--fs-small);
    text-transform: var(--headline-tt);
    letter-spacing: var(--headline-ls);
    color: var(--text);
    margin: 0 0 var(--space-1);
}
.alert-body { font-size: var(--fs-small); color: var(--text-muted); margin: 0; }
.alert--info    { border-left: 8px solid var(--brand); }
.alert--success { border-left: 8px solid var(--success); }
.alert--warning { border-left: 8px solid var(--warning); }
.alert--error   { border-left: 8px solid var(--danger); }

/* ============================================================
   TABS — horizontal scroll on mobile so labels never wrap; full strip at md+
   ============================================================ */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--rule);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    font-size: 13px;
    text-transform: var(--headline-tt);
    letter-spacing: var(--headline-ls);
    padding: var(--space-3) var(--space-4);
    background: transparent;
    color: var(--text-muted);
    border: 0;
    border-bottom: 4px solid transparent;
    margin-bottom: -2px;
    flex: none;
    min-height: var(--hit);
    scroll-snap-align: start;
    white-space: nowrap;
}
.tab.is-active { color: var(--text); border-bottom-color: var(--brand); }
.tab:hover:not(.is-active) { color: var(--text); }
@media (min-width: 720px) { .tabs { flex-wrap: wrap; overflow: visible; } }
@media (min-width: 1024px) { .tab { min-height: 0; } }

/* ============================================================
   TABLES — the big mobile transformation.

   Strategy: under 720px, every row is a "card" — <td> elements stack
     vertically with their column label provided by `data-label`. Above
     720px we restore the real table grid. One markup, two presentations.
   ============================================================ */

/* Standings — compact on mobile (rank, team, points only); expands at md+ */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: var(--border-w) solid var(--rule);
    box-shadow: var(--shadow-sm);
    font-variant-numeric: tabular-nums;
    border-radius: var(--radius);
    overflow: hidden;
}
@media (min-width: 720px) { .data-table { box-shadow: var(--shadow-md); } }

.data-table thead th {
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-align: left;
    padding: var(--row-pad) var(--space-3);
    background: var(--rule);
    color: var(--surface);
    white-space: nowrap;
}
.data-table thead th.num { text-align: right; }
.data-table tbody td {
    padding: var(--row-pad) var(--space-3);
    border-bottom: 1px solid var(--hairline);
    font-size: var(--fs-small);
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody td.team { font-weight: 600; }
.data-table tbody td.num  { text-align: right; }
.data-table tbody td.rank {
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    font-size: 16px;
    color: var(--brand);
    width: 1%;
    padding-right: var(--space-4);
    white-space: nowrap;
}
.data-table tbody tr.is-leader td.rank::after {
    content: "★";
    color: var(--accent);
    margin-left: 6px;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 0.85em;
    vertical-align: 0.06em;
}

/* Hide low-priority columns on phones — keep rank, team, last column (PTS).
   Each <th>/<td> may carry a priority class: .col-p1 (always), .col-p2 (≥480px),
   .col-p3 (≥720px). Default priority is p3 (table-only). */
.data-table .col-p2 { display: none; }
.data-table .col-p3 { display: none; }
@media (min-width: 480px) { .data-table .col-p2 { display: table-cell; } }
@media (min-width: 720px) { .data-table .col-p3 { display: table-cell; } }

/* Sortable headers (md+ only — sort UI doesn't make sense on a card list) */
.data-table thead th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 26px;
}
.data-table thead th.sortable:hover { color: var(--accent); }
.data-table thead th.sortable .sort-indicator {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    opacity: 0.5;
    transition: opacity 80ms, transform 120ms;
}
.data-table thead th.sortable.sort-asc .sort-indicator,
.data-table thead th.sortable.sort-desc .sort-indicator {
    opacity: 1;
    color: var(--accent);
}
.data-table thead th.sortable.sort-desc .sort-indicator { transform: translateY(-50%) rotate(180deg); }

.data-table tbody tr:hover td { background: var(--surface-2); }
.data-table tbody tr.is-selected td {
    background: color-mix(in srgb, var(--brand) 8%, var(--surface));
}
.data-table tbody tr.is-selected:hover td {
    background: color-mix(in srgb, var(--brand) 14%, var(--surface));
}

.data-table .col-checkbox { width: 1%; padding-right: 4px; }
.data-table .col-actions  { width: 1%; text-align: right; padding-right: 12px; padding-left: 0; }
.data-table .col-jersey {
    font-family: var(--font-mono);
    color: var(--brand);
    font-weight: 700;
    width: 1%;
    text-align: right;
    padding-right: 12px;
    white-space: nowrap;
}
.data-table .row-action {
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: 8px 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 18px;
    line-height: 1;
    min-width: var(--hit);
    min-height: var(--hit);
}
.data-table .row-action:hover { color: var(--brand); }
.data-table .checkbox-box { width: 18px; height: 18px; }

/* ============================================================
   TABLE — RICH (Players): card list under 720px, real <table> at md+.

   The markup matches the thead 1:1 (10 cells per row), tagged with
   `data-area="..."` so we can place each cell on the mobile card grid.
   On mobile the <tr> becomes a 5-col CSS grid; the 4 numeric stat
   cells (gp / g / a / last) sit on row 3 as a horizontal strip with
   ::before-rendered labels (GP / G / A). At md+ we revert <tr> to
   display: table-row and explicitly re-assert display: table-cell on
   every data-area td (since the per-area selectors are more specific
   than a generic td reset).
   ============================================================ */

/* --- Mobile (default): card grid --- */
.data-table[data-rich-table] {
    display: block;
    border: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
}
.data-table[data-rich-table] thead { display: none; }
.data-table[data-rich-table] tbody {
    display: grid;
    gap: var(--space-3);
}
.data-table[data-rich-table] tbody tr {
    display: grid;
    grid-template-columns: auto auto 1fr auto auto;
    grid-template-areas:
        "select jersey name name    actions"
        "select jersey pos  status  actions";
    column-gap: var(--space-3);
    row-gap: var(--space-1);
    align-items: center;
    background: var(--surface);
    border: var(--border-w) solid var(--rule);
    box-shadow: var(--shadow-sm);
    padding: var(--space-3);
}
.data-table[data-rich-table] tbody tr.is-selected {
    background: color-mix(in srgb, var(--brand) 8%, var(--surface));
}
.data-table[data-rich-table] tbody td {
    border: 0;
    padding: 0;
    font-size: var(--fs-small);
}

.data-table[data-rich-table] tbody td[data-area="select"]   { grid-area: select; align-self: center; }
.data-table[data-rich-table] tbody td[data-area="jersey"] {
    grid-area: jersey;
    align-self: center;
    font-family: var(--font-mono);
    color: var(--brand);
    font-weight: 700;
    font-size: 14px;
    text-align: left;
    white-space: nowrap;
}
.data-table[data-rich-table] tbody td[data-area="jersey"]::before {
    content: "№";
    color: var(--text-muted);
    font-weight: 600;
    margin-right: 2px;
}
.data-table[data-rich-table] tbody td[data-area="name"] {
    grid-area: name;
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    text-transform: var(--headline-tt);
    letter-spacing: var(--headline-ls);
    font-size: 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    overflow-wrap: anywhere;
}
.data-table[data-rich-table] tbody td[data-area="position"] {
    grid-area: pos;
    color: var(--text-muted);
    font-size: 12px;
}
.data-table[data-rich-table] tbody td[data-area="status"] {
    grid-area: status;
    justify-self: end;
}
.data-table[data-rich-table] tbody td[data-area="actions"] {
    grid-area: actions;
    align-self: center;
    justify-self: end;
}

/* Stat row — 4 numeric cells laid out horizontally on row 3 */
.data-table[data-rich-table] tbody td[data-area="gp"],
.data-table[data-rich-table] tbody td[data-area="g"],
.data-table[data-rich-table] tbody td[data-area="a"],
.data-table[data-rich-table] tbody td[data-area="last"] {
    grid-row: 3;
    margin-top: var(--space-2);
    padding-top: var(--space-2);
    border-top: 1px solid var(--hairline);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    text-align: left;
    color: var(--text);
}
.data-table[data-rich-table] tbody td[data-area="gp"]   { grid-column: 1 / 3; }
.data-table[data-rich-table] tbody td[data-area="g"]    { grid-column: 3; }
.data-table[data-rich-table] tbody td[data-area="a"]    { grid-column: 4; }
.data-table[data-rich-table] tbody td[data-area="last"] {
    grid-column: 5;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    text-align: right;
}
.data-table[data-rich-table] tbody td[data-area="gp"]::before,
.data-table[data-rich-table] tbody td[data-area="g"]::before,
.data-table[data-rich-table] tbody td[data-area="a"]::before {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    margin-right: 4px;
}
.data-table[data-rich-table] tbody td[data-area="gp"]::before { content: "GP"; }
.data-table[data-rich-table] tbody td[data-area="g"]::before  { content: "G"; }
.data-table[data-rich-table] tbody td[data-area="a"]::before  { content: "A"; }

/* Hover at mobile lives on the whole card; the generic `tr:hover td` rule
   would paint each grid cell individually and leave the gaps unpainted. */
.data-table[data-rich-table] tbody tr:hover         { background: var(--surface-2); }
.data-table[data-rich-table] tbody tr:hover td      { background: transparent; }
.data-table[data-rich-table] tbody tr.is-selected:hover {
    background: color-mix(in srgb, var(--brand) 14%, var(--surface));
}

/* --- md+: real table --- */
@media (min-width: 720px) {
    .data-table[data-rich-table] {
        display: table;
        width: 100%;
        border: var(--border-w) solid var(--rule);
        background: var(--surface);
        box-shadow: var(--shadow-md);
    }
    .data-table[data-rich-table] thead { display: table-header-group; }
    .data-table[data-rich-table] tbody { display: table-row-group; gap: 0; }
    .data-table[data-rich-table] tbody tr {
        display: table-row;
        background: transparent;
        border: 0;
        box-shadow: none;
        padding: 0;
        grid-template-columns: none;
        grid-template-areas: none;
        column-gap: 0;
        row-gap: 0;
    }
    .data-table[data-rich-table] tbody tr.is-selected {
        background: transparent;
    }
    .data-table[data-rich-table] tbody tr.is-selected td {
        background: color-mix(in srgb, var(--brand) 8%, var(--surface));
    }
    /* Re-assert table-cell on every per-area td (per-area selectors above
       have higher specificity than a generic `td { display: table-cell }`). */
    .data-table[data-rich-table] tbody td[data-area] {
        display: table-cell;
        padding: var(--row-pad) var(--space-3);
        border-bottom: 1px solid var(--hairline);
        border-top: 0;
        margin-top: 0;
        text-align: left;
        font-size: var(--fs-small);
        font-family: var(--font-body);
        font-weight: 400;
        text-transform: none;
        letter-spacing: normal;
        align-self: auto;
        justify-self: auto;
        grid-column: auto;
        grid-row: auto;
    }
    /* Strip mobile-only ::before labels at desktop */
    .data-table[data-rich-table] tbody td[data-area]::before { content: none; }
    /* Cells whose desktop styling differs from the body-text default */
    .data-table[data-rich-table] tbody td[data-area="select"] {
        width: 1%;
        padding-right: 4px;
    }
    .data-table[data-rich-table] tbody td[data-area="jersey"] {
        font-family: var(--font-mono);
        color: var(--brand);
        font-weight: 700;
        text-align: right;
        padding-right: 12px;
        width: 1%;
        white-space: nowrap;
    }
    .data-table[data-rich-table] tbody td[data-area="name"] {
        font-weight: 600;
    }
    .data-table[data-rich-table] tbody td[data-area="gp"],
    .data-table[data-rich-table] tbody td[data-area="g"],
    .data-table[data-rich-table] tbody td[data-area="a"] {
        text-align: right;
        font-variant-numeric: tabular-nums;
    }
    .data-table[data-rich-table] tbody td[data-area="actions"] {
        width: 1%;
        text-align: right;
        padding-right: 12px;
        padding-left: 0;
    }
    /* Revert hover from the whole-card mobile rule back to the per-td rule. */
    .data-table[data-rich-table] tbody tr:hover { background: transparent; }
    .data-table[data-rich-table] tbody tr:hover td { background: var(--surface-2); }
    .data-table[data-rich-table] tbody tr.is-selected:hover { background: transparent; }
    .data-table[data-rich-table] tbody tr.is-selected:hover td {
        background: color-mix(in srgb, var(--brand) 14%, var(--surface));
    }
}

/* Stack wrapper — toolbar + bulk + table + footer share one shadow */
.table-stack {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    max-width: 100%;
    min-width: 0;
}
.table-stack > * { min-width: 0; max-width: 100%; }
@media (min-width: 720px) {
    .table-stack { box-shadow: var(--shadow-md); }
    .table-stack > * { box-shadow: none !important; }
    .table-stack .data-table { border-top: 0; }
    .table-stack .table-toolbar { border-bottom: 1px solid var(--hairline); }
    .table-stack .table-bulk { border-bottom: 0; }
    .table-stack .table-footer { border-top: 0; }
    .table-stack .data-table[data-rich-table] { border: 0; box-shadow: none; }
}

/* Toolbar — vertical stack on mobile (search top, chips horizontal scroll, actions row) */
.table-toolbar {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--surface);
    border: var(--border-w) solid var(--rule);
    box-shadow: var(--shadow-sm);
}
.table-toolbar .search-input { flex: 1 1 100%; min-width: 0; }
.table-toolbar .toolbar-chips {
    display: flex;
    gap: var(--space-2);
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 calc(-1 * var(--space-3));
    padding: 0 var(--space-3);
}
.table-toolbar .toolbar-chips::-webkit-scrollbar { display: none; }
.table-toolbar .toolbar-actions {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    align-items: center;
}
.table-toolbar .toolbar-actions .grow { flex: 1; }
@media (min-width: 720px) {
    .table-toolbar {
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        gap: var(--space-3);
        padding: var(--space-3) var(--space-4);
        box-shadow: none;
    }
    .table-toolbar .search-input { flex: 0 1 280px; }
    .table-toolbar .toolbar-chips {
        flex-wrap: wrap;
        overflow: visible;
        margin: 0;
        padding: 0;
    }
    .table-toolbar .toolbar-actions { flex: 0 0 auto; margin-left: auto; }
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex: none;
    min-height: var(--hit);
    white-space: nowrap;
}
.filter-chip.is-active { background: var(--brand); color: var(--brand-fg); border-color: var(--brand); }
.filter-chip:hover:not(.is-active) { border-color: var(--rule); color: var(--text); }
.filter-chip .count {
    background: color-mix(in srgb, currentColor 14%, transparent);
    padding: 0 5px;
    font-weight: 700;
    margin-left: 2px;
}
@media (min-width: 1024px) { .filter-chip { padding: 5px 10px; min-height: 0; } }

/* Bulk action bar — fixed bottom sheet on mobile, inline on desktop */
.table-bulk {
    display: none;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    padding: var(--space-3) var(--space-4);
    background: var(--rule);
    color: var(--surface);
    font-family: var(--font-mono);
    font-size: 12px;
    border: var(--border-w) solid var(--rule);
}
.table-bulk.is-visible {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 80;
    box-shadow: 0 -4px 0 var(--shadow-color);
    padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
}
.table-bulk .count { font-weight: 700; }
.table-bulk .grow { flex: 1; }
.table-bulk button {
    background: transparent;
    color: var(--surface);
    border: 1px solid color-mix(in srgb, var(--surface) 30%, transparent);
    padding: 8px 12px;
    font-family: var(--font-display);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.06em;
    cursor: pointer;
    min-height: 36px;
}
.table-bulk button:hover { background: color-mix(in srgb, var(--surface) 15%, transparent); }
.table-bulk button.danger { color: color-mix(in srgb, var(--brand) 60%, white); border-color: color-mix(in srgb, var(--brand) 50%, transparent); }
@media (min-width: 720px) {
    .table-bulk.is-visible {
        position: static;
        box-shadow: none;
        padding-bottom: var(--space-2);
    }
    .table-bulk { padding: var(--space-2) var(--space-4); border-top: 0; }
    .table-bulk button { padding: 4px 10px; min-height: 0; }
}

/* Table footer — pagination + count, stacks on mobile */
.table-footer {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    align-items: stretch;
    padding: var(--space-3);
    background: var(--surface);
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 12px;
    border: var(--border-w) solid var(--rule);
}
.table-footer .grow { display: none; }
@media (min-width: 480px) {
    .table-footer { flex-direction: row; align-items: center; flex-wrap: wrap; }
    .table-footer .grow { display: block; flex: 1; }
}

/* ============================================================
   SCHEDULE LIST — date inline with info on mobile, side-by-side on md
   ============================================================ */
.schedule { list-style: none; padding: 0; margin: 0; }
.schedule-row {
    display: grid;
    grid-template-columns: 56px 1fr;
    grid-template-areas:
        "date  info"
        "pill  pill";
    gap: var(--space-3);
    padding: var(--row-pad) var(--space-3);
    align-items: start;
    border-bottom: 1px solid var(--hairline);
}
.schedule-row:last-child { border-bottom: 0; }
.schedule-row > .sched-date { grid-area: date; }
.schedule-row > div:nth-of-type(2) { grid-area: info; min-width: 0; }
.schedule-row > .pill { grid-area: pill; justify-self: start; }

@media (min-width: 480px) {
    .schedule-row {
        grid-template-columns: 56px 1fr auto;
        grid-template-areas: "date info pill";
        align-items: center;
    }
    .schedule-row > .pill { justify-self: end; }
}
@media (min-width: 1024px) {
    .schedule-row { grid-template-columns: 64px 1fr auto; gap: var(--space-4); }
}

.sched-date {
    text-align: center;
    padding: 6px 0;
    border: var(--border-w) solid var(--rule);
    background: var(--surface-2);
    border-radius: var(--radius);
}
.sched-day {
    font-family: var(--font-mono);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--brand);
    margin: 0;
    font-weight: 700;
}
.sched-num {
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    font-size: 20px;
    line-height: 1;
    color: var(--text);
    margin: 2px 0 0;
}
.sched-time {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    margin: 0;
    letter-spacing: 0.04em;
}
.sched-teams {
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    font-size: clamp(14px, 3.5vw, 16px);
    text-transform: var(--headline-tt);
    letter-spacing: var(--headline-ls);
    color: var(--text);
    margin: 2px 0 0;
    overflow-wrap: anywhere;
}
.sched-venue { font-size: 12px; color: var(--text-muted); margin: 2px 0 0; }

/* ============================================================
   SCOREBOARD — vertical stacked teams on mobile, 3-col grid at md+
   Mobile: Home block, horizontal meta divider, Away block.
   ============================================================ */
.scoreboard {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
        "home"
        "meta"
        "away";
    gap: var(--space-3);
    padding: var(--pad-card-y) var(--pad-card-x);
    background: var(--surface);
    border: var(--border-w) solid var(--rule);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius);
}
@media (min-width: 720px) { .scoreboard { box-shadow: var(--shadow-md); } }

.score-team { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.score-team.home { grid-area: home; }
.score-team.away { grid-area: away; }
.score-meta {
    grid-area: meta;
    text-align: center;
    border-top: 1px solid var(--hairline);
    border-bottom: 1px solid var(--hairline);
    padding: var(--space-2) 0;
}

.team-name {
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    font-size: clamp(14px, 4vw, 16px);
    text-transform: var(--headline-tt);
    letter-spacing: var(--headline-ls);
    color: var(--text);
    margin: 0;
    overflow-wrap: anywhere;
}
.team-score {
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    font-size: clamp(40px, 12vw, 56px);
    line-height: 1;
    color: var(--text);
    margin: 0;
    font-variant-numeric: tabular-nums;
}
.score-team.winner .team-score { color: var(--brand); }
.score-meta .kicker { color: var(--accent); font-weight: 700; margin-bottom: 4px; }
.score-time { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); margin: 0; }

@media (min-width: 720px) {
    .scoreboard {
        grid-template-columns: 1fr auto 1fr;
        grid-template-areas: "home meta away";
        gap: var(--space-4);
        align-items: center;
    }
    .score-team { display: block; }
    .score-team.home { text-align: right; }
    .score-team.away { text-align: left; }
    .score-meta { border: 0; padding: 0; }
    .team-name { margin: 0 0 6px; }
}

/* ============================================================
   TIMELINE — mobile: time+node inline as a header strip; rail on left.
   md+: 3-col grid (time / node / body) with the rail through the node.
   ============================================================ */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }

.timeline-period {
    display: flex;
    align-items: baseline;
    gap: var(--space-3);
    padding: var(--space-4) 0 var(--space-2);
    margin-top: var(--space-6);
    margin-bottom: var(--space-2);
    border-bottom: var(--rule-w) solid var(--rule);
    flex-wrap: wrap;
}
.timeline-period:first-child { margin-top: 0; }
.timeline-period .label {
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: clamp(14px, 4vw, 18px);
    color: var(--text);
    margin: 0;
}
.timeline-period .meta {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.timeline-period .grow { flex: 1; }

.timeline-event {
    position: relative;
    display: grid;
    grid-template-columns: 32px 1fr;
    grid-template-areas:
        "node header"
        "rail body";
    column-gap: var(--space-3);
    row-gap: var(--space-1);
    padding: var(--space-3) 0;
}
.timeline-event > .time     { grid-area: header; align-self: center; display: flex; gap: var(--space-2); align-items: baseline; }
.timeline-event > .node     { grid-area: node; }
.timeline-event > .body     { grid-area: body; }
/* Rail running down the node column on mobile */
.timeline-event::before {
    content: "";
    grid-area: rail;
    width: 2px;
    background: var(--border);
    justify-self: center;
    margin-top: -8px;
}
.timeline-event:last-of-type::before { display: none; }

.timeline-event .time {
    font-variant-numeric: tabular-nums;
}
.timeline-event .period-label {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.timeline-event .clock {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.timeline-event .node {
    width: 32px;
    height: 32px;
    background: var(--surface);
    border: 2px solid var(--rule);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    text-transform: uppercase;
    font-size: 13px;
    box-shadow: 2px 2px 0 var(--shadow-color);
    z-index: 1;
}
.timeline-event .node--goal    { background: var(--brand); color: var(--brand-fg); border-color: var(--brand); }
.timeline-event .node--penalty { background: var(--warning); color: #ffffff; border-color: var(--warning); }
.timeline-event .node--final   { background: var(--accent); color: var(--slate-900); border-color: var(--accent); }
.timeline-event .node--save    { background: var(--surface-2); color: var(--text); }

.timeline-event .body { padding: 0; }
.timeline-event .title {
    display: flex; align-items: center; gap: var(--space-2);
    flex-wrap: wrap;
    margin: 0 0 4px;
    font-family: var(--font-body);
    font-size: var(--fs-body);
    color: var(--text);
}
.timeline-event .event-tag {
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 11px;
    padding: 3px 8px;
    background: var(--brand);
    color: var(--brand-fg);
}
.timeline-event--penalty .event-tag { background: var(--warning); color: #ffffff; }
.timeline-event--final   .event-tag { background: var(--accent); color: var(--slate-900); }
.timeline-event--save    .event-tag { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.timeline-event .player {
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    text-transform: var(--headline-tt);
    letter-spacing: var(--headline-ls);
    font-size: clamp(13px, 3.5vw, 16px);
    color: var(--text);
}
.timeline-event .team-tag {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.timeline-event .desc {
    font-size: 13px;
    color: var(--text-muted);
    margin: 4px 0 0;
}
.timeline-event .score-callout {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-2);
    padding: 4px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
}
.timeline-event .score-callout .winner { color: var(--brand); }

@media (min-width: 720px) {
    .timeline-event {
        grid-template-columns: 64px 36px 1fr;
        grid-template-areas: "time node body";
        column-gap: var(--space-4);
        padding: var(--space-3) 0;
    }
    .timeline-event > .time { grid-area: time; align-self: start; flex-direction: column; align-items: flex-end; gap: 0; padding-top: 6px; text-align: right; }
    .timeline-event > .node { grid-area: node; width: 36px; height: 36px; font-size: 14px; margin-top: 4px; }
    .timeline-event > .body { grid-area: body; padding: 4px 0 8px; }
    .timeline-event::before {
        content: "";
        position: absolute;
        grid-area: auto;
        left: calc(64px + var(--space-4) + 17px);
        top: 0; bottom: 0;
        width: 2px;
        background: var(--border);
        margin-top: 0;
        justify-self: auto;
    }
    .timeline-event:last-of-type::before { display: block; }
    .timeline-event .clock { font-size: 14px; }
}

/* ============================================================
   ROSTER — auto-fill grid; minmax shrinks naturally on phones
   ============================================================ */
.roster {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--space-3);
}
@media (min-width: 480px) {
    .roster { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--space-4); }
}
@media (min-width: 1024px) {
    .roster { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--gap); }
}
.player-card {
    background: var(--surface);
    border: var(--border-w) solid var(--rule);
    box-shadow: var(--shadow-sm);
    padding: var(--space-3) var(--space-3);
    border-radius: var(--radius);
    position: relative;
}
@media (min-width: 720px) {
    .player-card { box-shadow: var(--shadow-md); padding: var(--pad-card-y) var(--pad-card-x); }
}
.player-card.captain { border-color: var(--brand); }
.player-num {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--brand);
    font-weight: 700;
    letter-spacing: 0.1em;
    margin: 0 0 var(--space-1);
}
.player-num .num-mark {
    font-size: 1.7em;
    line-height: 1;
    vertical-align: -0.18em;
    font-weight: 600;
    letter-spacing: 0;
    margin-right: 2px;
}
.player-name {
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    font-size: var(--fs-small);
    text-transform: var(--headline-tt);
    letter-spacing: var(--headline-ls);
    color: var(--text);
    margin: 0 0 var(--space-1);
    overflow-wrap: anywhere;
}
.player-pos { font-size: var(--fs-tiny); color: var(--text-muted); margin: 0; }

/* ============================================================
   SITE HEADER — hamburger by default; full inline nav at md+
   Mobile structure:
     [brand]                                [hamburger]
     [-- expanded nav slides in below when open --]
   ============================================================ */
.site-header {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "brand toggle";
    column-gap: var(--space-3);
    row-gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--surface);
    border-bottom: var(--rule-w) solid var(--rule);
    position: relative;
}
.site-brand {
    grid-area: brand;
    display: flex; align-items: center; gap: var(--space-2);
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    font-size: clamp(14px, 4vw, 16px);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text);
    min-width: 0;
}
.site-brand > span:not(.brand-mark) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.brand-mark {
    width: 36px; height: 36px;
    background: var(--brand);
    color: var(--brand-fg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    font-size: 16px;
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius);
    flex: none;
}
.site-header .nav-toggle {
    grid-area: toggle;
    display: inline-flex;
    background: transparent;
    border: var(--border-w) solid var(--rule);
    color: var(--text);
    cursor: pointer;
    padding: 0;
    width: var(--hit); height: var(--hit);
    align-items: center;
    justify-content: center;
}
.site-header .nav-toggle .icon { width: 22px; height: 22px; }
.site-nav, .site-auth { display: none; }

.site-header[data-nav="open"] {
    grid-template-areas:
        "brand toggle"
        "nav   nav"
        "auth  auth";
}
.site-header[data-nav="open"] .site-nav,
.site-header[data-nav="open"] .site-auth {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-top: var(--space-2);
    border-top: 1px solid var(--hairline);
    margin-top: var(--space-2);
}
.site-header[data-nav="open"] .site-nav { grid-area: nav; }
.site-header[data-nav="open"] .site-auth { grid-area: auth; gap: var(--space-2); flex-direction: row; }

.nav-link {
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    text-decoration: none;
    padding: var(--space-3) 0;
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: var(--hit);
    border-bottom: 1px solid var(--hairline);
}
.nav-link.is-active { color: var(--text); }
.nav-link.is-active::before {
    content: "";
    position: absolute;
    left: -8px;
    top: 8px; bottom: 8px;
    width: 4px;
    background: var(--brand);
}
.nav-link:hover { color: var(--text); background: transparent; text-decoration: none; }
.nav-link.is-trigger {
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--hairline);
    cursor: pointer;
    text-align: left;
    width: 100%;
}
.nav-link .caret { width: 10px; height: 10px; flex: none; transition: transform 120ms; margin-left: auto; }
.has-dropdown[aria-expanded="true"] .nav-link .caret { transform: rotate(180deg); }

.site-auth .btn { flex: 1; }

@media (min-width: 720px) {
    .site-header {
        display: flex;
        align-items: center;
        gap: var(--space-4);
        padding: var(--space-3) var(--space-5);
    }
    .site-header .nav-toggle { display: none; }
    .site-nav, .site-header .site-auth { display: flex !important; }
    .site-nav {
        gap: 0;
        flex: 1;
        flex-direction: row;
        flex-wrap: wrap;
        padding-top: 0;
        border-top: 0;
        margin-top: 0;
    }
    .site-header .site-auth {
        gap: var(--space-2);
        flex-direction: row;
        padding-top: 0;
        border-top: 0;
        margin-top: 0;
    }
    .site-auth .btn { flex: 0 0 auto; }
    .nav-link {
        padding: var(--space-2) 14px;
        border-bottom: 0;
        min-height: 0;
    }
    .nav-link.is-active::before { display: none; }
    .nav-link.is-active::after {
        content: "";
        position: absolute;
        left: 14px; right: 14px;
        bottom: -14px;
        height: 4px;
        background: var(--brand);
    }
    .nav-link.is-trigger { border-bottom: 0; width: auto; text-align: center; }
    .nav-link .caret { margin-left: 0; }
}
@media (min-width: 1024px) {
    .site-header { padding: var(--space-3) var(--space-6); gap: var(--space-6); }
}

/* ============================================================
   DROPDOWN MENU — full-width below trigger on mobile;
   absolute-positioned overlay at md+
   ============================================================ */
.has-dropdown { position: relative; }
.dropdown-menu {
    display: none;
    background: var(--surface);
    padding: var(--space-2) 0;
    margin: 0;
}
.has-dropdown[aria-expanded="true"] > .dropdown-menu,
.has-dropdown:focus-within > .dropdown-menu { display: block; }

/* On mobile we render dropdown items inline as a flat list */
.site-header[data-nav="open"] .has-dropdown .nav-link.is-trigger { display: none; }
.site-header[data-nav="open"] .has-dropdown[aria-expanded] .dropdown-menu,
.site-header[data-nav="open"] .has-dropdown .dropdown-menu { display: block; }
.site-header[data-nav="open"] .has-dropdown .dropdown-menu a,
.site-header[data-nav="open"] .has-dropdown .dropdown-menu button {
    padding-left: var(--space-4);
    color: var(--text-muted);
}

.dropdown-menu a,
.dropdown-menu button {
    display: block;
    width: 100%;
    text-align: left;
    padding: var(--space-3) var(--space-4);
    color: var(--text);
    text-decoration: none;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--hairline);
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 0.06em;
    cursor: pointer;
    min-height: var(--hit);
}
.dropdown-menu a:last-child,
.dropdown-menu button:last-child { border-bottom: 0; }
.dropdown-menu a:hover,
.dropdown-menu button:hover {
    background: var(--brand);
    color: var(--brand-fg);
    text-decoration: none;
}
.dropdown-menu .meta {
    display: block;
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 2px;
}
.dropdown-menu a:hover .meta,
.dropdown-menu button:hover .meta { color: var(--brand-fg); opacity: 0.85; }
.dropdown-divider {
    border: 0;
    height: 1px;
    background: var(--hairline);
    margin: var(--space-2) 0;
}
.dropdown-label {
    display: block;
    padding: var(--space-2) var(--space-4) var(--space-1);
    font-family: var(--font-mono);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
}

@media (min-width: 720px) {
    .dropdown-menu {
        position: absolute;
        top: calc(100% + 14px);
        left: 0;
        min-width: 220px;
        max-width: calc(100vw - 32px);
        border: var(--border-w) solid var(--rule);
        box-shadow: var(--shadow-md);
        z-index: 100;
        padding: var(--space-2) 0;
    }
    .dropdown-menu.align-end { left: auto; right: 0; }
    .has-dropdown:hover > .dropdown-menu { display: block; }
    .dropdown-menu a, .dropdown-menu button {
        padding: var(--space-2) var(--space-4);
        font-size: 12px;
        border-bottom: 0;
        min-height: 0;
    }
}

/* ============================================================
   HERO — tight padding mobile, generous desktop
   ============================================================ */
.hero {
    padding: var(--space-6) var(--space-4);
    background: var(--surface);
    border-bottom: var(--rule-w) solid var(--rule);
}
@media (min-width: 720px) { .hero { padding: var(--space-10) var(--space-6); } }
@media (min-width: 1024px) { .hero { padding: var(--space-12) var(--space-8); } }

.hero .h1 { font-size: clamp(28px, 8vw, var(--fs-display)); max-width: 900px; }
.hero-sub { font-size: var(--fs-body); color: var(--text-muted); margin: var(--space-3) 0 0; max-width: 700px; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty {
    text-align: center;
    padding: var(--space-8) var(--space-4);
    background: var(--surface);
    border: var(--border-w) solid var(--rule);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius);
}
@media (min-width: 720px) { .empty { padding: var(--space-12) var(--space-6); box-shadow: var(--shadow-md); } }
.empty-mark {
    width: 56px; height: 56px;
    background: var(--rule);
    color: var(--surface);
    display: inline-flex; align-items: center; justify-content: center;
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    font-size: 24px;
    margin-bottom: var(--space-4);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius);
}
.empty .h2 { margin-bottom: var(--space-2); border: 0; padding: 0; }
.empty p { color: var(--text-muted); margin-bottom: var(--space-4); }

/* ============================================================
   TOOLBAR / SEARCH / PAGINATION
   ============================================================ */
.toolbar {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--surface);
    border: var(--border-w) solid var(--rule);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
@media (min-width: 720px) {
    .toolbar {
        flex-direction: row;
        align-items: center;
        gap: var(--space-2);
        flex-wrap: wrap;
        padding: var(--row-pad) var(--space-3);
        box-shadow: var(--shadow-md);
    }
}

.search-input {
    display: flex; align-items: center; gap: var(--space-2);
    padding: var(--pad-input-y) var(--pad-input-x);
    background: var(--surface);
    color: var(--text);
    border: var(--border-w) solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    min-height: var(--hit);
}
.search-input input {
    flex: 1;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 16px;
    outline: none;
    padding: 0;
    min-width: 0;
}
.search-input .icon { color: var(--text-muted); width: 18px; height: 18px; flex: none; }
@media (min-width: 720px) { .search-input { width: auto; flex: 1; min-width: 180px; min-height: 0; } .search-input input { font-size: var(--fs-small); } }

.pagination {
    display: flex; align-items: center; gap: 4px;
    font-family: var(--font-mono);
    font-size: 12px;
    flex-wrap: wrap;
    justify-content: center;
}
.pagination .page {
    min-width: var(--hit); height: var(--hit);
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    padding: 0 var(--space-2);
}
.pagination .page.is-active { background: var(--brand); color: var(--brand-fg); border-color: var(--brand); }
.pagination .page:hover:not(.is-active) { color: var(--text); border-color: var(--rule); }
@media (min-width: 1024px) { .pagination .page { min-width: 32px; height: 32px; } }

/* ============================================================
   ICONS
   ============================================================ */
.icon {
    width: 1.2em; height: 1.2em;
    flex: none;
    vertical-align: middle;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: square;
    stroke-linejoin: miter;
}

/* ============================================================
   LOGO
   ============================================================ */
.logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1em;
    height: 1em;
    background: var(--brand);
    color: var(--brand-fg);
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    font-size: inherit;
    text-transform: uppercase;
    line-height: 1;
    box-shadow: 0.1em 0.1em 0 var(--shadow-color);
    border-radius: var(--radius);
    flex: none;
}
.logo-wordmark {
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 0.9;
    color: var(--text);
    display: inline-block;
}
.logo-wordmark::after {
    content: "";
    display: block;
    height: 0.16em;
    background: var(--brand);
    margin-top: 0.18em;
    width: 100%;
}
.logo-lockup {
    display: inline-flex;
    align-items: center;
    gap: 0.38em;
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1;
    color: var(--text);
}
.logo-lockup .word { line-height: 1; }

