/* ==========================================================================
   SportsAnalysisQA — design system

   Tokens are taken verbatim from the supplied design (player_parent_login.html
   Tailwind config + the five screenshots). Written by hand rather than pulled
   from a CDN so the Content-Security-Policy can stay at style-src 'self'.
   ========================================================================== */

:root {
    /* Surfaces */
    --surface:              #051424;
    --surface-lowest:       #010f1f;
    --surface-low:          #0d1c2d;
    --surface-container:    #122131;
    --surface-high:         #1c2b3c;
    --surface-highest:      #273647;
    --surface-bright:       #2c3a4c;

    /* Content */
    --on-surface:           #d4e4fa;
    --on-surface-variant:   #c4c9ac;
    --outline:              #8e9379;
    --outline-variant:      #444933;

    /* Accent — the lime that carries every primary action */
    --accent:               #c3f400;
    --accent-dim:           #abd600;
    --accent-deep:          #556d00;
    --on-accent:            #161e00;

    /* Secondary — blue, used for informational states and the second series */
    --secondary:            #adc6ff;
    --secondary-container:  #4b8eff;
    --on-secondary:         #002e69;

    --error:                #ffb4ab;
    --error-container:      #93000a;
    --on-error-container:   #ffdad6;

    --success:              #9ee493;

    /* Radii */
    --r-sm: 0.125rem;
    --r-md: 0.25rem;
    --r-lg: 0.5rem;
    --r-xl: 0.75rem;
    --r-pill: 999px;

    /* Spacing */
    --gutter: 24px;
    --margin-mobile: 16px;
    --margin-desktop: 40px;
    --container-max: 1440px;
    --sidebar-w: 264px;

    --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-display: "Montserrat", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace;

    --shadow-card: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .22);
    --shadow-accent: 0 8px 24px rgba(195, 244, 0, .18);
}

/* --- Self-hosted fonts ---------------------------------------------------
   Falls back to the system stack above if the woff2 files are not present, so
   the app never blocks on a font it cannot load. */
@font-face {
    font-family: "Inter";
    src: url("../fonts/inter-variable.woff2") format("woff2");
    font-weight: 100 900;
    font-display: swap;
}
@font-face {
    font-family: "Montserrat";
    src: url("../fonts/montserrat-variable.woff2") format("woff2");
    font-weight: 100 900;
    font-display: swap;
}
@font-face {
    font-family: "JetBrains Mono";
    src: url("../fonts/jetbrains-mono-variable.woff2") format("woff2");
    font-weight: 100 800;
    font-display: swap;
}

/* --- Reset ---------------------------------------------------------------- */

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--surface);
    color: var(--on-surface);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 24px;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
}

img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 700; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

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

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--surface-lowest); }
::-webkit-scrollbar-thumb { background: var(--surface-highest); border-radius: var(--r-pill); }
::-webkit-scrollbar-thumb:hover { background: var(--outline-variant); }

/* --- Typography ----------------------------------------------------------- */

.display   { font-family: var(--font-display); font-size: 48px; line-height: 56px; font-weight: 800; letter-spacing: -0.02em; }
.headline  { font-family: var(--font-display); font-size: 24px; line-height: 32px; font-weight: 700; }
.title     { font-family: var(--font-display); font-size: 18px; line-height: 26px; font-weight: 700; }
.body-lg   { font-size: 18px; line-height: 28px; }
.caption   { font-size: 12px; line-height: 16px; font-weight: 500; }
.data-label{ font-family: var(--font-mono); font-size: 14px; line-height: 20px; letter-spacing: .05em; font-weight: 500; }

.eyebrow {
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 16px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--on-surface-variant);
}
.eyebrow--accent { color: var(--accent); }

.muted     { color: var(--on-surface-variant); }
.dim       { color: rgba(212, 228, 250, .55); }
.accent    { color: var(--accent); }
.text-error{ color: var(--error); }
.mono      { font-family: var(--font-mono); }
.truncate  { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2   { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

@media (max-width: 720px) {
    .display { font-size: 32px; line-height: 40px; }
}

/* --- Icons ---------------------------------------------------------------- */

.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 32px; height: 32px; }

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

.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: none;
    background: var(--surface-low);
    border-right: 1px solid rgba(39, 54, 71, .7);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; }
/* object-fit keeps an administrator-uploaded logo of any proportion inside the
   slot: letterboxed, never stretched. Without it this fixed square distorts
   anything that is not itself square. */
.brand__mark { width: 44px; height: 44px; flex: none; object-fit: contain; }

/* A logo wider than ~2.2:1 is a wordmark. The sidebar shows the mark alone
   either way, so this only gives such a logo the width it needs — capped so it
   cannot overflow the 216px a 264px sidebar leaves for it. */
.brand--wordmark .brand__mark { width: auto; max-width: 176px; height: 40px; }

/* Settings → Branding. The preview is a fixed box for the same reason the auth
   tile is: whatever is chosen has to sit inside it without moving anything. */
.logo-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo-preview {
    width: 96px; height: 96px; flex: none;
    border-radius: var(--r-lg);
    background: var(--surface-container);
    display: grid; place-items: center;
    overflow: hidden;
}
.logo-preview img {
    max-width: 100%; max-height: 100%;
    min-width: 0; min-height: 0;              /* see .auth__logo img */
    object-fit: contain;
}

.nav-group-label {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: rgba(196, 201, 172, .65);
    padding: 16px 12px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--r-lg);
    color: var(--on-surface);
    font-size: 15px;
    transition: background .15s ease, color .15s ease;
}
.nav-item:hover { background: var(--surface-container); }
.nav-item--active {
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 600;
    box-shadow: var(--shadow-accent);
}
.nav-item--active:hover { background: var(--accent); }
.nav-item--sub { padding-left: 22px; font-size: 14px; }

.sidebar__spacer { flex: 1 1 auto; }
.sidebar__divider { height: 1px; background: rgba(39, 54, 71, .8); margin: 12px 8px; }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px var(--margin-desktop);
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(5, 20, 36, .92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(39, 54, 71, .5);
}

.searchbar { flex: 1 1 auto; max-width: 720px; position: relative; }
.searchbar .icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--on-surface-variant); pointer-events: none; }
.searchbar input {
    width: 100%;
    background: var(--surface-container);
    border: 1px solid transparent;
    border-radius: var(--r-xl);
    padding: 12px 16px 12px 46px;
    color: var(--on-surface);
    transition: border-color .2s, background .2s;
}
.searchbar input::placeholder { color: rgba(196, 201, 172, .6); }
.searchbar input:focus { outline: none; border-color: var(--accent-dim); background: var(--surface-high); }

.topbar__actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }

.bell { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-lg); color: var(--on-surface-variant); }
.bell:hover { background: var(--surface-container); color: var(--on-surface); }
.bell__badge {
    position: absolute; top: 2px; right: 2px;
    min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: var(--r-pill);
    background: var(--accent); color: var(--on-accent);
    font-family: var(--font-mono); font-size: 10px; font-weight: 700;
    display: grid; place-items: center;
}

.userchip { display: flex; align-items: center; gap: 12px; padding: 4px 4px 4px 12px; border-radius: var(--r-lg); }
.userchip:hover { background: var(--surface-container); }
.userchip__name { font-family: var(--font-display); font-weight: 700; font-size: 15px; line-height: 20px; }
.userchip__role { font-size: 12px; line-height: 16px; color: var(--on-surface-variant); text-align: right; }

.avatar {
    width: 40px; height: 40px; flex: none;
    border-radius: var(--r-lg);
    background: var(--surface-highest);
    display: grid; place-items: center;
    font-family: var(--font-display); font-weight: 700; font-size: 14px;
    color: var(--accent);
    border: 2px solid var(--accent);
}
.avatar--lg { width: 56px; height: 56px; font-size: 18px; }
.avatar--plain { border-color: var(--surface-bright); color: var(--on-surface-variant); }

.content { padding: 32px var(--margin-desktop) 64px; max-width: var(--container-max); width: 100%; }

/* --- Page header ---------------------------------------------------------- */

.page-head { display: flex; align-items: flex-start; gap: var(--gutter); flex-wrap: wrap; margin-bottom: 28px; }
.page-head__text { flex: 1 1 320px; min-width: 0; }
.page-head__actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* --- Buttons -------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    border: 1px solid transparent;
    border-radius: var(--r-lg);
    background: var(--surface-high);
    color: var(--on-surface);
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background .18s ease, transform .12s ease, box-shadow .18s ease;
    text-align: center;
}
.btn:hover { background: var(--surface-highest); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-busy { opacity: .55; pointer-events: none; }

.btn--primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-accent); }
.btn--primary:hover { background: var(--accent-dim); }

.btn--white { background: #fff; color: #1a2400; }
.btn--white:hover { background: #eef3e0; }

.btn--ghost { background: transparent; border-color: var(--surface-highest); }
.btn--ghost:hover { background: var(--surface-container); }

.btn--danger { background: var(--error-container); color: var(--on-error-container); }
.btn--danger:hover { background: #a80010; }

.btn--sm { padding: 8px 14px; font-size: 13px; }
.btn--block { width: 100%; }
.btn--lg { padding: 16px 24px; font-size: 16px; }

.icon-btn {
    display: grid; place-items: center;
    width: 38px; height: 38px;
    border: 1px solid var(--surface-highest);
    border-radius: var(--r-lg);
    background: var(--surface-container);
    color: var(--on-surface-variant);
    cursor: pointer;
}
.icon-btn:hover { color: var(--on-surface); background: var(--surface-high); }

/* --- Cards ---------------------------------------------------------------- */

.card {
    background: var(--surface-container);
    border: 1px solid rgba(39, 54, 71, .6);
    border-radius: var(--r-xl);
    padding: var(--gutter);
}
.card--flush { padding: 0; overflow: hidden; }
.card__head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.card__head h2 { flex: 1 1 auto; min-width: 0; }

.section-title { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.section-title::before { content: ""; width: 4px; height: 24px; border-radius: var(--r-pill); background: var(--accent); flex: none; }
.section-title--blue::before { background: var(--secondary); }
.section-title--white::before { background: #fff; }
.section-title h2 { flex: 1 1 auto; min-width: 0; }
.section-title a { font-family: var(--font-mono); font-size: 13px; letter-spacing: .04em; color: var(--on-surface-variant); display: inline-flex; align-items: center; gap: 6px; }
.section-title a:hover { color: var(--accent); }

/* --- Grid helpers --------------------------------------------------------- */

.grid { display: grid; gap: var(--gutter); }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
/* Cards that are NOT media: the player, child and search-player tiles, which
   carry a 56px avatar, a name and buttons and need the room. */
.grid--cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid--tiles { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
/* Media thumbnails. 160px puts the card at 163–175px at every width from a
   phone to an ultrawide, so the tile reads as one fixed component rather than
   a track that stretches. */
.grid--media { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.grid--photos { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 6px; }
.grid--split { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr); align-items: start; }
.grid--halves { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

@media (max-width: 1100px) {
    .grid--split { grid-template-columns: minmax(0, 1fr); }
}

.stack { display: flex; flex-direction: column; gap: var(--gutter); }
.stack--sm { gap: 12px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row--tight { gap: 8px; }
.spacer { flex: 1 1 auto; }

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

.stat {
    position: relative;
    background: var(--surface-container);
    border: 1px solid rgba(39, 54, 71, .6);
    border-radius: var(--r-xl);
    padding: 20px;
    min-height: 168px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.stat__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: auto; }
.stat__icon { color: var(--on-surface); }
.stat__delta { font-family: var(--font-mono); font-size: 12px; color: var(--accent); }
.stat__delta--flat { color: var(--on-surface-variant); }
.stat__value { font-family: var(--font-display); font-size: 34px; line-height: 40px; font-weight: 800; margin-top: 20px; }
.stat__value small { font-size: 18px; font-weight: 600; color: var(--on-surface-variant); }
.stat__label {
    font-family: var(--font-mono); font-size: 12px; letter-spacing: .1em;
    text-transform: uppercase; color: var(--on-surface-variant); margin-top: 6px;
}
.stat--highlight { border-left: 3px solid var(--accent); }
.stat__bar { margin-top: 14px; height: 6px; border-radius: var(--r-pill); background: var(--surface-highest); overflow: hidden; }
.stat__bar span { display: block; height: 100%; background: #fff; border-radius: var(--r-pill); }

/* Tinted glow behind the first four stat cards, as in the design */
.stat--tint-1::after, .stat--tint-2::after, .stat--tint-3::after, .stat--tint-4::after {
    content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
}
.stat--tint-1::after { background: radial-gradient(120% 80% at 0% 0%, rgba(195, 244, 0, .10), transparent 60%); }
.stat--tint-2::after { background: radial-gradient(120% 80% at 0% 0%, rgba(75, 142, 255, .12), transparent 60%); }
.stat--tint-3::after { background: radial-gradient(120% 80% at 0% 0%, rgba(255, 255, 255, .06), transparent 60%); }
.stat--tint-4::after { background: radial-gradient(120% 80% at 0% 0%, rgba(158, 228, 147, .10), transparent 60%); }
.stat > * { position: relative; z-index: 1; }

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

.media-card {
    display: flex;
    flex-direction: column;
    background: var(--surface-container);
    border: 1px solid rgba(39, 54, 71, .6);
    border-radius: var(--r-lg);
    overflow: hidden;
    transition: transform .18s ease, border-color .18s ease;
}
.media-card:hover { transform: translateY(-2px); border-color: rgba(195, 244, 0, .35); }

.thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    background: linear-gradient(140deg, var(--surface-high), var(--surface-lowest));
    display: grid;
    place-items: center;
    overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb--square { aspect-ratio: 1 / 1; }
.thumb__placeholder { color: rgba(196, 201, 172, .35); }
.thumb__badge {
    position: absolute; right: 6px; bottom: 6px;
    background: rgba(1, 15, 31, .85);
    border-radius: var(--r-md);
    padding: 2px 6px;
    font-family: var(--font-mono); font-size: 11px; line-height: 15px;
}
.thumb__tag {
    position: absolute; left: 8px; top: 8px;
    background: rgba(255, 180, 171, .92); color: #4a0006;
    border-radius: var(--r-pill); padding: 2px 10px;
    font-size: 12px; font-weight: 600;
}
.thumb__play {
    position: absolute; inset: 0; margin: auto;
    width: 32px; height: 32px; border-radius: var(--r-pill);
    background: rgba(1, 15, 31, .7);
    border: 1px solid rgba(212, 228, 250, .25);
    display: grid; place-items: center;
    color: #fff;
}
/* The glyph sizes are overridden here rather than in the markup, so the shared
   icon scale is untouched and the standalone photo tiles keep their own. */
.thumb__play .icon { width: 16px; height: 16px; }
.media-card .thumb__placeholder .icon { width: 24px; height: 24px; }
.media-card:hover .thumb__play { background: var(--accent); color: var(--on-accent); border-color: transparent; }

.media-card__body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1 1 auto; }
/* line-height is explicit on the kicker and the meta row on purpose. Without
   it they inherit the computed 24px from body, not a ratio, so shrinking the
   font alone leaves the line boxes — and the card — the same height. */
.media-card__kicker {
    font-family: var(--font-mono); font-size: 10px; line-height: 14px; letter-spacing: .1em;
    text-transform: uppercase; color: var(--on-surface-variant);
}
.media-card__kicker--accent { color: var(--accent); }
.media-card__title { font-family: var(--font-display); font-weight: 700; font-size: 13px; line-height: 18px; }
.media-card__meta { display: flex; align-items: center; gap: 4px; font-size: 11.5px; line-height: 16px; color: var(--on-surface-variant); margin-top: auto; padding-top: 6px; }
.media-card__meta .icon { width: 14px; height: 14px; }

/* --- Chips / badges ------------------------------------------------------- */

.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px;
    border-radius: var(--r-pill);
    border: 1px solid var(--surface-highest);
    background: var(--surface-container);
    font-size: 13px;
    color: var(--on-surface-variant);
    cursor: pointer;
    white-space: nowrap;
}
.chip:hover { color: var(--on-surface); border-color: var(--outline-variant); }
.chip--active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }

.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px; border-radius: var(--r-pill);
    font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
    background: var(--surface-highest); color: var(--on-surface-variant);
}
.badge--accent  { background: rgba(195, 244, 0, .16); color: var(--accent); }
.badge--blue    { background: rgba(75, 142, 255, .18); color: var(--secondary); }
.badge--danger  { background: rgba(255, 180, 171, .16); color: var(--error); }
.badge--success { background: rgba(158, 228, 147, .16); color: var(--success); }
.badge--plain   { background: transparent; border: 1px solid var(--surface-highest); }

.filetag {
    width: 44px; height: 44px; flex: none;
    border-radius: var(--r-lg);
    display: grid; place-items: center;
    font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: .04em;
}
.filetag--pdf  { background: #b3261e; color: #fff; }
.filetag--xlsx,
.filetag--xls  { background: #4b8eff; color: #04204d; }
.filetag--other{ background: var(--surface-highest); color: var(--on-surface-variant); }

/* --- Lists ---------------------------------------------------------------- */

.list { display: flex; flex-direction: column; }
.list__row {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 4px;
    border-bottom: 1px solid rgba(39, 54, 71, .5);
}
.list__row:last-child { border-bottom: 0; }
.list__row-body { flex: 1 1 auto; min-width: 0; }
.list__row-title { font-weight: 600; font-size: 15px; }
.list__row-sub { font-size: 13px; color: var(--on-surface-variant); }
.list__row-time { font-family: var(--font-mono); font-size: 13px; color: var(--on-surface-variant); white-space: nowrap; }

.actor {
    width: 40px; height: 40px; flex: none;
    border-radius: var(--r-lg);
    display: grid; place-items: center;
}
.actor--accent  { background: rgba(195, 244, 0, .14); color: var(--accent); }
.actor--blue    { background: rgba(75, 142, 255, .18); color: var(--secondary); }
.actor--danger  { background: rgba(255, 180, 171, .14); color: var(--error); }
.actor--neutral { background: var(--surface-highest); color: var(--on-surface-variant); }

/* --- Tables --------------------------------------------------------------- */

.table-wrap { overflow-x: auto; border-radius: var(--r-xl); border: 1px solid rgba(39, 54, 71, .6); }
table.data { width: 100%; border-collapse: collapse; background: var(--surface-container); min-width: 720px; }
table.data th {
    text-align: left;
    padding: 14px 16px;
    font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
    color: var(--on-surface-variant);
    background: var(--surface-low);
    border-bottom: 1px solid rgba(39, 54, 71, .8);
    white-space: nowrap;
}
table.data td { padding: 14px 16px; border-bottom: 1px solid rgba(39, 54, 71, .45); vertical-align: middle; font-size: 14px; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: rgba(28, 43, 60, .5); }
table.data td.actions { text-align: right; white-space: nowrap; }

/* --- Forms ---------------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.field > label, .label {
    font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em;
    text-transform: uppercase; color: var(--on-surface-variant);
}
.control {
    width: 100%;
    background: var(--surface-highest);
    border: 1px solid transparent;
    border-radius: var(--r-lg);
    padding: 12px 14px;
    color: var(--on-surface);
    transition: border-color .18s, background .18s;
}
.control::placeholder { color: rgba(196, 201, 172, .5); }
.control:focus { outline: none; border-color: var(--accent-dim); background: var(--surface-high); }
.control:disabled { opacity: .5; }
textarea.control { min-height: 110px; resize: vertical; line-height: 22px; }
select.control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23c4c9ac' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}
.control--with-icon { padding-left: 42px; }

.input-wrap { position: relative; }
.input-wrap > .icon:first-child { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: rgba(196, 201, 172, .7); pointer-events: none; }
.input-wrap .toggle-eye { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: 0; cursor: pointer; color: rgba(196, 201, 172, .7); padding: 0; }
.input-wrap .toggle-eye:hover { color: var(--accent); }

.field__error { color: var(--error); font-size: 13px; }
.field__hint  { color: var(--on-surface-variant); font-size: 13px; }
.control.is-invalid { border-color: var(--error); }

.checkbox { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.checkbox input {
    appearance: none; width: 18px; height: 18px; flex: none;
    border-radius: var(--r-md);
    background: var(--surface-highest);
    border: 1px solid var(--surface-bright);
    cursor: pointer;
    display: grid; place-items: center;
}
.checkbox input:checked { background: var(--accent); border-color: var(--accent); }
.checkbox input:checked::after {
    content: ""; width: 10px; height: 6px;
    border-left: 2px solid var(--on-accent); border-bottom: 2px solid var(--on-accent);
    transform: rotate(-45deg) translate(1px, -1px);
}

.fieldset { border: 1px solid rgba(39, 54, 71, .7); border-radius: var(--r-lg); padding: 16px; margin-bottom: 18px; }
.fieldset > legend { padding: 0 8px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--on-surface-variant); }

.checklist { max-height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 var(--gutter); }

/* --- Alerts --------------------------------------------------------------- */

.alert {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 16px;
    border-radius: var(--r-lg);
    border: 1px solid;
    margin-bottom: var(--gutter);
    font-size: 14px;
}
.alert--success { background: rgba(158, 228, 147, .10); border-color: rgba(158, 228, 147, .35); color: var(--success); }
.alert--error   { background: rgba(255, 180, 171, .10); border-color: rgba(255, 180, 171, .35); color: var(--error); }
.alert--info    { background: rgba(75, 142, 255, .10);  border-color: rgba(75, 142, 255, .35);  color: var(--secondary); }
.alert code { font-family: var(--font-mono); font-size: 12px; word-break: break-all; }

/* --- Empty states (PRD §73) ----------------------------------------------- */

.empty {
    text-align: center;
    padding: 56px 24px;
    border: 1px dashed rgba(142, 147, 121, .35);
    border-radius: var(--r-xl);
    background: rgba(13, 28, 45, .5);
}
.empty .icon { width: 40px; height: 40px; margin: 0 auto 16px; color: rgba(196, 201, 172, .45); }
.empty h3 { font-size: 18px; margin-bottom: 6px; }
.empty p { color: var(--on-surface-variant); max-width: 420px; margin: 0 auto 18px; font-size: 14px; }

/* --- Pagination ----------------------------------------------------------- */

.pagination { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: var(--gutter); }
.pagination a, .pagination span {
    min-width: 38px; height: 38px; padding: 0 10px;
    display: grid; place-items: center;
    border-radius: var(--r-lg);
    border: 1px solid var(--surface-highest);
    font-family: var(--font-mono); font-size: 13px;
    color: var(--on-surface-variant);
}
.pagination a:hover { color: var(--on-surface); background: var(--surface-container); }
.pagination .is-current { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.pagination .is-gap { border-color: transparent; }
.pagination__summary { margin-left: auto; font-size: 13px; color: var(--on-surface-variant); }

/* --- Filter bar ----------------------------------------------------------- */

.filters { display: flex; flex-direction: column; gap: 14px; margin-bottom: var(--gutter); }
.filters__row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters__chips { display: flex; gap: 8px; flex-wrap: wrap; }
.filters select.control, .filters input.control { width: auto; min-width: 150px; padding: 9px 12px; font-size: 14px; }
.filters select.control { padding-right: 34px; }

/* --- Player hero (player dashboard) --------------------------------------- */

.hero {
    position: relative;
    border-radius: var(--r-xl);
    border: 1px solid rgba(39, 54, 71, .6);
    background:
        radial-gradient(90% 140% at 88% 20%, rgba(75, 142, 255, .16), transparent 60%),
        linear-gradient(120deg, var(--surface-container), var(--surface-lowest));
    padding: 32px;
    display: flex;
    align-items: center;
    gap: var(--gutter);
    flex-wrap: wrap;
    overflow: hidden;
}
.hero__body { flex: 1 1 320px; min-width: 0; }
.hero__name { font-family: var(--font-display); font-size: 44px; line-height: 52px; font-weight: 800; letter-spacing: -.02em; display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.hero__number { font-size: 52px; color: rgba(212, 228, 250, .18); }
.hero__stats { display: flex; gap: 36px; margin-top: 22px; flex-wrap: wrap; }
.hero__stat-label { font-family: var(--font-mono); font-size: 13px; color: var(--on-surface-variant); letter-spacing: .04em; }
.hero__stat-value { font-family: var(--font-display); font-size: 26px; font-weight: 800; margin-top: 2px; }
.hero__photo {
    width: 148px; height: 148px; flex: none;
    border-radius: var(--r-lg);
    border: 1px solid rgba(212, 228, 250, .2);
    background: var(--surface-high);
    display: grid; place-items: center;
    overflow: hidden;
}
.hero__photo img { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 720px) {
    .hero { padding: 20px; }
    .hero__name { font-size: 30px; line-height: 38px; }
    .hero__number { font-size: 34px; }
}

/* --- Charts (hand-drawn, no library) -------------------------------------- */

.donut { display: grid; place-items: center; position: relative; margin: 8px auto 20px; width: 220px; height: 220px; }
.donut svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.donut__center { position: absolute; text-align: center; }
.donut__value { font-family: var(--font-display); font-size: 30px; font-weight: 800; }
.donut__unit { font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--on-surface-variant); }

.legend { display: flex; flex-direction: column; gap: 12px; }
.legend__row { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.legend__dot { width: 10px; height: 10px; border-radius: var(--r-pill); flex: none; }
.legend__value { margin-left: auto; font-family: var(--font-mono); font-size: 13px; color: var(--on-surface-variant); }

.bars { display: flex; align-items: flex-end; gap: 12px; height: 150px; margin-top: 18px; }
.bars__col { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bars__bar { width: 100%; border-radius: var(--r-md); background: var(--surface-highest); min-height: 6px; }
.bars__bar--peak { background: #fff; }
.bars__label { font-family: var(--font-mono); font-size: 11px; color: var(--on-surface-variant); }
.bars__label--peak { color: var(--on-surface); font-weight: 700; }

/* --- Video player --------------------------------------------------------- */

.player-frame {
    border-radius: var(--r-xl);
    overflow: hidden;
    background: #000;
    border: 1px solid rgba(39, 54, 71, .7);
}
.player-frame video { width: 100%; max-height: 68vh; background: #000; }

.pdf-frame {
    width: 100%;
    height: 78vh;
    border: 1px solid rgba(39, 54, 71, .7);
    border-radius: var(--r-xl);
    background: var(--surface-lowest);
}

.meta-table { width: 100%; border-collapse: collapse; }
.meta-table th {
    text-align: left; padding: 10px 0; width: 42%;
    font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
    color: var(--on-surface-variant); font-weight: 500; vertical-align: top;
}
.meta-table td { padding: 10px 0; font-size: 14px; border-bottom: 1px solid rgba(39, 54, 71, .4); }
.meta-table tr:last-child td, .meta-table tr:last-child th { border-bottom: 0; }

/* --- Lightbox ------------------------------------------------------------- */

.lightbox {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(1, 15, 31, .95);
    display: none;
    align-items: center; justify-content: center;
    padding: 24px;
}
.lightbox.is-open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 82vh; object-fit: contain; border-radius: var(--r-lg); }
.lightbox__caption { position: absolute; bottom: 24px; left: 0; right: 0; text-align: center; font-size: 14px; color: var(--on-surface-variant); }
.lightbox__btn {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 48px; height: 48px; border-radius: var(--r-pill);
    background: rgba(39, 54, 71, .8); border: 0; color: #fff; cursor: pointer;
    display: grid; place-items: center;
}
.lightbox__btn:hover { background: var(--accent); color: var(--on-accent); }
.lightbox__prev { left: 20px; }
.lightbox__next { right: 20px; }
.lightbox__close { top: 20px; right: 20px; transform: none; }

/* --- Upload wizard -------------------------------------------------------- */

.steps { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: var(--gutter); }
.step {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px;
    border-radius: var(--r-lg);
    background: var(--surface-container);
    border: 1px solid rgba(39, 54, 71, .7);
    font-size: 14px;
    color: var(--on-surface-variant);
}
.step__num {
    width: 24px; height: 24px; border-radius: var(--r-pill);
    display: grid; place-items: center;
    background: var(--surface-highest);
    font-family: var(--font-mono); font-size: 12px; font-weight: 700;
}
.step--active { border-color: var(--accent); color: var(--on-surface); }
.step--active .step__num { background: var(--accent); color: var(--on-accent); }
.step--done .step__num { background: rgba(158, 228, 147, .25); color: var(--success); }

.dropzone {
    border: 2px dashed rgba(142, 147, 121, .4);
    border-radius: var(--r-xl);
    background: rgba(13, 28, 45, .5);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color .18s, background .18s;
}
.dropzone:hover, .dropzone.is-dragover { border-color: var(--accent); background: rgba(195, 244, 0, .06); }
.dropzone .icon { width: 40px; height: 40px; margin: 0 auto 14px; color: var(--on-surface-variant); }
.dropzone h3 { font-size: 17px; margin-bottom: 6px; }

.queue { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.queue__item {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 14px;
    border-radius: var(--r-lg);
    background: var(--surface-container);
    border: 1px solid rgba(39, 54, 71, .7);
}
.queue__preview {
    width: 64px; height: 40px; flex: none; border-radius: var(--r-md);
    background: var(--surface-highest); object-fit: cover;
    display: grid; place-items: center; color: var(--on-surface-variant); overflow: hidden;
}
.queue__body { flex: 1 1 auto; min-width: 0; }
.queue__name { font-size: 14px; font-weight: 600; }
.queue__meta { font-size: 12px; color: var(--on-surface-variant); font-family: var(--font-mono); }
.queue__progress { height: 6px; border-radius: var(--r-pill); background: var(--surface-highest); overflow: hidden; margin-top: 8px; }
.queue__progress span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: var(--r-pill); transition: width .2s ease; }
.queue__item--done .queue__progress span { background: var(--success); }
.queue__item--error .queue__progress span { background: var(--error); }
.queue__status { font-family: var(--font-mono); font-size: 12px; color: var(--on-surface-variant); white-space: nowrap; }
.queue__item--error .queue__status { color: var(--error); }
.queue__item--done  .queue__status { color: var(--success); }

/* --- Auth screens --------------------------------------------------------- */

.auth {
    min-height: 100vh;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 48px var(--margin-mobile);
    position: relative;
    overflow: hidden;
}
/* The SVG needs explicit dimensions — inset alone leaves it at its intrinsic
   size, which paints the grid into one corner. */
.auth__bg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: .5; }
.auth__inner { position: relative; z-index: 1; width: 100%; max-width: 460px; animation: rise .7s cubic-bezier(.16, 1, .3, 1) both; }
.auth__brand { text-align: center; margin-bottom: 36px; }
/* The packaged logo is a transparent mark, so the tile's own surface and glow
   show through it rather than being covered by a baked-in background. An
   uploaded logo may be any shape or fully opaque, so the tile is a fixed box
   and the image is fitted inside it either way. */
.auth__logo {
    width: 168px; height: 168px; margin: 0 auto 12px;
    border-radius: var(--r-xl);
    background: var(--surface-container);
    display: grid; place-items: center;
    box-shadow: 0 0 70px rgba(195, 244, 0, .16);
    overflow: hidden;
}
/* Both dimensions bounded plus object-fit: a tall logo used to overflow the
   tile and be clipped by overflow:hidden, and a wide one to sit oddly. Now
   anything is scaled to fit whole, keeping its own proportions.
   align/justify-self are required: the tile centres its items, which stops the
   image stretching, and a percentage height then has nothing to resolve
   against — it falls back to the intrinsic height and overflows again. */
/* Bounded by max-*, with min-*: 0 — which is the part that actually works.
   A grid item's automatic minimum size is its content size, and a minimum
   beats a maximum, so without min-height:0 a tall logo keeps its intrinsic
   height, overflows the tile and is clipped by overflow:hidden. */
.auth__logo img {
    max-width: 100%; max-height: 100%;
    min-width: 0; min-height: 0;
    object-fit: contain;
}
.auth__title { font-family: var(--font-display); font-size: 38px; line-height: 46px; font-weight: 800; letter-spacing: -.02em; }
.auth__subtitle { margin-top: 8px; }
.auth__card {
    background: var(--surface-container);
    border: 1px solid rgba(39, 54, 71, .7);
    border-radius: var(--r-xl);
    padding: 32px;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}
.auth__card::before {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
}
.auth__foot { margin-top: 28px; padding-top: 20px; border-top: 1px solid rgba(39, 54, 71, .6); text-align: center; }
.auth__meta { margin-top: 20px; display: flex; justify-content: center; gap: 20px; }

.portal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.portal-tile {
    display: flex; flex-direction: column; gap: 8px;
    padding: 20px;
    border-radius: var(--r-lg);
    background: var(--surface-container);
    border: 1px solid rgba(39, 54, 71, .7);
    transition: border-color .18s, transform .18s;
}
.portal-tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.portal-tile .icon { color: var(--accent); }
.portal-tile strong { font-family: var(--font-display); font-size: 16px; }

.site-foot { padding: 32px 0 0; text-align: center; }

@keyframes rise { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }

/* --- Utility --------------------------------------------------------------
   These exist because the Content-Security-Policy is style-src 'self', which
   blocks inline style="" attributes outright. Anything that would have been an
   inline style lives here instead; the three genuinely dynamic values (a
   progress width, chart bar heights) are emitted in a nonce-carrying <style>
   block by the view that needs them. */

.u-accent      { color: var(--accent); }
.u-secondary   { color: var(--secondary); }
.u-ghost       { color: rgba(212, 228, 250, .25); }
.u-radius      { border-radius: var(--r-lg); }
.u-prewrap     { white-space: pre-line; }
.u-nowrap      { white-space: nowrap; }
.u-no-wrap     { flex-wrap: nowrap; }
.u-min0        { min-width: 0; }
.u-grow        { min-width: 0; flex: 1 1 auto; }
.u-between     { justify-content: space-between; }
.u-center      { justify-content: center; }
.u-textcenter  { text-align: center; }
.u-pad-pw      { padding-right: 44px; }
.u-chip-light  { background: #fff; color: #0d1c2d; }
.u-truncate-md { max-width: 220px; }

.grid--pair    { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.control--narrow  { min-width: 90px; }
.control--tiny    { width: 84px; }
.control--select  { min-width: 112px; }

.card--pad-sm     { padding: 16px; }
.card--tile       { text-align: center; padding: 18px; }
.card--pad-lg     { text-align: center; padding: 56px 24px; }
.card--photo      { padding: 12px; display: grid; place-items: center; background: var(--surface-lowest); }
.card--narrow     { max-width: 640px; margin: 0 auto; text-align: center; }

.prose-narrow  { max-width: 440px; margin: 8px auto 0; }

.filetag--xl   { width: 72px; height: 72px; margin: 0 auto 20px; font-size: 15px; }

.hero--compact { min-height: 280px; }

.fixture-date {
    text-align: center; padding: 8px 12px;
    border-radius: var(--r-md); background: var(--surface-container);
}

.error-trace {
    text-align: left; white-space: pre-wrap; word-break: break-word;
    font-size: 12px; color: var(--on-surface-variant);
    background: var(--surface-lowest); padding: 16px;
    border-radius: var(--r-lg); overflow: auto; max-height: 340px;
}

.eyebrow-inline { text-transform: uppercase; letter-spacing: .14em; }
.u-onsurface   { color: var(--on-surface); }
.photo-full    { max-height: 70vh; border-radius: var(--r-lg); }
.error-code    { font-family: var(--font-mono); font-size: 56px; font-weight: 700; color: var(--accent); line-height: 1; }

.fixture-row {
    align-items: stretch; gap: 14px; padding: 14px;
    border-radius: var(--r-lg); background: var(--surface-high);
}

/* Donut / legend swatches — a fixed palette beats a generated inline colour. */
.legend__dot--c1, .donut-c1 { background: #c3f400; }
.legend__dot--c2, .donut-c2 { background: #4b8eff; }
.legend__dot--c3, .donut-c3 { background: #d4e4fa; }
.legend__dot--c4, .donut-c4 { background: #9ee493; }
.legend__dot--c5, .donut-c5 { background: #ffb4ab; }
.legend__dot--c6, .donut-c6 { background: #8e9379; }

.mt-0  { margin-top: 0; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.hidden { display: none !important; }
.inline-form { display: inline; }

/* --- Responsive ----------------------------------------------------------- */

@media (max-width: 900px) {
    .shell { flex-direction: column; }

    .sidebar {
        position: fixed;
        bottom: 0; left: 0; right: 0;
        top: auto;
        width: 100%;
        height: auto;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
        border-right: 0;
        border-top: 1px solid rgba(39, 54, 71, .8);
        z-index: 40;
        gap: 4px;
    }
    .brand, .nav-group-label, .sidebar__spacer, .sidebar__divider { display: none; }
    .nav-item { flex-direction: column; gap: 4px; padding: 8px 12px; font-size: 11px; white-space: nowrap; }
    .nav-item--sub { padding-left: 12px; }

    .topbar { padding: 12px var(--margin-mobile); }
    .userchip__name, .userchip__role { display: none; }
    .content { padding: 20px var(--margin-mobile) 96px; }
    .page-head { margin-bottom: 20px; }
    .card { padding: 18px; }
    :root { --gutter: 16px; }
}

@media (max-width: 560px) {
    .grid--stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    /* Pinned column counts rather than letting auto-fill run, so a phone gets
       half of what it showed before rather than a third of it: one 528px card
       becomes two of 256px, and a 256px photo tile becomes four of 127px. */
    .grid--media  { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid--photos { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .btn { padding: 11px 16px; font-size: 14px; }
    .auth__card { padding: 22px; }
    .auth__title { font-size: 30px; line-height: 38px; }
    /* 168px is over half the width of a 320px screen, which pushed the sign-in
       form below the fold on small phones. */
    .auth__logo { width: 116px; height: 116px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media print {
    .sidebar, .topbar, .page-head__actions, .pagination { display: none; }
    body { background: #fff; color: #000; }
}
