/* =============================================================
   CONTEST TABULATION & SCORING MANAGEMENT SYSTEM
   Premium Forest Green / Emerald / Champagne Gold Design System
   ============================================================= */

:root {
    --forest: #004D3B;
    --forest-dark: #003D30;
    --emerald: #087B59;
    --nav-active: #16865F;
    --mint: #DDF5E8;
    --gold: #D6AA32;
    --gold-light: #F5E8BD;
    /* The darker gold, for icons and small labels that need more weight than
       --gold gives on a pale background. Declared here as well as on
       .judge-sheet because it is used all over the app - the guide headings, the
       system-log retention note, the judge access notices and the submission
       views. It used to exist ONLY inside .judge-sheet, which meant every one of
       those rules resolved an undefined variable on any page that is not the
       scoring sheet: var() with no declaration is invalid at computed-value time,
       so the colour silently fell back to inherited rather than failing loudly. */
    --gold-deep: #A8851F;
    --primary: #004D3B;
    --secondary: #087B59;
    --accent: #16865F;
    --accent-light: #35B779;
    --bg: #FFFFFF;
    --bg-secondary: #F4F7F6;
    --text: #183D33;
    --text-muted: #71817B;
    --border: #DFE9E5;
    --shadow: 0 1px 3px rgba(0,61,48,0.08), 0 1px 2px rgba(0,61,48,0.05);
    --shadow-lg: 0 12px 28px rgba(0,61,48,0.12), 0 4px 10px rgba(0,61,48,0.06);
    --radius: 16px;
    --radius-sm: 10px;
    --sidebar-w: 300px;
    --topbar-h: 72px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-secondary);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--emerald); text-decoration: none; }
a:hover { color: var(--forest); }

/* Lucide-style inline SVG icons */
.lucide { flex-shrink: 0; vertical-align: -3px; }

/* ---------------------------------------------------------------
 * ADMIN LAYOUT + SIDEBAR
 * ------------------------------------------------------------- */
.admin-wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--forest) 0%, var(--forest-dark) 100%);
    color: #fff;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-brand { padding: 24px 22px 18px; }
.brand-row { display: flex; align-items: center; gap: 12px; }
.brand-icon {
    width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--gold) 0%, #B8912A 100%);
    display: flex; align-items: center; justify-content: center;
    color: #fff; box-shadow: 0 4px 12px rgba(214,170,50,0.4);
}
.brand-name { font-size: 17px; font-weight: 800; letter-spacing: 0.2px; line-height: 1.25; }
.brand-sub { font-size: 12px; color: rgba(255,255,255,0.65); margin-top: 2px; }
.brand-divider {
    margin-top: 16px; height: 2px; border-radius: 2px;
    background: linear-gradient(90deg, var(--gold) 0%, rgba(214,170,50,0.15) 70%, transparent 100%);
}

.sidebar-nav { flex: 1; padding: 10px 16px; overflow-y: auto; }
.nav-section-label {
    font-size: 11px; font-weight: 700; letter-spacing: 1.5px;
    color: rgba(255,255,255,0.45); padding: 14px 12px 8px;
}

.nav-link {
    position: relative;
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; margin-bottom: 4px;
    color: rgba(255,255,255,0.78);
    font-size: 14px; font-weight: 500;
    border-radius: 12px;
    transition: background 0.2s, color 0.2s;
    cursor: pointer;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,0.08); }
.nav-link.active { color: #fff; background: var(--nav-active); font-weight: 700; }
.nav-link.active::before {
    content: ''; position: absolute; left: -16px; top: 8px; bottom: 8px;
    width: 4px; border-radius: 0 4px 4px 0; background: var(--gold);
}
.nav-icon { display: flex; align-items: center; justify-content: center; width: 22px; color: inherit; }
.nav-icon .lucide { width: 20px; height: 20px; }

.rt-header { margin-bottom: 6px; }
.rt-sub { color: #6B7280; font-size: 13px; margin: 4px 0 0; }

/* Matrix results table (Major / Minor) */
/* ---------------------------------------------------------------
 * PER-TABLE SCROLL CONTAINERS
 * -------------------------------------------------------------
 *
 * The structure the whole app follows:
 *
 *     page -> card -> .table-scroll -> table
 *
 * Each table owns its overflow. A long table scrolls inside its own wrapper and
 * nothing above it moves: not the page, not the card, not a neighbouring table.
 *
 * Two axes, independently:
 *
 *   overflow-x: auto   a table with many COLUMNS scrolls sideways. The bar sits
 *                      under that table and nowhere else.
 *   overflow-y: auto   a table with many ROWS scrolls down inside a capped
 *                      height, so 400 contestants do not make the page 20,000px
 *                      tall. Opt-in per table via .table-scroll-tall, because a
 *                      short table should size to its content rather than sit in
 *                      a box with dead space under it.
 *
 * thead th is sticky so the column headings stay put while the body scrolls.
 * That needs border-collapse: separate (below) - with the default collapsed
 * borders, a sticky th is drawn over by the cells scrolling beneath it and the
 * header ends up transparent. It also needs a z-index below .sticky-col's, so
 * that at the top-left corner where a sticky column and a sticky header overlap,
 * the column wins: it is the one holding its background, and a header sliding
 * under it would show through.
 *
 * No global scroll container is involved. body and .page-content scroll the page
 * normally and are never given overflow to absorb a wide table - the
 * min-width: 0 pair on .main-content / .page-content is what stops the flex
 * layout from pushing them wide in the first place.
 */
.matrix-wrap,
.table-wrapper,
.table-scroll,
.sc-table-wrap,
.lp-table-wrap {
    overflow-x: auto;
    /* Without this a flex/grid parent can still squeeze the wrapper narrower
       than its own box, and the bar appears under a table that is not the one
       being read. */
    min-width: 0;
}
/* Opt-in vertical cap. Applied only where a table can genuinely hold many rows:
 * contestant lists, criteria, submissions, audit logs, archive, the breakdown
 * modal, and the Major/Minor/Final matrices. */
.matrix-wrap.table-scroll-tall,
.table-wrapper.table-scroll-tall,
.table-scroll.table-scroll-tall,
.sc-table-wrap.table-scroll-tall {
    max-height: var(--table-scroll-max, 62vh);
    overflow-y: auto;
}
/* The heading row, pinned to the top of whichever wrapper scrolls vertically. */
.table-scroll-tall thead th,
.matrix-wrap thead th,
.table-wrapper thead th,
.sc-table-wrap thead th {
    position: sticky; top: 0;
    /* Above the wrapper's own content, below .sticky-col (z-index 3), which
       shares the top-left corner with the heading and must win there. */
    z-index: 2;
}
/* A sticky th needs its own opaque background or the rows scrolling under it
   show through the letters. */
table.data-table thead th,
table.table thead th,
table.sc-table thead th {
    background: var(--forest);
}
.data-table.matrix { border-collapse: separate; border-spacing: 0; min-width: 100%; }
.data-table.matrix th, .data-table.matrix td { white-space: nowrap; padding: 10px 16px; }
.data-table.matrix .matrix-col { text-align: center; min-width: 130px; }
.data-table.matrix .matrix-total { text-align: center; min-width: 110px; font-weight: 700; }
.data-table.matrix .matrix-cell { text-align: center; }
.data-table.matrix .matrix-score { font-weight: 600; color: #1F2937; }
.data-table.matrix .matrix-score.provisional { color: #9CA3AF; font-style: italic; }
.matrix-col-meta { margin-top: 4px; display: flex; gap: 6px; align-items: center; justify-content: center; }
.matrix-date { font-size: 10px; color: #9CA3AF; }
/* Sits in the dark-green table header, so it must be light to be readable. */
.matrix-category {
    margin-top: 3px; font-size: 11px; font-weight: 500; color: #fff;
    text-transform: none; letter-spacing: 0;
}
.matrix-category .matrix-sep { color: rgba(255,255,255,.55); margin: 0 4px; }
/* The scoring basis under an event heading. Gold for Rank, because that is the
   column whose cells carry a place rather than a bare score; Point stays quiet. */
.matrix-basis {
    display: inline-block; margin-top: 4px; padding: 1px 8px;
    border-radius: 999px; background: rgba(255,255,255,.16); color: #fff;
    font-size: 10px; font-weight: 700; letter-spacing: .4px;
    text-transform: uppercase; line-height: 1.5;
}
.matrix-basis-rank { background: #D6AA32; color: #23301B; }
.data-table.matrix .matrix-score-ref { font-weight: 500; opacity: .75; }
.sticky-col { position: sticky; background: #fff; z-index: 3; box-shadow: 2px 0 4px -2px rgba(0,0,0,0.12); }
.sticky-rank { left: 0; width: 56px; min-width: 56px; text-align: center; }
.sticky-name { left: 56px; min-width: 200px; text-align: left; }
/* Same dark green as the rest of the header row - a light background here made
   the white "#" and "Contestant" headings invisible.

   The z-index MUST beat the rule above, and "thead .sticky-col" (0,1,1) did not:
   ".matrix-wrap thead th" (0,1,2) outranked it, so inside the matrix every header
   cell - pinned and scrolling alike - sat at z-index 2. That is exactly the corner
   this value exists to protect: when the table scrolls sideways, the event
   headings slide left and paint straight over the pinned "# / Contestant" headings
   they are supposed to pass behind. The names went under a wall of green event
   titles with no visible sign anything had overlapped.

   Raised to (0,2,1) - two classes - so it wins against every wrapper-scoped
   heading rule, and scoped to the wrappers rather than bare <thead> so a sticky
   column outside one of them cannot inherit it by accident. */
.matrix-wrap thead .sticky-col,
.table-wrapper thead .sticky-col,
.table-scroll-tall thead .sticky-col,
.sc-table-wrap thead .sticky-col {
    z-index: 4; background: var(--forest); color: #fff;
}
thead .sticky-col { z-index: 4; background: var(--forest); color: #fff; }
tbody tr:hover .sticky-col { background: #F9FAFB; }
.rt-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.medal-dot {
    display: inline-block; width: 10px; height: 10px; border-radius: 50%;
    margin-right: 6px; vertical-align: middle; border: 1px solid rgba(0,0,0,0.12);
}
.medal-gold   { background: #D6AA32; }
.medal-silver { background: #C0C7CF; }
.medal-bronze { background: #C9803E; }
.medal-white  { background: #F3F4F6; }
.medal-cell  { text-align: center; font-variant-numeric: tabular-nums; }
.medal-head  { text-align: center; white-space: nowrap; }
.medal-ic.gold-ic { color: #D6AA32; }
.total-pts { color: #004D3B; font-size: 15px; }
.final-table td, .final-table th { vertical-align: middle; }
.podium { margin: 0; padding-left: 22px; }
.podium li { margin-bottom: 8px; font-size: 15px; }
.breakdown-totals div { padding: 6px 0; border-bottom: 1px dashed #E5E7EB; }
.breakdown-totals .overall { font-size: 16px; color: #004D3B; border-bottom: none; padding-top: 10px; }

.nav-sublink {
    color: rgba(255,255,255,.62); text-decoration: none; font-weight: 500;
    padding: 4px 8px; border-radius: 8px; transition: background 0.2s, color 0.2s;
}
.nav-sublink:hover { color: #fff; background: rgba(255,255,255,.08); text-decoration: none; }

.sidebar-footer { padding: 12px 16px 16px; border-top: 1px solid rgba(255,255,255,0.12); }

.main-content {
    flex: 1; margin-left: var(--sidebar-w);
    display: flex; flex-direction: column; min-height: 100vh;
    /* THE rule that makes per-table scrolling work at all.
     *
     * A flex item's automatic minimum size is min-width: auto, which resolves to
     * the item's min-CONTENT width - it refuses to be narrower than its widest
     * unbreakable content. A results matrix with 14 event columns has a
     * min-content width around 2186px, so this item refused to shrink, the whole
     * page grew to match, and .matrix-wrap (overflow-x: auto) was handed 2186px
     * of room: nothing overflowed, so it never scrolled. The symptom was a
     * page-wide horizontal scrollbar on the Major/Minor tabs and a table that
     * pushed the card and the layout sideways.
     *
     * min-width: 0 opts out of that floor, so this column keeps the width the
     * viewport gives it and the table overflows INSIDE its own wrapper, which is
     * where the scrollbar belongs.
     *
     * .page-content below needs the same treatment: it is the next flex item down
     * the chain and would otherwise re-introduce the same floor one level in. */
    min-width: 0;
}

/* ---------------------------------------------------------------
 * TOP BAR
 * ------------------------------------------------------------- */
.top-bar {
    height: var(--topbar-h);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
    padding: 0 28px; gap: 16px;
    position: sticky; top: 0; z-index: 50;
}
.sidebar-toggle {
    display: none; background: none; border: none;
    cursor: pointer; color: var(--text);
    width: 40px; height: 40px; align-items: center; justify-content: center;
    border-radius: 10px;
}
.sidebar-toggle:hover { background: var(--bg-secondary); }
.top-bar-title { font-size: 19px; font-weight: 700; color: var(--forest); flex: 1; }
/* Title + optional subtitle as one left-aligned block in the top bar. The
   wrapper carries the flex:1 the title used to hold, so pages that set no
   subtitle lay out exactly as before. */
.top-bar-heading { flex: 1; min-width: 0; }
.top-bar-subtitle {
    font-size: 12px; color: var(--text-muted);
    margin-top: 1px; line-height: 1.3;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.top-bar-right { display: flex; align-items: center; gap: 16px; }

.notif-bell {
    position: relative; color: var(--forest);
    width: 42px; height: 42px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
}
.notif-bell:hover { background: var(--mint); }
.notif-badge {
    position: absolute; top: 2px; right: 2px;
    background: #E5484D; color: #fff;
    font-size: 10px; font-weight: 700;
    min-width: 18px; height: 18px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 4px; line-height: 1; border: 2px solid #fff;
}
.top-divider { width: 1px; height: 36px; background: var(--border); }

/* Guide button ---------------------------------------------------
 * The book icon beside the notification bell. Styled to match .notif-bell exactly
 * so the two read as a pair of top-bar controls rather than one looking bolted
 * on - same 42px circle, same hover. The bell is an <a> and this is a <button>,
 * so the button's own chrome has to be cleared here.
 */
.guide-btn {
    border: none; background: none; cursor: pointer;
    color: var(--forest);
    width: 42px; height: 42px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
}
.guide-btn:hover { background: var(--mint); }
.guide-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.profile-wrap { position: relative; }
.profile-btn {
    display: flex; align-items: center; gap: 12px;
    background: none; border: none; cursor: pointer; padding: 6px 8px;
    border-radius: 12px; color: var(--text); text-align: left;
}
.profile-btn:hover { background: var(--bg-secondary); }
.profile-avatar {
    width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, var(--forest) 0%, var(--emerald) 100%);
    color: #fff; font-weight: 800; font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--gold-light);
}
.profile-meta { line-height: 1.3; }
.profile-menu {
    position: absolute; right: 0; top: calc(100% + 8px);
    background: #fff; border: 1px solid var(--border); border-radius: 12px;
    box-shadow: var(--shadow-lg); min-width: 200px; padding: 8px;
    display: none; z-index: 200;
}
.profile-wrap:hover .profile-menu, .profile-wrap:focus-within .profile-menu { display: block; }
.profile-menu a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 8px; font-size: 14px;
    color: var(--text); font-weight: 500;
}
.profile-menu a:hover { background: var(--mint); color: var(--forest); }

.user-info { text-align: right; }
.user-name { display: block; font-size: 14px; font-weight: 700; color: var(--text); }
.user-role { display: block; font-size: 12px; color: var(--text-muted); text-transform: capitalize; }

/* min-width: 0 for the reason set out on .main-content: this is a flex item too,
   and without it a wide table sets a min-content floor here and stops the table
   wrappers from ever scrolling. */
.page-content { padding: 28px; flex: 1; min-width: 0; }

/* ---------------------------------------------------------------
 * PAGE HEADINGS
 * ------------------------------------------------------------- */
.page-head { margin-bottom: 22px; }
.page-head h1 {
    font-size: 30px; font-weight: 800; color: var(--forest);
    letter-spacing: -0.3px; line-height: 1.2;
}
.page-head h1::after {
    content: ''; display: block; width: 56px; height: 4px; border-radius: 4px;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    margin-top: 8px;
}
.page-head p { color: var(--text-muted); font-size: 14px; margin-top: 6px; }

/* Icon containers */
.icon-box {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--mint); color: var(--emerald);
    border-radius: 12px; padding: 9px;
}
.icon-box.gold { background: var(--gold-light); color: #9A7418; }
.card-title { display: inline-flex; align-items: center; gap: 10px; }

/* ---------------------------------------------------------------
 * CARDS
 * ------------------------------------------------------------- */
.card {
    background: var(--bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}
.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-title { font-size: 17px; font-weight: 700; color: var(--forest); }
.card-body { padding: 24px; }

/* ---------------------------------------------------------------
 * STAT CARDS
 * ------------------------------------------------------------- */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px; margin-bottom: 24px;
}
.stat-card {
    background: var(--bg); border-radius: var(--radius);
    padding: 20px 24px; box-shadow: var(--shadow); border: 1px solid var(--border);
    display: flex; align-items: center; gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-icon {
    width: 52px; height: 52px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    background: var(--mint); color: var(--emerald);
}
.stat-icon .lucide { width: 24px; height: 24px; }
.stat-icon.green  { background: #DDF5E8; color: #087B59; }
.stat-icon.blue   { background: #DBEAFE; color: #1D4ED8; }
.stat-icon.amber  { background: #F5E8BD; color: #9A7418; }
.stat-icon.red    { background: #FEE2E2; color: #DC2626; }
.stat-icon.purple { background: #EDE9FE; color: #6D28D9; }
.stat-icon.teal   { background: #CCFBF1; color: #0F766E; }
.stat-info { flex: 1; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--forest); line-height: 1.2; }
.stat-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }

/* ---------------------------------------------------------------
 * BUTTONS
 * ------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 600;
    border: 1px solid transparent; cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, border-color 0.2s;
    text-decoration: none; line-height: 1.4; font-family: inherit;
}
.btn .lucide { width: 15px; height: 15px; }
.btn-primary { background: var(--forest); color: #fff; }
.btn-primary:hover { background: var(--emerald); color: #fff; box-shadow: 0 4px 12px rgba(0,77,59,0.3); }
.btn-secondary { background: #fff; color: var(--forest); border-color: #BFD8CE; }
.btn-secondary:hover { background: var(--mint); border-color: var(--emerald); color: var(--forest); }
.btn-gold { background: #fff; color: var(--forest); border-color: var(--gold); }
.btn-gold:hover { background: var(--gold-light); }
.btn-danger { background: #FDECEC; color: #C81E1E; border-color: #F5C2C2; }
.btn-danger:hover { background: #F9D5D5; color: #A11717; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; justify-content: center; }

/* ---------------------------------------------------------------
 * FORMS
 * ------------------------------------------------------------- */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-label .required { color: #DC2626; }
.form-control {
    width: 100%; padding: 10px 14px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 14px; transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--bg); color: var(--text); font-family: inherit;
}
.form-control:focus {
    outline: none; border-color: var(--emerald);
    box-shadow: 0 0 0 3px rgba(8,123,89,0.15);
}
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.contest-scoring-row { align-items: start; }

/* .form-narrow no longer constrains anything, and the class is kept only so the
   markup that already carries it does not have to change.

   It capped the form at 880px, which was deliberate once - .form-row divides
   whatever width it is given, and a two-column row inside a full-width card gave
   each field about 510px on a 1440px screen, which is a very wide box for
   "Venue". But a cap has a cost the form owner sees every day: whatever width it
   withholds becomes empty card. Left-aligned that read as a 156px gap down the
   right-hand side; centring it only split the same gap across both sides. Either
   way the fields were sitting in less room than the card was offering.

   The fields are sized sensibly now for the reason that actually mattered - the
   two dropdowns are no longer 200px tall (see the select.form-control rule), which
   was what made them read as oversized boxes in the first place. So the form
   fills the card it is in, and every control fills its grid cell. */

.form-narrow { width: 100%; }
.form-narrow select.form-control { width: 100%; }
/* Small helper line under a form control, e.g. explaining what a number means.
   Sits between the field and the next group, so it tightens the group above it. */
.form-hint {
    margin: 7px 0 -8px;
    font-size: 12.5px; line-height: 1.45; color: var(--text-muted);
}

/* ---------- System URL Configuration (settings) ----------
   The card is the widest thing on the settings grid, so it spans every
   column instead of sharing a row with the password form. */
.url-config-card { grid-column: 1 / -1; }
.url-config-card .card-body > p:first-child { margin-bottom: 20px; }
.url-input-row { display: flex; gap: 8px; align-items: stretch; }
.url-input-row .form-control { flex: 1 1 auto; min-width: 0; }
.url-input-row .btn { flex: 0 0 auto; white-space: nowrap; }

.url-effective {
    display: flex; flex-direction: column; gap: 6px;
    margin-bottom: 18px; padding: 12px 14px;
    background: var(--mint);
    border: 1px solid rgba(8,122,89,0.28);
    border-left: 3px solid var(--emerald);
    border-radius: var(--radius-sm);
}
.url-effective-label {
    font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--emerald);
}
.url-effective code {
    font-size: 13px; font-weight: 600; color: var(--forest);
    word-break: break-all; background: none; padding: 0;
}
.url-config-card code {
    background: #EEF3F1; padding: 1px 5px; border-radius: 4px; font-size: 12px;
}
select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2371817B' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px;
}

/* A select is the same size as the text field beside it, and was NOT always.

   Both stylesheets used to force height:200px on every select.form-control, so a
   native dropdown opened as a tall scrollable box instead of a dropdown. It was
   written for the contest lists, which held dozens of entries and needed the
   room to scroll on a phone.

   Those lists are the searchable picker now (contest-select.js) and that
   <select> is display:none, so nothing on screen needs the tall box. What it
   leaves behind is Contest Type and Scoring Mode - two options each - rendered as
   200px boxes with the chosen value stranded in the middle of empty space.

   The height is now inherited from .form-control, so every select matches the
   input fields around it. overflow-y goes with it: without a forced height there
   is nothing to scroll. */
textarea.form-control { resize: vertical; min-height: 80px; }
input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--emerald); }

/* ---------------------------------------------------------------
 * TABLES
 * ------------------------------------------------------------- */
.table-wrapper { overflow-x: auto; }

/* ---------------------------------------------------------------
 * SCROLLBARS
 * -------------------------------------------------------------
 *
 * One appearance for every scrollbar in the app, on both axes, always drawn
 * INSIDE the box that scrolls.
 *
 * "Inside" is the whole point of this block. A styled bar is painted within the
 * scroll container's own padding box - it never sits outside the card, and the
 * document itself never grows a bar of its own, because nothing here widens the
 * page. The four wrappers below are the horizontal cases (a matrix grows a column
 * per event, so it has to scroll sideways); the vertical cases are listed
 * separately, because a wrapper that scrolls on one axis must not be the only one
 * that looks right on it.
 *
 * Why the bars are painted at all: Windows draws overlay scrollbars that stay
 * invisible until you drag them. A Major/Minor matrix with more columns than fit
 * therefore read as "the extra events are missing", and a tall modal table read
 * as "the rest of the rows are missing". A painted track and thumb show up the
 * moment content overflows.
 *
 * Two details that are deliberate:
 *
 *   - The thumb's 2px border is drawn in the TRACK colour, so the thumb reads as
 *     a shorter pill floating in the track rather than a bar filling it end to
 *     end. On a wide matrix the track is long and the difference is obvious.
 *
 *   - overscroll-behavior: contain stops a trackpad fling from chaining to the
 *     page behind, so a swipe inside a table moves the table and stops. It
 *     matters on the matrix specifically, where the sticky # and Contestant
 *     columns already pin the left edge: without it, overscroll would fight the
 *     sticky offsets.
 *
 * scrollbar-width/-color are the standard properties (Firefox, and Chrome 121+
 * as a fallback). The ::-webkit-scrollbar rules are what Chrome and Edge still
 * use for the custom look, and ::-webkit-scrollbar sets the thickness for BOTH
 * axes at once - `width` for vertical, `height` for horizontal - so each element
 * needs it only once, not per axis.
 */

/* Every table scroller, on both axes. .table-scroll is in the list because it is
 * the name to reach for on a new table; the others are the classes already in
 * the markup. ::-webkit-scrollbar sets thickness for both axes at once. */
.matrix-wrap,
.table-wrapper,
.table-scroll,
.sc-table-wrap,
.lp-table-wrap {
    scrollbar-width: thin;
    scrollbar-color: #B9D2C7 #F2F8F5;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
.matrix-wrap::-webkit-scrollbar,
.table-wrapper::-webkit-scrollbar,
.table-scroll::-webkit-scrollbar,
.sc-table-wrap::-webkit-scrollbar,
.lp-table-wrap::-webkit-scrollbar { width: 10px; height: 10px; }
.matrix-wrap::-webkit-scrollbar-track,
.table-wrapper::-webkit-scrollbar-track,
.table-scroll::-webkit-scrollbar-track,
.sc-table-wrap::-webkit-scrollbar-track,
.lp-table-wrap::-webkit-scrollbar-track { background: #F2F8F5; border-radius: 999px; }
.matrix-wrap::-webkit-scrollbar-thumb,
.table-wrapper::-webkit-scrollbar-thumb,
.table-scroll::-webkit-scrollbar-thumb,
.sc-table-wrap::-webkit-scrollbar-thumb,
.lp-table-wrap::-webkit-scrollbar-thumb {
    background: #B9D2C7; border-radius: 999px;
    border: 2px solid #F2F8F5;
}
.matrix-wrap::-webkit-scrollbar-thumb:hover,
.table-wrapper::-webkit-scrollbar-thumb:hover,
.table-scroll::-webkit-scrollbar-thumb:hover,
.sc-table-wrap::-webkit-scrollbar-thumb:hover,
.lp-table-wrap::-webkit-scrollbar-thumb:hover { background: var(--forest); }

/* Vertical scrollers, same colours and thickness so a bar reads the same
 * whichever axis it is on.
 *
 *   .sidebar / .sidebar-nav   the nav is the tall one
 *   .modal                    long forms scroll inside the dialog
 *   .guide-body               the help slides
 *   .modal .table-wrapper     a tall table in a modal: BOTH axes at once
 *   .lp-modal-body            the landing page's result dialog
 *
 * The winners screen (body.ws-body) is deliberately NOT in the list. Its
 * overflow is set on <body>, and overflow on the body element propagates to the
 * viewport - so the bar that actually appears is the viewport's, not the body's,
 * and styling body::-webkit-scrollbar paints nothing. The :has() rule further
 * down styles that viewport bar instead.
 *
 * The sidebar is the one place the bar sits on a dark green field, so its thumb
 * is lightened to keep it visible; everything else is on white or mint. */
.sidebar,
.sidebar-nav,
.modal,
.modal-guide .modal-body.guide-body,
.modal .table-wrapper,
.lp-modal-body {
    scrollbar-width: thin;
    scrollbar-color: #B9D2C7 #F2F8F5;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
.sidebar::-webkit-scrollbar,
.sidebar-nav::-webkit-scrollbar,
.modal::-webkit-scrollbar,
.modal-guide .modal-body.guide-body::-webkit-scrollbar,
.modal .table-wrapper::-webkit-scrollbar,
.lp-modal-body::-webkit-scrollbar { width: 10px; }
.sidebar::-webkit-scrollbar-track,
.sidebar-nav::-webkit-scrollbar-track,
.modal::-webkit-scrollbar-track,
.modal-guide .modal-body.guide-body::-webkit-scrollbar-track,
.modal .table-wrapper::-webkit-scrollbar-track,
.lp-modal-body::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb,
.sidebar-nav::-webkit-scrollbar-thumb,
.modal::-webkit-scrollbar-thumb,
.modal-guide .modal-body.guide-body::-webkit-scrollbar-thumb,
.modal .table-wrapper::-webkit-scrollbar-thumb,
.lp-modal-body::-webkit-scrollbar-thumb {
    background: #B9D2C7; border-radius: 999px;
    border: 2px solid transparent;
}
.modal::-webkit-scrollbar-thumb:hover,
.modal-guide .modal-body.guide-body::-webkit-scrollbar-thumb:hover,
.modal .table-wrapper::-webkit-scrollbar-thumb:hover,
.lp-modal-body::-webkit-scrollbar-thumb:hover { background: var(--forest); }

/* The winners screen. Its overflow lives on <body>, and overflow on the body
 * element propagates to the viewport, so the bar that actually draws is the
 * viewport's. :has() is what lets the rule reach the root element conditionally,
 * without giving every admin page the winners screen's colours. */
html:has(body.ws-body) {
    scrollbar-width: thin;
    scrollbar-color: #B9D2C7 #F2F8F5;
    overscroll-behavior: contain;
}
html:has(body.ws-body)::-webkit-scrollbar { width: 10px; }
html:has(body.ws-body)::-webkit-scrollbar-track { background: transparent; }
html:has(body.ws-body)::-webkit-scrollbar-thumb {
    background: #B9D2C7; border-radius: 999px; border: 2px solid transparent;
}
html:has(body.ws-body)::-webkit-scrollbar-thumb:hover { background: var(--forest); }

/* On the sidebar the track is transparent so the green shows through, which
 * means the 2px border cannot be the track colour - it would draw a light line
 * down the nav. A transparent border shortens the pill without that. */
.sidebar::-webkit-scrollbar-thumb,
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.34); }
.sidebar::-webkit-scrollbar-thumb:hover,
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.62); }

/* Column widths for <colgroup>.
 *
 * Every <colgroup> in the app names its columns through these classes - see
 * admin/partials/dashboard-body.php, admin/partials/setup-panel.php,
 * admin/audit-logs.php and admin/reports.php - but not one of them had a rule.
 * The colgroups were therefore inert: the browser fell back to automatic layout
 * and decided every width from the cell contents alone, which is how a single
 * long value in one row pushed a column out from under its heading.
 *
 * These are the widths those colgroups were written to ask for. The narrow ones
 * are pinned so a badge, a date or a rank keeps the same width on every row, and
 * the wide ones are left to absorb what is left. Widths on a <col> are treated
 * as a preference under the default table-layout, so a long cell still expands
 * its column rather than wrapping into an unreadable sliver.
 */
.col-rank     { width: 62px; }
.col-number   { width: 96px; }
.col-date     { width: 132px; }
.col-datetime { width: 168px; }
.col-status   { width: 132px; }
.col-pct      { width: 104px; }
.col-score    { width: 128px; }
.col-action   { width: 116px; }
/* The three "take the remainder" columns. Naming one of them is optional; all
   three resolve to auto, so a colgroup can use whichever reads best. */
.col-name, .col-title, .col-flex { width: auto; }

/* Base table styles for both .data-table and .table-responsive-stack */
table.data-table,
table.table-responsive-stack {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
}
table.data-table th,
table.table-responsive-stack th {
    background: var(--forest);
    color: #fff;
    padding: 13px 16px;
    text-align: left;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    white-space: nowrap;
}
table.data-table th:first-child,
table.table-responsive-stack th:first-child { border-top-left-radius: 10px; }
table.data-table th:last-child,
table.table-responsive-stack th:last-child { border-top-right-radius: 10px; }
table.data-table td,
table.table-responsive-stack td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    background: #fff;
}
table.data-table tbody tr:hover td,
table.table-responsive-stack tbody tr:hover td { background: #F2F8F5; }
table.data-table tbody tr:last-child td,
table.table-responsive-stack tbody tr:last-child td { border-bottom: none; }
table.data-table tbody tr:last-child td:first-child,
table.table-responsive-stack tbody tr:last-child td:first-child { border-bottom-left-radius: 10px; }
table.data-table tbody tr:last-child td:last-child,
table.table-responsive-stack tbody tr:last-child td:last-child { border-bottom-right-radius: 10px; }

/* Consolidated category matrix (the selected contest's own divisions).
   The row carries a contestant name, a cell per category and the roll-up - but
   a contestant name and a "1st (65)" must not split, or the place and the
   points it earned read as two different figures. */
.cr-category-matrix .cr-matrix-team,
.cr-category-matrix .cr-matrix-place { white-space: nowrap; }

/* A division name may be long. A heading may wrap onto a second line; a figure
   may not. */
table.table-responsive-stack.cr-category-matrix th { white-space: normal; }

/* ============================================================
   Submission Actions - one row per judge, one column per contestant
   ============================================================
   Transposed, so a panel is read across: Judge No. | Judge | Red
   Team | Yellow Team | ... | Signature | Action.

   Width is the cost. A column per contestant means a large field is
   wider than the card, so the two identity columns are held narrow to
   buy back room and the contestant headers wrap rather than forcing
   the whole table wider. .table-wrapper is already overflow-x:auto
   and takes over from there. */
.subm-table { table-layout: auto; }
.subm-table .subm-col-judgeno,
.subm-table .subm-col-judge { white-space: nowrap; }
.subm-table .subm-col-contestant {
    min-width: 92px;
    /* The name wraps inside its own column rather than widening the table,
       which is what keeps a dozen-contestant field usable. */
    max-width: 150px;
    white-space: normal;
    word-break: break-word;
}
.subm-table .subm-col-name { display: block; }
.subm-table .subm-col-sig,
.subm-table .subm-col-action { white-space: nowrap; }

/* The signature itself, at a size that reads as a thumbnail beside a row of
   figures without turning the row three lines deep. */
.subm-table .subm-sig-img {
    display: block;
    width: 84px;
    height: 34px;
    object-fit: contain;
    object-position: left center;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    padding: 2px;
}

.subm-table .subm-judge-status {
    display: block;
    margin-top: 3px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #8A6D1F;
}
.subm-table .subm-judge-status.is-submitted { color: var(--forest); }
.subm-table .subm-number { color: var(--forest); font-weight: 700; margin-right: 4px; }

/* "4/7" beside a draft score: how much of that contestant's sheet exists.
 * Kept inline rather than a block on purpose - below 768px the stacked
 * layout turns each cell into a flex row, where a block child becomes a
 * flex item and sits beside the score instead of under it. */
.subm-table .subm-partial {
    margin-left: 6px;
    font-size: 11px;
    font-weight: 700;
    color: #8A6D1F;
    white-space: nowrap;
}
/* Footer: the per-contestant average across the judges above it. The shared
   th/td rules paint every th as a dark header, so this row is made of td
   cells and takes the same summary treatment the app's other footer rows
   use - a light band under a strong top rule - so it reads as the total of
   the column rather than as another judge. */
.subm-table tfoot td {
    background: var(--bg-secondary);
    border-top: 2px solid var(--border);
    border-bottom: none;
    font-size: 12.5px;
    color: var(--text);
}
.subm-table tfoot .subm-col-avg-label {
    font-weight: 700;
    color: var(--forest);
}
/* A Ranking System contest ends in three summary rows instead of one. Only the
   first opens the footer; the rest are separated by the ordinary row rule so
   the band still reads as one summary block. */
.subm-table tfoot tr + tr td { border-top: 1px solid var(--border); }

/* "3 (85.20)" - the judge's place first, because that is what the event is
   placed on; the points total they signed sits beside it in brackets. */
.subm-table .subm-rank { color: var(--forest); }
.subm-table .subm-score {
    margin-left: 2px;
    font-size: 12px;
    color: var(--text-muted);
}
.subm-footnote {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin: 14px 2px 0;
    font-size: 12.5px;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    /* Transposed, this table stacks well: .table-responsive-stack turns each
     * judge into a card, and each contestant's score becomes a line labelled
     * "J1 score for Red Team". The per-cell min-width from the desktop rules
     * would only add slack inside that card, so it is released here. */
    .subm-table .subm-col-contestant { min-width: 0; max-width: none; }
    .subm-table .subm-col-judgeno,
    .subm-table .subm-col-judge,
    .subm-table .subm-col-sig,
    .subm-table .subm-col-action { white-space: normal; }
    .subm-table .subm-sig-img { width: 100%; max-width: 200px; }
    /* The points cell holds two figures, so without this the stacked flex row
       spreads them to opposite edges - the rank stranded mid-row and its points
       at the far right. The rank takes the free space instead, keeping
       "3 (85.20)" together on the right, where a single score used to sit. */
    .subm-table td .subm-rank { margin-left: auto; }
    .subm-table td .subm-score { margin-left: 4px; }
    /* The shared stacking rule blockifies the table, tbody, tr and td but not
       tfoot - left as a table-footer-group it would wrap its rows in an
       anonymous table box inside the now-block table. Blockified, the footer
       stacks as one more card, labelled "TOTAL AVERAGE". */
    .subm-table tfoot { display: block; }
}

/* ============================================================
   Submission Actions - expandable category rows
   ============================================================
   The contest picker names an event once, so its categories are read here: one
   full-width row per category, each opening its own judge table underneath.

   Rows are full width and generous to click because they are the whole way in;
   the panel stays inside its own row so expanding a category never pushes the
   rest of the page apart, and its table scrolls sideways inside .table-wrapper
   rather than widening the card. */
.subm-cats-card .card-body { padding: 16px; }

.subm-selected {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    padding: 0 2px 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}
.subm-selected-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.subm-selected-title { font-size: 16px; color: var(--forest); }
.subm-selected-hint { font-size: 12.5px; color: var(--text-muted); margin-left: auto; }

/* Rank / Point scoring basis toggle (MR. AND MS. ANIMOLYMPICS and THE BATTLES only). */
/* Rank / Point scoring basis toggle switch (all non-sports contests). */
.subm-scoring-switch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
}
.subm-scoring-switch input[type="checkbox"] {
    display: none;
}
.subm-scoring-slider {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    background: #ccc;
    border-radius: 24px;
    transition: background 0.2s;
    vertical-align: middle;
}
.subm-scoring-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}
.subm-scoring-switch input[type="checkbox"]:checked + .subm-scoring-slider {
    background: var(--forest);
}
.subm-scoring-switch input[type="checkbox"]:checked + .subm-scoring-slider::after {
    transform: translateX(20px);
}
.subm-scoring-label {
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
}

.subm-cats { display: flex; flex-direction: column; gap: 8px; }

.subm-cat {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    overflow: hidden;
}
.subm-cat:hover { border-color: #B7D4C6; }
.subm-cat.is-open {
    border-color: #B7D4C6;
    box-shadow: var(--shadow);
}

.subm-cat-head {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 13px 14px;
    border: 0;
    background: #fff;
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.subm-cat-head:hover { background: #F4FAF6; }
.subm-cat-head:focus-visible { outline: 2px solid var(--emerald); outline-offset: -2px; }
.subm-cat.is-open > .subm-cat-head {
    background: #F4FAF6;
    border-bottom: 1px solid var(--border);
}

.subm-cat-chevron {
    display: inline-flex;
    flex: 0 0 auto;
    color: var(--forest);
    transition: transform .18s ease;
}
.subm-cat.is-open > .subm-cat-head .subm-cat-chevron { transform: rotate(90deg); }

.subm-cat-name {
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 700;
    word-break: break-word;
}
.subm-cat-count {
    flex: 0 0 auto;
    font-size: 12.5px;
    color: var(--text-muted);
    white-space: nowrap;
}
.subm-cat-status {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    flex: 0 0 auto;
}

.subm-cat-panel { padding: 14px; }
.subm-cat-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--text-muted);
}
.subm-cat-fact { display: inline-flex; align-items: center; gap: 4px; }

/* THE BATTLES: its Main Criteria are the dropdowns, so the category above
   them is a plain heading. It is not a row of its own because a collapsible
   category would sit directly above a criterion carrying the same name. */
.subm-battle-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 4px 2px 0;
}
.subm-battle-name { font-weight: 700; color: var(--forest); }
.subm-battle-count { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }

@media (max-width: 768px) {
    /* The row keeps its name and chevron on the first line and lets the counts
       wrap under them; a single squeezed line reads as a broken table. */
    .subm-cat-head { flex-wrap: wrap; gap: 8px; }
    .subm-cat-name { flex: 1 1 auto; }
    .subm-cat-count { flex: 1 0 100%; order: 3; padding-left: 28px; }
    .subm-cat-status { order: 2; }
    .subm-cat-panel { padding: 12px 10px; }
    .subm-selected-hint { margin-left: 0; flex: 1 0 100%; }
}

/* Responsive stack: on small screens, stack cells vertically with labels */
@media (max-width: 768px) {
    table.table-responsive-stack thead { display: none; }
    table.table-responsive-stack,
    table.table-responsive-stack tbody,
    table.table-responsive-stack tr,
    table.table-responsive-stack td { display: block; width: 100%; }
    table.table-responsive-stack tr { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 12px; padding: 12px; background: #fff; }
    table.table-responsive-stack td { border: none; padding: 8px 0; display: flex; justify-content: space-between; align-items: center; }
    table.table-responsive-stack td::before {
        content: attr(data-label);
        font-weight: 700;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.6px;
        color: var(--forest);
    }
}

/* data-table matrix specific (extends base) */
table.data-table.matrix { border-collapse: separate; border-spacing: 0; min-width: 100%; }
table.data-table.matrix th,
table.data-table.matrix td { white-space: nowrap; padding: 10px 16px; }
table.data-table.matrix .matrix-col { text-align: center; min-width: 130px; }
table.data-table.matrix .matrix-total { text-align: center; min-width: 110px; font-weight: 700; }
table.data-table.matrix .matrix-cell { text-align: center; }
table.data-table.matrix .matrix-score { font-weight: 600; color: #1F2937; }
table.data-table.matrix .matrix-score.provisional { color: #9CA3AF; font-style: italic; }
table.data-table th {
    background: var(--forest); color: #fff;
    padding: 13px 16px; text-align: left;
    font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px;
    white-space: nowrap;
}
table.data-table th:first-child { border-top-left-radius: 10px; }
table.data-table th:last-child { border-top-right-radius: 10px; }
table.data-table td {
    padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle;
    background: #fff;
}
table.data-table tbody tr:hover td { background: #F2F8F5; }
table.data-table tbody tr:last-child td { border-bottom: none; }
table.data-table tbody tr:last-child td:first-child { border-bottom-left-radius: 10px; }
table.data-table tbody tr:last-child td:last-child { border-bottom-right-radius: 10px; }

/* ---------------------------------------------------------------
 * MEDAL RANK INDICATORS + SCORE BADGES
 * ------------------------------------------------------------- */
.medal {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 50%;
    font-weight: 800; font-size: 14px; line-height: 1;
}
.medal.m1 { background: linear-gradient(135deg, #F7E08B 0%, #D6AA32 100%); color: #5C430A; box-shadow: 0 0 0 3px #F5E8BD, 0 2px 6px rgba(214,170,50,0.45); }
.medal.m2 { background: linear-gradient(135deg, #E8EDF2 0%, #9AA7B4 100%); color: #3D4752; box-shadow: 0 0 0 3px #EDF1F5, 0 2px 6px rgba(120,135,150,0.4); }
.medal.m3 { background: linear-gradient(135deg, #EDBE8E 0%, #B26A2E 100%); color: #5B3410; box-shadow: 0 0 0 3px #F6E3CB, 0 2px 6px rgba(178,106,46,0.4); }
.medal.mx { background: var(--mint); color: var(--emerald); }
.medal.lg { width: 56px; height: 56px; font-size: 24px; }
.avg-badge {
    display: inline-block; background: var(--mint); color: var(--forest);
    font-weight: 800; padding: 5px 14px; border-radius: 999px; white-space: nowrap;
}

/* ---------------------------------------------------------------
 * BADGES
 * ------------------------------------------------------------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 11px; border-radius: 20px;
    font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge .lucide { width: 12px; height: 12px; }
.badge-green  { background: #DDF5E8; color: #087B59; }
.badge-gold   { background: rgba(214, 170, 50, .18); color: #8A6A12; }
.badge-silver { background: rgba(148, 163, 184, .22); color: #4B5563; }
.badge-bronze { background: rgba(201, 128, 62, .18); color: #8A4B1D; }
.badge-white  { background: #F3F4F6; color: #6B7280; border: 1px solid #E5E7EB; }
.badge-blue   { background: #DBEAFE; color: #1D4ED8; }
.badge-amber  { background: #F5E8BD; color: #9A7418; }
.badge-red    { background: #FEE2E2; color: #B91C1C; }
.badge-purple { background: #EDE9FE; color: #6D28D9; }
.badge-gray   { background: #EEF2F1; color: #5B6B64; }
.badge-teal   { background: #CCFBF1; color: #0F766E; }

/* ---------------------------------------------------------------
 * ALERTS
 * ------------------------------------------------------------- */
.alert {
    padding: 14px 18px; border-radius: var(--radius-sm);
    font-size: 14px; margin-bottom: 20px;
    display: flex; align-items: flex-start; gap: 10px;
}
.alert .lucide { width: 18px; height: 18px; margin-top: 2px; }
/* .alert sets display:flex, which beats the UA stylesheet's [hidden] rule and
   would leave an empty red bar on screen. Restore it explicitly so the gate
   form's inline error box can be hidden and shown by the AJAX handler. */
.alert[hidden] { display: none; }
.alert-success { background: #DDF5E8; color: #05603A; border: 1px solid #B9E8CF; }
.alert-warning { background: #F5E8BD; color: #8A6D0B; border: 1px solid #EBD48A; }
.alert-danger  { background: #FEE2E2; color: #B91C1C; border: 1px solid #FECACA; }
.alert-info    { background: #DBEAFE; color: #1D4ED8; border: 1px solid #BFDBFE; }

/* ---------------------------------------------------------------
 * MODALS
 * ------------------------------------------------------------- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,45,34,0.55);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; opacity: 0; visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s; padding: 20px;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
    background: var(--bg); border-radius: 18px; box-shadow: var(--shadow-lg);
    max-width: 560px; width: 100%; max-height: 90vh; overflow-y: auto;
    transform: scale(0.95); transition: transform 0.3s;
    border-top: 4px solid var(--gold);
}
.modal-overlay.active .modal { transform: scale(1); }
.modal-wide { max-width: 760px; }
.modal-xl { max-width: 1100px; width: 96%; }

/* Final Tabulation "View Breakdown" - large, centered */
.modal-overlay.breakdown-overlay {
    position: fixed !important; inset: 0 !important;
    display: flex !important; align-items: center !important; justify-content: center !important;
    padding: 24px !important; margin: 0 !important; z-index: 2000 !important;
}
.modal.breakdown-modal {
    width: 94vw !important; max-width: 1150px !important;
    max-height: 92vh !important; margin: 0 auto !important;
    position: relative !important; left: auto !important; top: auto !important;
}
.modal.breakdown-modal .modal-header { padding: 24px 32px; }
.modal.breakdown-modal .modal-title { font-size: 24px !important; }
.modal.breakdown-modal .modal-footer { padding: 18px 32px; }
.modal.breakdown-modal .modal-body { padding: 28px 32px; font-size: 14px; }
.modal.breakdown-modal table { font-size: 14px !important; }
.modal.breakdown-modal table td, .modal.breakdown-modal table th { padding: 12px 10px !important; }
.modal-header {
    padding: 20px 24px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 18px; font-weight: 700; color: var(--forest); display: flex; align-items: center; gap: 10px; }
.modal-close {
    background: var(--bg-secondary); border: none; width: 32px; height: 32px;
    border-radius: 50%; font-size: 18px; cursor: pointer; color: var(--text-muted);
    display: flex; align-items: center; justify-content: center; line-height: 1;
}
.modal-close:hover { background: var(--border); color: var(--text); }
.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px; border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 12px;
}

/* System guide ---------------------------------------------------
 * A deck of slides rather than one long scroll, so a reader can go straight to
 * the step they need. The body relies on .modal's own max-height/overflow to
 * scroll rather than nesting a second scroller inside the slide.
 */
.modal.modal-guide {
    display: flex; flex-direction: column;
    max-width: 780px; max-height: 90vh; overflow: hidden;
}
.modal-guide .modal-body.guide-body { flex: 1 1 auto; overflow-y: auto; }
.guide-intro {
    font-size: 13px; line-height: 1.6; color: var(--text-muted);
    margin: 0 0 20px; padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.guide-intro strong { color: var(--forest); }

/* One slide at a time. Inactive slides stay in the DOM with [hidden] so the
   deck has no load-in-flight, which is what makes Next feel instant. */
.guide-slide[hidden] { display: none; }

/* Slide heading: icon, then title over a one-line summary. */
.guide-slide-head {
    display: flex; align-items: flex-start; gap: 12px;
    margin: 0 0 18px;
}
.guide-slide-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; flex-shrink: 0;
    border-radius: 11px;
    background: rgba(214,170,50,.16); color: var(--gold-deep);
}
.guide-heading {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 800; letter-spacing: .6px;
    text-transform: uppercase; color: var(--forest);
    margin: 0 0 3px;
}
.guide-slide-sub {
    margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--text-muted);
}

/* Numbered steps. The marker is a fixed-width gold number rather than a plain
   bullet, so a step reads as an instruction in sequence. */
.guide-steps {
    margin: 0; padding: 0; list-style: none; counter-reset: guide-step;
}
.guide-step {
    position: relative; counter-increment: guide-step;
    font-size: 13.5px; line-height: 1.6; color: var(--text);
    margin-bottom: 10px; padding-left: 32px;
}
.guide-step:last-child { margin-bottom: 0; }
.guide-step::before {
    content: counter(guide-step);
    position: absolute; left: 0; top: 1px;
    width: 21px; height: 21px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--forest); color: #fff;
    font-size: 11px; font-weight: 700; line-height: 1;
}
/* The bold opener carries the term, the rest explains it - the same shape as
   .login-hint and the settings alerts, so it reads like the rest of the app. */
.guide-step strong { color: var(--forest); }

/* Watch-out notes: the things the interface cannot say for itself. Tinted like
   the amber alerts elsewhere so they read as caution rather than as steps. */
.guide-tips {
    margin-top: 20px; padding: 14px 16px;
    background: #FEF3C7; border: 1px solid #FCD34D; border-radius: 12px;
}
.guide-tips-heading {
    display: flex; align-items: center; gap: 7px;
    margin: 0 0 10px;
    font-size: 11px; font-weight: 800; letter-spacing: .6px;
    text-transform: uppercase; color: #92400E;
}
.guide-tips-heading .lucide { flex-shrink: 0; }
.guide-tips-list { margin: 0; padding-left: 16px; }
.guide-tips-list li {
    font-size: 13px; line-height: 1.55; color: #78350F;
    margin-bottom: 7px;
}
.guide-tips-list li:last-child { margin-bottom: 0; }
.guide-tips-list strong { color: #92400E; }

/* Footer: dots as the jump-to control, then Back / count / Next. Wraps to two
   rows on a narrow screen rather than squeezing the labels out of shape. */
.modal-footer.guide-footer {
    align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px;
}
.guide-dots { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.guide-dot {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 11px; border-radius: 999px; cursor: pointer;
    background: var(--bg-secondary); border: 1px solid var(--border);
    color: var(--text-muted); font-family: inherit; font-size: 12px; font-weight: 600;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.guide-dot:hover { border-color: var(--emerald); color: var(--forest); }
.guide-dot.active {
    background: var(--forest); border-color: var(--forest); color: #fff;
}
.guide-dot-label {
    display: inline-flex; align-items: center; justify-content: center;
    width: 17px; height: 17px; border-radius: 50%;
    background: rgba(255,255,255,.22); font-size: 10px; font-weight: 700;
}
.guide-dot:not(.active) .guide-dot-label { background: rgba(0,77,59,.10); }
.guide-dot-name { white-space: nowrap; }

.guide-nav { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.guide-nav .btn { display: inline-flex; align-items: center; gap: 6px; }
.guide-nav .btn[disabled] { opacity: .45; cursor: not-allowed; }
.guide-count {
    font-size: 12px; font-weight: 600; color: var(--text-muted);
    min-width: 44px; text-align: center;
}

/* The closing button sits on its own strip below the footer rather than in it, so
   the Next button's label can stay "Next" on the last slide instead of turning
   into "Done" - and so the dots always have the footer's full width to sit in.
   Deliberately quiet: closing is a mouse action, walking through is not. */
.guide-end {
    padding: 12px 24px;
    border-top: 1px solid var(--border);
    text-align: center;
}
.guide-end .btn {
    display: inline-flex; align-items: center; gap: 7px;
    background: transparent; border: none; color: var(--text-muted);
    font-size: 13px; padding: 6px 10px;
}
.guide-end .btn:hover { color: var(--forest); background: var(--bg-secondary); }

@media (max-width: 640px) {
    .guide-dot-name { display: none; }
    .guide-dot { padding: 6px 8px; }
    .modal-footer.guide-footer { justify-content: center; }
    .guide-nav { margin-left: 0; }
}

/* ---------------------------------------------------------------
 * SETUP TABS + SELECTOR (shared by Contest Setup / Results pages)
 * ------------------------------------------------------------- */
.setup-tabs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.setup-tabs a {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px; border-radius: 12px; text-decoration: none;
    font-weight: 600; font-size: 14px;
    background: #fff; color: var(--forest);
    border: 1px solid var(--border);
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.setup-tabs a:hover { border-color: var(--emerald); }
.setup-tabs a.active { background: var(--forest); color: #fff; border-color: var(--forest); }
.setup-selector { border: 1px solid var(--border); box-shadow: var(--shadow); }
.setup-selector-body { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: space-between; }
.setup-selector-left { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.setup-selector-icon {
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 22px; background: var(--mint); color: var(--emerald);
    border-radius: 12px; padding: 9px;
}
.setup-selector-icon .lucide { width: 22px; height: 22px; }
.setup-selector-title { font-weight: 700; font-size: 16px; color: var(--forest); }
.setup-selector-sub { font-size: 12px; color: var(--text-muted); }
.setup-selector-form { margin-left: auto; }
.setup-selector-form .form-control { min-width: 260px; max-width: 360px; border-radius: 10px; }
/* The searchable picker that wraps the contest <select> takes the same box, so
   swapping the control in changed nothing about the row's proportions. */
.setup-selector-form .cs { min-width: 260px; max-width: 360px; }

/* Search bar rendered next to "Add" buttons in card headers */
.setup-search { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.setup-search .form-control { width: auto; min-width: 200px; max-width: 280px; padding: 7px 12px; font-size: 13px; }
@media (max-width: 700px) {
    .setup-search { width: 100%; }
    .setup-search .form-control { flex: 1; min-width: 0; max-width: none; }
}
.setup-header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

/* QR modal horizontal layout */
.qr-modal-grid { display: flex; gap: 24px; align-items: flex-start; }
/* Sized for the dialog, not the standalone page: the code shares the row with
   the link box, and at the page's 280px it dominated the dialog.
   150px is a deliberate floor, not an arbitrary number. This link encodes to a
   version 5 code - 37x37 modules over a 2-module quiet zone, 41 across - so 150px
   is still 3.66 px per module, which a phone camera reads reliably. Below about
   3 px per module scanning starts to fail, and a code that cannot be scanned is
   worse than a large one. Keep it at or above 140px. */
.qr-modal-grid .qr-container { flex: 0 0 178px; padding: 12px; }
.qr-modal-grid .qr-container img { width: 150px; max-width: 100%; margin: 0 auto; }
.qr-modal-grid .qr-modal-side { flex: 1; min-width: 0; }
@media (max-width: 640px) {
    .qr-modal-grid { flex-direction: column; }
    .qr-modal-grid .qr-container { flex: none; width: 100%; }
}

/* Premium event summary card */
.event-card { position: relative; overflow: hidden; }
.event-card::after {
    content: ''; position: absolute; right: -60px; bottom: -70px;
    width: 220px; height: 220px; border-radius: 50%;
    background: radial-gradient(circle, rgba(214,170,50,0.22) 0%, transparent 65%);
    pointer-events: none;
}
.event-card::before {
    content: ''; position: absolute; right: -30px; bottom: -90px;
    width: 200px; height: 200px; border-radius: 50%;
    border: 2px solid rgba(8,123,89,0.14); pointer-events: none;
}
.event-trophy {
    width: 84px; height: 84px; border-radius: 50%; flex-shrink: 0;
    background: radial-gradient(circle at 35% 30%, #EAF7F0 0%, var(--mint) 70%);
    display: flex; align-items: center; justify-content: center;
    color: var(--gold); border: 2px solid var(--gold-light);
}
.event-trophy .lucide { width: 40px; height: 40px; }
.event-title { font-size: 22px; font-weight: 800; color: var(--forest); margin: 0; }
.event-meta { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ---------------------------------------------------------------
 * LOGIN PAGE
 * ------------------------------------------------------------- */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    /* Deep forest gradient base */
    background: linear-gradient(160deg, #0A2E1F 0%, #0D3524 45%, #113F2A 100%);
    position: relative;
    padding: 24px 20px;
    overflow: hidden;
}
/* Soft, blurred botanical overlay + radial glows */
.login-page::before {
    content: ''; position: absolute; inset: -12%;
    background: url('../images/login-background.jpg') center center / cover no-repeat;
    filter: blur(3px) saturate(115%);
    opacity: .22;
    transform: scale(1.08);
    pointer-events: none;
}
.login-page::after {
    content: ''; position: absolute; inset: 0;
    background:
        radial-gradient(58% 44% at 18% 14%, rgba(53,183,121,.22) 0%, transparent 62%),
        radial-gradient(52% 46% at 84% 86%, rgba(214,170,50,.16) 0%, transparent 64%),
        radial-gradient(70% 60% at 50% 50%, rgba(10,46,31,0) 30%, rgba(6,28,20,.55) 100%);
    pointer-events: none;
}

/* --- Card --- */
.login-card {
    position: relative; z-index: 1;
    width: 100%; max-width: 420px;
    background: #FCFDFC;
    border-radius: 16px;
    padding: 40px 36px 32px;
    box-shadow: 0 24px 60px rgba(3,20,14,.45), 0 2px 8px rgba(3,20,14,.18);
}
/* Light-gold gradient hairline around the card edge */
.login-card::before {
    content: ''; position: absolute; inset: 0; border-radius: inherit;
    padding: 1px;
    background: linear-gradient(145deg, rgba(214,170,50,.85) 0%, rgba(245,232,189,.35) 32%, rgba(223,229,226,.9) 62%, rgba(214,170,50,.6) 100%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    pointer-events: none;
}

/* --- Header / branding --- */
.login-header { text-align: center; margin-bottom: 30px; }
.login-logo { margin-bottom: 18px; display: flex; justify-content: center; }
.login-logo .icon-box.gold {
    padding: 15px; border-radius: 18px;
    background: linear-gradient(145deg, #B98A34 0%, #8A6524 48%, #D8B45C 100%);
    color: #FFE9AE;
    box-shadow: 0 8px 20px rgba(138,101,36,.32), inset 0 1px 0 rgba(255,255,255,.28);
    border: 1px solid rgba(255,233,174,.28);
}
.login-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 26px; font-weight: 700; letter-spacing: -.2px;
    color: #1C2A24; line-height: 1.2; margin: 0;
}
.login-subtitle { font-size: 13px; color: #7A8A84; margin-top: 7px; letter-spacing: .2px; }

/* --- Fields --- */
.login-field { margin-bottom: 18px; }
.login-label {
    display: block; text-align: left;
    font-size: 13px; font-weight: 600; color: #33443D;
    margin-bottom: 7px; letter-spacing: .1px;
}
.login-label .required { color: #DC2626; margin-left: 2px; }
.login-input-wrap { position: relative; }
/* Shared by every password field with an eye toggle, not just the login one. */
.input-wrap { position: relative; }
.login-input {
    width: 100%;
    padding: 12px 14px;
    font-size: 14px; line-height: 1.45;
    color: #1C2A24;
    background: #F4F6F5;
    border: 1px solid #E2E8E5;
    border-radius: 8px;
    font-family: inherit;
    transition: border-color .18s, box-shadow .18s, background .18s;
    -webkit-appearance: none; appearance: none;
}
.login-input::placeholder { color: #A6B2AD; }
.login-input:hover { border-color: #CFD9D4; }
.login-input:focus {
    outline: none;
    background: #fff;
    border-color: #E0B857;
    box-shadow: 0 0 0 3px rgba(224,184,87,.30), 0 0 14px rgba(224,184,87,.28);
}
.login-input.has-toggle { padding-right: 46px; }
/* Clear the button so the dots are never hidden underneath it. */
.form-control.has-toggle { padding-right: 42px; }
/* .pw-toggle is the shared eye button (.login-toggle is the original name,
   kept so the login form is untouched). */
.login-toggle,
.pw-toggle {
    position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: 0; border-radius: 8px;
    color: #8A9A94; cursor: pointer;
    transition: color .18s, background .18s;
}
.login-toggle:hover,
.pw-toggle:hover { color: #33443D; background: #E9EEEC; }
.login-toggle:focus-visible,
.pw-toggle:focus-visible { outline: 2px solid #E0B857; outline-offset: 1px; }
.login-toggle .lucide,
.pw-toggle .lucide { width: 18px; height: 18px; }

/* --- Remember me --- */
.login-remember {
    display: flex; align-items: center; gap: 9px;
    margin: 4px 0 22px; cursor: pointer;
    font-size: 13.5px; color: #46564F; user-select: none;
}
.login-remember input {
    width: 16px; height: 16px; margin: 0;
    accent-color: #0A2E1F; cursor: pointer;
}
.login-remember:focus-within { color: #1C2A24; }

/* --- Submit --- */
.login-submit {
    width: 100%;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 13px 20px;
    font-size: 15px; font-weight: 700; letter-spacing: .3px;
    color: #fff;
    background: linear-gradient(180deg, #114B34 0%, #0A2E1F 100%);
    border: 0; border-radius: 10px;
    box-shadow: 0 8px 18px rgba(10,46,31,.34);
    cursor: pointer; font-family: inherit;
    transition: transform .15s, box-shadow .2s, filter .2s;
}
.login-submit:hover {
    filter: brightness(1.12);
    box-shadow: 0 12px 24px rgba(10,46,31,.42);
    transform: translateY(-1px);
}
.login-submit:active { transform: translateY(0); box-shadow: 0 4px 12px rgba(10,46,31,.32); }
.login-submit:focus-visible { outline: 3px solid rgba(224,184,87,.6); outline-offset: 2px; }

/* --- Footer link --- */
.login-forgot { text-align: center; margin: 20px 0 0; }
.login-forgot a {
    font-size: 13.5px; color: #46564F; text-decoration: none;
    border-bottom: 1px solid transparent; padding-bottom: 1px;
    transition: color .18s, border-color .18s;
}
.login-forgot a:hover { color: #0A2E1F; border-bottom-color: currentColor; }
.login-forgot a:focus-visible { outline: 2px solid #E0B857; outline-offset: 3px; border-radius: 3px; }

/* The two escape routes, on one row: Back to Landing Page left, Forgot
   Password right. No arrows ? their placement already says which is which.
   The back link is deliberately quieter than Forgot Password, which is the
   action most people on this screen actually want. */
.login-links {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-top: 20px;
}
.login-links a {
    font-size: 13.5px; text-decoration: none;
    border-bottom: 1px solid transparent; padding-bottom: 1px;
    transition: color .18s, border-color .18s;
}
.login-link-right { color: #46564F; }
.login-link-right:hover { color: #0A2E1F; border-bottom-color: currentColor; }
.login-link-left { color: #6B7B74; font-size: 13px; }
.login-link-left:hover { color: #0A2E1F; border-bottom-color: currentColor; }
.login-links a:focus-visible { outline: 2px solid #E0B857; outline-offset: 3px; border-radius: 3px; }

/* The contest selector on Contest Results needs no extra rules of its own: the
   form sits directly in the card body and inherits .setup-selector-form, so the
   dropdown takes the free width exactly as it does on Contest Setup.

   The .cr-picker / .cr-toggle rules that used to live here styled the Judge /
   Manual buttons beside it. Both are gone from the markup, so the rules were
   removed rather than left as dead CSS. */

/* ---------------------------------------------------------------
 * DASHBOARD SUMMARY CONTAINERS
 * Winners / Submission Monitoring / Latest Results.
 *
 * Three equal columns on a wide screen, stacking rather than squeezing on a
 * narrow one. Each tile is a single click target that opens a modal holding the
 * full record, so the tile itself stays a summary: a count and a few names.
 * --------------------------------------------------------------- */
.dash-cards {
    display: grid; gap: 18px; margin-top: 18px;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    /* stretch, not start. A tile shows one line of text when it has records and
       two (the empty-state line plus the date hint) when it has none, so under
       start every tile sized itself to its own content and the row went ragged:
       on 2026-10-07 Submission Monitoring measured 133px against 114px for the
       other two. Changing the calendar moved that count from non-zero to zero,
       which added the second line, so the container visibly grew and shrank as
       the admin moved between days. Stretch pins all three to the tallest, so
       the row is the same height whatever the day holds. */
    align-items: stretch;
}

.dash-tile {
    display: block; margin: 0; padding: 20px 22px;
    cursor: pointer; text-decoration: none; color: inherit;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.dash-tile:hover { transform: translateY(-2px); border-color: var(--gold); box-shadow: var(--shadow-lg); }
.dash-tile:focus-visible {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(214,170,50,.35), var(--shadow-lg);
}

/* Header row: icon, name, count - all on one line.
   justify-content is gone, and the count is pushed to the far right with
   margin-left:auto instead. The old pairing of space-between put the icon and
   the count at opposite edges with nothing between them, which read as two
   unrelated figures rather than one card's heading. */
.dash-tile-top { display: flex; align-items: center; gap: 12px; }
.dash-tile-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; border-radius: 12px;
    background: var(--mint); color: var(--emerald);
    flex: 0 0 auto;
}
.dash-tile-icon.gold { background: var(--gold-light); color: #9A7418; }
/* Takes the slack so the count sits hard against the right edge while the name
   stays next to its icon. min-width:0 lets a long name ellipsis instead of
   shoving the count off the card. */
.dash-tile-title {
    flex: 1 1 auto; min-width: 0;
    font-size: 12px; font-weight: 700;
    letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dash-tile-count {
    margin-left: auto; flex: 0 0 auto;
    font-size: 26px; font-weight: 800; line-height: 1;
    color: var(--forest); font-variant-numeric: tabular-nums;
}
/* Reserved for two lines. A tile prints one line when its count is non-zero and
   two when it is zero (the empty-state line plus the date hint), so without a
   floor the card grew and shrank by 8px as the admin moved between calendar days.
   Reserving the space keeps the whole row the same height on every day, and costs
   nothing when both lines are showing. */
.dash-tile-list { margin-top: 12px; min-height: 48px; }
.dash-tile-line {
    font-size: 13px; color: var(--text); padding: 3px 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dash-tile-empty { font-size: 13px; font-weight: 600; color: var(--text); }
.dash-tile-more, .dash-tile-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; }


/* ============================================================================
/* ============================================================================
 * Contest Setup - the contest table
 * ============================================================================
 *
 * Ten columns: Title, Grouping, Category, Type, Date, Judges, Scoring, Mode, Status, Actions.
 *
 * COLUMN DISTRIBUTION
 *
 * Every column is given a share of the table, and the shares add up to 100%.
 * That is the whole mechanism. Automatic layout treats a column with no width as
 * a place to put whatever space is left over, so the Title column - which is
 * prose and the widest thing anyone looks at - used to take all of it: measured,
 * 836px of a 1496px table on a 1920px window, holding the word "Boggle". Naming a
 * share for every column means the row adds up and the space is shared out.
 *
 * The shares are set by what each column holds, not by what looks tidy:
 *
 *   Title    15%  prose, wraps to a second line rather than growing the table
 *   Event    11%  prose; "Animolympics" is the longest name here, 93px
 *   Category 12%  contest category, wraps rather than growing the table
 *   Type      7%  a badge: "Minor"
 *   Date     11%  a fixed-format string: "Oct 07, 2026", 78px
 *   Judges    7%  a digit, or "N/A"
 *   Scoring  10%  a badge: "Weighted"
 *   Mode     10%  a badge: "Judge-Based", the longest badge at 78px
 *   Status    9%  a badge: "Finalized"
 *   Actions   8%  one button
 *
 * Title, Grouping and Category hold prose and wrap. Short date and action values
 * remain on one line, while badges may wrap at narrower card sizes.
 *
 * FIXED LAYOUT, so those shares are authoritative and a heading can never be
 * given a different width from the cells under it - which is what let the row
 * repaint itself when a badge changed and shove every column to its right
 * sideways. Needs the `table.` prefix: the base rule is
 * `table.table-responsive-stack` at 0,1,2 and a bare `.ct-table` at 0,1,0 loses
 * to it whatever order they appear in.
 *
 * PADDING is a flat 8px 14px - tighter than the app's default 13px 16px, because
 * ten columns of 16px is 320px of padding across the row before any content is
 * placed. The container queries below trim the horizontal side further as the card
 * narrows, which is what keeps the table off a horizontal scrollbar.
 *
 * The vertical 8px is about how many contests fit on screen, not about looks. This
 * table is the one long list an admin scrolls through looking for one event, and
 * every 4px of row padding is a whole extra row gone: at 12px the thirteen contests
 * on this install needed roughly 700px of rows, so a normal laptop showed about
 * seven and the rest sat below the fold with the page as the only way to reach
 * them. At 8px the same thirteen fit in about 560px.
 *
 * Only the vertical side moved. The horizontal padding is what fixes the column
 * widths above, and shrinking it would undo that. */
table.ct-table { table-layout: fixed; }
table.ct-table th,
table.ct-table td { padding: 8px 14px; vertical-align: middle; }

/* Alignment, via the classes the markup already carries.
 *
 * The markup marks every heading and every cell in this table with .align-left or
 * .align-center already - see admin/partials/setup-panel.php - but the only rule
 * for those classes anywhere in the stylesheet is `.align-center { align-items:
 * center }`, and align-items is a flex property. A td is not a flex container, so
 * it did nothing at all: measured, all ten columns rendered left-aligned while
 * their markup said centred, with the base `th { text-align: left }` simply
 * winning. Same for .align-left, which has no rule at all.
 *
 * So alignment is declared here, scoped to this table, using the classes that are
 * already on the elements. Deliberately not fixed globally: .align-center is used
 * on cells in tables right across the app, and correcting it everywhere would
 * centre a lot of columns nobody asked about.
 *
 * th and td are named together in both rules, so a heading can never drift from
 * the column beneath it. */
.ct-table th.align-left,
.ct-table td.align-left { text-align: left; }
.ct-table th.align-center,
.ct-table td.align-center { text-align: center; }

/* Column shares. Scoped to .ct-table deliberately: the col-* names are shared
   across the app's colgroups - .col-number is used by the Dashboard's Contest
   Overview too - so bare .col-date / .col-number / .col-action rules here would
   silently override the pixel widths set in the TABLES section for every other
   table as well. */
.ct-table .col-title    { width: 15%; }
.ct-table .col-event    { width: 11%; }
.ct-table .col-category { width: 12%; }
.ct-table .col-type     { width: 7%; }
.ct-table .col-date     { width: 11%; }
.ct-table .col-number   { width: 7%; }
.ct-table .col-scoring  { width: 10%; }
.ct-table .col-mode     { width: 10%; }
.ct-table .col-status  { width: 9%; }
.ct-table .col-action  { width: 8%; }

/* Only the columns whose content is a short fixed string that must not break.
   The badge columns are deliberately not in this list, so long badges can wrap
   rather than overflow their fixed column. */
.ct-table td[data-label="Type"],
.ct-table td[data-label="Date"],
.ct-table td[data-label="Judges"],
.ct-table td[data-label="Actions"] { white-space: nowrap; }

/* The badge's own side padding is trimmed to preserve room for the table's
   fixed-width columns at laptop sizes. */
.ct-table .badge { padding: 3px 6px; }

/* Date and Judges are each exactly as wide as their content, so at 14px of
   padding the two counts read as one string, "Oct 07, 2026 N/A". The gap between
   two columns is the sum of their paddings, so it takes an asymmetric one to open
   it up without widening the table. */
.ct-table th[data-label="Date"],
.ct-table td[data-label="Date"] { padding-right: 20px; }

/* Title, Grouping and Category carry prose, so they wrap rather than truncate - a name cut off
   with an ellipsis is a name nobody can read. hyphens: auto is the last resort,
   for a single word too long for the column; the document declares lang="en",
   which is what hyphenation needs to pick a dictionary. The title attribute on
   each cell keeps the full text available on hover. */
.ct-table td[data-label="Title"],
.ct-table td[data-label="Grouping"],
.ct-table td[data-label="Category"] {
    overflow-wrap: break-word;
    hyphens: auto;
    -webkit-hyphens: auto;
}

/* Let an open menu escape its card and its wrapper.
 *
 * .card          { overflow: hidden }   - to round off the header
 * .table-wrapper { overflow-x: auto }  - to give a too-wide table a scrollbar
 *
 * The table fits its container at every width, so the scrollbar was never used
 * and the wrapper does not need to clip either. The card keeps its rounded
 * corners without overflow: hidden here because .card-header sets no background
 * of its own - there is nothing for the radius to trim. */
.setup-type-filter {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.contest-list-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 0 14px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.contest-list-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    min-width: 0;
    margin-left: auto;
}
.contest-list-actions .setup-search { flex-wrap: nowrap; }
.contest-list-actions .setup-search .form-control { min-width: 170px; }
@media (max-width: 700px) {
    .contest-list-actions .setup-search { width: auto; }
}

/* ---------------------------------------------------------------
 * CONTEST TAB - Sports and Non-Sports folders
 *
 * Three tabs over one panel, joined along a seam.
 *
 * THE PAINT ORDER, WHICH IS THE WHOLE POINT
 *
 * The container is drawn OVER the tab row, not the other way round. The row is
 * pulled up by exactly the tab's bottom border (2px, matched by the panel's
 * 2px top edge), and the panel's z-index is the higher of the two - so the
 * panel's highlighted top edge runs continuously across the base of every tab
 * and carries on down the panel. The active tab is interrupted by that line
 * rather than merging into it: the selected tab is inserted INTO the panel's
 * highlighted edge, instead of the tab covering the panel's edge and hiding it.
 *
 * Getting this backwards is what produced two earlier wrong answers: with the
 * tab on top and a transparent foot, the panel's highlight vanished under the
 * selected tab and the two read as an unrelated pair.
 *
 * The panel's box-shadow spreads 3px outside its border, and because the panel
 * paints last, that soft emerald halo also falls across the bottom of the tab
 * row - which is the visible sign that the container is the thing on top.
 * ------------------------------------------------------------- */
.contest-group-tabs {
    display: flex;
    gap: 8px;
    /* Matches .contest-group-tab's border-bottom and .contest-group-panel's
       border-top-width. All three are 2px; change one and the seam reopens. */
    margin-bottom: -2px;
    position: relative;
    /* Below the panel. */
    z-index: 2;
}

.contest-group-tab {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 180px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    /* 2px, and visible. It was 0, which left the panel's top border as the only
       thing at the seam; now the tab carries its own foot and the panel's
       highlight is drawn across it. */
    border-bottom: 2px solid var(--border);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    background: var(--bg-secondary);
    color: var(--text-muted);
    text-decoration: none;
    transition: background 0.18s, color 0.18s, border-color 0.18s;
    position: relative;
}
.contest-group-tab:hover { border-color: var(--emerald); color: var(--forest); }
.contest-group-tab.is-active {
    /* No `bottom` offset and no transparent foot. An offset moved the box
       without moving its layout space and left the row a pixel out; a
       transparent foot only made sense while the tab, not the panel, was the
       thing painting over the seam. */
    border-color: var(--emerald);
    background: #fff;
    color: var(--forest);
    /* Above its neighbours, so the selected tab's own outline is not buried -
       but below the panel. */
    z-index: 3;
}
.contest-group-tab:focus-visible { outline: 2px solid var(--emerald); outline-offset: 2px; z-index: 3; }

.contest-group-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--mint);
    color: var(--emerald);
}
.contest-group-tab.is-active .contest-group-icon { background: var(--forest); color: #fff; }

.contest-group-titles { display: flex; flex-direction: column; min-width: 0; }
.contest-group-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--forest);
    line-height: 1.3;
}
.contest-group-sub { font-size: 12px; color: var(--text-muted); }

.contest-group-panel {
    padding: 16px;
    /* The highlight, and the thing that paints LAST.
     *
     * --emerald matches .contest-group-tab.is-active, so the selected tab and
     * this panel share one outline; the 2px top edge is the line that crosses
     * the tab row's base, and the square top-left corner lets the selected tab's
     * edge meet a square corner instead of clipping the card's radius.
     *
     * position + z-index are what make this panel win the overlap against
     * .contest-group-tabs (z-index: 2). Without them the panel is a static
     * sibling, the tab row's positioned box paints over it, and the highlight
     * disappears under the tabs again - the exact bug this ordering fixes.
     *
     * The 3px shadow spreads outside the border and, painting last, hazes the
     * bottom of the tab row. That is deliberate: it is the container's glow
     * visibly reaching up over the folder. */
    position: relative;
    z-index: 4;
    border: 1px solid var(--emerald);
    border-top-width: 2px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) var(--radius-sm);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(8,123,89,0.07), var(--shadow);
}

.contest-category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.contest-list-toolbar .contest-category-tabs {
    flex: 1 1 auto;
    padding: 0;
    margin: 0;
    border: 0;
}
.contest-category-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--forest);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.18s, background 0.18s, color 0.18s;
}
.contest-category-tab:hover { border-color: var(--emerald); background: #F7FBF9; }
.contest-category-tab.is-active {
    border-color: var(--forest);
    background: var(--forest);
    color: #fff;
}
.contest-category-tab:focus-visible { outline: 2px solid var(--emerald); outline-offset: 2px; }
.contest-category-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
}
.contest-category-tab.is-active .contest-category-count {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

/* Scrollable category tabs - limit to 8 visible, then scroll horizontally */
.contest-category-tabs--scroll {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px; /* space for scrollbar */
    margin-bottom: -8px; /* compensate padding */
    /* hide scrollbar in supported browsers, show on hover/focus */
    scrollbar-width: thin;
    scrollbar-color: var(--emerald) transparent;
}
.contest-category-tabs--scroll::-webkit-scrollbar {
    height: 6px;
}
.contest-category-tabs--scroll::-webkit-scrollbar-track {
    background: transparent;
}
.contest-category-tabs--scroll::-webkit-scrollbar-thumb {
    background-color: var(--emerald);
    border-radius: 3px;
}
.contest-category-tabs--scroll::-webkit-scrollbar-thumb:hover {
    background-color: var(--forest);
}

/* Limit to ~8 tabs visible before scrolling */
.contest-category-tabs--scroll .contest-category-tab {
    flex-shrink: 0;
    scroll-snap-align: start;
}

/* Empty state for sports with no categories */
.contest-category-tab--empty {
    flex-shrink: 0;
    padding: 7px 12px;
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
}

/* The card header shows the category name plus "showing N of M", which is the
   honest reading when the Major/Minor pills or the search box are narrowing the
   table below it - a bare count would look like the category had lost rows. */
.contest-table-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    vertical-align: middle;
}

/* Shown until a category is chosen. */
.contest-picker-hint {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 6px 4px;
}
.contest-picker-hint-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--mint);
    color: var(--emerald);
}
.contest-picker-hint-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--forest);
}
.contest-picker-hint-sub { font-size: 13px; color: var(--text-muted); }
.contest-picker-hint .btn { margin-left: auto; }

@media (max-width: 640px) {
    /* -2px, not 12px. The old value undid the seam on small screens only: the
       tab row dropped its overlap, the panel's 2px top border became visible
       again, and a line reappeared across the foot of the selected tab. */
    .contest-group-tabs { gap: 6px; margin-bottom: -2px; }
    .contest-group-tab { min-width: 0; flex: 1; padding: 9px 10px; gap: 8px; }
    .contest-group-icon { width: 34px; height: 34px; border-radius: 10px; }
    .contest-group-icon .lucide { width: 18px; height: 18px; }
    .contest-group-panel { padding: 12px; }
    .contest-list-toolbar { align-items: stretch; flex-direction: column; }
    .contest-list-actions { justify-content: flex-start; flex-wrap: wrap; margin-left: 0; }
    .contest-list-actions .setup-search { width: auto; flex: 1 1 240px; }
    .contest-list-actions .setup-search .form-control { min-width: 0; }
    .contest-picker-hint .btn { margin-left: 0; width: 100%; justify-content: center; }
}

/* ---------------------------------------------------------------
 * CRITERIA TYPE SELECTOR (Single / Multiple Criteria) - FOLDER TABS
 *
 * A compact row of folder-style tabs sitting directly below the contest
 * selector, above the panel they control.
 *
 * Each tab is a real <button> inside a real form, so this works with JavaScript
 * disabled and the pressed state is rendered by the server rather than toggled
 * by script (the panel is replaced wholesale on every AJAX swap, so any
 * client-side state inside it does not survive).
 *
 * THE ALIGNMENT CONTRACT - three numbers that have to agree
 *
 * The tab row and the panel are one shape, joined along a seam. That seam only
 * disappears while these hold:
 *
 *   1. EVERY TAB IS THE SAME HEIGHT, AND ITS HEIGHT IS ITS OWN. Padding and
 *      border widths are identical for the active and inactive states, so the
 *      row has one top edge and one bottom edge instead of a stepped one. The
 *      active tab used to be given three extra pixels of bottom padding to look
 *      "taller"; because the tabs share a bottom edge, that moved its TOP edge
 *      up three pixels instead, and the row read as misaligned. "In use" is now
 *      carried by colour and by which border is transparent - never by a
 *      different box. The form is display:flex so nothing between it and the
 *      button adds height either.
 *
 *   2. THE ROW'S NEGATIVE MARGIN EQUALS THE TAB'S BOTTOM BORDER (both 2px).
 *      That is what makes the active tab's transparent bottom border land
 *      exactly ON the panel's top border instead of 1px short of it. When the
 *      two numbers disagreed, a hairline of page background showed through
 *      between the mint tab and the white panel - the "not connected" look.
 *
 *   3. z-index PUTS THE ACTIVE TAB IN FRONT OF THE PANEL'S BORDER. The panel is
 *      a plain static sibling, so without this the panel's own top border wins
 *      the overlap and draws a line across the foot of the tab.
 *
 * If you change the border width, the padding, or the margin, change all three
 * together - there is no single rule holding them in step.
 * ------------------------------------------------------------- */
.criteria-folder-tabs {
    display: flex;
    gap: 4px;
    /* (2) */
    margin-bottom: -2px;
    position: relative;
    /* (3) */
    z-index: 3;
    flex-wrap: wrap;
}
.criteria-folder-tabs.is-disabled {
    opacity: 0.5;
    pointer-events: none;
    /* No panel follows these, so there is nothing to join to. */
    margin-bottom: 0;
}
.criteria-folder-form {
    margin: 0;
    /* flex, NOT block.
     *
     * The tab is an inline-flex button. Left inside a block-level form it would
     * sit in a LINE BOX, and the form's height would be the button's height plus
     * the line box's descender space - a few pixels of nothing, inherited from
     * the 14px/1.6 body font, that vary with the font stack. The row above then
     * sizes to that inflated form, and the tabs sit proud of the seam with the
     * panel by an amount nobody can predict.
     *
     * As a flex container the button is blockified into a flex item: no line box,
     * no descender space, and the form's height is exactly the button's height. */
    display: flex;
}

/* (1) Identical box for both states: 1 + 10 + 17 + 12 + 2 = 42px. */
.criteria-folder-tab {
    display: inline-flex;
    align-items: center;
    /* Matches .setup-tabs a, so the labels on this row sit on the same optical
       line as the labels on the Contests / Contestants / Judges row above. */
    gap: 8px;
    padding: 10px 20px 12px;
    border: 1px solid var(--border);
    border-bottom: 2px solid var(--border);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    background: #fff;
    color: var(--text-muted);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    /* Only for the ::after accent. No offset here on purpose - an offset would
       move the box without moving its layout space, which is what knocked the
       row's edges out of line in the first place. */
    position: relative;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    white-space: nowrap;
}
.criteria-folder-tab .lucide { flex-shrink: 0; }
.criteria-folder-tab:hover {
    background: var(--mint);
    color: var(--forest);
    border-color: var(--emerald);
}
.criteria-folder-tab:focus-visible {
    outline: 2px solid var(--emerald);
    outline-offset: 2px;
    z-index: 4;
}

/* The tab in use.
 *
 * Same 42px box as its neighbour. Two changes carry the whole state:
 *
 *   - border-bottom: transparent. The background is clipped to the border box
 *     by default, so this 2px strip shows MINT, not the page behind it - the
 *     mint tab therefore runs unbroken down into the panel below.
 *   - z-index, so that strip paints over the panel's own top border.
 */
.criteria-folder-tab.is-active {
    background: var(--mint);
    color: var(--forest);
    border-color: var(--emerald);
    border-bottom-color: transparent;
    font-weight: 700;
    z-index: 4;
}
/* Gold underline, sitting inside the mint above the seam. */
.criteria-folder-tab.is-active::after {
    content: '';
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 5px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    pointer-events: none;
}

/* The panel the tabs are heading.
 *
 * .card is rounded on all four corners. The tabs are square-bottomed and start
 * at the same left edge as the panel, so leaving the top corners rounded means
 * the tab covers one of them and leaves the other floating - and WHICH one
 * changes when the admin switches tabs, so the panel would change shape. Both
 * top corners are squared instead, and the panel keeps its shape either way. */
.criteria-folder-tabs + .card {
    border-radius: 0 var(--radius) var(--radius) var(--radius);
}

/* When the hierarchy migration has not run, the notice replaces the panel the
   tabs would have joined to, so it takes the squared top-left corner instead. */
.criteria-folder-notice {
    margin-bottom: 20px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) var(--radius-sm);
}
@media (max-width: 600px) {
    .criteria-folder-tab {
        padding: 9px 12px 11px;
        font-size: 13px;
    }
    .criteria-folder-tab .lucide { width: 15px; height: 15px; }
}

/* ---------------------------------------------------------------
 * MAIN CRITERIA / SUBCRITERIA TABLES
 *
 * Fixed column widths, for the same reason .ct-table uses them: under auto
 * layout this table's intrinsic minimum is wider than the card on a laptop, so
 * .table-wrapper scrolls sideways and the Actions column - the only one with a
 * control in it - is the first thing pushed off the right edge.
 * ------------------------------------------------------------- */
.mc-table { table-layout: fixed; width: 100%; }
.mc-table .col-mc-name   { width: 40%; }
.mc-table .col-mc-weight { width: 16%; }
.mc-table .col-mc-subs   { width: 20%; }
/* Was 24% for a cell holding three side-by-side buttons. One "Actions" trigger
   needs far less, and the width goes to the name column instead - which is the
   column that was being squeezed by exactly the crowding this fixes. */
.mc-table .col-mc-action { width: 16%; }
.mc-table .col-mc-action,
.mc-sub-table .col-mc-action { white-space: nowrap; }
/* Narrowest the trigger can be without the label wrapping onto two lines: the
   word "Actions", its chevron and the button's own horizontal padding. */
.mc-sub-table .col-mc-action { min-width: 84px; }

.mc-table th.align-left, .mc-table td.align-left { text-align: left; }
.mc-table th.align-center, .mc-table td.align-center { text-align: center; }

/* Only the name is allowed to wrap on the Main Criteria rows. The description
   cell and its clamp went with that column - a rule left pointing at a label no
   longer rendered is a rule nobody can work out the intent of.

   The subcriteria equivalents now live with .mc-sub-table's own column widths,
   because they are the same problem one level down and had drifted apart from
   them. */
.mc-table td[data-label="Main Criteria"] {
    overflow-wrap: anywhere;
}
.mc-row:hover { background: #F2F8F5; }

/* The subcriteria panel lives in its own row directly under its Main Criteria,
   so a parent is never more than one line away from its children. The <details>
   inside is native, so opening it needs no script and survives the panel being
   replaced wholesale on every AJAX swap. */
.mc-sub-wrap > td { padding: 0; background: #FAFCFB; }
.mc-details { border-top: 1px dashed var(--border); border-bottom: 1px dashed var(--border); }
.mc-details[open] { border-bottom: none; }
.mc-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    list-style: none;
    font-size: 13px;
    color: var(--text-muted);
}
.mc-summary::-webkit-details-marker { display: none; }
/* The chevron is rotated rather than swapped, so the affordance does not depend
   on a second icon being loaded. */
.mc-summary > .lucide { transition: transform 0.15s; flex-shrink: 0; }
.mc-details[open] > .mc-summary > .lucide { transform: rotate(90deg); }
.mc-summary:hover { background: #F2F8F5; }
.mc-summary:focus-visible { outline: 2px solid var(--emerald); outline-offset: -2px; }
.mc-summary-text { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-width: 0; }
.mc-summary-text strong { color: var(--forest); font-size: 13.5px; }
.mc-summary-meta { font-size: 12.5px; }

.mc-sub-inner { padding: 0 16px 16px; }
/* A nested table inside an already-bordered card: no outer border, and its own
   header tinted so the two levels are told apart at a glance rather than by
   reading the column labels. */
.mc-sub-table { margin: 0; background: #fff; border-radius: var(--radius-sm); }

/* table-layout: fixed, which .mc-table already sets for the Main Criteria table and
   this nested table was NOT getting - it carries its own class, so the parent
   table's layout algorithm did not apply to it.

   Without it the browser lays the subcriteria table out by CONTENT and treats
   every <col> width as a suggestion it can overrule. Measured with fixed off: two
   columns declared at 10% each came out at 131px and 128px, because that is what
   their content asked for, and the Description column - the one with real prose to
   wrap - was squeezed to 105px and clipped. The declared widths were being read
   and then ignored, which is why the columns looked crooked: each was sized to
   its own contents rather than to the grid the header row set out. */
.mc-sub-table { table-layout: fixed; width: 100%; }

/* Column widths for the subcriteria table, set HERE rather than by inheriting the
   Main Criteria classes above.

   ONLY above 768px. Both tables carry .table-responsive-stack, and at 768px and
   below that class turns every cell into a full-width block with its
   data-label printed beside it - the stacked-card layout at style.css:803. The
   <col> widths are inert in that mode (the measurement below 768px reads 0px on
   every column for exactly this reason), so percentage widths here apply to the
   real table only.
   Two reasons, and the second is the one that was actually breaking the page:

   1. .mc-table's rules are descendant selectors, so a nested .mc-sub-table was
      picking up col-mc-name's 40% and applying it to the SUBcriteria name - a
      width chosen for a Main Criteria row, now governing a different column.

   2. col-mc-desc no longer exists on the Main Criteria table at all (that column
      was removed), so the subcriteria's description column fell back to `auto`
      and the two fixed .col-score columns - 128px each, sized for the Contest
      Setup tables - took 260px of a 762px table. The description was left 105px,
      and a sentence that needs 264px of height was clipped into 63px. That is
      where "some words are not visible" came from.

   Percentages that add up to 100 so nothing overflows the parent cell. The two
   score columns drop to a tenth each: they hold at most "100.00", and were
   spending more width between them than the description needed. */
.mc-sub-table .col-mc-name   { width: 24%; }
.mc-sub-table .col-mc-desc   { width: 32%; }
/* Both score columns share one class, so one declaration sizes both - and it has
   to override .col-score's 128px outright, because a px width from the Contest
   Setup tables beats a percentage declared here on order of appearance and the
   two cannot both hold. Verified by the readout: before this, the two score
   columns took 260px of a 762px table between them. */
.mc-sub-table .col-score     { width: 10%; }
.mc-sub-table .col-mc-weight { width: 10%; }
.mc-sub-table .col-mc-action { width: 14%; }

/* Long names and descriptions wrap instead of pushing the table wider. Without
   this a single long subcriterion name forces the whole nested table past the
   width of the cell it sits in, which scrolls the outer table sideways and
   hides the Actions column off the right edge. */
.mc-sub-table td[data-label="Subcriteria"],
.mc-sub-table td[data-label="Description"] {
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* The description is NOT clamped, and that is a correction rather than an
   omission.

   A two-line clamp was applied here to stop one long description from making its
   row taller than its neighbours, by turning the <td> itself into a
   -webkit-box. Two things went wrong with that, and both were visible on the
   page:

   1. It hid text. The clamp is a fixed two lines with no ellipsis and no
      anything else, so the rest of the sentence was simply not there. Measured:
      45px of description hidden on the first row and 22px on the second -
      roughly one and a half lines each, cut off mid-word.

   2. It broke the grid. Taking the cell out of the table box model made its
      height independent of the row, so the horizontal rules stopped lining up
      with the cells they belong to - rows measured 36px and 63px against each
      other in the same column, and a clipped half-line hung below the rule.

   Letting the description wrap costs a taller row, which is a fair price: the
   table already lives in a .table-scroll-tall container, and an admin setting
   up a rubric needs to read what each subcriterion says. */
.mc-sub-table td[data-label="Description"] {
    vertical-align: top;
}

/* Header and footer rows each state their BACKGROUND and their TEXT COLOUR.
   Neither used to, and both were inheriting from the shared
   `table.table-responsive-stack th` rule, which paints a dark forest header with
   white text. That is right for a header and exactly wrong for a footer:

     thead  measured #71817B on #004D3B  = 2.61:1  (WCAG AA needs 4.5)
     tfoot  measured #FFFFFF on #F4F7F6  = 1.08:1  - effectively invisible

   The footer is where the group total and the sentence explaining it sit, so
   "Total Subcriteria Weight" was printed in near-white on near-white and
   "must add up to 100% of this Main Criteria" ran off the right edge (45px of
   it, nowrap inherited from the same shared rule).

   The selectors carry `table` so they outrank the shared rule at
   (0,1,2) rather than tying with it and depending on source order. */
table.mc-sub-table thead th {
    background: var(--forest);
    color: #E8F1EE;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    white-space: nowrap;
}
table.mc-sub-table tfoot th {
    background: var(--bg-secondary);
    color: var(--text);
    border-top: 2px solid var(--border);
    font-size: 12.5px;
    /* Wraps, unlike the header. The note is a sentence and the cell it sits in
       is a third of the table; nowrap truncated it mid-word. */
    white-space: normal;
}
.mc-sub-table thead th, .mc-sub-table tbody td, .mc-sub-table tfoot th {
    padding: 9px 12px;
}
.mc-sub-table tbody tr:hover { background: #F7FBF9; }
/* The footer's colours are set by table.mc-sub-table tfoot th above. This used to
   restate background, border and size here with no colour, which is why it
   inherited white text onto a light background. */
.mc-foot-note { font-weight: 400; color: var(--text); font-size: 12px; }

/* Weight state. Three states, three colours, used identically for a Main
   Criteria weight, a subcriteria group and the category total - so a red number
   means the same thing wherever it appears. */
.mc-ok    { color: var(--emerald); }
.mc-under { color: #B4790B; }
.mc-over  { color: #B42318; }

.mc-total-row { background: #F4F7F6; }
.mc-total-row td { border-top: 2px solid var(--border); }
.mc-total-figure { font-size: 15px; }
.mc-total-status { font-size: 12.5px; color: var(--text-muted); }
.mc-total-status .lucide { margin-right: 4px; vertical-align: -2px; }

.mc-sub-alert { margin: 12px 0 0; font-size: 13px; padding: 10px 14px; }
.mc-problems { margin: 6px 0 0 20px; font-size: 13.5px; }
.mc-problems li { margin-bottom: 3px; }
.mc-note { font-size: 12.5px; color: var(--text-muted); margin-top: 8px; }
.mc-empty { padding: 28px 20px; }
.mc-empty .sub { max-width: 420px; margin-left: auto; margin-right: auto; }

.criteria-sub-parent {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin-bottom: 16px;
    background: var(--mint);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    color: var(--forest);
}
.criteria-sub-parent .lucide { flex-shrink: 0; }

/* Read-only renderings of the hierarchy: the judge's brief (judge/info.php) and
   the Form Preview tab. Grouped under one class so the two never drift, and
   deliberately plain - these pages are read, not edited, and they inherit the
   judge portal's own table styles rather than the admin's. */
.info-criteria-group { margin-bottom: 18px; }
.info-criteria-group:last-child { margin-bottom: 0; }
.info-criteria-group-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 8px 0 10px;
    margin-bottom: 6px;
    border-bottom: 2px solid var(--border);
}
.info-criteria-group-head strong { font-size: 14.5px; color: var(--forest); }
.info-criteria-group .data-table,
.info-criteria-group .table { margin: 0; }
.info-criteria-group tfoot th {
    background: var(--bg-secondary);
    font-size: 12px;
    color: var(--text-muted);
    text-align: left;
}
.info-criteria-group tfoot th:not(:first-child) { text-align: center; }

@media (max-width: 760px) {
    /* The Main Criteria table still drops to auto here. The subcriteria table does
     * NOT - see the note above it.
     *
     * .mc-table is a flat list of six short cells and reads fine sized by content.
     * .mc-sub-table has a wrapping description in it, and auto layout on a table
     * with wrapping text is exactly what lets the rows disagree about the column
     * boundaries. It stays fixed, which means the columns stay in step at every
     * width; the text wraps and the two-line clamp still applies below this
     * breakpoint. */
     *
     * An earlier version of this comment claimed auto layout kept the header and
     * body in step, so nothing was lost by using it on both. Measuring that
     * assumption showed the opposite: under `auto` every row resolves its own column
     * widths from its own content, so the header row and the body rows land on
     * DIFFERENT boundaries. Measured at 760px, every one of the six columns was
     * 77px out and 573px off in width from its own header. That is the "lines are
     * not straight" symptom, and it was this rule causing it. */
    .mc-table { table-layout: auto; }
    .mc-sub-inner { padding: 0 10px 12px; }
    .mc-summary { padding: 10px 12px; }
}

.ct-wrap {
    overflow: visible;
    /* Query container so the padding trim below follows the width this card
       actually has. A viewport media query cannot: the sidebar is a fixed 300px,
       so content width and window width are about 358px apart, and every case
       worth handling sits inside that gap. */
    container-type: inline-size;
    /* Limit table to ~8 rows + header, then scroll vertically */
    max-height: 420px; /* ~8 rows at ~44px each + header */
    overflow-y: auto;
    overflow-x: auto;
}
.ct-wrap:has(.ct-table) {
    /* Only apply scroll when table exists */
}
.ct-card { overflow: visible; }

/* Actions pinned to the right edge. It needs the row's own background, or the rows
   show through it.

   No shadow here. There was one - a -6px 0 6px -6px blur in the forest green -
   to read as floating above the rows, which is only meaningful while the table is
   scrolling sideways under it. It is not: the table fits its card at every width,
   so the column never overlaps anything and the shadow just drew a permanent
   vertical line down the table, immediately after Status. */
.ct-table th:last-child,
.ct-table td:last-child {
    position: sticky; right: 0; z-index: 2;
    background: #fff;
}
.ct-table thead th:last-child { z-index: 3; background: var(--forest); }
.ct-table tbody tr:hover td:last-child { background: #F2F8F5; }

/* Sticky header for vertical scrolling in .ct-wrap */
.ct-wrap .ct-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--forest);
    color: #fff;
}
.ct-wrap .ct-table thead th:last-child { z-index: 3; }

/* Lift the host cell of an open menu above its sibling rows. Set by
   action-menu.js; see liftHost() there for why the cell, and not the menu, is
   what has to move.

   Written as td:last-child.act-host-open, which is 0,3,1, rather than the
   tidier td.act-host-open at 0,2,1 - the same specificity as the sticky rule
   above, which sits later in the file and would simply win. */
.ct-table td:last-child.act-host-open { z-index: 30; }

/* Narrow cards.
 *
 * Side padding is the first thing to go: at 14px a side, ten columns spend 280px
 * on padding alone, which is more than the content needs at the narrow end. Each
 * step below trims it a little further and gives Title a slightly larger share,
 * because it is the one column holding prose and the one that suffers most when
 * squeezed. Four steps take a 780px card from 920px of table down inside its 778.
 *
 * Keyed to the card's own width, not the window: the sidebar is fixed, so the two
 * differ by about 358px and a viewport breakpoint lands in the wrong place. */
@container (max-width: 1150px) {
    table.ct-table th,
    table.ct-table td { padding-left: 11px; padding-right: 11px; }
    .ct-table th[data-label="Date"],
    .ct-table td[data-label="Date"] { padding-right: 16px; }
}
@container (max-width: 980px) {
    table.ct-table th,
    table.ct-table td { padding-left: 9px; padding-right: 9px; }
    .ct-table th[data-label="Date"],
    .ct-table td[data-label="Date"] { padding-right: 14px; }
    .ct-table .col-title    { width: 14%; }
    .ct-table .col-category { width: 11%; }
    .ct-table .col-number   { width: 6%; }
    .ct-table .col-action   { width: 11%; }
}
@container (max-width: 880px) {
    /* Badges stop being nowrap.
     *
     * "Judge-Based" is the longest one and needs about 95px; at this width Mode's
     * share is 69px. Under fixed layout a badge that does not fit spills into the
     * column beside it, measured at +26px. The two alternatives are both worse:
     * taking the 26px out of Title leaves it unreadably narrow, which is exactly
     * what the do-not-over-compress rule rules out, and dropping a column would
     * change what the table shows.
     *
     * So the badge breaks instead - and it breaks at its own hyphen, giving
     * "Judge-" / "Based". Two lines in one row at a narrow card, with every
     * column still aligned and nothing overflowing. */
    .ct-table .badge { white-space: normal; }
    table.ct-table th,
    table.ct-table td { padding-left: 7px; padding-right: 7px; }
    .ct-table th[data-label="Date"],
    .ct-table td[data-label="Date"] { padding-right: 12px; }
    .ct-table .col-title    { width: 15%; }
    .ct-table .col-event    { width: 11%; }
    .ct-table .col-category { width: 10%; }
    .ct-table .col-type     { width: 7%; }
    .ct-table .col-date     { width: 10%; }
    .ct-table .col-number   { width: 7%; }
    .ct-table .col-scoring  { width: 10%; }
    .ct-table .col-mode     { width: 10%; }
    .ct-table .col-status   { width: 9%; }
    .ct-table .col-action   { width: 11%; }
}
@container (max-width: 820px) {
    table.ct-table th,
    table.ct-table td { padding-left: 5px; padding-right: 5px; }
    .ct-table th[data-label="Date"],
    .ct-table td[data-label="Date"] { padding-right: 10px; }
    .ct-table .col-title    { width: 14%; }
    .ct-table .col-event    { width: 10%; }
    .ct-table .col-category { width: 10%; }
    .ct-table .col-type     { width: 7%; }
    .ct-table .col-date     { width: 11%; }
    .ct-table .col-number   { width: 8%; }
    .ct-table .col-scoring  { width: 10%; }
    .ct-table .col-mode     { width: 9%; }
    .ct-table .col-status   { width: 10%; }
    .ct-table .col-action   { width: 11%; }
}
@media (max-width: 768px) {
    /* Below this the responsive stack takes over and the table stops being a
       table: each cell gets a full line of its own. A sticky column has nothing
       left to stick to. */
    .ct-table th:last-child,
    .ct-table td:last-child { position: static; }
}

/* ---------- Settings page ----------
   Two cards, side by side on a wide screen and stacked on a narrow one. The
   organization card is the wider of the two because its switch row carries a
   sentence of explanation next to the control; the account card has three short
   forms and does not need the room.

   grid-template-columns, not the .dashboard-grid the page used before: that is
   repeat(auto-fit, minmax(340px, 1fr)), which split a two-card page into two
   EQUAL columns and left the org form with a 600px-wide name box beside a stack
   of short password fields. minmax(0, ...) matters as much as the track size -
   without it a grid item defaults to min-width:auto and refuses to shrink below
   its content, which is what pushes a card past the viewport. */
.settings-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 20px;
    /* Stretch, not start: both cards share a row, and without this the Account
       Settings card stops at its content while the taller Organization card runs
       on, leaving two visibly different-sized boxes side by side. */
    align-items: stretch;
}
@media (max-width: 980px) {
    .settings-grid { grid-template-columns: minmax(0, 1fr); }
}

/* A titled block inside the account card. The rule under the heading is what
   separates "change your username" from "change your password" - without it the
   two forms run together and read as one long list of five fields. */
.settings-subsection + .settings-subsection {
    margin-top: 26px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}
.settings-subtitle {
    display: flex; align-items: center; gap: 7px;
    margin: 0 0 16px;
    font-size: 12px; font-weight: 800; letter-spacing: .6px;
    text-transform: uppercase; color: var(--forest);
}
.settings-subtitle .lucide { color: var(--gold-deep); }

/* The two account actions on one row.
 *
 * They sit below both field groups rather than inside either form, because each
 * button names its own form through a `form` attribute - so a username change
 * can never post the password fields and a password change can never post the
 * username. The rule above them is what makes that read as deliberate: without
 * it the buttons look like they belong to whichever group happens to end nearest,
 * which is the change-password one. */
.account-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}
.account-actions .btn { flex: 0 1 auto; }

/* ---------- Account Settings: one form at a time ----------
 *
 * Two panels, one visible. The switch is a pair of radio inputs, so it is pure
 * CSS and works with JavaScript off - the same progressive-enhancement rule the
 * rest of the app follows.
 *
 * The radios are invisible but NOT display:none. display:none removes an element
 * from the tab order entirely, which would leave a keyboard user with no way to
 * reach the switch at all; hidden-but-present keeps it focusable, and arrow keys
 * move through a radio group natively. The visible controls are <label>s pointing
 * at them, so a mouse click needs no script either.
 *
 * The `hidden` attribute on the inactive panel is the no-JavaScript-safe default
 * and is what the server sets; settings.js removes it when it takes over, so the
 * two never disagree about which panel is showing. */
.account-panel-state {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0; border: 0;
    clip: rect(0 0 0 0); clip-path: inset(50%);
    overflow: hidden; white-space: nowrap;
}
/* The label that switches panels. Styled as a button because that is what it
   looks like, and given role="button" plus tabindex so a screen reader and a
   keyboard treat it as one - a bare <label> is not announced as a control. */
.account-switch-btn {
    cursor: pointer;
    user-select: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.account-switch-btn:focus-visible {
    outline: 2px solid var(--gold); outline-offset: 2px;
}
/* The `hidden` attribute is NOT used for this switch. There is deliberately no
   rule here keyed on it: a rule that only ever HIDES a panel cannot show one,
   which is how the switch ended up dead - clicking the label checked the radio,
   but nothing ever removed the attribute, so the panel stayed put.

   Instead the panels are driven straight off the checked radio, because the radios
   are siblings of the sections inside .account-switch and CSS can reach them with
   the general sibling combinator. That makes the whole switch work with no
   JavaScript at all, which is the point of putting it on radios. */

/* Exactly one panel on screen, chosen by which radio is checked.
 *
 * BOTH are hidden by default and each is shown only by its own radio. The first
 * version hid only the password panel, which was the whole bug: a <section> is
 * display:block by default, so with nothing hiding it the username form stayed on
 * screen when you switched to the password form - the new panel simply appeared
 * underneath instead of replacing it.
 *
 * display:none rather than visibility:hidden, so the hidden form's fields are
 * neither submitted nor part of the layout. The server renders the correct radio
 * checked, so this is right on first paint too, with JavaScript off entirely. */
.account-panel--user,
.account-panel--pass { display: none; }
#accountPanelUser:checked ~ .account-panel--user { display: block; }
#accountPanelPass:checked ~ .account-panel--pass { display: block; }

/* The panel that is on screen gets a little air above it, so the switch reads as a
   change of view rather than a jump cut. Scoped to :checked so the hidden panel
   does not contribute margin. */
#accountPanelUser:checked ~ .account-panel--user,
#accountPanelPass:checked ~ .account-panel--pass { margin-top: 4px; }

/* Shown in place of the organization form when the viewer may not edit it. */
.settings-readonly .form-control[readonly] {
    background: var(--bg-secondary); color: var(--text-muted); cursor: default;
}

/* ---------- Toggle switch ----------
   A hidden input drives a styled track, which is what makes it a switch rather
   than a checkbox that happens to be wide.

   The real <input> is NOT display:none - it is made invisible but still laid out,
   so it keeps its place in the tab order and still receives focus. A
   display:none input cannot be reached by keyboard at all, which would make the
   setting unreachable without a mouse. Focus is shown with :focus-visible on the
   track instead, so the ring is drawn where the eye is: on the control. */
.switch-row { display: flex; align-items: flex-start; gap: 12px; }
.switch-input {
    position: absolute; width: 1px; height: 1px;
    margin: -1px; padding: 0; border: 0;
    clip: rect(0 0 0 0); clip-path: inset(50%);
    overflow: hidden; white-space: nowrap;
}
.switch { cursor: pointer; flex: 0 0 auto; line-height: 0; }
.switch-track {
    display: block; position: relative;
    width: 46px; height: 26px;
    background: #C9D5D0;
    border-radius: 999px;
    transition: background .18s ease;
}
.switch-thumb {
    position: absolute; top: 3px; left: 3px;
    width: 20px; height: 20px;
    background: #fff; border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
    transition: transform .18s ease;
}
.switch-input:checked ~ .switch .switch-track { background: var(--emerald); }
.switch-input:checked ~ .switch .switch-thumb { transform: translateX(20px); }
/* Gold, not grey: the ring has to be visible on the forest-green track too, and
   the app's own focus colour elsewhere is the gold accent. */
.switch-input:focus-visible ~ .switch .switch-track {
    outline: 2px solid var(--gold); outline-offset: 2px;
}
.switch-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.switch-state { font-size: 14px; font-weight: 700; color: var(--text); }
.switch-hint { font-size: 12.5px; line-height: 1.45; color: var(--text-muted); }

/* ---------- Row "Actions" menu ----------
   Replaces the run of side-by-side buttons a table row used to carry. Those
   buttons made the row mostly controls, which squeezed the columns that
   actually describe the row.

   The list is absolutely positioned, so opening it costs the row no height and
   the table does not reflow. z-index lifts it clear of the rows below; without
   it the next row's border painted straight over the open menu. */
.act-menu { position: relative; display: inline-block; }
/* Compact trigger: a table row's control, not a page-level button. */
.act-menu .act-menu-trigger {
    padding: 4px 9px; font-size: 12px; line-height: 1.3;
    border-radius: 7px; gap: 3px; min-height: 0;
}
.act-menu-trigger .lucide { transition: transform .15s ease; margin-left: 1px; width: 12px; height: 12px; }
.act-menu.is-open .act-menu-trigger .lucide { transform: rotate(180deg); }
.act-menu-list {
    position: absolute; right: 0; top: calc(100% + 4px);
    min-width: 140px; z-index: 9999;
    display: flex; flex-direction: column;
    padding: 4px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    text-align: left;
}
.act-menu-list[hidden] { display: none; }
/* One rule for links and for the buttons that submit an action form, so a POST
   action and a plain link are indistinguishable in the menu. */
.act-menu-item {
    display: flex; align-items: center; gap: 7px; width: 100%;
    padding: 6px 9px; border: 0; border-radius: 6px;
    background: none;
    font-family: inherit; font-size: 12.5px; font-weight: 500;
    color: var(--text); text-decoration: none; text-align: left;
    cursor: pointer; white-space: nowrap;
}
.act-menu-item:hover,
.act-menu-item:focus-visible {
    background: var(--mint); color: var(--forest); outline: none;
}
.act-menu-item .lucide { color: var(--emerald); flex-shrink: 0; width: 13px; height: 13px; }
.act-menu-item.is-danger { color: #B42318; }
.act-menu-item.is-danger .lucide { color: #B42318; }
.act-menu-item.is-danger:hover,
.act-menu-item.is-danger:focus-visible { background: #FDECEA; color: #B42318; }
/* Opens above instead of below when there is no room beneath it, so the last
   row of a long table can still reach its actions. */
.act-menu.is-up .act-menu-list { top: auto; bottom: calc(100% + 4px); }

/* Medal chip. Named by medal rather than by colour, so the label still carries
   the meaning if the palette is ever changed. */
.dash-medal {
    display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .04em;
    padding: 3px 8px; border-radius: 999px; white-space: nowrap;
}
.dash-medal-gold { background: rgba(214, 170, 50, .18); color: #8A6A12; }
.dash-medal-silver { background: rgba(148, 163, 184, .22); color: #4B5563; }
.dash-medal-bronze { background: rgba(201, 128, 62, .18); color: #8A4B1D; }
.dash-medal-white { background: #F3F4F6; color: #6B7280; border: 1px solid #E5E7EB; }
.dash-medal-gray { background: #F2F5F4; color: #667370; }

/* Manual score sheet
 *
 * table-layout: fixed is load-bearing here, not a preference. The sheet repaints
 * itself as the admin types: Rank goes from an em dash to a "Rank N" badge and
 * Placement from an em dash to "Champion" or "1st Place", and the rows are also
 * reordered into score order. Under the default auto layout every row is sized
 * against its own content, so a row whose badges had just grown took width from
 * the name column and pushed every following column sideways - the headings no
 * longer sat over their data.
 *
 * With fixed layout the widths declared on the colgroup are authoritative, so
 * the header and every row agree whatever the cells currently contain. Anything
 * wider than its column wraps, or is reached through the wrapper's horizontal
 * scroll, rather than shifting the whole grid.
 *
 * The name column is the only one left to absorb the remainder. */
.ms-table { table-layout: fixed; }
/* Qualified with the element + class exactly as the base table rule is
   (`table.data-table th`, 0,1,2). A bare `.ms-table th` is 0,1,1 and loses to it
   on specificity whatever order they appear in, so the padding below would
   silently never apply. */
table.ms-table th,
table.ms-table td { padding: 12px 14px; vertical-align: middle; }
.ms-points-bar {
    display: flex; flex-wrap: wrap; gap: 16px;
    margin-bottom: 12px; padding: 8px 12px;
    background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 8px;
    font-size: 13px; color: #334155;
}
.ms-pt { font-weight: 600; }
.ms-col-num { text-align: center; font-weight: 700; color: #64748B; }

/* Column widths for the manual score entry grid - all of them, in one place.
 *
 * Seven shares of 100%, and the contestant column is given one like every other.
 *
 * That last part is the whole fix. Under table-layout: fixed a percentage is
 * resolved against the table's own width, and whatever is left afterwards is handed
 * to the columns that have no percentage. The contestant column had none - it
 * carried only `min-width: 200px`, which fixed layout ignores - so it took the
 * entire remainder: measured, 348px of a 1450px table, and it grew with the window
 * while the numbers and badges beside it sat at their minimum. Naming a share for
 * it means the row adds up, and the space is shared out instead of pooled.
 *
 * 20% keeps the contestant column close to its content: the longest name this table
 * holds, "Blue Team Basketball girls", is about 185px. The rest are sized to what
 * they hold - the score input needs about 140px, a placement badge about 150px.
 *
 * This replaces a scatter of declarations that had grown up separately around this
 * table: rank, place, points and status each carried their own pixel width; num
 * and score carried theirs on rules that also set text-align and colour; and there
 * was a stray `width: 140px` on .ms-col-score sitting later in the file than this
 * block, which would have quietly overridden the share below. */
.ms-col-num    { width: 7%; }
.ms-col-name   { width: 24%; }
.ms-col-score  { width: 20%; }
.ms-col-rank   { width: 11%; }
.ms-col-place  { width: 13%; }
.ms-col-points { width: 11%; }
.ms-col-status { width: 14%; }
.ms-team { display: inline-flex; align-items: center; gap: 8px; }
.ms-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
    border: 1px solid rgba(0,0,0,.1);
}
.ms-team-green .ms-dot { background: #22c55e; }
.ms-team-blue .ms-dot { background: #3b82f6; }
.ms-team-red .ms-dot { background: #ef4444; }
.ms-team-yellow .ms-dot { background: #eab308; }
.ms-team-gray .ms-dot { background: #94a3b8; }
.ms-name { font-weight: 600; color: #1e293b; }
.ms-input {
    /* Fills its own column and no more. max-width: 130px left the input
       narrower than the cell it was given, which is wasted space, and
       width: 100% alone would let a long value stretch the column.
       box-sizing keeps the padding and border inside the 100%. */
    width: 100%; max-width: 100%; box-sizing: border-box;
    padding: 6px 10px;
    border: 1px solid #CBD5E1; border-radius: 6px;
    font-size: 14px; font-variant-numeric: tabular-nums;
    text-align: right; background: #fff; color: #1e293b;
    transition: border-color .15s, box-shadow .15s;
}
.ms-input:focus { outline: none; border-color: #087B59; box-shadow: 0 0 0 3px rgba(8, 123, 89, .15); }
.ms-input.is-invalid { border-color: #C0392B !important; box-shadow: 0 0 0 2px rgba(192, 57, 43, .16); }
/* Alignment. The base rule left-aligns every heading, so "RANK" and "PLACEMENT"
   sit hard against the left edge of a column holding a centred badge. Short
   columns centre so the heading reads over its own content; the contestant name
   stays left, since centring a name is never an improvement. th and td are named
   together so a heading can never drift from the column under it. */
table.ms-table th.ms-col-num,
table.ms-table td.ms-col-num,
table.ms-table th.ms-col-rank,
table.ms-table td.ms-col-rank,
table.ms-table th.ms-col-place,
table.ms-table td.ms-col-place,
table.ms-table th.ms-col-points,
table.ms-table td.ms-col-points,
table.ms-table th.ms-col-status,
table.ms-table td.ms-col-status { text-align: center; white-space: nowrap; }
table.ms-table th.ms-col-score,
table.ms-table td.ms-col-score { text-align: center; }
.ms-col-rank .badge, .ms-col-place .badge { font-size: 12px; padding: 4px 8px; }
.ms-status { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.ms-status.badge-blue { background: #DBEAFE; color: #1D4ED8; }
.ms-status.badge-gray { background: #F1F5F9; color: #64748B; }
.ms-status.badge-green { background: #DCFCE7; color: #166534; }
.ms-status.badge-amber { background: #FEF3C7; color: #92400E; }
.ms-actions { display: flex; gap: 12px; align-items: center; margin-top: 16px; padding-top: 12px; border-top: 1px solid #E2E8F0; }
.ms-finalize { margin-top: 16px; padding-top: 12px; border-top: 1px solid #E2E8F0; }

/* Matrix table category/date line */
.matrix-category {
    margin-top: 3px; font-size: 11px; font-weight: 500; color: #fff;
    text-transform: none; letter-spacing: 0;
}
.matrix-category .matrix-sep { color: rgba(255,255,255,.55); margin: 0 4px; }

/* Animolympics tagline moved down */
.lp-hero-text { margin-top: 20px; }

/* Print button in Major/Minor results */
.results-print-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 8px;
    background: #fff; color: var(--forest); border: 1px solid var(--border);
    font-size: 12.5px; font-weight: 600; text-decoration: none;
}
.results-print-btn:hover { border-color: var(--emerald); color: var(--emerald); }

.login-error {
    display: flex; align-items: flex-start; gap: 9px;
    background: #FDF0F0; border: 1px solid #F5C2C2; color: #A11717;
    border-radius: 10px; padding: 11px 14px; margin-bottom: 20px;
    font-size: 13.5px; line-height: 1.5; text-align: left;
}
.login-error .lucide { flex-shrink: 0; margin-top: 1px; }

/* --- Forgot / reset password pages ---------------------------------
 * Same shape as .login-error but green, so "we emailed you" reads as the
 * outcome of the form rather than as another problem. Used by the
 * forgot-password confirmation and by the reset-password success state. */
.login-note {
    display: flex; align-items: flex-start; gap: 9px;
    background: #EDF6F1; border: 1px solid #C6E0D3; color: #0A4D3B;
    border-radius: 10px; padding: 11px 14px; margin-bottom: 20px;
    font-size: 13.5px; line-height: 1.5; text-align: left;
}
.login-note .lucide { flex-shrink: 0; margin-top: 1px; }
.login-note.success {
    background: #EDF6F1; border-color: #C6E0D3; color: #0A4D3B;
}

/* Small helper line under a login field. */
.login-hint {
    margin: 7px 2px 0;
    font-size: 12.5px; line-height: 1.45; color: #5C6B64;
}

/* A <a> wearing the submit button, for the two states that are a single
 * onward action instead of a form (sign in / request a new link). */
.login-submit.as-button {
    text-decoration: none;
    margin-top: 4px;
}

@media (max-width: 420px) {
    .login-card { padding: 32px 22px 26px; border-radius: 14px; }
    .login-title { font-size: 23px; }
}

/* ---------------------------------------------------------------
 * DASHBOARD
 * ------------------------------------------------------------- */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; }
/* Grid items carry the same min-width:auto floor as flex items, so a card
   holding a wide table would refuse to fit its track and stretch the grid.
   This is the same fix as .main-content / .page-content, one level down: the
   table overflows inside its own wrapper rather than pushing the card wider. */
.dashboard-grid > * { min-width: 0; }

/* Dashboard date filter ---------------------------------------------
 * Lives in the top bar beside the page title, supplied by the page through
 * $headerActions. Sized to sit in line with the title rather than push it down.
 */
.top-bar-title { flex-shrink: 0; }
.top-bar-actions {
    display: flex; align-items: center; gap: 10px;
    min-width: 0;
}

.date-filter {
    display: flex; align-items: center; gap: 8px;
    margin: 0; min-width: 0;
    /* Anchor for .dashcal-pop, which is appended INSIDE this element so its
       absolute top/left resolve against the field and not the document. */
    position: relative;
}
.date-filter-label {
    font-size: 12.5px; font-weight: 600; color: var(--text-muted);
    white-space: nowrap;
}
/* The calendar glyph lives inside the field box, so the field reads as something
 * that opens a calendar rather than a value to be typed. Positioned against this
 * wrapper (not the form, which is also the popup's anchor) so the pair cannot
 * drift apart when the row wraps on narrow screens.
 *
 * inline-flex, not flex. This wrapper only exists to give the glyph something to
 * sit against, so it should be exactly as wide as the field it wraps. A plain
 * flex box is block-level and spreads to whatever the row offers, which is what
 * made the container wider than the field - and below 900px the old flex: 1 1 140px
 * stretched it across the whole bar. inline-flex shrink-wraps in every layout,
 * so no media query has to keep it honest. */
.date-filter-field {
    position: relative;
    display: inline-flex; align-items: center;
    min-width: 0;
}
.date-filter-icon {
    position: absolute; left: 9px; top: 50%;
    transform: translateY(-50%);
    /* Above the input's own opaque background, so nothing about how a browser
       composites its date control can end up covering the glyph. */
    z-index: 1;
    /* display:block, deliberately NOT flex. This class lands on the <svg> itself
       (icon() puts it there), and making an svg a flex container turns its <path>
       and <rect> children into flex items. Every other icon in this app puts the
       flex on a wrapping <span> (.gate-input-icon, .login-note .lucide); this
       one has no wrapper, so it must not have one. */
    display: block;
    /* Stated here as well as in the width/height attributes, so a size rule aimed
       at .lucide elsewhere in this stylesheet cannot shrink it to nothing. */
    width: 15px; height: 15px;
    color: #8FA8A0;
    /* The glyph is decoration for the field, not a control of its own: letting
       clicks through means the whole box is one target, so there is no dead
       strip where the icon is drawn and the click does nothing. */
    pointer-events: none;
    transition: color .2s;
}
.date-filter-field:hover .date-filter-icon,
.date-filter-field:focus-within .date-filter-icon { color: var(--emerald); }
/* One calendar glyph per field, not two. A native date input carries its own
 * small picker indicator on the right; with .date-filter-icon already on the
 * left the two read as two separate controls for one action, and the right-hand
 * one is the weaker signal of the pair.
 *
 * Unconditional rather than switched on by a script: the rule has to hold in the
 * no-script state too, and a class toggled at runtime only ever gets this right
 * by timing. Hiding it costs nothing - dashboard-calendar.js makes the input
 * readonly and opens its own calendar, so the indicator opened that same
 * calendar anyway once scripting was available.
 *
 * Chrome, Edge and Safari only. Firefox exposes no pseudo-element for its date
 * indicator, so there is nothing to hide there and the right-hand glyph stays. */
.date-filter-input::-webkit-calendar-picker-indicator { display: none; }
.date-filter-input {
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    /* Wider on the left than the other edges to clear .date-filter-icon, which
       spans 9px to 24px. Kept to the 4px it actually needs rather than a rounder
       number, so the field does not end up wider than it was before the glyph. */
    padding: 6px 10px 6px 28px;
    min-width: 148px;
    /* Reads as a trigger rather than a field you type into: dashboard-calendar.js
       makes it readonly and opens its own calendar on click, so typing is not the
       interaction. The browser's picker indicator is deliberately left showing -
       it opens the same calendar, because the click reaches this input. */
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s;
}
.date-filter-field:hover .date-filter-input { border-color: var(--emerald); }
.date-filter-input:focus {
    outline: none;
    border-color: var(--emerald);
    box-shadow: 0 0 0 3px rgba(8, 123, 89, .15);
}
/* Apply is the no-scripting submit button, and it is now inside <noscript>, so
   there is nothing to hide here: with scripting on the control is not in the
   markup at all and the calendar applies the day itself. This rule only keeps it
   from wrapping when the no-JS filter is laid out on a narrow screen. */
.date-filter-go { white-space: nowrap; }

@media (max-width: 900px) {
    .top-bar { flex-wrap: wrap; }
    .top-bar-actions { width: 100%; }
    .date-filter { flex-wrap: wrap; }
    /* Nothing to grow here: .date-filter-field shrink-wraps its input on its own,
       so the field stays the size of the date it shows rather than absorbing the
       width of the bar. Only the input's floor is dropped, so it can still give
       way when the row wraps beside the label. */
    .date-filter-input { min-width: 0; }
}

/* Dashboard calendar ------------------------------------------------
 * Replaces the browser's own date picker once scripting is available, because
 * that widget's individual days cannot be styled and the whole point here is
 * to mark the days that have data.
 *
 * Screen-hidden until opened. The native input underneath is the control the
 * form submits, so this is purely additive.
 */
.dashcal-pop {
    display: none;
    position: absolute;
    /* Anchored to .date-filter, which is position:relative, because the popup is
       appended inside it. Both of these are required, not decoration:
       position:absolute with neither top nor left falls back to the element's
       static position, which put the calendar at the very end of the document -
       it opened below the footer and lengthened the page, so the whole dashboard
       visibly shifted instead of a calendar appearing under the field.
       Note: .top-bar is position:sticky with a z-index, so it is a stacking
       context and this z-index only orders the popup WITHIN the header (ahead of
       .profile-menu). That is enough here: .main-content is static, so the whole
       header subtree paints above the page, and .sidebar is fixed to the left
       edge where a right-anchored 268px popup cannot reach it. */
    top: calc(100% + 6px);
    left: 0;
    z-index: 1200;
    width: 268px;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 14px 38px rgba(0, 40, 30, .18);
}
.dashcal-pop.is-open { display: block; }

.dashcal-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; margin-bottom: 10px;
}
.dashcal-month {
    font-size: 13.5px; font-weight: 700; color: var(--text);
}
.dashcal-nav {
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    background: transparent; color: var(--text-muted);
    border: 1px solid var(--border); border-radius: 8px;
    cursor: pointer; padding: 0;
}
.dashcal-nav:hover { background: var(--mint); color: var(--forest); border-color: var(--emerald); }
.dashcal-nav:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

.dashcal-dow, .dashcal-grid {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
}
.dashcal-dow { margin-bottom: 4px; }
.dashcal-dow span {
    text-align: center;
    font-size: 10.5px; font-weight: 700; letter-spacing: .3px;
    text-transform: uppercase; color: #93A29C;
    padding: 2px 0;
}

.dashcal-day {
    position: relative;
    height: 32px;
    display: flex; align-items: center; justify-content: center;
    font-family: inherit; font-size: 12.5px; font-weight: 600;
    color: var(--text);
    background: transparent;
    border: 1px solid transparent; border-radius: 8px;
    cursor: pointer; padding: 0;
    transition: background .12s, color .12s, border-color .12s;
}
.dashcal-day:hover:not(:disabled) { background: #EDF2F0; }
.dashcal-day:focus-visible { outline: 2px solid var(--gold); outline-offset: -1px; }

/* A day that has dashboard activity.
 * A solid green fill across the whole cell, not a pale tint: the point is that
 * a glance at the month shows where the activity was. The dot is kept as well so
 * the signal does not rest on colour alone. */
.dashcal-day.has-data {
    background: #1E8A5F;
    color: #fff;
    border-color: #14724D;
    font-weight: 700;
}
.dashcal-day.has-data::after {
    content: '';
    position: absolute; bottom: 3px; left: 50%;
    transform: translateX(-50%);
    width: 4px; height: 4px; border-radius: 50%;
    background: rgba(255, 255, 255, .85);
}
.dashcal-day.has-data:hover { background: #197A53; }

/* Selected day. Dark forest plus a gold ring, so it stays distinct from the
 * plain green of a day that merely has data. */
.dashcal-day.is-selected {
    background: var(--forest);
    color: #fff;
    border-color: var(--forest);
    box-shadow: 0 0 0 2px var(--gold), 0 3px 8px rgba(0, 77, 59, .28);
}
.dashcal-day.is-selected.has-data { background: var(--forest); }
.dashcal-day.is-selected.has-data::after { background: #E8C766; }
.dashcal-day.is-today:not(.is-selected) { border-color: var(--gold); border-width: 2px; }
.dashcal-day.is-future { color: #C4CCC8; cursor: default; }
.dashcal-day.is-future.has-data { background: #E7F5EC; color: #8FA79C; border-color: #D8EAE0; }

.dashcal-foot {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; margin-top: 10px; padding-top: 9px;
    border-top: 1px solid var(--border);
}
.dashcal-key {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11.5px; color: var(--text-muted);
}
.dashcal-dot {
    width: 11px; height: 11px; border-radius: 3px;
    background: #1E8A5F; border: 1px solid #14724D; display: inline-block;
}
.dashcal-pop[aria-busy="true"] .dashcal-grid { opacity: .5; }

/* Contest switcher on the QR page's card header. */
.card-header-actions { display: flex; align-items: center; gap: 10px; }
/* Retention window stated beside the System Logs entry count, so the fact that
   old rows are deleted is visible rather than a surprise. */
.audit-retention-note {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12px; color: var(--text-muted); white-space: nowrap;
}
.audit-retention-note .lucide { color: var(--gold-deep); }
@media (max-width: 720px) {
    .audit-retention-note { white-space: normal; }
}
.qr-switcher { display: flex; align-items: center; gap: 6px; margin: 0; }
.qr-switcher .form-control {
    max-width: 260px;
    padding: 6px 30px 6px 11px;
    font-size: 13px;
    border-radius: 8px;
}
/* Same compact box for the searchable picker in this header, which is why the
   trigger rather than the wrapper carries the padding and the type size. */
.qr-switcher .cs { max-width: 260px; }
.qr-switcher .cs-trigger { min-height: 0; padding: 6px 11px; font-size: 13px; border-radius: 8px; }
/* Only for assistive technology - the select already has an aria-label. */
.visually-hidden {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (max-width: 640px) {
    .card-header { flex-wrap: wrap; }
    .qr-switcher, .qr-switcher .form-control { width: 100%; max-width: none; }
    .qr-switcher .cs { width: 100%; max-width: none; }
}

/* QR print sheet ---------------------------------------------------
 * A standalone card holding just the code and the written URL. Screen-hidden:
 * the live page already shows the QR, so this exists only for paper. The
 * "Print QR Code" button sets body.printing-qr for the duration of the
 * dialog, and the print rules below swap the whole admin page out for this.
 */
.qr-print-sheet { display: none; }

@media print {
    /* The sheet lives inside .page-content, alongside the live card, so the
       card is hidden rather than everything outside the sheet. The sidebar,
       top bar, buttons and card headers are already hidden by the print rules
       above, which leaves the sheet as the only thing on the page. */
    body.printing-qr .card { display: none !important; }
    body.printing-qr .qr-print-sheet {
        display: block !important;
        text-align: center;
        padding-top: 10mm;
    }
    body.printing-qr .qr-print-sheet img {
        width: 90mm;
        height: 90mm;
        object-fit: contain;
        margin: 0 auto 6mm;
    }
    body.printing-qr .qr-print-url {
        font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
        font-size: 10pt;
        color: #1A1A1A;
        word-break: break-all;
        line-height: 1.45;
    }
    body.printing-qr .qr-print-note {
        margin-top: 4mm;
        font-size: 9pt;
        color: #555;
        letter-spacing: .4px;
        text-transform: uppercase;
    }
}

/* Winners list on the dashboard.
   Read-only summary rows, not links, so there is no hover state, pointer
   cursor or transition here - only the static card look. */
.winner-row {
    display: flex; align-items: center; gap: 14px;
    /* One line per winner. The rank, name, contest and score belong on a
       single row; anything too long truncates rather than wrapping onto a
       second line, which is what made the card grow three rows deep. */
    flex-wrap: nowrap;
    padding: 12px; border-radius: 12px; text-decoration: none;
    border: 1px solid var(--border); background: #fff;
    margin-bottom: 10px; color: var(--text);
}
.winner-row:last-child { margin-bottom: 0; }
/* .winner-initial used to live here - the round mint badge showing the first
   letter of the winner's name beside the name itself. Removed: for a team name
   the badge is just the first character of the word to its right, printed a
   second time and larger, so the row read as the name appearing twice. Nothing
   renders that class any more. */
/* Name and contest sit side by side instead of stacked. The name keeps the
   space it needs and the contest line yields first, so a long title is what
   gets the ellipsis. */
.winner-info {
    flex: 1; min-width: 0;
    display: flex; align-items: baseline; gap: 8px;
    overflow: hidden;
}
.winner-name {
    font-size: 15px; font-weight: 700; color: var(--forest);
    display: flex; align-items: center; gap: 8px;
    min-width: 0; flex: 0 1 auto;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.winner-name .medal { flex-shrink: 0; }
.winner-meta {
    font-size: 12px; color: var(--text-muted);
    min-width: 0; flex: 1 1 auto;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.winner-score { flex-shrink: 0; font-weight: 800; color: var(--emerald); font-size: 15px; white-space: nowrap; }
.activity-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 8px; flex-shrink: 0; }
.activity-text { flex: 1; font-size: 14px; }
.activity-time { font-size: 12px; color: var(--text-muted); }

/* ---------------------------------------------------------------
 * JUDGE INTERFACE
 * ------------------------------------------------------------- */
.judge-page {
    min-height: 100vh;
    background: linear-gradient(180deg, var(--forest) 0%, var(--forest-dark) 100%);
    display: flex; flex-direction: column;
}
.judge-header {
    background: rgba(255,255,255,0.08); backdrop-filter: blur(10px);
    padding: 16px 24px; display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.judge-header .logo { font-size: 20px; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 10px; }
.judge-header .logo .lucide { color: var(--gold); }
.judge-content { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.judge-card { background: var(--bg); border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 100%; max-width: 640px; padding: 36px; }
.judge-card h2 { color: var(--forest); font-size: 22px; margin-bottom: 8px; }
.judge-card .subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }
/* Contest brief shown on the judge scoring form */
.judge-brief {
    background: #F7FAF9; border: 1px solid var(--border);
    border-left: 4px solid var(--gold);
    border-radius: 12px; padding: 16px 18px;
}
.judge-brief-title {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; font-weight: 700; letter-spacing: .5px;
    text-transform: uppercase; color: var(--emerald);
    margin: 0 0 6px;
}
.judge-brief-title .lucide { width: 15px; height: 15px; }
.judge-brief-title + .judge-brief-text { margin-top: 0; }
.judge-brief-title:not(:first-child) { margin-top: 16px; }
.judge-brief-text { font-size: 14px; line-height: 1.65; color: var(--text); margin: 0 0 4px; }

.scoring-section { border: 2px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; transition: border-color 0.3s; }
.scoring-section:focus-within { border-color: var(--emerald); }
.contestant-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 2px solid var(--border); }
.contestant-number { background: linear-gradient(135deg, var(--emerald), var(--forest)); color: #fff; font-weight: 800; font-size: 14px; padding: 6px 14px; border-radius: 20px; }
.contestant-name { font-size: 18px; font-weight: 700; color: var(--text); }
.criteria-row { display: grid; grid-template-columns: 1fr 80px 100px; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.criteria-row:last-child { border-bottom: none; }
.criteria-name { font-size: 14px; font-weight: 500; }
.criteria-pct { font-size: 13px; color: var(--text-muted); text-align: center; }
.score-input {
    width: 100%; padding: 8px 12px; border: 2px solid var(--border);
    border-radius: var(--radius-sm); font-size: 16px; font-weight: 700;
    text-align: center; transition: border-color 0.2s;
}
.score-input:focus { outline: none; border-color: var(--emerald); box-shadow: 0 0 0 3px rgba(8,123,89,0.15); }
.score-input.invalid { border-color: #DC2626; }
.progress-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-top: 16px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--emerald), var(--accent-light)); border-radius: 3px; transition: width 0.3s; }
.confirmation-icon {
    width: 80px; height: 80px; background: var(--mint); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 24px; color: var(--emerald);
}
.confirmation-title { text-align: center; font-size: 24px; font-weight: 800; color: var(--forest); margin-bottom: 8px; }
.confirmation-message { text-align: center; color: var(--text-muted); font-size: 15px; margin-bottom: 24px; }
.confirmation-details { background: var(--bg-secondary); border-radius: var(--radius-sm); padding: 20px; margin-bottom: 24px; }
.confirmation-details .detail-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14px; }
.confirmation-details .detail-row .label { color: var(--text-muted); }
.confirmation-details .detail-row .value { font-weight: 600; }

/* ---------------------------------------------------------------
 * WINNERS PODIUM
 * ------------------------------------------------------------- */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 20px; margin: 40px 0; flex-wrap: wrap; }
.podium-place { text-align: center; width: 200px; }
.podium-card { border-radius: var(--radius) var(--radius) 0 0; padding: 24px 16px; color: #fff; position: relative; }
.podium-1 .podium-card { background: linear-gradient(180deg, #E3B93C, #B8912A); height: 180px; }
.podium-2 .podium-card { background: linear-gradient(180deg, #A7B3C0, #6E7B89); height: 140px; }
.podium-3 .podium-card { background: linear-gradient(180deg, #D89A5B, #9C5E28); height: 110px; }
.podium-medal { margin-bottom: 10px; display: flex; justify-content: center; }
.podium-name { font-size: 16px; font-weight: 700; }
.podium-score { font-size: 14px; opacity: 0.92; margin-top: 4px; }

/* ---------------------------------------------------------------
 * QR CODE
 * ------------------------------------------------------------- */
.qr-container { text-align: center; padding: 24px; }
.qr-container img { max-width: 280px; width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.qr-link-box { display: flex; gap: 8px; margin-top: 16px; }
.qr-link-box .form-control { background: var(--bg-secondary); font-size: 13px; }

/* ---------------------------------------------------------------
 * PRINT - Consolidated Tabulation Result (official report)
 *
 * Print-only markup; the on-screen card is untouched.
 *
 * Sheet: the paper is chosen in the print dialog, not here (see @page below),
 * so A4 and Letter both lay out natively at half-inch margins.
 *
 * Letterhead: crest, a 1pt vertical rule and the school name as live text, the
 * whole lockup centred. Every rule that has to survive paper is a border rather
 * than a background, because backgrounds are dropped when "Background graphics"
 * is unticked.
 *
 * Palette: white paper, forest green headings, subtle green rules, a very
 * light green on the winner only. Type stays dark grey/black so it remains
 * legible on a mono printer and when photocopied.
 * ------------------------------------------------------------- */
.print-only { display: none; }
.screen-only { display: block; }

/* The default page box, and the one the official report sheets use: half an inch
   on all four sides, including the top.

   Size is deliberately NOT fixed here. `size: auto` leaves the paper to whatever is
   chosen in the print dialog, so Letter, A4 and anything else all lay out natively
   instead of being scaled to fit a size the stylesheet picked. Forcing
   `size: letter` (which this did) is what made an A4 print either shrink to fit or
   run past the sheet edge - the header rule landing a few millimetres short of the
   paper.

   Margins are half an inch, not 1in: 1in was tried and is too generous here, it
   pushed the letterhead down far enough that the sheet read as mostly empty above
   the first line of the document, and it ate an inch of width the judge columns
   need. At 0.5in the printable width is 190mm on Letter and 184mm on A4, which is
   also what lets five judges fit their columns.

   This rule is UNNAMED, which is what makes it the fallback for every page box in
   the document. That is also why no other sheet may declare a bare `@page` rule:
   two unnamed rules cascade against each other by source order with no selector to
   separate them, so a later one silently takes the sheet away from every page that
   never asked for it. The judge's "view" sheet did exactly that - see
   `judge-sheet` below for the bug it caused and the fix. */
@page { size: auto; margin: 0.5in; }

/* Landscape, for the wide Major/Minor matrices only.
 *
 * Declared as a NAMED page and then attached to the body, because @page cannot be
 * conditioned on anything inside the document - it has no class, no id and no
 * ancestor to match. Naming it and selecting it with `page:` on <body> is the only
 * way to say "this one sheet prints sideways" while every other sheet keeps the
 * portrait default above. admin/results-tabulation.php sets
 * .print-landscape-page on <body> for the major and minor tabs.
 *
 * Fallback: a browser that does not support named pages ignores both rules and
 * prints portrait, which is still a readable sheet - just a tall one. Nothing
 * depends on landscape being honoured. */
@page print-landscape { size: landscape; margin: 0.5in; }

/* Landscape, for the judge's own signature sheet.
 *
 * NAMED for the same reason as print-landscape, and this one is load-bearing: it
 * used to be a bare `@page { size: landscape; margin: 0.45in; }` sitting in the
 * judge's @media print block further down the file. @page cannot see which page it
 * is styling, so that unnamed rule was not scoped to the judge sheet at all - it
 * just sat later in the source than the default above and outranked it for the
 * whole document. Every printed page in the app came out landscape at 0.45in, so
 * the official results sheets lost the portrait layout and the half-inch top margin
 * they are drawn around. Naming it confines landscape to the one sheet that asks
 * for it.
 *
 * The margin is 0.5in, the same as every other page box in the app. It used to be
 * 0.45in here on the reasoning that a scoring form wants tighter margins than a
 * report, which gave the judge's own signature sheet - the one sheet an organizer
 * most often prints and files - a slightly different top edge from the official
 * results sheet it is stapled to. Three named page boxes now all read 0.5in, so
 * every printed page in the app has one margin and a stack of them lines up. */
@page judge-sheet { size: landscape; margin: 0.5in; }

/* Consolidated print page (admin/contest-results.php, results tab) - explicit
 * top margin so the letterhead sits at exactly 0.5in from the page edge. */
@page consolidated-print { size: auto; margin: 0.5in; }

/* The same page turned sideways, for the one sheet that asks for it.
 *
 * The consolidated sheet now measures its own columns - see printSheetPlan() in
 * includes/functions.php - and a wide event (many categories, or a judge grid with
 * twenty contestants across) comes back wanting landscape. `@page` cannot see a
 * class, an id or any content, so the only way to honour that request is a second
 * named box that a body class selects, stamped at beforeprint by
 * assets/js/print-sheet.js from the sheet that is actually about to print.
 *
 * This is why it is a separate box rather than a change to consolidated-print:
 * two sheets can sit on the same page with different needs (the Submission Actions
 * tab holds a narrow judge grid and a wide consolidated matrix), and only one of
 * them reaches paper per print job. The margin is the same 0.5in as every other
 * page box in the app, so a stack of printed sheets still lines up. */
@page consolidated-print-wide { size: landscape; margin: 0.5in; }

@media print {
    body.print-landscape-page { page: print-landscape; }
    body.consolidated-print { page: consolidated-print; }
    /* Later, and equal in specificity to the rule above, so when both classes are
       on <body> the sideways box wins - which is the point: the sheet measured
       itself as too wide for upright paper. */
    body.consolidated-print-wide { page: consolidated-print-wide; }
}

@media print {
    /* Dashboard chrome never reaches paper. */
    .sidebar, .top-bar, .no-print, .screen-only { display: none !important; }
    .main-content, .page-content { margin: 0 !important; padding: 0 !important; }

    /* ---------- The judge portal ----------
     *
     * One rule set for ALL FOUR judge stages, scoped to body.judge-sheet rather
     * than to one [data-judge-page] value.
     *
     * It used to live only under body[data-judge-page="view"], further down this
     * file, which meant the receipt was the only judge sheet that started at the
     * top of the page box. Evaluate, Review and Confirmation all printed with the
     * on-screen furniture still in force: .sc-wrap's 24px top padding and
     * .sc-sheet's 18px margin-top together put about 42px - 11mm, more than twice
     * the 0.5in page margin itself - of dead white above the first row of the
     * scoring table. The judges who print the scoring sheet are handed the sheet
     * with the most air on it, which is exactly backwards.
     *
     * body.judge-sheet is stamped by judge/partials/shell.php on every stage
     * (evaluate, review, confirmation, view) and on the sign-in gate, so one rule
     * covers all of them and a new stage inherits the print treatment for free
     * instead of needing a fifth copy.
     *
     * The target is the one the whole app is drawn around: content begins exactly
     * 0.5in from the paper edge, set by the @page rule above. Nothing inside the
     * page box may add to it. */
    body.judge-page {
        /* min-height:100vh on a flex body means "at least one full page tall".
         * On paper that is a tall box the content is aligned inside, and the
         * leftover height reads as top space. Collapsing it to an ordinary block
         * is what makes the sheet start where the margin says it should. */
        display: block !important;
        min-height: 0 !important;
    }
    body.judge-sheet .judge-header { display: none !important; }
    body.judge-sheet .sc-wrap {
        display: block !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    body.judge-sheet .sc-sheet {
        /* The gold frame, its radius, its shadow and its 18px top offset are
         * screen decoration around a scrollable worksheet. Printed, they are an
         * extra border and an extra gap that no one asked for. */
        margin-top: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }
    /* The four gold corner arcs are absolutely positioned against .sc-sheet, so
     * they have to go explicitly - zeroing the frame above leaves them to paint
     * over the first row of the table. */
    body.judge-sheet .sc-corner { display: none !important; }

    /* The sign-in gate and the confirmation receipt are not built on .sc-wrap -
     * they use .gate-wrap and .cf-wrap around .gate-card / .cf-card - but they are
     * the same problem with different class names: 40px of top padding above a
     * centred card, so they were printing with more dead space above them than the
     * page margin alone calls for. Reset to the same 0.5in start. */
    body.judge-sheet .gate-wrap,
    body.judge-sheet .cf-wrap {
        display: block !important;
        padding: 0 !important;
        overflow: visible !important;
    }
    body.judge-sheet .gate-card,
    body.judge-sheet .cf-card {
        max-width: none !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }
    /* The soft orbs behind those two cards are 460px screen decoration. Printed
     * they are either invisible (backgrounds off, the default) or a pair of grey
     * discs stamped on the sheet. Neither is wanted on paper. */
    body.judge-sheet .gate-orb,
    body.judge-sheet .cf-orb { display: none !important; }

    /* On-screen scroll containers must not become print containers.
     *
     * The tall wrappers (table-scroll-tall) cap their height at 62vh to scroll
     * on screen, and their thead is position:sticky so the heading stays put.
     * Neither means anything on paper: the height cap would silently cut a table
     * off at the bottom of page one, and a sticky header with no scroll range
     * just paints over the rows. Every table scrolls as one continuous block on
     * paper, with no bar and no pinning.
     *
     * This is about the on-screen wrappers only - .print-only sheets are a
     * separate markup (.print-table) and are untouched by it. */
    .matrix-wrap,
    .table-wrapper,
    .table-scroll,
    .sc-table-wrap {
        max-height: none !important;
        overflow: visible !important;
        scrollbar-width: none !important;
    }
    .matrix-wrap thead th,
    .table-wrapper thead th,
    .table-scroll thead th,
    .sc-table-wrap thead th {
        position: static !important;
    }
    /* Same reason: a pinned Actions column is meaningless on paper and would
       print a shadow down the page. */
    .sticky-col { position: static !important; box-shadow: none !important; }

    /* The responsive stack must NOT apply on paper.
     *
     * @media (max-width: 768px) matches the PRINT viewport, which is about 7.5in
     * of usable width - under 768px. So printing a .table-responsive-stack table
     * hit the stacking rules meant for phones: thead hidden, every td promoted
     * to display:block and given a full line of its own. Measured on a 40-row
     * table, that produced 7 pages instead of 3, each row inflated into a card
     * with its No./Name/Score stacked and labelled.
     *
     * Reverting it here means a printed list prints as a list. The official
     * report sheets use .print-table and were never affected.
     *
     * Scoped to the print block on purpose: on screen the stack is exactly what
     * is wanted on a phone, and that rule is left alone. */
    table.table-responsive-stack thead { display: table-header-group !important; }
    table.table-responsive-stack,
    table.table-responsive-stack tbody,
    table.table-responsive-stack tr,
    table.table-responsive-stack td { display: table-row !important; width: auto !important; }
    table.table-responsive-stack tbody { display: table-row-group !important; }
    table.table-responsive-stack tr {
        border: 0 !important; border-radius: 0 !important;
        margin-bottom: 0 !important; padding: 0 !important; background: none !important;
    }
    table.table-responsive-stack td {
        border: 0 !important; padding: 13px 16px !important;
        display: table-cell !important; justify-content: normal !important;
        align-items: normal !important;
    }
    table.table-responsive-stack td::before { content: none !important; }
    .matrix-wrap::-webkit-scrollbar,
    .table-wrapper::-webkit-scrollbar,
    .table-scroll::-webkit-scrollbar,
    .sc-table-wrap::-webkit-scrollbar { display: none !important; }
    body { background: #fff !important; color: #1A1A1A !important; font-size: 10.5pt; }
    /* .col-status used to sit in this list. It looked like it dropped the Status
       column from paper, but it only ever matched a <col class="col-status"> in a
       colgroup, and display:none on a <col> is ignored by Chrome - the column
       stayed. Removed so the list is only rules that actually do something; the
       widths those colgroups ask for are set in the TABLES section instead. */
    .setup-tabs, .setup-selector, .event-card, .alert, .modal-overlay, #livePill,
    .card-header, .card-header .btn, .card-header button, .livePill,
    .btn, .badge-amber, .notify-toast-host { display: none !important; }

    /* The results card is only a wrapper on paper: no border, shadow or padding,
       so the report starts at the top-left of the printable area. */
    .results-print-card,
    .results-print-card .card-body,
    .results-print-card .table-wrapper {
        background: none !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
        max-height: none !important;
        /* No bar on paper. The screen scrollbar styling above would otherwise
           paint a track and thumb into the printed sheet, because these rules
           only neutralise the scrolling itself and not its appearance. */
        scrollbar-width: none !important;
    }
    .results-print-card .table-wrapper::-webkit-scrollbar { display: none !important; }

    .print-only { display: block !important; }
    .print-report { width: 100%; margin: 0; }

    /* One page, several official sheets: @media print shows every .print-only it
       finds, so two documents on the same page would print as one stapled run.
       assets/js/print-sheet.js suppresses all but the sheet a button named, and this
       is the hook it toggles. Later and more specific than the rule above, so it
       wins without the script having to reach for inline styles. */
    .print-sheet.print-suppress { display: none !important; }

    /* ---------- 1. Institutional letterhead ----------
       Official DLSJBC document header: the crest, a thin vertical rule and the
       school name set as live text in two weights, the whole lockup centred on
       the sheet, with a horizontal rule closing the block off from the body. */
    .print-letterhead {
        display: flex;
        align-items: center;            /* crest, rule and name on one optical line */
        justify-content: center;        /* the whole lockup centred on the sheet */
        gap: 6mm;                      /* one value, so the spacing rhythm is even */
        padding-bottom: 3mm;
        /* The rule that separates the header from the content below it. 1pt, not
           the 1.5pt it used to be: the vertical rule above it is 1pt, and a
           matched pair reads as one deliberate frame rather than two competing
           weights. 1pt is 0.35mm - comfortably clear of the sub-pixel width a
           print preview discards when it scales the page down to fit. */
        border-bottom: 1pt solid var(--forest);
        /* A letterhead split across two sheets is not a letterhead. */
        break-inside: avoid; page-break-inside: avoid;
    }

    /* The crest. Sized in millimetres, not percentages, so it covers the same
       area on A4 and on Letter - the two differ by 6mm in width, and a
       percentage would render it a different size on each.
       flex:0 0 auto stops the flex algorithm shrinking it when the sheet is
       narrower than expected; when it could shrink, it pushed the divider into
       the crest and the rule sat on top of the artwork. */
    .print-head-logo {
        width: 19mm; height: 19mm;
        object-fit: contain;
        flex: 0 0 auto;
    }

    /* The vertical rule between the crest and the school name.
       Drawn as a BORDER, not a background. That is deliberate: a background is
       dropped whenever "Background graphics" is unticked in the print dialog,
       which is the default on most browsers and the usual setting on a shared
       office printer. A border is always rendered, so the rule cannot silently
       disappear from a printed batch - the one failure a letterhead cannot have. */
    .print-head-divider {
        flex: 0 0 auto;      /* never squashed by its neighbours */
        width: 0;            /* the rule IS the border edge; no content width */
        height: 11mm;        /* explicit, so the 1pt border has real height */
        align-self: center;  /* sits on the crest's optical centre */
        border-left: 1pt solid var(--forest);
        /* Kept for safety and to document the choice: if this is ever changed
           back to a background-color, this is what makes it survive. */
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }

    /* The school name.
       flex-grow is 0 on purpose. With flex:1 1 auto this block absorbed every
       spare pixel of the row, which silently defeated justify-content: center -
       the flex box was centred, but the ink was not, so the crest and the name
       both drifted left of the middle of the sheet. min-width:0 is kept so a
       long line can still shrink and wrap rather than shoving the rule off the
       edge; only the growing is given up. */
    .print-head-name {
        flex: 0 1 auto;
        min-width: 0;
        /* Pinned rather than inherited. An institutional letterhead should not
           change face if the surrounding page is ever restyled, and this rules
           out a decorative fallback - the brief is formal, institutional type. */
        font-family: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
        color: var(--forest);
        text-align: left;
        line-height: 1.15;
    }
    /* DE LA SALLE: the larger, heavier of the two lines. */
    .print-head-name-1 {
        display: block;
        font-size: 13pt;
        font-weight: 800;
        letter-spacing: .10em;
        white-space: nowrap;
    }
    /* JOHN BOSCO COLLEGE: smaller, directly underneath, wider tracking so the
       longer string optically balances the shorter one above it. */
    .print-head-name-2 {
        display: block;
        font-size: 8.5pt;
        font-weight: 600;
        letter-spacing: .20em;
        margin-top: 1.2mm;
        white-space: nowrap;
    }

    /* ---------- 2. Report identity ---------- */
    /* Kept tight. This opened up to 6mm when the sheet was on 1in margins, which
       was the right call then and is wrong now that the page is back to 0.5in:
       the same gap at half the margin reads as a second band of empty space
       between the letterhead rule and the title. */
    .print-title-block { text-align: center; margin: 4mm 0 3mm; }
    .print-title {
        font-size: 15pt; font-weight: 800; color: var(--forest);
        letter-spacing: .04em; margin: 0 0 2.5mm;
        text-align: center;
    }
    .print-contest-name {
        font-size: 18pt; font-weight: 800; color: var(--forest);
        line-height: 1.25; margin-bottom: 3mm;
        text-align: center; overflow-wrap: anywhere;
    }
    /* Document designation, centred under the contest name. */
    .print-title-status {
        text-align: center; font-size: 10pt; font-weight: 700;
        letter-spacing: .22em; text-transform: uppercase;
        color: var(--forest); margin: 0 0 3mm;
    }
    .print-event-line {
        display: flex; flex-wrap: wrap; justify-content: center;
        gap: 2mm 10mm; font-size: 10pt; color: #333;
    }
    .print-event-line b { font-weight: 700; color: var(--forest); }
    /* Contest Results: "Category | Mode | Date | Venue" on one line. */
    .print-event-facts { gap: 1.5mm 0; }
    .print-event-facts > span + span::before {
        content: "|"; color: #9CA3AF; margin: 0 3.5mm; font-weight: 400;
    }

    /* ---------- 3. Consolidated results table ---------- */
    .print-table {
        width: 100%; border-collapse: collapse;
        font-size: 10pt; table-layout: auto; margin-top: 0;
    }
    .print-table th, .print-table td {
        padding: 2.6mm 2mm; vertical-align: middle;
        border: .5pt solid #BFD4C9;
    }
    .print-table thead th {
        background: var(--forest) !important; color: #fff !important;
        font-size: 9.5pt; font-weight: 700;
        letter-spacing: .02em; text-align: left;
        border-color: var(--forest);
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
    .print-table tbody tr { break-inside: avoid; page-break-inside: avoid; }
    .print-table tbody td { background: none !important; color: #1A1A1A; }

    /* Winner only, and only very lightly. */
    .print-table tbody tr.print-row-first td {
        background: #EAF6EF !important;
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
    .print-table thead { display: table-header-group; }  /* repeat on page 2+ */

    /* Column sizing. The judge columns take whatever is left, so adding judges
       widens the table instead of crushing the contestant names. */
    .print-col-rank  { width: 14mm; text-align: center !important; }
    .print-col-name  { width: 34%; }
    .print-col-judge { text-align: center; }
    /* A bare count (gold/silver/bronze/white tallies). Narrower than
       .print-col-pct, which is sized for a figure plus a "%" sign: the Final
       Tabulation prints four of these side by side, and at the wider width they
       overran the printable area and squeezed the contestant names. */
    .print-col-count { width: 15mm; text-align: center; font-weight: 600; }
    .print-col-avg   { width: 14mm; text-align: center; font-weight: 700; }
    .print-col-pct   { width: 16mm; text-align: center; font-weight: 700; }
    /* The headings of the figure columns are centred like the figures under
       them. The table's own heading rule is left-aligned, so these two say so
       again, one level deeper - a judge name and a total read better centred
       than hung on the left edge of their column. */
    .print-table thead th.print-col-judge,
    .print-table thead th.print-col-avg,
    .print-table thead th.print-col-event,
    .print-table thead th.print-col-count { text-align: center; }
/* Submission Actions print layout: judges down the page, contestants across.
   The judge identity columns stay narrow; contestant columns share the rest. */
.print-col-judgeno { width: 18mm; text-align: center !important; font-weight: 600; }
.print-col-judge-name { width: 40mm; font-weight: 600; }
.print-col-contestant { text-align: center; }
.print-col-contestants-group { text-align: center !important; font-weight: 700; }
/* Submission Actions print: keep the table compact on paper. */
.print-submission-actions-table th,
.print-submission-actions-table td { padding: 1mm; }
.print-col-judge-merged { font-weight: 700; vertical-align: middle; }
.print-table tbody tr.print-row-summary td { font-weight: 700; background: #F2F7F4 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

    /* ---------- 3b. Major / Minor matrix sheet ----------
     *
     * One column per event, so this is the only print table whose width grows with
     * the data. The event columns take whatever is left after the two fixed
     * columns and the total, so adding events widens the table instead of
     * crushing the contestant names - the same reasoning as .print-col-judge
     * above, applied to many more columns.
     *
     * The header carries the event title with its category and date beneath it,
     * so a printed sheet with seven events is still readable without the screen
     * to refer back to. */
    .print-matrix-table .print-col-name { width: 46mm; }
    .print-col-event { text-align: center; }
    .print-event-title { font-weight: 700; }
    .print-event-sub {
        font-size: 8pt; font-weight: 400; opacity: .82;
        margin-top: .4mm; letter-spacing: 0;
    }
    /* A provisional score is called out in italics rather than dropped or
       footnoted per cell, so the paper itself says which figures are not final. */
    .print-provisional { font-style: italic; color: #555; }
    .print-foot-note {
        font-size: 8.5pt; color: #444; margin-top: 2mm; font-style: italic;
    }

    .print-rank {
        display: inline-block; min-width: 7mm; padding: .3mm 1.5mm;
        border: .5pt solid var(--forest); border-radius: 1mm;
        font-size: 9.5pt; font-weight: 700; color: var(--forest);
    }
    .print-tie {
        display: block; font-size: 7.5pt; font-weight: 700;
        letter-spacing: .06em; text-transform: uppercase; color: #6B7A74;
        margin-top: .6mm;
    }
    /* Block, so the contestant number can never sit beside the name. */
    .print-col-name strong { display: block; font-weight: 700; color: #1A1A1A; }
    .print-number {
        display: block; font-size: 8.5pt; color: #5A5A5A; margin-top: .4mm;
    }
    .print-empty { text-align: center; padding: 10mm 0; color: #444; }

    /* ---------- 3c. The sheet that measures itself ----------
     *
     * The rules above this section are the app's print layout written for the
     * sheet that was in front of whoever wrote them: five judges, a handful of
     * contestants, upright paper. Fixed millimetre columns and one font size are
     * exactly that assumption, and the moment an event has twelve categories or a
     * grid has twenty contestants across, the same rules either overrun the paper
     * or squeeze the contestant names to nothing.
     *
     * So the consolidated sheet no longer takes its geometry from the stylesheet.
     * printSheetPlan() in includes/functions.php reads the columns it is about to
     * print - headings and every cell, not a column count - and writes the answer
     * onto the sheet element as custom properties, in the right order:
     *
     *   --print-font    the largest size at which every column still fits the page
     *   --print-pad-x   horizontal padding, the first thing a crowded sheet gives up
     *   --print-pad-y   row padding, driven by how many rows there are
     *   --print-line    leading, tightened only on a genuinely long list
     *
     * and each column's share of the paper as a <colgroup> measured in percentages
     * of the sheet - never absolute millimetres, because the printable width is not
     * known until the printer answers, and 6mm of Letter and 6mm of A4 are not the
     * same column.
     *
     * Everything is scoped to .print-sheet, which only the consolidated sheet and
     * its Submission Actions twin carry: admin/results-tabulation.php prints with
     * the fixed columns above and is untouched here. And all of it sits under
     * @media print on an element that is display:none on screen, so the interface
     * cannot move. */
    .print-sheet .print-table {
        /* Fixed layout is what makes the colgroup mean something: with auto
           layout the browser re-solves the columns from the content and the
           measurement is thrown away. */
        table-layout: fixed;
        width: 100%;
        max-width: 100%;
        font-size: var(--print-font, 10pt);
        line-height: var(--print-line, 1.22);
    }
    .print-sheet .print-table th,
    .print-sheet .print-table td {
        padding: var(--print-pad-y, 2.6mm) var(--print-pad-x, 2mm);
        /* A column is allowed to be narrower than one of its words. Breaking the
           word is how: spilling past the border and losing a digit at the paper
           edge is not, and on a score sheet a lost digit is a wrong score. */
        overflow-wrap: break-word;
        /* ... but it should look like type doing it, not like the sheet running
           out. The document is lang="en", so a heading that genuinely has to split
           splits on a syllable - and this only ever engages when the measured width
           was not enough, which the sheet asks for at PRINT_HEADER_WORD_CHARS. */
        -webkit-hyphens: auto; hyphens: auto;
    }
    /* Headings, contestant numbers and the rest of the type on the table follow
       the table down rather than staying at their own absolute sizes. */
    .print-sheet .print-table thead th { font-size: calc(var(--print-font, 10pt) - .5pt); }
    .print-sheet .print-number { font-size: .85em; }

    /* The fixed column widths, released. Left in place they fight the colgroup
       for every column they name; only the widths go, the centring and the weights
       are still wanted. !important because .print-matrix-table .print-col-name is
       itself a two-class rule. */
    .print-sheet .print-col-rank,
    .print-sheet .print-col-name,
    .print-sheet .print-col-judge,
    .print-sheet .print-col-event,
    .print-sheet .print-col-avg,
    .print-sheet .print-col-pct,
    .print-sheet .print-col-count,
    .print-sheet .print-col-judgeno,
    .print-sheet .print-col-judge-name,
    .print-sheet .print-col-contestant {
        width: auto !important;
    }

    /* Across pages: the heading row repeats and a contestant is never split, both
       already true of .print-table above. What a fixed layout adds is the third
       half of "without cutting anything off" - a column that is too wide for the
       paper no longer exists, because the columns are percentages of it. */

    /* A dense sheet buys its room from its own furniture as well as from the
       cells. The letterhead, the title block and the signature panel are fixed
       millimetre costs that a long list pays on every sheet it spills onto. */
    .print-sheet[data-print-density="compact"] .print-title-block { margin: 3mm 0 2.5mm; }
    .print-sheet[data-print-density="dense"] .print-letterhead { gap: 5mm; padding-bottom: 2mm; }
    .print-sheet[data-print-density="dense"] .print-head-logo { width: 16mm; height: 16mm; }
    .print-sheet[data-print-density="dense"] .print-head-divider { height: 9mm; }
    .print-sheet[data-print-density="dense"] .print-head-name-1 { font-size: 11.5pt; }
    .print-sheet[data-print-density="dense"] .print-head-name-2 { font-size: 7.5pt; margin-top: 1mm; }
    .print-sheet[data-print-density="dense"] .print-title-block { margin: 2.5mm 0 2mm; }
    .print-sheet[data-print-density="dense"] .print-title { font-size: 12pt; margin-bottom: 1.5mm; }
    .print-sheet[data-print-density="dense"] .print-contest-name { font-size: 14.5pt; margin-bottom: 1.5mm; }
    .print-sheet[data-print-density="dense"] .print-title-status { font-size: 8.5pt; margin-bottom: 2mm; }
    .print-sheet[data-print-density="dense"] .print-event-line { font-size: 8.5pt; gap: 1mm 6mm; }
    .print-sheet[data-print-density="dense"] .print-signatures {
        grid-template-columns: repeat(auto-fit, minmax(34mm, 1fr));
        gap: 4mm; margin-top: 5mm;
    }

    /* ---------- 4. Authorisation ---------- */
    .print-signatures {
        display: grid; grid-template-columns: repeat(auto-fit, minmax(42mm, 1fr));
        gap: 6mm; margin-top: 8mm;
        /* Never orphaned onto a sheet of its own. */
        break-inside: avoid; page-break-inside: avoid;
    }
    .print-signature {
        text-align: center;
        break-inside: avoid; page-break-inside: avoid;
        /* Keep each signature, judge name, and signing time grouped together. */
        max-width: 52mm;
        margin: 0 auto;
        width: 100%;
    }
    .print-signature-space { height: 18mm; }
    .print-judge-signature-space {
        height: 16mm;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .print-judge-signature-img {
        display: block;
        max-width: 46mm;
        max-height: 14mm;
        width: auto;
        height: auto;
        object-fit: contain;

        /* The signature is drawn ACROSS the printed name, the way a real one is,
           rather than parked in the blank space above it.

           position:relative + top shifts the image without taking it out of flow,
           so the block's height - and with it the gap between the panel and the
           administrator's row below - is exactly what it was. margin-top would have
           done the same job but re-flowed every other signature on the sheet by the
           same amount, which is how one signature ends up crowding the next.

           z-index puts the image IN FRONT of the name rather than behind it. The
           name line is not positioned, so a positioned sibling with a positive
           z-index paints over it; without this the overlap would be decided by
           source order and the name would win.

           5mm takes the image's lower edge across the name band and stops short of
           the "Judge No. N" line below it. Fixed rather than proportional on
           purpose: a signature image's height depends on the aspect ratio of
           whatever was drawn in the pad, so a percentage of its own height would
           overlap deeply on a square scrawl and not at all on a long flat one. */
        position: relative;
        top: 5mm;
        z-index: 2;
    }
    .print-signatures-empty {
        grid-column: 1 / -1;
        margin: 0;
        text-align: center;
        font-size: 9pt;
        color: #555;
    }
    /* The signing rule.
       A BORDER rather than a background, for the same reason as
       .print-head-divider: "Background graphics" is unticked by default in most
       print dialogs, and a border is always rendered, so the line cannot
       silently vanish from a printed batch. */
    .print-signature-line {
        min-height: 5mm;
        display: flex;
        align-items: flex-end;
        justify-content: center;
        padding: 0 1mm .8mm;
        border-bottom: .5pt solid #444;
        font-size: 9pt;
        color: #444;
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
    .print-signature-role {
        font-size: 9.5pt; font-weight: 700; color: var(--forest);
        letter-spacing: .06em; text-transform: uppercase;
        margin-top: 2.5mm;
    }
    .print-signature-name { font-size: 9pt; font-weight: 700; color: #444; margin-top: .8mm; }

    /* The administrator's attestation: its own row, below the judges' grid.
     *
     * A flex row holding exactly one block, centred. This is the whole of the
     * "adjust to however many judges there are" behaviour. The judges above sit in
     * an auto-fit grid whose column count is decided by how many judges there are,
     * so its width and row count are not known in advance; centring the single
     * admin block in the full printable width keeps it under the middle of whatever
     * the grid resolved to, instead of at a hardcoded offset from the left edge.
     *
     * The margin-top matches .print-signatures above it so the gap from the table
     * to the panel, and from the panel to the administrator, read as one rhythm.
     *
     * break-inside: keep the whole attestation together. If it will not fit under
     * the judges it moves to the next page whole rather than being torn across a
     * page boundary - which is the one thing that would make a signed sheet look
     * forged. */
    .print-admin-row {
        display: flex;
        justify-content: center;
        margin-top: 8mm;
        break-inside: avoid; page-break-inside: avoid;
    }
    /* flex:0 0 auto stops the flex algorithm from stretching or shrinking the
       block: inside a row with no other items it would otherwise be sized by
       flex-basis rather than by the max-width it is drawn at. */
    .print-admin-row .print-signature { flex: 0 0 auto; }

    /* Never leave a stray sheet behind. */
    .print-report { break-before: avoid; page-break-before: avoid; }
}

.admin-sign-pad-wrap { margin-top: 14px; }
.admin-sign-pad-wrap .sig-canvas { height: 180px; }

/* ---------------------------------------------------------------
 * NOTIFICATIONS — toasts + confirm modal (assets/js/notify.js)
 * ------------------------------------------------------------- */
.notify-toast-host {
    position: fixed; top: calc(var(--topbar-h) + 14px); right: 20px;
    z-index: 1200; display: flex; flex-direction: column; gap: 10px;
    width: min(380px, calc(100vw - 40px)); pointer-events: none;
}
.notify-toast {
    display: flex; align-items: flex-start; gap: 12px;
    background: #fff; border: 1px solid var(--border);
    border-left: 4px solid var(--toast-accent, var(--emerald));
    border-radius: 12px; padding: 14px 14px 14px 16px;
    box-shadow: var(--shadow-lg);
    opacity: 0; transform: translateX(24px);
    transition: opacity .28s ease, transform .28s ease;
    pointer-events: auto;
}
.notify-toast.show { opacity: 1; transform: translateX(0); }

/* System notification — gold highlight */
.notify-toast-system {
    --toast-accent: #D6AA32;
    background: linear-gradient(135deg, #FFFDF5 0%, #FDF6E3 60%, #F7EDD2 100%);
    border-color: #E8D19A;
    border-left-color: #D6AA32;
    box-shadow: 0 12px 28px rgba(184,145,42,0.22), 0 0 0 1px rgba(214,170,50,0.30);
}
.notify-toast-system .notify-toast-icon { color: #A87F22; }
.notify-toast-system .notify-toast-title { color: #8A6524; }
.notify-toast-system .notify-toast-text { color: #4A3A16; }
.notify-toast-system .notify-toast-close { color: #B8912A; }
.notify-toast-system .notify-toast-close:hover { color: #6E4E12; background: rgba(214,170,50,0.18); }
.notify-toast-icon { color: var(--toast-accent, var(--emerald)); display: flex; padding-top: 1px; }
.notify-toast-body { flex: 1; min-width: 0; }
.notify-toast-title { font-size: 14px; font-weight: 700; color: var(--text); }
.notify-toast-text { font-size: 14px; color: var(--text-muted); word-break: break-word; }
.notify-toast-text:empty { display: none; }
.notify-toast-close {
    background: none; border: none; cursor: pointer; color: var(--text-muted);
    font-size: 20px; line-height: 1; padding: 0 2px; flex-shrink: 0;
}
.notify-toast-close:hover { color: var(--text); }

/* Confirm dialog — gold highlight for every confirmation in the system */
.modal-confirm { max-width: 460px; }
.notify-modal-gold .modal {
    border-top: 4px solid var(--gold);
    background: linear-gradient(180deg, #FFFDF7 0%, #FFFFFF 32%);
    box-shadow: 0 12px 28px rgba(0,61,48,.12), 0 0 0 1px rgba(214,170,50,.35), 0 18px 44px rgba(184,145,42,.18);
}
.notify-modal-gold .modal-title { color: #8A6524; }
.notify-modal-gold .modal-header {
    background: linear-gradient(135deg, #FDF6E3 0%, #FFFDF7 100%);
    border-bottom-color: #E8D19A;
}
.notify-modal-gold .modal-footer { border-top-color: #EFE3C4; }
.notify-modal-gold .modal-close:hover { background: rgba(214,170,50,.18); color: #6E4E12; }

/* The big circular icon box above the message was removed: the icon is already
   shown in the modal title bar, so it was rendering the same glyph twice. */
.modal-confirm .modal-body { text-align: center; padding: 24px; }
.notify-confirm-message { font-size: 15px; color: var(--text); line-height: 1.55; }
.notify-confirm-detail {
    font-size: 13px; color: #6B5A38; margin-top: 10px;
    background: #FDF8EA; border: 1px solid #EFE3C4;
    border-radius: 8px; padding: 9px 12px; display: inline-block;
}

/* Gold primary action used inside confirmation dialogs */
.btn-gold {
    background: linear-gradient(180deg, #C79A32 0%, #A87F22 100%);
    color: #fff;
    box-shadow: 0 6px 16px rgba(184,145,42,.34);
}
.btn-gold:hover { background: linear-gradient(180deg, #B8912A 0%, #8A6524 100%); color: #fff; box-shadow: 0 8px 20px rgba(184,145,42,.42); }
.btn-gold:focus-visible { outline: 3px solid rgba(214,170,50,.6); outline-offset: 2px; }

/* Clickable stat cards */
.stat-card.clickable { cursor: pointer; text-align: left; width: 100%; font: inherit; }
.stat-card.clickable .stat-info { display: flex; flex-direction: column; align-items: flex-start; }
.stat-card.clickable .stat-value, .stat-card.clickable .stat-label { display: block; }
.stat-card.clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--emerald); }
.stat-card.clickable:active { transform: translateY(0); }
.stat-card.clickable:focus-visible { outline: 3px solid var(--emerald); outline-offset: 2px; }

/* Modal data tables get breathing room. This wrapper scrolls on BOTH axes once
   the table is tall and wide, and its bar is styled in the SCROLLBARS block
   above rather than here, with the rest. */
.modal .table-wrapper { max-height: 55vh; overflow-y: auto; }
.modal-table-meta { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.modal-row-detail { font-size: 12px; color: var(--text-muted); }

/* ---------------------------------------------------------------
 * MISC
 * ------------------------------------------------------------- */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; } .mb-4 { margin-bottom: 32px; }
.d-flex { display: flex; } .gap-2 { gap: 12px; } .gap-3 { gap: 20px; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.align-center { align-items: center; }
.flex-1 { flex: 1; }
.w-100 { width: 100%; }
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state .icon {
    width: 84px; height: 84px; margin: 0 auto 14px;
    background: var(--mint); color: var(--emerald);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.empty-state .icon .lucide { width: 38px; height: 38px; }
.empty-state .text { font-size: 16px; font-weight: 600; color: var(--text); }
.empty-state .sub { font-size: 14px; margin-top: 4px; }

/* ---------------------------------------------------------------
 * RESPONSIVE
 * ------------------------------------------------------------- */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .sidebar-toggle { display: flex; }
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}

@media (max-width: 768px) {
    .page-content { padding: 16px; }
    .page-head h1 { font-size: 24px; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .criteria-row { grid-template-columns: 1fr 60px 80px; }
    .podium { flex-direction: column; align-items: center; }
    .podium-place { width: 100%; max-width: 280px; }
    .login-card { padding: 28px; }
    .judge-card { padding: 24px; }
    .top-bar-title { font-size: 16px; }
    .user-info, .profile-meta { display: none; }
    .top-divider { display: none; }
    .setup-selector-form { margin-left: 0; width: 100%; }
    .setup-selector-form .form-control { max-width: 100%; }
    .setup-selector-form .cs { max-width: 100%; }
}

/* ---------------------------------------------------------------
 * CONTEST PICKER (searchable dropdown)
 *
 * Wraps a plain <select data-contest-select>. The select itself stays in the
 * form and stays enabled - it is only taken out of sight and out of the tab
 * order - so every form, query string and database call downstream reads
 * exactly what it read before. What is drawn here is the visible trigger plus
 * one panel that is appended to <body>.
 *
 * The panel is position:fixed on purpose. These selectors sit inside flex rows,
 * cards and tables that carry their own overflow rules, and an absolutely
 * positioned popup inside one of those is clipped by it - the reason a plain
 * dropdown could end up half hidden. Fixed to the viewport, it cannot be.
 * --------------------------------------------------------------- */
/* No position:relative here on purpose. The panel is a child of <body>, so
   nothing about this wrapper can establish a containing block for it - which is
   what makes it impossible for a card or a flex row to clip the dropdown. */
.cs { display: block; width: 100%; }

/* Out of sight, not out of the document.
   display:none, NOT disabled: a control hidden this way is still a successful
   control, so contest_id is submitted exactly as it always was. Removing the
   select from the form, or disabling it, would drop it out of every GET and
   POST - which is why neither is done. The trigger button takes the keyboard
   in its place (contest-select.js puts tabindex="-1" and aria-hidden on the
   select, so the two are never both in the tab order). */
select.cs-native { display: none !important; }

.cs-trigger {
    display: flex; align-items: center; gap: 8px;
    width: 100%; min-height: 42px;
    padding: 10px 14px;
    background: #fff; color: var(--text);
    border: 1px solid var(--border); border-radius: 10px;
    font: inherit; font-size: 14px; text-align: left;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.cs-trigger:hover { border-color: var(--emerald); }
.cs-trigger:focus,
.cs.is-open .cs-trigger {
    outline: none; border-color: var(--emerald);
    box-shadow: 0 0 0 3px rgba(8,123,89,0.15);
}
/* The selected contest can be a long name. One line with an ellipsis keeps the
   trigger the same height whatever is chosen; the full text is in the title. */
.cs-value {
    flex: 1; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cs-value.is-empty { color: var(--text-muted); }
.cs-caret { flex: 0 0 auto; color: var(--text-muted); transition: transform 0.2s; }
.cs.is-open .cs-caret { transform: rotate(180deg); }

.cs-panel {
    position: fixed;
    /* Above the top bar and the action menus (both 1200), below the toast host
       (9999) so a flash is never hidden behind an open picker. */
    z-index: 4000;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 8px;
    /* overflow:hidden clips the rounded corners of the list underneath it. The
       scrolling happens on .cs-list, not here. */
    overflow: hidden;
}

.cs-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.cs-search-wrap { position: relative; flex: 1; min-width: 0; }
.cs-search-icon {
    position: absolute; left: 10px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted); pointer-events: none;
}
.cs-search {
    width: 100%; padding: 8px 12px 8px 30px;
    border: 1px solid var(--border); border-radius: 8px;
    font: inherit; font-size: 13px; color: var(--text);
    background: var(--bg-secondary);
}
.cs-search:focus {
    outline: none; background: #fff;
    border-color: var(--emerald);
    box-shadow: 0 0 0 3px rgba(8,123,89,0.12);
}
/* "12 of 40" - the whole point of capping the list is that the admin can see
   there is more, and this says how much without opening anything else. */
.cs-count {
    flex: 0 0 auto;
    font-size: 11px; font-weight: 600; color: var(--text-muted);
    white-space: nowrap; padding-right: 2px;
}

/* Ten rows at a time. max-height is set in JS from the measured row height, then
   clamped to the room actually available on the chosen side of the trigger, so
   the panel never runs off the bottom of a short window.

   overscroll-behavior is deliberately NOT set to 'contain' here. That stops
   scroll chaining at the list's edges, which is usually what you want for a
   scrolling region - but the panel is 400px tall and sits on top of the page,
   so a dead zone that size swallows every wheel gesture over it. Reaching the
   end of thirteen contests and then being unable to scroll the page further is
   read as the page being frozen. The default ('auto') hands the gesture back to
   the page once the list is exhausted, which is what a native dropdown on a
   short list does anyway. */
.cs-list {
    list-style: none; margin: 0; padding: 0;
    overflow-y: auto;
}
.cs-opt {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 10px; border-radius: 8px;
    cursor: pointer;
}
.cs-opt.is-active { background: var(--mint); }
.cs-opt.is-selected .cs-opt-title { color: var(--forest); font-weight: 700; }
.cs-opt-title { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The category rides beside the name as a chip, so a list of similar contest
   titles is still told apart at a glance without a second line per row. */
.cs-opt-cat {
    flex: 0 1 auto; max-width: 45%;
    font-size: 11.5px; color: var(--text-muted);
    background: var(--mint); border-radius: 999px;
    padding: 2px 8px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cs-opt-tick { flex: 0 0 auto; color: var(--emerald); display: inline-flex; }
.cs-empty { padding: 14px 10px; font-size: 13px; color: var(--text-muted); text-align: center; }

/* The scrollbar is themed rather than left as the OS default, which is
   grey-on-white next to a green control. */
.cs-list::-webkit-scrollbar { width: 10px; }
.cs-list::-webkit-scrollbar-track { background: transparent; }
.cs-list::-webkit-scrollbar-thumb { background: var(--mint); border: 3px solid #fff; border-radius: 999px; }
.cs-list::-webkit-scrollbar-thumb:hover { background: var(--accent-light); }
.cs-list { scrollbar-width: thin; scrollbar-color: var(--emerald) transparent; }

/* =============================================================
   JUDGE SCORING SHEET (REDESIGN)
   Folder-style contestant tabs + award banner + criteria table.
   Scoped to body.judge-sheet so the other judge pages are untouched.
   ============================================================= */
.judge-sheet {
    /* Premium green + gold identity for the scoring sheet. */
    --forest: #004D3B;
    --emerald: #087A59;
    --mint: #DFF3E9;
    --gold: #D4AF37;
    --gold-deep: #A8851F;
    --sheet-page: #F0F7F4;

    background: var(--sheet-page);
    background-image:
        radial-gradient(900px 420px at 12% -8%, rgba(8,122,89,0.10), transparent 62%),
        radial-gradient(760px 380px at 92% 0%, rgba(212,175,55,0.12), transparent 60%);
    background-attachment: fixed;
}
.judge-sheet .judge-header {
    position: sticky; top: 0; z-index: 40;
    background: linear-gradient(100deg, #004D3B 0%, #06614A 55%, #00382B 100%);
    border-bottom: 2px solid rgba(212,175,55,0.55);
    box-shadow: 0 4px 18px rgba(0,56,43,0.24);
}
.judge-header-judge {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 13.5px; font-weight: 600;
    color: rgba(255,255,255,0.78);
    background: rgba(255,255,255,0.09);
    border: 1px solid rgba(255,255,255,0.14);
    padding: 6px 13px; border-radius: 999px;
}
.judge-header-judge .lucide { color: var(--gold); }

.sc-wrap {
    flex: 1; width: 100%; max-width: 1180px;
    margin: 0 auto; padding: 24px 22px 64px;
    display: flex; flex-direction: column; gap: 16px;
}

/* ---------- 0. The sheet: one gold-framed panel behind the whole flow ---------- */
.sc-sheet {
    position: relative; min-width: 0;
    display: flex; flex-direction: column; gap: 16px;
    background: #fff;
    border: 1px solid rgba(212,175,55,0.75);
    border-radius: 18px;
    margin-top: 18px;
    padding: 26px 26px 24px;
    box-shadow:
        0 18px 40px rgba(0,77,59,0.12),
        0 0 0 4px rgba(212,175,55,0.10),
        0 0 22px rgba(212,175,55,0.14);
}
/* Lift real content above the gold corner decoration. The corners are
   absolutely positioned on purpose, so they are excluded here. */
.sc-sheet > *:not(.sc-corner) { position: relative; z-index: 1; }

/* Decorative gold corner arcs. They sit just INSIDE the frame and copy its
   border-radius, so the container edge stays smoothly curved.
   display:block is required -- these are <span>s, and width/height do not
   apply to non-replaced inline boxes. */
.sc-corner {
    position: absolute; display: block;
    width: 30px; height: 30px;
    z-index: 2; pointer-events: none;
    border: 0 solid var(--gold);
    opacity: 0.9;
}
.sc-corner-tl { top: 4px;    left: 4px;    border-top-width: 2px; border-left-width: 2px;   border-top-left-radius: 16px; }
.sc-corner-tr { top: 4px;    right: 4px;   border-top-width: 2px; border-right-width: 2px;  border-top-right-radius: 16px; }
.sc-corner-bl { bottom: 4px; left: 4px;    border-bottom-width: 2px; border-left-width: 2px;  border-bottom-left-radius: 16px; }
.sc-corner-br { bottom: 4px; right: 4px;   border-bottom-width: 2px; border-right-width: 2px; border-bottom-right-radius: 16px; }

/* ---------- 1. Contestant Evaluation header ---------- */
.sc-head {
    display: flex; align-items: center; gap: 16px;
    background: #fff;
    border: 1px solid #DCEAE4;
    border-radius: 14px; padding: 16px 20px;
    box-shadow: 0 2px 8px rgba(0,77,59,0.06);
}
.sc-head-icon {
    position: relative; flex-shrink: 0;
    width: 48px; height: 48px; border-radius: 50%;
    background: linear-gradient(140deg, var(--emerald) 0%, var(--forest) 100%);
    color: #fff; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 16px rgba(0,77,59,0.26);
}
.sc-head-icon::after {
    content: ''; position: absolute; inset: -4px;
    border-radius: 50%; border: 1px solid rgba(212,175,55,0.75);
}
.sc-head-icon .lucide { color: #F3E3B0; }
.sc-head-text { min-width: 0; }
.sc-head-text h1 {
    font-size: 20px; font-weight: 800; letter-spacing: -0.2px;
    color: var(--forest); line-height: 1.25;
}
.sc-head-text p { font-size: 13.5px; color: var(--text-muted); margin-top: 2px; }
.sc-head-progress { margin-left: auto; width: 210px; flex-shrink: 0; }
.sc-progress {
    height: 6px; border-radius: 999px; background: #E7F0EB; overflow: hidden;
}
.sc-progress-fill {
    display: block; height: 100%; border-radius: 999px;
    background: linear-gradient(90deg, var(--emerald) 0%, var(--accent-light) 100%);
    transition: width 0.3s ease;
}
.sc-progress-label {
    display: block; margin-top: 6px; text-align: right;
    font-size: 11.5px; font-weight: 700; letter-spacing: 0.3px;
    text-transform: uppercase; color: var(--text-muted);
}

/* ---------- 2. Folder-style contestant selector ---------- */
/* Nested level: the contestant folders that sit INSIDE a contest panel on a
   grouped sheet.
   Two levels of folder tabs share one visual language on purpose - a judge who
   has learned one has learned the other - so these are told apart by scale and
   by weight rather than by becoming an unrelated control. The contest tabs
   above carry .bundle-contest-tabs styling and their own status badge; these
   carry the contestant's own number and name. */
.sc-folders-nested {
    background: #FBFDFC;
    border-color: #E3EEEA;
    border-radius: 12px;
    padding: 7px;
    gap: 6px;
}
.sc-folders-nested .sc-folder {
    min-width: 150px;
    max-width: 200px;
    padding: 7px 11px;
    gap: 8px;
}
.sc-folders-nested .sc-folder-name { font-size: 12.5px; }
.sc-folders-nested .sc-folder-num { font-size: 9.5px; }
.sc-folders-nested .sc-folder-arrow { width: 28px; }
/* A lighter halo than the outer level, so the two never present an identical
   "you are here" at the same time. */
.sc-folders-nested .sc-folder.is-active { box-shadow: 0 0 0 1px var(--gold); }

.sc-folders {
    position: relative;
    display: flex; align-items: stretch; gap: 8px;
    background: #fff; border: 1px solid #DCEAE4;
    border-radius: 14px; padding: 10px;
}
.bundle-contest-tabs {
    display: flex; gap: 9px; overflow-x: auto;
    margin: 0 0 14px; padding: 10px;
    background: #fff; border: 1px solid #DCEAE4; border-radius: 14px;
    scrollbar-width: thin; scrollbar-color: #CFE0D9 transparent;
}
.bundle-contest-tab {
    /* TWO ROWS, as a grid - not one flex row.
     *
     * Four children (folder icon, title, category pill, status pill) on a single
     * flex row cannot fit inside a tab this narrow. Only the title and the
     * category were allowed to shrink, the status was flex:0 0 auto, and so the
     * two pills crowded the title and each other - the "overlapping" and
     * "not aligned to the others" this layout produced. The pills also drifted
     * with each title's length, because where they landed depended on how much
     * room the title happened to leave.
     *
     * Grid with named areas puts the title on row 1 beside the icon and the two
     * pills on row 2, the category start-aligned and the status end-aligned. The
     * pills then sit in the same two columns on EVERY tab, so they line up
     * across the bar instead of moving with each title.
     *
     * Row gap 6px / column gap 9px: the pills sit closer under their own title
     * than the icon sits beside it, which is what makes the tab read as one
     * object rather than four. */
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
        "icon  title"
        "cat   status";
    align-items: center;
    gap: 6px 9px;
    min-width: 180px;
    max-width: 250px;
    padding: 10px 14px;
    color: var(--text); background: #fff; border: 1px solid #D7E5DF;
    border-radius: 10px; text-align: left; cursor: pointer;
    font: inherit; font-weight: 700; transition: all 0.18s ease;
}
.bundle-contest-tab:hover { background: #FAF9F4; border-color: #C7D4CF; }
.bundle-contest-tab:focus-visible { outline: 2px solid var(--emerald); outline-offset: 2px; }
.bundle-contest-tab.is-active {
    color: var(--forest); background: var(--mint); border-color: var(--forest);
    box-shadow: 0 0 0 2px var(--gold), 0 8px 18px rgba(212,175,55,0.2);
}
.bundle-contest-tab-icon {
    grid-area: icon; align-self: center;
    display: inline-flex; color: var(--forest);
}
.bundle-contest-tab-icon .ico-open { display: none; }
.bundle-contest-tab.is-active .bundle-contest-tab-icon .ico-closed { display: none; }
.bundle-contest-tab.is-active .bundle-contest-tab-icon .ico-open { display: flex; }
.bundle-contest-tab-title {
    grid-area: title; align-self: center;
    min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* The category, on row 2 under the title, aligned to the same left edge on every
 * tab so a run of them reads as a column.
 *
 * A sibling of the title rather than part of its text on purpose: judge.js reads
 * .bundle-contest-tab-title to name the contest in the submit confirmation, the
 * signature pad and the browser tab title, and folding the category in would push
 * "DANCE SPORTS — Jive" into all three. Kept in its own element, the title stays
 * the bare name for every consumer that needs an exact match.
 *
 * Without it a grouping's tab bar was several identical "DANCE SPORTS" buttons
 * and the judge had no way to tell which contest they were on. */
.bundle-contest-tab-cat {
    grid-area: cat; justify-self: start; align-self: center;
    max-width: 100%; overflow: hidden; text-overflow: ellipsis;
    padding: 2px 7px;
    font-size: 10px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase;
    white-space: nowrap;
    color: #0F6B5E;
    background: #EAF6F3;
    border: 1px solid #CFE7E1;
    border-radius: 999px;
}
/* Row 2, right column - so the status lands in the same place on every tab.
 *
 * justify-self replaces the margin-left:auto this used. auto margins position a
 * box inside the free space of its own cell, which in a grid column is not the
 * same thing as aligning the item to the column's edge, and it is the kind of
 * thing that looks right until a title is long enough to matter. */
.bundle-contest-status {
    grid-area: status; justify-self: end; align-self: center;
    padding: 3px 7px;
    border-radius: 999px; color: var(--text-muted); background: #F2F5F3;
    font-size: 10px; font-weight: 700; white-space: nowrap;
}
.bundle-contest-status.is-submitted { color: #087B59; background: #DDF5E8; }
.bundle-contest-panel[hidden] { display: none !important; }
.bundle-contest-actions { justify-content: flex-end; padding-top: 14px; border-top: 1px solid var(--border); }
/* Soft edges so a clipped folder tab reads as "scroll for more". */
.sc-folders::before, .sc-folders::after {
    content: ''; position: absolute; top: 10px; bottom: 10px; width: 44px;
    pointer-events: none; opacity: 0; transition: opacity 0.2s ease; z-index: 2;
}
.sc-folders::before {
    left: 44px; border-radius: 10px 0 0 10px;
    background: linear-gradient(90deg, #fff 15%, rgba(255,255,255,0));
}
.sc-folders::after {
    right: 44px; border-radius: 0 10px 10px 0;
    background: linear-gradient(270deg, #fff 15%, rgba(255,255,255,0));
}
.sc-folders.can-scroll-left::before { opacity: 1; }
.sc-folders.can-scroll-right::after  { opacity: 1; }
.sc-folder-arrow {
    flex-shrink: 0; width: 34px;
    border: 1px solid var(--border); border-radius: 10px;
    background: #fff; color: var(--emerald);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.18s ease;
}
.sc-folder-arrow:hover:not(:disabled) { background: var(--mint); color: var(--forest); border-color: var(--emerald); }
.sc-folder-arrow:disabled { opacity: 0.32; cursor: default; }
.sc-folder-track {
    flex: 1; min-width: 0; display: flex; gap: 9px;
    overflow-x: auto; scroll-behavior: smooth; padding: 2px;
    scrollbar-width: thin; scrollbar-color: #CFE0D9 transparent;
}
.sc-folder-track::-webkit-scrollbar { height: 6px; }
.sc-folder-track::-webkit-scrollbar-thumb { background: #D5E5DE; border-radius: 999px; }
.sc-folder-track::-webkit-scrollbar-track { background: transparent; }
.sc-folder {
    position: relative;
    flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
    min-width: 172px; max-width: 224px;
    padding: 10px 14px; text-align: left; cursor: pointer;
    background: #fff; border: 1px solid #D7E5DF; border-radius: 10px;
    font-family: inherit; transition: all 0.18s ease;
}
.sc-folder:hover { background: #FAF9F4; border-color: #C7D4CF; }
.sc-folder-icon { display: flex; color: var(--forest); flex-shrink: 0; }
/* Closed / open folder glyphs, swapped purely by the active state. */
.sc-folder-icon .ico-open { display: none; }
.sc-folder.is-active .sc-folder-icon .ico-closed { display: none; }
.sc-folder.is-active .sc-folder-icon .ico-open { display: flex; }
/* A contestant with gaps is flagged straight on its tab. */
.sc-folder.is-incomplete .sc-folder-num::after {
    content: ''; display: inline-block;
    width: 6px; height: 6px; margin-left: 6px; border-radius: 50%;
    background: var(--gold); vertical-align: middle;
}
.sc-folder-text { min-width: 0; display: block; }
.sc-folder-num {
    display: block; font-size: 10.5px; font-weight: 800;
    letter-spacing: 0.7px; text-transform: uppercase; color: var(--emerald);
    line-height: 1.5;
}
.sc-folder-name {
    display: block; font-size: 13.5px; font-weight: 700; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Selected folder: mint fill, thin dark green edge, clean gold halo.
   No striped bar -- it fought the folder's own rounded outline. */
.sc-folder.is-active {
    background: var(--mint);
    border-color: var(--forest);
    box-shadow:
        0 0 0 2px var(--gold),
        0 8px 18px rgba(212,175,55,0.28);
}
.sc-folder.is-active .sc-folder-num { color: var(--forest); }
.sc-folder.is-active .sc-folder-name { color: var(--forest); }

/* ---------- 3. Selected contestant banner ---------- */
.sc-banner {
    position: relative; overflow: hidden;
    display: flex; align-items: center; gap: 18px;
    padding: 20px 24px; border-radius: 16px;
    background: linear-gradient(115deg, #004D3B 0%, #0A6C51 52%, #00382B 100%);
    border: 1px solid rgba(212,175,55,0.45);
    box-shadow: 0 12px 28px rgba(0,77,59,0.24);
}
.sc-banner::before {
    content: ''; position: absolute; right: 0; top: 0; bottom: 0; width: 5px;
    background: linear-gradient(180deg, var(--gold) 0%, var(--gold-deep) 100%);
}
/* Elegant diagonal gold hairlines on the right of the banner. */
.sc-banner-deco {
    position: absolute; right: 0; top: 0; bottom: 0; width: 46%;
    z-index: 0; pointer-events: none;
    background: repeating-linear-gradient(115deg,
        rgba(212,175,55,0.22) 0 2px,
        rgba(212,175,55,0) 2px 11px);
    -webkit-mask-image: linear-gradient(270deg, #000 0%, rgba(0,0,0,0.55) 55%, transparent 100%);
    mask-image: linear-gradient(270deg, #000 0%, rgba(0,0,0,0.55) 55%, transparent 100%);
}
/* Keep the readable content above the gold decoration. */
.sc-banner-badge, .sc-banner-main, .sc-scorebox { position: relative; z-index: 1; }
.sc-banner-badge {
    flex-shrink: 0; width: 58px; height: 58px; border-radius: 50%;
    background: rgba(255,255,255,0.10); border: 1px solid rgba(212,175,55,0.85);
    display: flex; align-items: center; justify-content: center; color: #F3E3B0;
}
.sc-banner-main { min-width: 0; }
.sc-banner-label {
    display: block; font-size: 11px; font-weight: 800;
    letter-spacing: 1.1px; text-transform: uppercase;
    color: rgba(255,255,255,0.72);
}
.sc-banner-name {
    font-size: 28px; font-weight: 800; color: #fff;
    line-height: 1.2; letter-spacing: -0.3px; margin-top: 2px;
    word-break: break-word;
}
.sc-banner-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.sc-banner-chip {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600; color: #fff;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.20);
    padding: 4px 11px; border-radius: 999px;
}
.sc-banner-chip .lucide { color: #F3E3B0; }
.sc-scorebox {
    margin-left: auto; flex-shrink: 0; min-width: 200px;
    background: #fff; border: 1px solid rgba(212,175,55,0.9);
    border-radius: 12px; padding: 12px 20px 14px;
    text-align: center; box-shadow: 0 8px 20px rgba(0,0,0,0.18);
}
.sc-scorebox-label {
    display: block; font-size: 10.5px; font-weight: 800;
    letter-spacing: 0.9px; text-transform: uppercase; color: var(--text-muted);
}
.sc-scorebox-row {
    display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 4px;
}
.sc-scorebox .sc-star { color: var(--gold); }
.sc-scorebox-value {
    font-size: 30px; font-weight: 800; color: var(--forest); line-height: 1.15;
}
.sc-scorebox-max { font-size: 12.5px; font-weight: 700; color: var(--text-muted); }

/* ---------- Collapsible event brief ---------- */
.sc-brief {
    background: #FDFCF6; border: 1px solid rgba(212,175,55,0.55);
    border-radius: 12px;
}
.sc-brief > summary {
    display: flex; align-items: center; gap: 8px; cursor: pointer;
    padding: 12px 16px; list-style: none;
    font-size: 13px; font-weight: 700; color: var(--emerald);
}
.sc-brief > summary::-webkit-details-marker { display: none; }
.sc-brief > summary .lucide { color: var(--gold-deep); }
.sc-brief > summary:hover { color: var(--forest); }
.sc-brief-body { padding: 0 16px 16px; }

/* ---------- 4. Evaluation criteria card ---------- */
.sc-card {
    min-width: 0;
    background: #fff; border: 1px solid #DCEAE4;
    border-radius: 14px; overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,77,59,0.06);
}
.sc-card-head {
    display: flex; align-items: center; gap: 14px;
    padding: 18px 22px; border-bottom: 1px solid #DCEAE4;
    background: #fff;
}
.sc-card-icon {
    flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%;
    background: var(--forest); color: #fff;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(0,77,59,0.22);
}
.sc-card-text h2 { font-size: 17px; font-weight: 800; color: var(--forest); line-height: 1.3; }
.sc-card-text p { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* The scoring-limits note.
 *
 * Sits directly under the card head and above the table, in the same pale-green
 * register as the other informational strips on the judging sheet, so it reads as
 * part of the sheet rather than as an error or a warning. Left padding matches the
 * table's first cell and the icon is aligned to the first text line, so the block
 * starts on the same vertical line as the criteria names below it. */
.sc-scorenote {
    display: flex; align-items: flex-start; gap: 9px;
    margin: 0; padding: 12px 18px;
    background: var(--mint);
    border-bottom: 1px solid #CFE6DC;
    font-size: 13px; line-height: 1.5; color: #12463A;
}
.sc-scorenote .lucide { flex-shrink: 0; margin-top: 2px; color: var(--forest); }
.sc-scorenote span { min-width: 0; }

/* The allowed range, under the Score column heading.
 *
 * Block so it sits on its own line inside the header cell instead of crowding
 * "Score" sideways and forcing the column wider than the numbers need. */
.sc-th-hint {
    display: block; margin-top: 2px;
    font-size: 10px; font-weight: 600;
    letter-spacing: .06em; text-transform: uppercase;
    opacity: .85;
}

.sc-panel { min-width: 0; }
.sc-panel[hidden] { display: none !important; }
.sc-table-wrap { min-width: 0; overflow-x: auto; }
.sc-table { width: 100%; min-width: 700px; border-collapse: collapse; }
/* Dark green table head with a thin gold underline. */
.sc-table th {
    padding: 12px 18px; text-align: left; white-space: nowrap;
    font-size: 10.5px; font-weight: 800; letter-spacing: 0.8px;
    text-transform: uppercase; color: #fff;
    background: linear-gradient(180deg, #0A5B47 0%, #004D3B 100%);
    border-bottom: 2px solid var(--gold);
}
.sc-table th.num, .sc-table td.num { text-align: center; }
.sc-table td { padding: 14px 18px; border-bottom: 1px solid #E7EFEB; vertical-align: middle; }
.sc-table tbody tr:last-child td { border-bottom: none; }
.sc-table tbody tr:hover { background: #FAFDFC; }
.sc-table tbody tr:focus-within { background: #F5FBF8; }
.sc-crit { display: flex; align-items: flex-start; gap: 12px; min-width: 190px; }
.sc-crit-icon {
    flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%;
    background: var(--mint); color: var(--emerald);
    display: flex; align-items: center; justify-content: center;
}
.sc-crit-text { min-width: 0; }
.sc-crit-name { display: block; font-size: 14.5px; font-weight: 700; color: var(--forest); line-height: 1.35; }
.sc-crit-pct { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ---------------------------------------------------------------
 * MULTIPLE CRITERIA on the judging sheet
 *
 * A Main Criteria is a heading row inside the same table as its subcriteria,
 * rather than a separate table per group. One vertical rhythm therefore runs
 * down the sheet, and the parent sits directly above the children it explains
 * - which is the entire point of the hierarchy, and the thing a judge has to be
 * able to see while scoring.
 *
 * The heading is styled as a band, not as a row of data: tinted background, the
 * Main Criteria name at heading weight, and its own weight labelled "of category
 * score" so it cannot be confused with a subcriterion's weight a few lines
 * below it. Both are percentages; only one of them is a share of 100.
 * ------------------------------------------------------------- */
.sc-table-multi .sc-group-row > th,
.sc-table-multi .sc-group-row > td {
    background: var(--mint);
    border-top: 2px solid var(--emerald);
    border-bottom: 1px solid #BFE3D0;
    padding-top: 12px;
    padding-bottom: 12px;
}
.sc-group-head { text-align: left; white-space: normal !important; }
.sc-group-name {
    display: block;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: none;
    color: var(--forest);
}
.sc-group-sub {
    display: block;
    margin-top: 2px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.2px;
    color: var(--emerald);
}
.sc-group-desc {
    display: block;
    margin-top: 4px;
    font-size: 12.5px;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    color: var(--text-muted);
}
.sc-main-score { font-size: 16px; font-weight: 800; color: var(--forest); }

/* Subcriteria rows sit under their heading, indented so the grouping reads even
   on a phone where the description column has collapsed away. */
.sc-table-multi .sc-sub-row > td { padding-top: 11px; padding-bottom: 11px; }
.sc-crit-sub { min-width: 0; padding-left: 14px; border-left: 3px solid var(--gold); }
.sc-crit-sub .sc-crit-name { font-size: 14px; font-weight: 600; }
.sc-crit-sub .sc-crit-pct { font-size: 11.5px; }
.sc-crit-sub .sc-crit-icon { width: 30px; height: 30px; }
.sc-crit-sub .sc-crit-icon .lucide { width: 15px; height: 15px; }
.sc-group-empty > td {
    font-size: 12.5px;
    font-style: italic;
    color: var(--text-muted);
    text-align: center;
    padding: 12px 18px;
}

/* Same pairing on the review page and the receipt: a Main Criteria band, then its
   subcriteria indented under it. */
.rv-group-row > td {
    background: var(--mint);
    border-top: 2px solid var(--emerald);
    padding-top: 11px;
    padding-bottom: 11px;
}
.rv-group-row .rv-crit-name { font-size: 14.5px; font-weight: 800; color: var(--forest); }
.rv-group-row .rv-crit-pct { font-size: 11.5px; font-weight: 700; color: var(--emerald); }
.rv-crit-sub { padding-left: 12px; border-left: 3px solid var(--gold); }
.rv-crit-sub .rv-crit-name { font-weight: 600; }

.sc-desc { font-size: 13px; line-height: 1.55; color: var(--text); min-width: 165px; max-width: 420px; }
.sc-muted { color: var(--text-muted); }
.sc-weighted-pct { font-size: 15px; font-weight: 800; color: var(--forest); }
.sc-pct-bar {
    display: block; width: 56px; height: 4px; margin: 6px auto 0;
    background: #E7F0EB; border-radius: 999px; overflow: hidden;
}
.sc-pct-bar > span {
    display: block; height: 100%; border-radius: 999px;
    background: linear-gradient(90deg, var(--emerald), var(--accent-light));
}
.sc-score-input {
    width: 100%; max-width: 118px; padding: 9px 12px;
    border: 1px solid #CFE0D9; border-radius: 10px;
    background: #fff; color: var(--forest);
    font-family: inherit; font-size: 15px; font-weight: 700; text-align: center;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
    -moz-appearance: textfield; appearance: textfield;
}
.sc-score-input::-webkit-outer-spin-button,
.sc-score-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
/* The placeholder is this criterion's OWN allowed range - "0-10" on one row,
   "0-9.94" on the next - so it is information the judge is expected to read
   before typing, not decoration to fade into the background.
 *
 * It used to be #A9BCB4, which is 1.99:1 against the white field and passed only
 * because the placeholder used to read "0.00": a formatting hint, which is allowed
 * to be hard to see. #5F7D71 measures 4.56:1 and still reads as a hint - lighter
 * than the typed score's var(--forest), so nothing suggests a value is present.
 *
 * Firefox does not expose ::placeholder as a pseudo-element, so the opacity form
 * is set too; without it the field falls back to the browser default grey, which is
 * darker than intended and no longer reads as secondary. */
.sc-score-input::placeholder { color: #5F7D71; font-weight: 600; opacity: 1; }
.sc-score-input:focus {
    outline: none; border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212,175,55,0.22);
}
.sc-weighted { font-size: 16px; font-weight: 800; color: var(--forest); }

/* ---------- 5. Actions ---------- */
.sc-actions {
    display: flex; align-items: center; justify-content: flex-end;
    gap: 12px; flex-wrap: wrap;
}
.sc-actions .btn { padding: 13px 26px; font-size: 14.5px; border-radius: 12px; }

/* Why the Submit button is disabled. This used to be a title attribute, which
   shows nothing on a touch device - the button just looked dead. */
.sc-actions-note {
    display: flex; align-items: center; gap: 8px;
    width: 100%; margin: 0 0 4px;
    font-size: 13px; line-height: 1.45; color: #8A6410;
}
.sc-actions-note .lucide { flex-shrink: 0; color: var(--gold-deep); }
@media (min-width: 700px) {
    .sc-actions-note { width: auto; margin: 0; margin-right: auto; }
}
.sc-review-btn {
    background: var(--forest); color: #fff;
    box-shadow: 0 6px 16px rgba(0,77,59,0.26);
}
.sc-review-btn .lucide { color: #F3E3B0; }
.sc-review-btn:hover:not(:disabled) {
    background: #0A5B47; color: #fff;
    box-shadow: 0 8px 22px rgba(212,175,55,0.34);
    border-color: rgba(212,175,55,0.85);
}
.sc-review-btn:focus-visible { outline: 3px solid rgba(212,175,55,0.55); outline-offset: 2px; }

/* ---------- Draft autosave toast ---------- */
.sc-toast {
    position: fixed; right: 20px; bottom: 20px; z-index: 9999;
    padding: 10px 18px; border-radius: 10px;
    font-size: 13px; font-weight: 700; color: #fff;
    opacity: 0; transform: translateY(8px); pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: 0 8px 22px rgba(0,61,48,0.24);
}
.sc-toast.is-visible { opacity: 1; transform: translateY(0); }
.sc-toast-ok { background: var(--emerald); }
.sc-toast-error { background: #C81E1E; }

/* The admin header flash toast was removed at the admin's request, along with
   the ?msg= redirect parameters that fed it. The remaining .sc-toast rules
   below still belong to the judge scoring sheet's draft autosave, so they
   stay. */

/* The "Scoring is Complete" modal was removed at the admin's request; its
   styles went with it. The persistent "Judging Closed" badge on the event
   card still reports the state, and each submission row carries its own
   Reopen button, so no separate explanation is needed. */

/* ---------- Empty state ---------- */
.sc-empty { padding: 46px 24px; text-align: center; color: var(--text-muted); }
.sc-empty .lucide { color: var(--gold); margin-bottom: 10px; }
.sc-empty-title { font-size: 16px; font-weight: 700; color: var(--forest); }
.sc-empty-sub { font-size: 13.5px; margin-top: 4px; }

/* =============================================================
   JUDGE EVALUATION PAGE — WIDE WORKSPACE REDESIGN

   Scoped to body[data-judge-page="evaluate"] so the review sheet, the
   receipt and the sign-in gate keep the framed look they already have.
   This is a change to one page, not to the judge portal.

   WHAT WAS WRONG WITH THE OLD SHAPE

   The scoring sheet sat inside one gold-framed panel capped at 1180px. On a
   wide monitor that panel took roughly half the width, so the criteria table
   ended up in a narrow column with an empty margin down both sides, and the
   frame's outer glow plus four corner brackets made the page read as a form in
   a box rather than a workspace. The panel also carried 26px of padding on
   every side and a 16px gap between every child, which stacked into a
   noticeable band of white below a short table.

   WHAT REPLACES IT

   One wide column taking ~92% of the desktop, a flat white card with a single
   restrained border, no corner decoration, and the table given the room it was
   always asking for. Everything decorative is gone; nothing functional moved.
   ============================================================= */



/* =============================================================
   JUDGE EVALUATION PAGE - ONE CENTRED WORKSPACE
   =============================================================

   Added on request. The evaluation sheet had gone to the opposite extreme: with
   the outer white panel deleted, every section became its own floating card on
   the mint background, and the judge saw the header, the warnings, the contest
   tabs and the scoring table as four unrelated objects rather than as one
   workspace they were working in.

   This puts them back into ONE container and then aligns them inside it.

   THE ALIGNMENT IDEA

   The sections were never the same width, and adding a container alone does not
   fix that - it only puts the misalignment inside a white box where it is more
   obvious. Each level of the markup (the sheet, the form, the per-contest
   panel, the per-contestant panel) was padding its own children differently, so
   the table, the folder bar and the action row each started somewhere else.

   So every direct child of those four levels is now given the SAME horizontal
   inset, from one variable. That is the whole trick: not a width per section,
   but a single inset that all of them read. Sections that already carry their
   own horizontal padding are reset to plain horizontal margins, so the padding
   they had stops competing with the inset.

   --judge-gutter is the single source of truth. Change it in one place and the
   header, the warnings, the tabs, the contest information, the folder bar, the
   table, the total and the buttons all move together. */

body[data-judge-page="evaluate"] {
    /* The one number every section aligns to. */
    --judge-gutter: 28px;
    /* Hairline colour for the rules that now do the work borders used to. */
    --judge-rule: #E3EDE8;
    /* Page background: soft mint, matching the review page. */
    background: var(--sheet-page);
    background-image:
        radial-gradient(1100px 520px at 50% -10%, rgba(8,122,89,0.06), transparent 65%);
    background-attachment: fixed;
}

/* ---------- 3a. The outer page: centring only ---------- */
body[data-judge-page="evaluate"] .sc-wrap {
    /* max-width is the container's cap; padding is the gutter OUTSIDE it, so it
       can never push the container off-centre or widen it. */
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px 16px 40px;
    gap: 0;
}

/* ---------- 3b. The one container ---------- */
/* No min-height and no height: the box is exactly as tall as its contents plus
   their padding. That is what stops a short roster producing a tall panel of
   empty white below the last table.

   padding:0 and gap:0 because the inset now lives on the children (see above).
   Giving the container padding AND guttering its children would indent
   everything twice. */
body[data-judge-page="evaluate"] .sc-sheet {
    width: 100%;
    margin-top: 0;
    background: #fff;
    /* A single hairline, not the old gold frame with its outer glow. */
    border: 1px solid #DCE7E2;
    border-radius: 16px;
    /* Soft and downward. The old shadow had three layers including two gold
       rings, which is what made the page read as a framed certificate. */
    box-shadow: 0 10px 30px rgba(0,77,59,0.10);
    padding: 0;
    gap: 0;
    align-items: stretch;
}

/* ---------- 3c. Every section shares one horizontal inset ---------- */
/* 
   Apply gutter margin to SPECIFIC section elements regardless of nesting level.
   This avoids the compounding margin bug where .sc-sheet > * + #scoringForm > * 
   + .sc-card > * + .sc-panel > * all stacked their margins.
   
   Each section class below represents one visual "band" that should align to
   the same left/right edge. They may be nested at different depths in the DOM.
*/
body[data-judge-page="evaluate"] .sc-alerts,
body[data-judge-page="evaluate"] .bundle-contest-tabs,
body[data-judge-page="evaluate"] .sc-folders,
body[data-judge-page="evaluate"] .sc-folders-nested,
body[data-judge-page="evaluate"] .sc-card-head,
body[data-judge-page="evaluate"] .sc-scorenote,
body[data-judge-page="evaluate"] .sc-banner,
body[data-judge-page="evaluate"] .sc-brief,
body[data-judge-page="evaluate"] .sc-table-wrap,
body[data-judge-page="evaluate"] .sc-scorebox,
body[data-judge-page="evaluate"] .sc-actions {
    margin-left: var(--judge-gutter);
    margin-right: var(--judge-gutter);
}
/* .sc-head is the one element NOT in that list, and it is the one deliberate
   exception on the page: it is the container's top edge rather than a section
   inside it, so it is full width and takes the gutter as padding instead. Its
   geometry is declared in one block further down - see the header card. */

/* Sections that carry their own horizontal PADDING are switched to margins, so
   the padding stops competing with the inset above. Without this the table would
   sit one gutter in from where the header sits.

   .sc-head is deliberately NOT in this list, and that omission is the whole
   header treatment - see the header block further down. Every other section is
   inset by the gutter; the header is not, because it is not a section sitting
   inside the container, it is the container's own top edge. */
body[data-judge-page="evaluate"] .sc-card-head,
body[data-judge-page="evaluate"] .sc-brief-body,
body[data-judge-page="evaluate"] .sc-scorenote,
body[data-judge-page="evaluate"] .sc-banner {
    padding-left: 0;
    padding-right: 0;
}

/* Alerts inside .sc-alerts wrapper don't need extra margin - the wrapper has it */
body[data-judge-page="evaluate"] .sc-alerts > .alert {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
}
/* Vertical rhythm for those same bands, now that they no longer carry a
   horizontal inset of their own. The header's own padding is declared with the
   rest of its geometry, in one place. */
body[data-judge-page="evaluate"] .sc-card-head     { padding-top: 18px; padding-bottom: 18px; }
body[data-judge-page="evaluate"] .sc-brief-body    { padding-top: 14px; padding-bottom: 16px; }
body[data-judge-page="evaluate"] .sc-scorenote     { padding-top: 12px; padding-bottom: 12px; }
body[data-judge-page="evaluate"] .sc-banner        { padding-top: 18px; padding-bottom: 18px; }

/* ---------- 3d. Warnings, directly under the header ---------- */
/* All four message slots live in one column so they stack with an even gap
   instead of relying on each one's own margin-bottom, which used to differ
   between the alert variants. Full inner width, wrapping naturally. */
body[data-judge-page="evaluate"] .sc-alerts {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 0 0;
}
body[data-judge-page="evaluate"] .sc-alerts:empty { display: none; }
body[data-judge-page="evaluate"] .sc-alerts > .alert {
    margin-bottom: 0;
    width: 100%;
    /* Long messages wrap rather than pushing the column wider. */
    min-width: 0;
    overflow-wrap: break-word;
}
/* An empty alert must not leave a coloured bar behind. .alert is display:flex,
   which beats the UA [hidden] rule, so [hidden] is restored explicitly - the
   same reason the base stylesheet does it. */
body[data-judge-page="evaluate"] .sc-alerts > .alert[hidden] { display: none !important; }

/* ---------- 3e. The per-contest panel: a section, not a nested card ---------- */
/* Previously a white card with its own border, radius and shadow, sitting
   inside the workspace - a card inside the container, which is the nesting the
   brief calls out. It is now a plain section: the rule above it and the inset
   do all the separating. */
body[data-judge-page="evaluate"] .sc-card {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    /* Keeps the sticky table header clipped to this panel's own box. */
    overflow: hidden;
    /* First contest sits directly under the header/tabs; each later one is
       separated from the previous by a single rule. */
    border-top: 1px solid var(--judge-rule);
    padding-top: 4px;
    margin-bottom: 0;
}
body[data-judge-page="evaluate"] .sc-card + .sc-card { margin-top: 0; }

/* ---------- 4. Judging form header card ---------- */
/* The dark band across the top of the container.
 *
 * FULL BLEED, and that is the fix.
 *
 * This used to take the shared gutter like every other section - margin-left and
 * margin-right of 28px, plus a 16px margin-top - so the band floated INSIDE the
 * white container: 16px of white above it, 28px of white either side of it, and
 * the container's own rounded top corners showing in white above and beside the
 * dark shape. Read as a card sitting on a card. It looked like the container had
 * no header at all, or like the header was a strip that had been laid on top of
 * something rather than being part of it.
 *
 * So the band is now flush to the container's top edge and both sides, and
 * carries the container's top corners itself. The gutter moved from margin to
 * padding, so nothing inside the band moved: the trophy, the title and the
 * progress bar still sit the same 28px in from the container's edge, and still
 * line up with the contest tabs, the table and the action row below.
 *
 * The top radius is 16px to match .sc-sheet exactly, rather than the 15px it used
 * to carry. The container has no overflow:hidden (deliberately - the submit modal
 * is position:fixed inside it), so a 1px mismatch between the two curves left a
 * sliver of page background showing at each top corner. Matching them removes the
 * sliver without needing the clipping that was avoided.
 *
 * The bottom corners stay square: everything below the band is white on white,
 * and the gold hairline is the separator. */
body[data-judge-page="evaluate"] .sc-head {
    margin-left: 0;
    margin-right: 0;
    margin-top: 0;
    padding: 20px var(--judge-gutter);
    background: linear-gradient(100deg, #004D3B 0%, #0A6650 60%, #00493A 100%);
    border: 0;
    border-bottom: 1px solid rgba(212,175,55,0.45);
    border-radius: 16px 16px 0 0;
    box-shadow: none;
}
body[data-judge-page="evaluate"] .sc-head-text h1 { color: #fff; font-size: 21px; }
body[data-judge-page="evaluate"] .sc-head-text p { color: rgba(255,255,255,0.76); font-size: 13.5px; }
body[data-judge-page="evaluate"] .sc-head-progress { width: 240px; }
body[data-judge-page="evaluate"] .sc-progress-label { color: rgba(255,255,255,0.82); }

/* ---------- 5. Contest tabs ---------- */
body[data-judge-page="evaluate"] .bundle-contest-tabs {
    /* Longhands, never the `margin` shorthand: 3c sets margin-left/right on this
       element via the shared gutter, and a shorthand here would reset both of
       them back to 0 and undo the alignment. */
    margin-top: 16px;
    padding: 8px;
    gap: 8px;
    background: #FBFDFC;
    border: 1px solid #DCEAE4;
    border-radius: 12px;
}
body[data-judge-page="evaluate"] .bundle-contest-tab {
    min-width: 190px;
    max-width: 300px;
    padding: 11px 15px;
}

/* ---------- 6. Contestant selector: evenly spaced cards ---------- */
/* Same horizontal inset as the table, so the selector and the table it switches
   between read as one block rather than two differently-sized strips. */
body[data-judge-page="evaluate"] .sc-folders,
body[data-judge-page="evaluate"] .sc-folders-nested {
    margin-top: 16px;
    background: #FBFDFC;
    border: 1px solid #DCEAE4;
    border-radius: 13px;
    padding: 9px;
}
/* Flex rather than a fixed grid: roster sizes vary a lot between contests, and
   equal-width cells that leave the last one stretched across half the bar look
   worse than natural widths. The gap does the spacing. */
body[data-judge-page="evaluate"] .sc-folder {
    flex: 1 1 auto;
    min-width: 158px;
    max-width: 260px;
    padding: 9px 13px;
}
body[data-judge-page="evaluate"] .sc-folder-name {
    font-size: 13.5px;
    /* Names are short ("Red Team", "Maria Santos"). Truncating them to fit a
       guessed width is what made the old selector look cramped; the bar
       scrolls horizontally instead. */
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
}
body[data-judge-page="evaluate"] .sc-folders-nested .sc-folder { min-width: 150px; }

/* ---------- 7. Scoring table: the main focus ---------- */
body[data-judge-page="evaluate"] .sc-card {
    /* The card itself is flattened to a plain section in 3e above; the icon
       keeps the heading legible once the card's own border is gone. */
    border-radius: 0;
}
/* Contest information: title, one line of guidance, then the judging
   instructions - all inside the scoring section's header band rather than as a
   separate block with its own border, which is what made it read as a third
   nested card. The horizontal inset is the shared gutter (3c), so this rule
   only has to supply vertical rhythm. */
body[data-judge-page="evaluate"] .sc-card-icon {
    width: 38px; height: 38px; border-radius: 10px;
}
body[data-judge-page="evaluate"] .sc-card-text h2 { font-size: 18px; }
body[data-judge-page="evaluate"] .sc-card-text p { font-size: 13px; }
body[data-judge-page="evaluate"] .sc-brief-body {
    border-top: 1px solid #E7EFEB;
    background: #FBFDFC;
    font-size: 13.5px;
    color: var(--text);
    line-height: 1.6;
}
body[data-judge-page="evaluate"] .sc-brief-body strong {
    display: block;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.9px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 3px;
}
body[data-judge-page="evaluate"] .sc-table { min-width: 860px; }

/* Zebra striping.
   Reads across five columns of numbers, where a vertical rule is the only thing
   telling the eye which row a figure belongs to. nth-child(even) rather than
   odd, so the FIRST data row is tinted - the judge spends most of their time in
   the top rows, and that is where the banding helps most. */
body[data-judge-page="evaluate"] .sc-table tbody tr:nth-child(even) { background: #FAFCFB; }
/* Hover wins over the banding, otherwise the row a judge is pointing at can look
   unchanged and the highlight reads as broken. */
body[data-judge-page="evaluate"] .sc-table tbody tr:hover { background: #F2F8F5; }
body[data-judge-page="evaluate"] .sc-table tbody tr:focus-within { background: #EDF7F2; }

/* Lighter dividers. The previous rule drew a full-strength border on every cell,
   which stacked into a dark grid across five columns. */
body[data-judge-page="evaluate"] .sc-table td { border-bottom: 1px solid #EFF5F2; }

/* Column widths. The two prose columns get the space and the three numeric ones
   are sized to their content. Without this the browser splits width evenly and
   the description - the part a judge actually reads - ends up the narrowest
   column on the page. */
body[data-judge-page="evaluate"] .sc-table th:nth-child(1),
body[data-judge-page="evaluate"] .sc-table td:nth-child(1) { width: 30%; }
body[data-judge-page="evaluate"] .sc-table th:nth-child(3),
body[data-judge-page="evaluate"] .sc-table td:nth-child(3) { width: 13%; }
body[data-judge-page="evaluate"] .sc-table th:nth-child(4),
body[data-judge-page="evaluate"] .sc-table td:nth-child(4) { width: 13%; }
body[data-judge-page="evaluate"] .sc-table th:nth-child(5),
body[data-judge-page="evaluate"] .sc-table td:nth-child(5) { width: 16%; }

body[data-judge-page="evaluate"] .sc-table th { padding: 13px 18px; }
body[data-judge-page="evaluate"] .sc-table td { padding: 15px 18px; }
/* Numeric columns right-aligned rather than centred: the weighted figures are
   what a judge compares down the column, and centring makes the decimal points
   land differently on every row. */
body[data-judge-page="evaluate"] .sc-table th.num,
body[data-judge-page="evaluate"] .sc-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
body[data-judge-page="evaluate"] .sc-table tbody tr:hover { background: #F7FBF9; }

/* Score inputs sized to the digits they hold rather than to a guess. */
body[data-judge-page="evaluate"] .sc-score-input {
    width: 100%;
    min-width: 86px;
    max-width: 120px;
    padding: 9px 10px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    /* A green edge, so the boxes a judge has to touch are findable at a glance
       without every one of them shouting. The default grey left them looking
       like static text. */
    border: 1px solid #BFDDD0;
    border-radius: 8px;
    background: #fff;
    color: var(--forest);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
body[data-judge-page="evaluate"] .sc-score-input:hover { border-color: var(--emerald); }
/* Focus ring has to be visible on both the white row and the tinted zebra row,
   so it carries its own halo rather than relying on the browser default. */
body[data-judge-page="evaluate"] .sc-score-input:focus {
    outline: none;
    border-color: var(--emerald);
    box-shadow: 0 0 0 3px rgba(8,122,89,0.18);
}
body[data-judge-page="evaluate"] .sc-score-input:focus-visible {
    border-color: var(--emerald);
    box-shadow: 0 0 0 3px rgba(212,175,55,0.35);
}

/* ---------- 8. Total weighted score: a compact summary row ----------
   Label on the left, figure on the right, on one line beneath the table.

   The horizontal inset comes from the shared gutter (3c), which is what makes it
   line up with the table's edges above it - previously it was pushed to the
   right with an auto margin and a max-width, so it ended wherever its own
   content ended rather than under the table. */
body[data-judge-page="evaluate"] .sc-scorebox {
    margin-top: 14px;
    /* Longhand only, for the same reason as the contest tabs: the shorthand would
       wipe the gutter's margin-left and drag the box out of alignment. */
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Wraps, rather than squeezing.
     *
     * The box carries a contest name on the left and the figure on the right, and
     * on a narrow screen - which is where a judge actually is - a long contest
     * name plus a large number left neither enough room, and the number was the
     * part that got clipped. Letting the row wrap puts the figure on its own line,
     * full width, instead of truncating it. The audience sees the whole total. */
    flex-wrap: wrap;
    gap: 4px 18px;
    background: #fff;
    border: 1px solid #E7E0CB;
    border-left: 4px solid var(--gold);
    border-radius: 10px;
    padding: 12px 20px;
    box-shadow: 0 2px 8px rgba(0,77,59,0.05);
}
body[data-judge-page="evaluate"] .sc-scorebox-label {
    /* font-size is not set here. It used to be 11.5px on this rule and then
     * restated lower further down, so the value that actually applied was
     * whichever came last - two declarations for one property on one element.
     * It now lives once, with the figure it has to sit beside, a few rules
     * below. */
    letter-spacing: 1px;
    color: var(--gold-deep);
    margin: 0;
}
body[data-judge-page="evaluate"] .sc-scorebox-row {
    justify-content: flex-end;
    gap: 8px;
    margin-top: 0;
    min-width: 0;
}
body[data-judge-page="evaluate"] .sc-scorebox-value {
    /* 17px, down from 20.
     *
     * 28 was the original: the figure out-shouted the thing it summarises, so on a
     * short rubric the total read louder than any single score above it. 23 was a
     * step back, and 20 was chosen so the label, the figure and the "/ 100"
     * ceiling fit on one line at the widths judges actually use.
     *
     * 17 because on a phone that is still not enough: the box carries the
     * contest name on the left and the figure on the right, so at 20px the
     * "Total Weighted Score" label wrapped to two lines beside a figure that
     * filled the rest, and the pair read as two competing blocks rather than one
     * summary. At 17 the label, the number and the ceiling sit together and the
     * whole total is legible without scrolling past it - which is the point the
     * flex-wrap comment above this block is making.
     *
     * Weight held at 700, so the visual gap between "a summary" and "a score you
     * typed" is unchanged; only the size moves. */
    font-size: 17px;
    font-weight: 700;
    color: var(--forest);
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
}
/* The ceiling and the label track the figure down a step, for the same reason. */
body[data-judge-page="evaluate"] .sc-scorebox-max { font-size: 11.5px; }
body[data-judge-page="evaluate"] .sc-scorebox-label { font-size: 10.5px; }

/* ---------- 9. Footer actions ---------- */
/* Bottom-right inside the workspace. The inset is the shared gutter again, so
   the buttons' right edge lines up with the table's right edge above them. */
body[data-judge-page="evaluate"] .sc-actions {
    margin-top: 4px;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 18px;
    padding-bottom: 6px;
    border-top: 1px solid var(--judge-rule);
}
body[data-judge-page="evaluate"] .sc-actions .btn {
    padding: 13px 24px;
    font-size: 14.5px;
    border-radius: 10px;
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
/* Secondary action outlined rather than filled, so the primary Submit keeps the
   hierarchy without having to be louder. */
body[data-judge-page="evaluate"] .sc-review-btn {
    background: #fff;
    color: var(--forest);
    border: 1px solid var(--forest);
    box-shadow: none;
}
body[data-judge-page="evaluate"] .sc-review-btn .lucide { color: var(--emerald); }
body[data-judge-page="evaluate"] .sc-review-btn:hover:not(:disabled) {
    background: var(--mint);
    color: var(--forest);
    border-color: var(--emerald);
    box-shadow: none;
}

/* ---------- 10. Responsive ---------- */
/* The gutter narrows with the viewport rather than being a fixed inset, so the
   alignment survives all the way down to a phone: every section is reading the
   same variable, and shrinking it shrinks all of them together.

   Review keeps its own 92% behaviour. */
@media (max-width: 900px) {
    body[data-judge-page="evaluate"] { --judge-gutter: 18px; }
    body[data-judge-page="evaluate"] .sc-wrap {
        padding: 12px 12px 28px;
    }
    body[data-judge-page="evaluate"] .sc-sheet { border-radius: 14px; }
    /* 14px, not 13px: it has to equal .sc-sheet's radius here, exactly as the
       desktop header equals its 16px. The container has no overflow:hidden, so
       the two curves are not clipped to each other - any difference between them
       shows the page background in the gap as a sliver at each top corner. The
       header is full-bleed, so its corners ARE the container's corners. */
    body[data-judge-page="evaluate"] .sc-head { border-radius: 14px 14px 0 0; }

    body[data-judge-page="evaluate"] .sc-head { flex-wrap: wrap; }
    body[data-judge-page="evaluate"] .sc-head-progress { width: 100%; margin-left: 0; }
    body[data-judge-page="evaluate"] .sc-scorebox {
        /* Longhand: this element is also inside the panel, so it already carries
           a horizontal inset. Only the vertical one needs resetting. */
        margin-top: 12px;
        flex-wrap: wrap;
        gap: 4px;
    }
    body[data-judge-page="evaluate"] .sc-scorebox-row { justify-content: flex-start; }
    /* Carries its own attribute selector, so it outranks the bare .sc-scorebox-value
       rule further down this stylesheet even though that one is also inside a
       media query and comes later. Specificity beats source order, so the bare
       rule has never applied on this page - mobile was getting the desktop size.
       Restating it here scoped to the page is what makes it actually do
       something. */
    body[data-judge-page="evaluate"] .sc-scorebox-value { font-size: 16px; }
    body[data-judge-page="evaluate"] .sc-scorebox-label,
    body[data-judge-page="evaluate"] .sc-scorebox-max { font-size: 11px; }
    body[data-judge-page="evaluate"] .sc-actions .btn { flex: 1 1 100%; justify-content: center; }
    body[data-judge-page="evaluate"] .sc-folder { max-width: none; }
    body[data-judge-page="evaluate"] .sc-actions-note { width: 100%; margin: 0 0 4px; }

    body[data-judge-page="review"] .sc-wrap {
        width: 100%;
        padding: 14px 14px 32px;
    }
    body[data-judge-page="review"] .sc-head { flex-wrap: wrap; padding: 16px 18px; }
    body[data-judge-page="review"] .sc-head-progress { width: 100%; margin-left: 0; }
    body[data-judge-page="review"] .sc-card-head { padding: 14px 16px; }
    body[data-judge-page="review"] .rv-total { margin-left: 0; }
    body[data-judge-page="review"] .sc-actions .btn { flex: 1 1 100%; justify-content: center; }
}

@media (max-width: 560px) {
    body[data-judge-page="evaluate"] { --judge-gutter: 14px; }
    body[data-judge-page="evaluate"] .sc-wrap { padding: 10px 10px 24px; }
    /* Full width is already the case; this only stops the criteria table from
       forcing the whole page sideways. The scroll stays inside the table
       wrapper, where it belongs. */
    body[data-judge-page="evaluate"] .sc-card,
    body[data-judge-page="evaluate"] .sc-panel { min-width: 0; }
}

/* ---------- 11. Contest name + role badge in the top bar ----------
   Reinstated on request, but as a LIVE element: judge.js rewrites it whenever
   the contest tab changes, so it always names the contest on screen. The static
   copy of exactly this that was removed earlier is what went stale. */
.judge-header-logo {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    font-size: 17px;
    font-weight: 700;
    color: #fff;
}
.judge-header-logo .lucide { color: var(--gold); flex-shrink: 0; }
.judge-header-logo-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* The judge's identity on the right of the header.
 *
 * Plain text, on purpose. This was a <details> disclosure whose summary carried
 * the avatar, the name and a chevron, and whose panel repeated the name and
 * added the judge number - so most of what the reader saw was a control, and
 * opening it revealed the name that was already on it. It is now one
 * non-interactive row, so there is no summary, no chevron, no panel and nothing
 * left to style for a closed and an open state.
 *
 * Declared once, unscoped, because all four judge pages render the same markup
 * (shell.php). It used to be defined three times over - once each for evaluate,
 * confirmation and view - which is how the three drifted apart from each other
 * and from review, the only page that already had this as plain text. */
.judge-profile {
    display: flex;
    align-items: center;
    gap: 9px;
    flex: 0 1 auto;
    min-width: 0;
    color: #fff;
}
/* The name truncates rather than disappearing.
 *
 * Every page used to hide it outright below its breakpoint, which was
 * reasonable when the name sat inside a menu and the avatar alone stood for the
 * whole thing. As plain text it is the content, so it is allowed to shrink and
 * ellipsis instead - a judge on a phone can still confirm they are on their own
 * sheet. */
.judge-profile-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* The round avatar.
 *
 * Hoisted to unscoped for the same reason as .judge-profile itself: it existed
 * three times, byte-identical, under evaluate / confirmation / view - and
 * review had no copy at all, so review's avatar was a bare icon with no circle
 * round it. One rule now covers all four pages and the three copies are gone. */
.judge-profile-avatar {
    display: inline-flex;
    flex-shrink: 0;
    width: 31px;
    height: 31px;
    align-items: center;
    justify-content: center;
    color: #F3E3B0;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(212,175,55,0.55);
    border-radius: 50%;
}
/* The judge number, carried over from the menu that used to hold it. Bare "#3",
 * no label - the header says who this is, and a word in front of the number
 * would put "Judge" back into the bar. */
.judge-header-number {
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(212,175,55,0.45);
    color: #F3E3B0;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.3px;
}
@media (max-width: 560px) {
    .judge-header-logo { font-size: 15px; }
    .judge-header-judge { font-size: 12px; padding: 5px 10px; }
    /* Below this the number is the first thing to go: it is the least useful of
       the three, and the name is what identifies the judge. */
    .judge-header-number { display: none; }
}

/* =============================================================
   JUDGE REVIEW PAGE — WIDE WORKSPACE REDESIGN

   The same treatment the evaluation sheet just received, for the same
   reason: a judge moves between evaluate.php and review.php in one
   sitting, so the two pages are one workspace seen from two angles.
   Left with the old framed shape, the Review step looked like the app
   had thrown a different theme over itself halfway through.

   Scoped to body[data-judge-page="review"]. The receipt (view) and the
   confirmation are deliberately left alone - they are terminal pages a
   judge reaches once and leaves, not a step they work inside.
   ============================================================= */

/* Workspace width and the card's own sizing are shared with the evaluation
   sheet and declared in the blocks above, so the two cannot drift. */
body[data-judge-page="review"] {
    background: var(--sheet-page);
    background-image:
        radial-gradient(1100px 520px at 50% -10%, rgba(8,122,89,0.06), transparent 65%);
    background-attachment: fixed;
    /* Shared alignment gutter and rule colour with evaluate page. */
    --judge-gutter: 28px;
    --judge-rule: #E3EDE8;
}

/* ---------- 1a. The outer page: centring only ---------- */
body[data-judge-page="review"] .sc-wrap {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px 16px 40px;
    gap: 0;
}

/* ---------- 1b. The one container ---------- */
body[data-judge-page="review"] .sc-sheet {
    width: 100%;
    margin-top: 0;
    background: #fff;
    border: 1px solid #DCE7E2;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,77,59,0.10);
    padding: 0;
    gap: 0;
    align-items: stretch;
}

/* The four corner brackets are dropped outright rather than restyled. */
body[data-judge-page="review"] .sc-corner { display: none !important; }

/* ---------- 1c. Every section shares one horizontal inset ---------- */
/* 
   Apply gutter margin to SPECIFIC section elements regardless of nesting level.
   Avoids the compounding margin bug from .sc-sheet > * + .sc-card > * + .rv-card > *
*/
body[data-judge-page="review"] .sc-head,
body[data-judge-page="review"] .sc-alerts,
body[data-judge-page="review"] .bundle-contest-tabs,
body[data-judge-page="review"] .sc-folders,
body[data-judge-page="review"] .sc-folders-nested,
body[data-judge-page="review"] .sc-card-head,
/* The per-contestant card's own header - number, name, trophy. Left out of this
   list it kept the card's full width while the table and total directly beneath
   it were pulled in by the gutter, so the name hung past the edge of the scores
   it was labelling. It is a band in its own right and belongs with them. */
body[data-judge-page="review"] .rv-card-head,
body[data-judge-page="review"] .rv-status,
body[data-judge-page="review"] .rv-missing,
body[data-judge-page="review"] .rv-total,
body[data-judge-page="review"] .sc-table-wrap,
body[data-judge-page="review"] .sc-actions {
    margin-left: var(--judge-gutter);
    margin-right: var(--judge-gutter);
}

/* Sections that carry their own horizontal PADDING are switched to margins. */
body[data-judge-page="review"] .sc-head,
body[data-judge-page="review"] .sc-card-head,
body[data-judge-page="review"] .rv-card-head,
body[data-judge-page="review"] .rv-status,
body[data-judge-page="review"] .rv-missing,
body[data-judge-page="review"] .rv-total,
body[data-judge-page="review"] .sc-actions {
    padding-left: 0;
    padding-right: 0;
}

/* Vertical rhythm for those same bands. */
body[data-judge-page="review"] .sc-head          { padding-top: 20px; padding-bottom: 20px; }
body[data-judge-page="review"] .sc-card-head     { padding-top: 18px; padding-bottom: 18px; }
body[data-judge-page="review"] .rv-status        { padding-top: 16px; padding-bottom: 16px; }
body[data-judge-page="review"] .rv-missing       { padding-top: 16px; padding-bottom: 16px; }
body[data-judge-page="review"] .rv-total         { padding-top: 16px; padding-bottom: 16px; }
body[data-judge-page="review"] .sc-actions       { padding-top: 18px; padding-bottom: 18px; }

/* The dark header band carries the container's top corners. */
body[data-judge-page="review"] .sc-head { border-radius: 15px 15px 0 0; }

/* Header card, matching the evaluation sheet exactly. */
body[data-judge-page="review"] .sc-head {
    background: linear-gradient(100deg, #004D3B 0%, #0A6650 60%, #00493A 100%);
    border: 0;
    border-bottom: 1px solid rgba(212,175,55,0.45);
    border-radius: 15px 15px 0 0;
    box-shadow: none;
}
body[data-judge-page="review"] .sc-head-text h1 { color: #fff; font-size: 21px; }
body[data-judge-page="review"] .sc-head-text p { color: rgba(255,255,255,0.76); font-size: 13.5px; }
body[data-judge-page="review"] .sc-head-progress { width: 240px; }
body[data-judge-page="review"] .sc-progress-label { color: rgba(255,255,255,0.82); }

/* Warnings/alerts directly under the header, matching evaluate. */
body[data-judge-page="review"] .sc-alerts {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 0 0;
}
body[data-judge-page="review"] .sc-alerts:empty { display: none; }
body[data-judge-page="review"] .sc-alerts > .alert {
    margin-bottom: 0;
    width: 100%;
    min-width: 0;
    overflow-wrap: break-word;
}
body[data-judge-page="review"] .sc-alerts > .alert[hidden] { display: none !important; }

/* Per-contest panels: flat sections separated by a single rule, matching evaluate. */
body[data-judge-page="review"] .sc-card {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    border-top: 1px solid var(--judge-rule);
    padding-top: 4px;
    margin-bottom: 0;
}
body[data-judge-page="review"] .sc-card + .sc-card { margin-top: 0; }

/* Contest panel headings inside the flat section. */
body[data-judge-page="review"] .sc-card-head {
    background: #fff;
    border-bottom: 1px solid #DCEAE4;
}
body[data-judge-page="review"] .sc-card-icon {
    width: 38px; height: 38px; border-radius: 10px;
}
body[data-judge-page="review"] .sc-card-text h2 { font-size: 18px; }
body[data-judge-page="review"] .sc-card-text p { font-size: 13px; }

/* Per-contestant cards (rv-card) - flat, matching the evaluate panel style. */
body[data-judge-page="review"] .rv-card {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    border-top: 1px solid var(--judge-rule);
    padding-top: 4px;
    margin-bottom: 0;
}
body[data-judge-page="review"] .rv-card + .rv-card { margin-top: 0; }
body[data-judge-page="review"] .rv-card-head {
    background: #fff;
    border-bottom: 1px solid #DCEAE4;
    /* Horizontal inset comes from the shared gutter above, so only vertical
     * rhythm belongs here - see the same note on .sc-card-head. */
    padding: 14px 0;
}
body[data-judge-page="review"] .rv-card-head h3 { font-size: 16px; font-weight: 700; color: var(--forest); }
body[data-judge-page="review"] .rv-num {
    font-size: 11px; font-weight: 800; letter-spacing: 1px;
    text-transform: uppercase; color: var(--emerald);
}
body[data-judge-page="review"] .rv-trophy { color: var(--gold); }

/* Tables: match evaluate's zebra striping, column widths, and right-aligned numbers. */
body[data-judge-page="review"] .rv-table,
body[data-judge-page="review"] .sc-table {
    min-width: 860px;
}
body[data-judge-page="review"] .rv-table th:first-child,
body[data-judge-page="review"] .rv-table td:first-child { width: 30%; }
body[data-judge-page="review"] .rv-table th:nth-child(2),
body[data-judge-page="review"] .rv-table td:nth-child(2) { width: 28%; }
body[data-judge-page="review"] .rv-table th,
body[data-judge-page="review"] .rv-table td { padding: 15px 18px; }
body[data-judge-page="review"] .rv-table th.num,
body[data-judge-page="review"] .rv-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Zebra striping for review tables (matching evaluate). */
body[data-judge-page="review"] .rv-table tbody tr:nth-child(even),
body[data-judge-page="review"] .sc-table tbody tr:nth-child(even) { background: #FAFCFB; }
body[data-judge-page="review"] .rv-table tbody tr:hover,
body[data-judge-page="review"] .sc-table tbody tr:hover { background: #F2F8F5; }
body[data-judge-page="review"] .rv-table tbody tr:focus-within,
body[data-judge-page="review"] .sc-table tbody tr:focus-within { background: #EDF7F2; }
body[data-judge-page="review"] .rv-table td,
body[data-judge-page="review"] .sc-table td { border-bottom: 1px solid #EFF5F2; }
body[data-judge-page="review"] .rv-table th,
body[data-judge-page="review"] .sc-table th { padding: 13px 18px; }

/* Column widths for multi-criteria tables (matching evaluate). */
body[data-judge-page="review"] .sc-table th:nth-child(1),
body[data-judge-page="review"] .sc-table td:nth-child(1) { width: 30%; }
body[data-judge-page="review"] .sc-table th:nth-child(3),
body[data-judge-page="review"] .sc-table td:nth-child(3) { width: 13%; }
body[data-judge-page="review"] .sc-table th:nth-child(4),
body[data-judge-page="review"] .sc-table td:nth-child(4) { width: 13%; }
body[data-judge-page="review"] .sc-table th:nth-child(5),
body[data-judge-page="review"] .sc-table td:nth-child(5) { width: 16%; }

/* Per-contestant total: match evaluate's scorebox style exactly. */
body[data-judge-page="review"] .rv-total {
    margin-top: 14px;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    background: #fff;
    border: 1px solid #E7E0CB;
    border-left: 4px solid var(--gold);
    border-radius: 10px;
    padding: 12px 20px;
    box-shadow: 0 2px 8px rgba(0,77,59,0.05);
}
body[data-judge-page="review"] .rv-total-icon {
    background: transparent;
    color: var(--gold-deep);
}
body[data-judge-page="review"] .rv-total-value {
    font-size: 23px;
    font-weight: 700;
    color: var(--forest);
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
}
body[data-judge-page="review"] .rv-total-value b { font-size: inherit; }
body[data-judge-page="review"] .rv-total-value span { font-size: 13px; }
body[data-judge-page="review"] .rv-total-label {
    font-size: 11.5px;
    letter-spacing: 1px;
    color: var(--gold-deep);
    margin: 0;
}
body[data-judge-page="review"] .rv-total-sub {
    font-size: 11px;
    color: var(--text-muted);
}

/* Status banners (rv-status) - full width, no border-radius, matching evaluate's sc-alerts > .alert. */
body[data-judge-page="review"] .rv-status {
    border-radius: 0;
    padding: 14px 18px;
    border: 0;
    border-bottom: 1px solid var(--judge-rule);
    background: transparent;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
body[data-judge-page="review"] .rv-status .lucide { width: 18px; height: 18px; margin-top: 2px; }
body[data-judge-page="review"] .rv-status > div { flex: 1; min-width: 0; }
body[data-judge-page="review"] .rv-status strong { color: var(--forest); }
body[data-judge-page="review"] .rv-status span { color: var(--text); }
body[data-judge-page="review"] .rv-status-missing {
    background: #FCEBEB;
    border-left: 4px solid #C81E1E;
}
body[data-judge-page="review"] .rv-status-missing .lucide { color: #C81E1E; }
body[data-judge-page="review"] .rv-status-complete {
    background: #DDF5E8;
    border-left: 4px solid #087B59;
}
body[data-judge-page="review"] .rv-status-complete .lucide { color: #087B59; }
body[data-judge-page="review"] .rv-status[hidden] { display: none !important; }

/* Missing list panel. */
body[data-judge-page="review"] .rv-missing {
    border-radius: 0;
    border-top: 1px solid var(--judge-rule);
    border-bottom: 1px solid var(--judge-rule);
    background: #FBFDFC;
}
body[data-judge-page="review"] .rv-missing-title {
    font-size: 14px; font-weight: 700; color: var(--forest);
    margin: 0; padding: 12px 0 8px;
}
body[data-judge-page="review"] .rv-missing-list { list-style: none; padding: 0; margin: 0; }
body[data-judge-page="review"] .rv-missing-list li { border-top: 1px solid #E7EFEB; }
body[data-judge-page="review"] .rv-missing-list li:first-child { border-top: 0; }
body[data-judge-page="review"] .rv-missing-list a {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px;
    color: var(--text);
    transition: background 0.15s;
    border-radius: 8px;
    margin: 4px;
}
body[data-judge-page="review"] .rv-missing-list a:hover { background: #F2F8F5; color: var(--forest); }
body[data-judge-page="review"] .rv-missing-c { font-weight: 700; color: var(--emerald); font-size: 12px; }
body[data-judge-page="review"] .rv-missing-name { font-weight: 600; }
body[data-judge-page="review"] .rv-missing-crit { color: var(--text-muted); font-size: 13px; }
body[data-judge-page="review"] .rv-missing-sep { color: var(--text-muted); }
body[data-judge-page="review"] .rv-missing-arrow { color: var(--text-muted); }

/* Footer actions: match evaluate's style exactly. */
body[data-judge-page="review"] .sc-actions {
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 18px;
    padding-bottom: 6px;
    border-top: 1px solid var(--judge-rule);
}
body[data-judge-page="review"] .sc-actions .btn {
    padding: 13px 24px;
    font-size: 14.5px;
    border-radius: 10px;
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
body[data-judge-page="review"] .sc-edit-btn {
    background: #fff;
    color: var(--forest);
    border: 1px solid var(--forest);
    box-shadow: none;
}
body[data-judge-page="review"] .sc-edit-btn .lucide { color: var(--emerald); }
body[data-judge-page="review"] .sc-edit-btn:hover:not(:disabled) {
    background: var(--mint);
    color: var(--forest);
    border-color: var(--emerald);
    box-shadow: none;
}

/* Contest tabs: match evaluate's styling exactly. */
body[data-judge-page="review"] .bundle-contest-tabs {
    margin-top: 16px;
    padding: 8px;
    gap: 8px;
    background: #FBFDFC;
    border: 1px solid #DCEAE4;
    border-radius: 12px;
}
body[data-judge-page="review"] .bundle-contest-tab {
    min-width: 190px;
    max-width: 300px;
    padding: 11px 15px;
}
body[data-judge-page="review"] .bundle-contest-tab .lucide { color: var(--gold-deep); }

/* Contestant folder bars: match evaluate's styling exactly. */
body[data-judge-page="review"] .sc-folders,
body[data-judge-page="review"] .sc-folders-nested {
    margin-top: 16px;
    background: #FBFDFC;
    border: 1px solid #DCEAE4;
    border-radius: 13px;
    padding: 9px;
}
body[data-judge-page="review"] .sc-folder {
    flex: 1 1 auto;
    min-width: 158px;
    max-width: 260px;
    padding: 9px 13px;
}
body[data-judge-page="review"] .sc-folder-name {
    font-size: 13.5px;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
}
body[data-judge-page="review"] .sc-folders-nested .sc-folder { min-width: 150px; }

@media (max-width: 900px) {
    body[data-judge-page="evaluate"],
    body[data-judge-page="review"] {
        --judge-gutter: 18px;
    }
    body[data-judge-page="evaluate"] .sc-wrap,
    body[data-judge-page="review"] .sc-wrap {
        width: 100%;
        padding: 12px 12px 28px;
    }
    body[data-judge-page="evaluate"] .sc-sheet,
    body[data-judge-page="review"] .sc-sheet { border-radius: 14px; }
    body[data-judge-page="evaluate"] .sc-head,
    body[data-judge-page="review"] .sc-head { border-radius: 13px 13px 0 0; }

    body[data-judge-page="evaluate"] .sc-head,
    body[data-judge-page="review"] .sc-head { flex-wrap: wrap; }
    body[data-judge-page="evaluate"] .sc-head-progress,
    body[data-judge-page="review"] .sc-head-progress { width: 100%; margin-left: 0; }
    body[data-judge-page="evaluate"] .sc-card-head,
    body[data-judge-page="review"] .sc-card-head { padding: 14px 16px; }
    /* Scored-either-way, so this element has a different name on each page:
     * the total box is .sc-scorebox on the scoring sheet and .rv-total on the
     * review sheet. Naming .rv-total on the evaluate page matched nothing, so the
     * score box kept its full-width inset while everything around it narrowed. */
    body[data-judge-page="evaluate"] .sc-scorebox,
    body[data-judge-page="review"] .rv-total { margin-left: 0; }
    body[data-judge-page="evaluate"] .sc-actions .btn,
    body[data-judge-page="review"] .sc-actions .btn { flex: 1 1 100%; justify-content: center; }
    body[data-judge-page="evaluate"] .sc-folder,
    body[data-judge-page="review"] .sc-folder { max-width: none; }
    body[data-judge-page="evaluate"] .sc-actions-note,
    body[data-judge-page="review"] .sc-actions-note { width: 100%; margin: 0 0 4px; }

    body[data-judge-page="review"] .rv-total-value { font-size: 21px; }
    body[data-judge-page="review"] .rv-total { flex-wrap: wrap; gap: 4px; }
    body[data-judge-page="review"] .rv-total-text { order: -1; width: 100%; }
}

@media (max-width: 560px) {
    body[data-judge-page="evaluate"],
    body[data-judge-page="review"] { --judge-gutter: 14px; }
    body[data-judge-page="evaluate"] .sc-wrap,
    body[data-judge-page="review"] .sc-wrap { padding: 10px 10px 24px; }
    /* Full width is already the case; this only stops the criteria table from
       forcing the whole page sideways. The scroll stays inside the table
       wrapper, where it belongs. */
    body[data-judge-page="evaluate"] .sc-card,
    body[data-judge-page="evaluate"] .sc-panel,
    body[data-judge-page="review"] .sc-card,
    body[data-judge-page="review"] .rv-card { min-width: 0; }
}

/* =============================================================
   JUDGE REVIEW SHEET (REDESIGN)
   =============================================================

   Scoped to .rvs-* on the review stage only. Nothing here changes the
   evaluate sheet, the receipt, or the admin - the three other places the
   same .rv-* and .sc-* classes appear keep their existing rules.

   The page was rebuilt around four things a judge needs in order: which
   contest this is, how far along they are, what is still missing, and where
   the Submit button is. Those are now four blocks rather than one heading, a
   progress bar, a status banner and an action row at the foot. */

/* ---------- Hero: contest identity + completion ring ---------- */

.rvs-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px;
    background: linear-gradient(100deg, #004D3B 0%, #0A6650 58%, #00493A 100%);
    border-bottom: 2px solid #D1AE3D;
    /* Rounded on three corners only: the gold rule below it is the sheet's own
     * top edge, so a radius on the bottom corners would leave a sliver of the
     * body background showing between the two. */
    border-radius: 15px 15px 0 0;
}
.rvs-hero-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.rvs-hero-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 13px;
    color: #F3E3B0;
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(212,175,55,0.75);
}
.rvs-hero-text { min-width: 0; }
.rvs-hero-eyebrow {
    display: block;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 1.1px;
    text-transform: uppercase;
    color: rgba(243,227,176,0.85);
    margin-bottom: 2px;
}
.rvs-hero-text h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    line-height: 1.25;
    color: #fff;
    word-break: break-word;
}
.rvs-hero-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin-top: 7px;
}
.rvs-hero-facts span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.82);
}
.rvs-hero-facts .lucide { color: rgba(243,227,176,0.9); flex-shrink: 0; }

/* The ring. The filled arc IS the percentage - there is no second number to
   keep in step with it, and the label inside restates it in words for anyone
   not reading the paint. */
.rvs-hero-ring {
    position: relative;
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.rvs-hero-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.rvs-ring-track,
.rvs-ring-fill { fill: none; stroke-width: 5; }
.rvs-ring-track { stroke: rgba(255,255,255,0.16); }
.rvs-ring-fill {
    stroke: #F3E3B0;
    stroke-linecap: round;
    /* A faint halo so the arc reads against the dark gradient without
       needing a second, brighter stroke. */
    filter: drop-shadow(0 0 3px rgba(243,227,176,0.45));
}
.rvs-ring-label {
    position: relative;
    display: flex;
    align-items: baseline;
    color: #fff;
}
.rvs-ring-label b { font-size: 17px; font-weight: 800; line-height: 1; }
.rvs-ring-label i { font-size: 10px; font-style: normal; font-weight: 700; opacity: 0.8; }

/* ---------- Status strip ---------- */

/* One line where the old banner was a three-line paragraph. The count is
   already in the hero facts and the specific gaps are directly below, so this
   row's only job is the instruction. */
.rvs-strip {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 14px var(--judge-gutter) 0;
    padding: 12px 15px;
    border-radius: 11px;
}
.rvs-strip-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
}
.rvs-strip-text { min-width: 0; }
.rvs-strip-text b { display: block; font-size: 14px; font-weight: 800; line-height: 1.3; }
.rvs-strip-text span { display: block; font-size: 12.5px; line-height: 1.45; margin-top: 1px; }

.rvs-strip-warn {
    background: #FFF8EC;
    border: 1px solid #E9D3A0;
    border-left: 4px solid #D1AE3D;
}
.rvs-strip-warn .rvs-strip-icon { background: rgba(212,175,55,0.18); color: #8A6A10; }
.rvs-strip-warn .rvs-strip-text b { color: #6E5409; }
.rvs-strip-warn .rvs-strip-text span { color: #8A6A3E; }

.rvs-strip-ok {
    background: #EAF7F0;
    border: 1px solid #BFE0CE;
    border-left: 4px solid #087B59;
}
.rvs-strip-ok .rvs-strip-icon { background: rgba(8,123,89,0.13); color: #087B59; }
.rvs-strip-ok .rvs-strip-text b { color: #004D3B; }
.rvs-strip-ok .rvs-strip-text span { color: #4A7A68; }

/* ---------- Still to fill: grouped by contestant ---------- */

/* The old panel listed every gap flat, so one person's name repeated once per
   gap - twelve rows in which the same three words appeared four times. Grouping
   puts each person in one place with their own gaps under them, in the same
   contestant order as the folder bar below, so the two read as one list. */
.rvs-gaps {
    margin: 16px var(--judge-gutter) 0;
    padding: 15px 17px;
    background: #FFFDF8;
    border: 1px solid #E9E0C8;
    border-radius: 13px;
}
.rvs-gaps-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    font-size: 13.5px;
    font-weight: 800;
    color: #6E5409;
}
.rvs-gaps-title .lucide { color: #B8912A; }
.rvs-gaps-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 7px;
    font-size: 11.5px;
    font-weight: 800;
    color: #fff;
    background: #C81E1E;
    border-radius: 999px;
}

.rvs-gaps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
    gap: 12px;
}
.rvs-gaps-group {
    background: #fff;
    border: 1px solid #E6E0D0;
    border-radius: 10px;
    overflow: hidden;
}
.rvs-gaps-who {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 11px;
    background: #FAF7EE;
    border-bottom: 1px solid #EDE6D4;
}
.rvs-gaps-num {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 20px;
    padding: 0 7px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.3px;
    color: #fff;
    background: var(--forest);
    border-radius: 999px;
}
.rvs-gaps-name {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 700;
    color: #3F3222;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rvs-gaps-badge {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 800;
    color: #8A6A10;
    background: rgba(212,175,55,0.22);
    border-radius: 999px;
}
.rvs-gaps-list { list-style: none; margin: 0; padding: 5px; }
.rvs-gap {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 9px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    /* The whole row is the tap target, not just the label - these are tapped on
       a phone while standing at a scoring desk, and a 12px text run is not a
       target. */
    transition: background-color 0.12s ease;
}
.rvs-gap:hover { background: #F3F7F5; }
.rvs-gap:focus-visible { outline: 2px solid #087B59; outline-offset: -2px; }
.rvs-gap-group {
    flex-shrink: 0;
    padding: 2px 7px;
    font-size: 10.5px;
    font-weight: 700;
    color: #7A5E12;
    background: #FBF1D6;
    border-radius: 999px;
}
.rvs-gap-crit {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rvs-gap-go { flex-shrink: 0; color: #A78314; display: flex; }

/* ---------- Contestant folder bar ---------- */

.rvs-contest-tabs { margin-top: 16px; }
.rvs-folders { margin-top: 18px; }

/* A tick for a finished contestant, replacing the folder glyph rather than
   sitting beside it, so complete and incomplete read apart at a glance in a
   long roster - which is what the judge is scanning for.

   Scoped to the review stage. The scoring sheet has its own treatment for a
   submitted contest and must not inherit this one. */
body[data-judge-page="review"] .sc-folder-check {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    color: #fff;
    background: #087B59;
}

/* ---------- Contestant card ---------- */

.rvs-card { margin-top: 16px; }

/* Three blocks across on a laptop: who this is, what is missing, and the
   total. The total is what a judge came to this page to read, so it sits at the
   far end of the same line as the name rather than three rows down under the
   table. */
.rvs-card-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 18px;
    background: linear-gradient(180deg, #FBFEFC 0%, #F4FAF7 100%);
    border-bottom: 1px solid #DCEAE4;
    box-shadow: inset 3px 0 0 var(--gold);
}
.rvs-card-who { flex: 1; min-width: 0; }
.rvs-card-name {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.3;
    color: var(--forest);
    word-break: break-word;
}
.rvs-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    margin-top: 4px;
}
.rvs-card-num {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.4px;
    color: var(--text-muted);
}
.rvs-card-flag {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 11px;
    font-size: 11.5px;
    font-weight: 700;
    border-radius: 999px;
}
.rvs-card-flag-ok {
    color: #fff;
    background: #087B59;
}
.rvs-card-flag-warn {
    color: #8A6A10;
    background: rgba(212,175,55,0.20);
    border: 1px solid rgba(212,175,55,0.55);
}

/* Incomplete cards get a red edge instead of the gold one, so a roster is
   scannable for "who still owes something" without reading a word. */
.rvs-card.is-incomplete > .rvs-card-head {
    box-shadow: inset 3px 0 0 #C81E1E;
}

/* Total, inside the header on wide screens. Below the table on narrow ones -
   see the media query at the end of this block. */
.rvs-total {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 18px;
    padding: 11px 15px;
    background: linear-gradient(115deg, #E8F6EF 0%, #F2FBF6 100%);
    border: 1px solid rgba(212,175,55,0.6);
    border-radius: 11px;
    box-shadow: 0 0 0 3px rgba(212,175,55,0.07);
}
.rvs-total .rv-total-text { flex: 1; min-width: 0; }
.rvs-total .rv-total-value { margin-left: auto; }
.rvs-total .rv-total-value b { font-size: 22px; }

/* ---------- Sticky action bar ---------- */

/* Sticky because Submit is the destination of this page and it used to sit
   below every contestant's full score sheet - several screens of scrolling
   between the last score and the decision. */
.rvs-actions {
    position: sticky;
    bottom: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 18px;
    padding: 13px 18px;
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(8px);
    border-top: 1px solid #DCEAE4;
    box-shadow: 0 -4px 14px rgba(0,77,59,0.08);
}
.rvs-actions-note {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 700;
    color: #8A6A10;
    min-width: 0;
}
.rvs-actions-note .lucide { flex-shrink: 0; }
.rvs-actions-note-ok { color: #087B59; }
.rvs-actions-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* ---------- Narrow screens ---------- */

@media (max-width: 760px) {
    /* The ring drops below the facts rather than squeezing them: at this width
       the identity block is already using most of the row, and a 64px ring
       beside a wrapped title pushes the title onto three lines. */
    .rvs-hero { flex-wrap: wrap; gap: 14px; padding: 16px 17px; }
    .rvs-hero-main { flex: 1 1 100%; }
    .rvs-hero-ring { margin-left: auto; margin-top: -4px; }
    .rvs-hero-text h1 { font-size: 18px; }

    /* Total returns below the table: the header is two lines tall here, and the
       figure beside it would push the contestant's name off the first screen -
       which is the one thing a judge must be able to confirm at a glance. */
    .rvs-card-head { flex-wrap: wrap; gap: 9px; padding: 12px 15px; }
    .rvs-card-who { flex: 1 1 100%; }
    .rvs-card-flag { margin-left: 0; }
    .rvs-total { margin: 13px 14px; }
    .rvs-total .rv-total-value b { font-size: 20px; }

    .rvs-gaps { padding: 13px 14px; }
    .rvs-actions { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 14px; }
    .rvs-actions-note { justify-content: center; }
    .rvs-actions-buttons { width: 100%; }
    .rvs-actions-buttons .btn { flex: 1; justify-content: center; }
}

@media (max-width: 560px) {
    .rvs-hero-facts { gap: 4px 10px; }
    .rvs-hero-facts span { font-size: 11.5px; }
    .rvs-gap-group { max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ---------- Grouped review: per-contest panel header ---------- */

/* The grouping's inner heading. The category is the heading here rather than the
   contest title, because the tab bar directly above already names every contest
   and in a grouping that name repeats - one "DANCE SPORTS" contest per category.
   The category is what tells two same-titled contests apart, and the tab cannot
   show it once the judge has scrolled away from the bar. */
.rvs-contest-panel {
    margin: 18px var(--judge-gutter) 0;
    padding: 0;
    overflow: hidden;
    background: #fff;
    border: 1px solid #DCEAE4;
    border-radius: 13px;
    box-shadow: 0 3px 12px rgba(0,77,59,0.05);
}
.rvs-panel-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 17px;
    background: linear-gradient(100deg, #004D3B 0%, #0A6650 100%);
    border-bottom: 2px solid #D1AE3D;
}
.rvs-panel-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    color: #F3E3B0;
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(212,175,55,0.7);
}
.rvs-panel-text { flex: 1; min-width: 0; }
.rvs-panel-cat {
    display: block;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.3;
    color: #fff;
    word-break: break-word;
}
.rvs-panel-facts {
    display: block;
    font-size: 12.5px;
    line-height: 1.45;
    color: rgba(255,255,255,0.78);
    margin-top: 2px;
}

/* The per-contest progress flag. A grouping is submitted contest by contest, so a
   judge needs to know at a glance which of them are still theirs to do - this is
   the one place that answers it. It uses the card flag's own colours so a
   complete contest and a complete contestant read identically. */
.rvs-panel-flag {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    font-size: 11.5px;
    font-weight: 700;
    border-radius: 999px;
}
/* On the dark panel head the light-gold treatment that works on a white card
   disappears, so this one is restated for the darker ground. */
.rvs-panel-head .rvs-card-flag-ok {
    color: #004D3B;
    background: #7BE0B4;
}
.rvs-panel-head .rvs-card-flag-warn {
    color: #6E5409;
    background: #F3E3B0;
    border: 0;
}

/* ---------- Grouped review: gap panel, nested one level deeper ---------- */

/* Same panel as the single-contest sheet, but each contest becomes its own
   labelled block so a judge can see at a glance which of the five contests the
   gaps belong to, rather than reading a flat run of criteria that span all five. */
.rvs-gaps-contest { margin-top: 12px; }
.rvs-gaps-contest:first-of-type { margin-top: 0; }
.rvs-gaps-contest-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 9px;
    padding-bottom: 7px;
    border-bottom: 1px dashed #E2D9C0;
}
.rvs-gaps-contest-icon {
    flex-shrink: 0;
    display: flex;
    color: #B8912A;
}
.rvs-gaps-contest-name {
    font-size: 13px;
    font-weight: 800;
    color: #4A3A16;
}
.rvs-gaps-contest-title {
    font-size: 11.5px;
    font-weight: 600;
    color: #A08C63;
    padding: 2px 8px;
    background: #F4EFE1;
    border-radius: 999px;
}
.rvs-gaps-contest-head .rvs-gaps-badge { margin-left: auto; }

/* Two nested grids inside one panel need a little more air between them than the
   single-contest sheet's one. */
.rvs-gaps-grouped .rvs-gaps-contest + .rvs-gaps-contest {
    padding-top: 12px;
    border-top: 1px solid #EFE8D6;
}

/* =============================================================
   JUDGE SIGNATURE / CERTIFICATION
 *
   Two pieces: the certification block on the receipt, and the signature pad
   modal. Both live on the judge side only.
   ============================================================= */

.cf-sign {
    margin: 18px 24px 0;
    padding: 18px 20px 16px;
    background: #F7FBF9;
    border: 1px solid #DCEAE4;
    border-left: 4px solid var(--gold);
    border-radius: 12px;
}
.cf-sign-head { display: flex; align-items: flex-start; gap: 12px; }
.cf-sign-head > .lucide { flex-shrink: 0; color: var(--gold-deep); margin-top: 2px; }
.cf-sign-title { font-size: 15px; font-weight: 800; color: var(--forest); line-height: 1.3; }
.cf-sign-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; line-height: 1.55; }

/* The submitted-and-signed contest list.
 *
 * Capped rather than expanded, because the certification sits in the narrow
 * column of a two-column receipt and every signed row carries a signature
 * thumbnail: in a grouping with a dozen categories the list grew taller than
 * the rest of the page and pushed the note and the View Submission button below
 * the fold. A cap produces a scrollbar only once the content actually exceeds
 * it, so a judge with one or two contests sees an ordinary full-height list with
 * no track and nothing that looks like a control that should have been omitted.
 *
 * The unit is a viewport fraction as well as a pixel ceiling so the list stays a
 * sensible share of the screen on a laptop and on a tall venue display alike.
 *
 * The floor is 340px because it has to clear two signed rows without help: one
 * signed row on this page measures about 155px (24px padding and border, a ~20px
 * title line, a 64px signature thumbnail and ~26px of meta beneath it), so two
 * are around 310px. A smaller floor would have put a scrollbar - and a visible
 * "there is more below" claim - under a judge with only a couple of contests,
 * which is the opposite of what was asked for and makes the control look broken
 * when nothing is actually hidden.
 *
 * overscroll-behavior contains the scroll, so reaching the end of the list does
 * not start scrolling the receipt behind it - which on a trackpad reads as the
 * page lurching for no reason.
 *
 * padding-right leaves room for the scrollbar so a row never sits under it. */
.cf-sign-rows {
    max-height: clamp(340px, 46vh, 480px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: #C6D9D1 transparent;
}
.cf-sign-rows::-webkit-scrollbar { width: 8px; }
.cf-sign-rows::-webkit-scrollbar-track { background: transparent; }
.cf-sign-rows::-webkit-scrollbar-thumb {
    background: #C6D9D1;
    border: 2px solid transparent;
    background-clip: content-box;
    border-radius: 999px;
}
.cf-sign-rows::-webkit-scrollbar-thumb:hover { background: #9FBCB1; background-clip: content-box; }
/* Keyboard focus on the scroll region itself, so it is obvious the region is
 * reachable - the rows below the cap can only be scrolled to by keyboard, a
 * wheel or a dragged thumb. :focus-visible rather than :focus, so a judge who
 * lands here by clicking does not get a ring they did not ask for. */
.cf-sign-rows:focus-visible {
    outline: 2px solid var(--gold-deep);
    outline-offset: 2px;
    border-radius: 8px;
}

.cf-sign-row {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px;
    margin-top: 14px; padding-top: 14px;
    border-top: 1px solid #E7EFEB;
}
.cf-sign-row.is-signed { align-items: flex-start; }
.cf-sign-row-main { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.cf-sign-row-titles { display: flex; align-items: baseline; gap: 7px; min-width: 0; flex-wrap: wrap; }
.cf-sign-row-title { font-size: 13.5px; font-weight: 700; color: var(--forest); }
/* The category rides beside the contest title because in a Non-Sports grouping
   the title repeats once per category - a Dance Sports bundle has one "DANCE
   SPORTS" contest per category, so the title alone cannot say which sheet a
   signature belongs to. */
.cf-sign-row-category {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 1px 8px;
    font-size: 11px; font-weight: 600; white-space: nowrap;
    color: #0F6B5E;
    background: #EAF6F3;
    border: 1px solid #CFE7E1;
    border-radius: 999px;
}
.cf-sign-btn { white-space: nowrap; }

.cf-sign-done { width: 100%; margin-top: 10px; }
.cf-sign-img {
    display: block;
    max-width: 100%;
    height: auto;
    background: #fff;
    border: 1px solid #E1EBE7;
    border-radius: 8px;
    padding: 6px 10px;
}
.cf-sign-meta {
    display: flex; flex-wrap: wrap; gap: 16px;
    margin-top: 8px;
    font-size: 12.5px; color: var(--text-muted);
}
.cf-sign-meta span { display: inline-flex; align-items: center; gap: 5px; }
.cf-sign-meta .lucide { color: var(--gold-deep); }

.cf-sign-note {
    display: flex; align-items: flex-start; gap: 7px;
    margin-top: 12px;
    font-size: 12.5px; color: var(--text-muted); line-height: 1.5;
}
.cf-sign-note .lucide { flex-shrink: 0; color: var(--gold-deep); margin-top: 1px; }
.cf-sign-note.is-done { color: var(--emerald); }
.cf-sign-note.is-done .lucide { color: var(--emerald); }

/* The gold "Awaiting Signature" pill, alongside the existing blue/green/amber. */
.cf-pill-gold {
    background: #FBF3DC;
    color: #8A6410;
    border: 1px solid rgba(212,175,55,0.5);
}

/* ---------- Signature pad ---------- */
.sig-modal { max-width: 680px; }
.sig-form { display: contents; }
.sig-instruction { font-size: 13.5px; color: var(--text); margin-bottom: 4px; }
.sig-contest { font-size: 12.5px; color: var(--text-muted); margin-bottom: 12px; }
.sig-contest strong { color: var(--forest); }

.sig-pad-wrap {
    position: relative;
    border: 1px solid #C9DDD4;
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
}
.sig-canvas {
    display: block;
    width: 100%;
    height: 200px;
    background: #fff;
    cursor: crosshair;
    /* The load-bearing rule for touch. Without it a stroke on a touchscreen
       scrolls the page instead of drawing, and the pad looks frozen. */
    touch-action: none;
    -ms-touch-action: none;
}
/* The writing line and the "Sign here" prompt are decoration, not the drawing
   surface, so they sit behind the canvas content and are hidden once there is
   ink. Both are positioned rather than painted into the canvas, so a cleared
   signature restores them for free. */
.sig-baseline {
    position: absolute; left: 24px; right: 24px; bottom: 42px;
    height: 1px; background: #DCEAE4; pointer-events: none;
}
.sig-placeholder {
    position: absolute; left: 24px; bottom: 50px;
    font-size: 12.5px; color: #A9BDB6; pointer-events: none;
}
.sig-error {
    margin-top: 12px; padding: 10px 12px;
    background: #FCEBEB; border: 1px solid #F2C4C4; border-radius: 8px;
    font-size: 13px; color: #99231F;
}
.sig-footer { gap: 10px; flex-wrap: wrap; }
.sig-footer .btn { min-height: 44px; }

/* ---------------------------------------------------------------
 * JUDGE CERTIFICATION — PRINT
 *
 * The certification block on the printed score sheet. Printed from the admin's
 * submission view, which is the sheet that already carries school name, contest
 * title, contestant, criteria, scores and total.
 *
 * break-inside:avoid is what keeps the wording, the signature and the name on
 * one sheet. Without it a certification can split across a page boundary and
 * leave a signature on the last page under text from the first.
 * ------------------------------------------------------------- */
.sig-cert {
    margin-top: 22px;
    padding-top: 16px;
    border-top: 2px solid var(--forest);
    page-break-inside: avoid;
    break-inside: avoid;
}
.sig-cert-title {
    font-size: 12px; font-weight: 800; letter-spacing: 1px;
    text-transform: uppercase; color: var(--forest);
    margin-bottom: 6px;
}
.sig-cert-text { font-size: 12.5px; color: var(--text); line-height: 1.6; max-width: 70ch; }
.sig-cert-rule {
    margin: 26px 0 0; width: 320px; max-width: 60%;
    border-bottom: 1px solid #9AA9A3;
}
.sig-cert-img {
    display: block;
    width: 320px; max-width: 60%; height: auto;
    margin-top: -22px; /* sit the drawing on the rule rather than below it */
}
.sig-cert-name {
    margin-top: 6px; font-size: 12.5px; font-weight: 700; color: var(--forest);
}
.sig-cert-role { font-size: 11.5px; color: var(--text-muted); }
.sig-cert-when { margin-top: 4px; font-size: 11.5px; color: var(--text-muted); }
.sig-cert-awaiting {
    margin-top: 18px; width: 320px; max-width: 60%;
    padding: 10px 12px;
    border: 1px dashed #C08A2A;
    border-radius: 6px;
    background: #FDF6E3;
    font-size: 11.5px; font-weight: 800; letter-spacing: 0.8px;
    text-transform: uppercase; color: #8A6410;
    text-align: center;
}

@media print {
    .sig-cert-img { max-width: 55%; }
    .sig-cert-rule { max-width: 55%; }
    /* A signature is a light drawing; forcing colour-adjust off stops browsers
       dropping the pale strokes when "background graphics" is unchecked, which
       is the default on most print dialogs. */
    .sig-cert-img, .sig-cert { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (max-width: 560px) {
    .cf-sign { margin: 14px 14px 0; padding: 15px 14px 14px; }
    .cf-sign-btn { width: 100%; justify-content: center; }
    .sig-canvas { height: 160px; }
    .sig-footer .btn { flex: 1 1 100%; justify-content: center; }
}

/* Landscape confirmation receipt: submission details left, certifications right. */
body[data-judge-page="confirmation"] .judge-header {
    flex: 0 0 60px;
    min-height: 60px;
    min-width: 0;
    max-width: 100%;
    padding: 0 28px;
    background: #064D3B;
    border-bottom: 1px solid rgba(212,175,55,0.55);
    backdrop-filter: none;
}
body[data-judge-page="confirmation"] {
    width: 100%;
    overflow-x: hidden;
}
body[data-judge-page="confirmation"] .judge-system-brand {
    gap: 10px;
    font-size: 15px;
}
body[data-judge-page="confirmation"] .judge-system-brand > .lucide { color: #E9C85B; }
body[data-judge-page="confirmation"] .judge-profile { font-size: 13px; font-weight: 600; }
body[data-judge-page="confirmation"] .cf-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: calc(100vh - 60px);
    padding: 24px 20px 34px;
}
body[data-judge-page="confirmation"] #judgeStage {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
}
body[data-judge-page="confirmation"] .cf-card {
    position: relative;
    flex: 0 1 1320px;
    width: 100%;
    min-width: 0;
    max-width: 1320px;
    margin: 0 auto;
    padding: 22px;
    border: 1px solid #DCEAE4;
    border-radius: 17px;
    box-shadow: 0 14px 36px rgba(0,77,59,0.1);
}
body[data-judge-page="confirmation"] .cf-landscape-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.95fr) minmax(330px, 0.95fr);
    min-width: 0;
    align-items: start;
    gap: 20px;
}
body[data-judge-page="confirmation"] .cf-left-column,
body[data-judge-page="confirmation"] .cf-right-column { min-width: 0; }
body[data-judge-page="confirmation"] .cf-success-banner {
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 0;
    padding: 19px 21px;
    color: #fff;
    background: linear-gradient(105deg, #064D3B 0%, #0A6650 100%);
    border: 1px solid rgba(212,175,55,0.65);
    border-radius: 13px;
}
body[data-judge-page="confirmation"] .cf-success-trophy {
    display: flex;
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    align-items: center;
    justify-content: center;
    color: #F3E3B0;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(212,175,55,0.75);
    border-radius: 50%;
}
body[data-judge-page="confirmation"] .cf-success-copy { min-width: 0; }
body[data-judge-page="confirmation"] .cf-success-copy .cf-title {
    color: #fff;
    font-size: 23px;
}
body[data-judge-page="confirmation"] .cf-success-copy p {
    margin-top: 4px;
    color: rgba(255,255,255,0.94);
    font-size: 13.5px;
    line-height: 1.45;
}
body[data-judge-page="confirmation"] .cf-success-copy > span {
    display: block;
    margin-top: 3px;
    color: rgba(255,255,255,0.72);
    font-size: 12px;
}
body[data-judge-page="confirmation"] .cf-success-check {
    display: flex;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    color: #E6F8EC;
    background: rgba(14,153,91,0.36);
    border: 1px solid rgba(191,238,205,0.72);
    border-radius: 50%;
}
body[data-judge-page="confirmation"] .cf-details-card {
    margin-top: 16px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #DCEAE4;
    border-radius: 12px;
}
body[data-judge-page="confirmation"] .cf-details-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 15px;
    color: #064D3B;
    background: #EFF8F3;
    border-bottom: 1px solid #DCEAE4;
}
body[data-judge-page="confirmation"] .cf-details-head > .lucide { color: #087B59; }
body[data-judge-page="confirmation"] .cf-details-head h2 {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}
body[data-judge-page="confirmation"] .cf-details-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    padding: 4px 15px;
}
body[data-judge-page="confirmation"] .cf-detail-item {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
    padding: 11px 10px;
    border-bottom: 1px solid #EDF3F0;
}
body[data-judge-page="confirmation"] .cf-detail-item:nth-last-child(-n+2) { border-bottom: 0; }
body[data-judge-page="confirmation"] .cf-detail-item .cf-label {
    color: #71827B;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.35px;
}
body[data-judge-page="confirmation"] .cf-detail-item .cf-label .lucide { color: #9A7B18; }
body[data-judge-page="confirmation"] .cf-detail-item .cf-value {
    overflow-wrap: anywhere;
    color: #17382E;
    font-size: 13px;
    text-align: left;
}
body[data-judge-page="confirmation"] .cf-contest-status-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
    gap: 8px;
    padding: 0 15px 14px;
}
body[data-judge-page="confirmation"] .cf-contest-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
    padding: 10px 11px;
    background: #FBFDFC;
    border: 1px solid #E3EDE8;
    border-radius: 9px;
}
body[data-judge-page="confirmation"] .cf-contest-status > span {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    color: #21483A;
    font-size: 12px;
    font-weight: 700;
}
body[data-judge-page="confirmation"] .cf-contest-status > span .lucide { flex: 0 0 auto; color: #9A7B18; }
/* The category beside a contest name in the receipt's per-contest status list.
 * Same reason as .bundle-contest-tab-cat: every row there is a contest in the
 * same grouping, so the title alone identified none of them. */
.cf-contest-cat {
    font-style: normal;
    padding: 2px 7px;
    font-size: 9.5px; font-weight: 800;
    letter-spacing: .3px; text-transform: uppercase; white-space: nowrap;
    color: #0F6B5E;
    background: #EAF6F3;
    border: 1px solid #CFE7E1;
    border-radius: 999px;
}
body[data-judge-page="confirmation"] .cf-contest-status .cf-pill { font-size: 10px; padding: 3px 8px; }

/* The submitted scores, listed on the certification page itself.
 *
 * That page says "I certify that the scores recorded above" and used to record
 * none, which is what sent judges back to the scoring sheet convinced their work
 * had vanished - and then into a refusal when they tried to enter it a second time.
 * The summary lives here, in the same card language as the details block above it,
 * and deliberately reuses .table so the table styling is the one the receipts
 * already have rather than a second set. */
body[data-judge-page="confirmation"] .cf-scorelist-title {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 12px 15px 4px;
    color: #0F6B5E;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .4px;
    text-transform: uppercase;
}
body[data-judge-page="confirmation"] .cf-scores-table {
    margin: 0;
    font-size: 13px;
}
body[data-judge-page="confirmation"] .cf-scores-table th[scope="row"] {
    font-weight: 600;
    color: #17382E;
}
body[data-judge-page="confirmation"] .cf-scores-table .cf-cno {
    display: inline-block;
    min-width: 34px;
    margin-right: 8px;
    padding: 2px 7px;
    font-size: 10px;
    font-weight: 800;
    text-align: center;
    color: #9A7B18;
    background: #FBF4E0;
    border: 1px solid #EBDCAF;
    border-radius: 999px;
}
body[data-judge-page="confirmation"] .cf-scores-table .cf-score {
    font-size: 15px;
    font-weight: 800;
    color: #004D3B;
}
body[data-judge-page="confirmation"] .cf-scores-table .cf-muted {
    font-size: 11px;
    font-weight: 600;
    color: #71817B;
}
body[data-judge-page="confirmation"] .cf-scorelist-note {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 10px 15px 14px;
    border-top: 1px solid #EAF1EE;
    color: #71817B;
    font-size: 11.5px;
    line-height: 1.5;
}
body[data-judge-page="confirmation"] .cf-scorelist-note .lucide { color: #9A7B18; }
body[data-judge-page="confirmation"] .cf-scorelist-note a {
    color: #0F6B5E;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}
body[data-judge-page="confirmation"] .cf-count {
    margin-top: 14px;
    padding: 13px 15px;
    background: #EFF8F3;
    border: 1px solid #D8E9DF;
    border-left: 4px solid #D1AE3D;
    border-radius: 10px;
    box-shadow: none;
}
body[data-judge-page="confirmation"] .cf-count.is-static { background: #EFF8F3; }
body[data-judge-page="confirmation"] .cf-count.is-static .cf-count-icon {
    width: 34px;
    height: 34px;
    color: #fff;
    background: #087B59;
    box-shadow: none;
}
body[data-judge-page="confirmation"] .cf-count-text strong { font-size: 12.5px; }
body[data-judge-page="confirmation"] .cf-count-text span { font-size: 11.5px; }
body[data-judge-page="confirmation"] .cf-left-actions { justify-content: flex-start; margin-top: 12px; }
body[data-judge-page="confirmation"] .cf-left-actions:empty { display: none; }
body[data-judge-page="confirmation"] .cf-sign {
    margin: 0;
    padding: 17px;
    background: #fff;
    border: 1px solid rgba(212,175,55,0.55);
    border-radius: 13px;
    box-shadow: 0 4px 14px rgba(0,77,59,0.06);
}
body[data-judge-page="confirmation"] .cf-sign-head {
    margin: -17px -17px 0;
    padding: 15px 17px;
    background: #EFF8F3;
    border-bottom: 1px solid #DCEAE4;
}
body[data-judge-page="confirmation"] .cf-sign-head > .lucide { color: #9A7B18; }
body[data-judge-page="confirmation"] .cf-sign-title { font-size: 15px; }
body[data-judge-page="confirmation"] .cf-sign-sub { font-size: 11.5px; }
body[data-judge-page="confirmation"] .cf-sign-row {
    display: block;
    margin-top: 12px;
    padding: 11px;
    background: #FBFDFC;
    border: 1px solid #E3EDE8;
    border-radius: 10px;
}
body[data-judge-page="confirmation"] .cf-sign-row-main {
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}
body[data-judge-page="confirmation"] .cf-sign-row-title {
    color: #064D3B;
    font-size: 12.5px;
}
/* Matched to the title and the state pill rather than left at the base 11px,
   which would have made the category the loudest thing on a row this small. */
body[data-judge-page="confirmation"] .cf-sign-row-category { font-size: 9.5px; padding: 2px 7px; }
body[data-judge-page="confirmation"] .cf-sign-row-state {
    white-space: normal;
    font-size: 9.5px;
    padding: 3px 7px;
}
body[data-judge-page="confirmation"] .cf-sign-done { margin-top: 9px; }
body[data-judge-page="confirmation"] .cf-sign-preview-trigger {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 9px;
    padding: 0;
    color: inherit;
    text-align: left;
    background: transparent;
    border: 0;
    cursor: pointer;
}
body[data-judge-page="confirmation"] .cf-sign-preview-trigger:focus-visible {
    outline: 2px solid #C9A227;
    outline-offset: 3px;
    border-radius: 8px;
}
body[data-judge-page="confirmation"] .cf-sign-image-wrap {
    display: flex;
    flex: 0 0 132px;
    height: 54px;
    min-height: 54px;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    background: #fff;
    border: 1px solid #E1EBE7;
    border-radius: 8px;
}
body[data-judge-page="confirmation"] .cf-sign-img {
    width: 100%;
    max-width: 116px;
    max-height: 42px;
    height: auto;
    object-fit: contain;
    padding: 0;
    border: 0;
    border-radius: 0;
}
body[data-judge-page="confirmation"] .cf-sign-preview-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #087052;
    font-size: 10.5px;
    font-weight: 700;
    white-space: nowrap;
}
body[data-judge-page="confirmation"] .cf-sign-meta {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 5px 12px;
    margin-top: 6px;
    font-size: 9.5px;
}
body[data-judge-page="confirmation"] .cf-sign-meta .lucide { width: 12px; height: 12px; }
body[data-judge-page="confirmation"] .cf-sign-meta span { min-width: 0; }
body[data-judge-page="confirmation"] .cf-sign-note { font-size: 11px; }
body[data-judge-page="confirmation"] .cf-view-submission {
    display: flex;
    width: 100%;
    justify-content: center;
    margin-top: 14px;
}
.cf-signature-preview-overlay {
    position: fixed;
    inset: 0;
    z-index: 1600;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(7, 29, 23, .68);
}
.cf-signature-preview-overlay.active { display: flex; }
.cf-signature-preview {
    width: min(560px, 100%);
    overflow: hidden;
    background: #fff;
    border: 1px solid #E4EDE8;
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
}
.cf-signature-preview-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    background: #F0F8F4;
    border-bottom: 1px solid #DEEAE4;
}
.cf-signature-preview-head h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: #064D3B;
    font-size: 17px;
}
.cf-signature-preview-head h2 .lucide { color: #A78314; }
.cf-signature-preview-head p {
    margin: 5px 0 0;
    color: #52665D;
    font-size: 12px;
}
.cf-signature-preview-close {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    padding: 0;
    color: #315348;
    font-size: 25px;
    line-height: 1;
    background: #fff;
    border: 1px solid #D8E4DE;
    border-radius: 9px;
    cursor: pointer;
}
.cf-signature-preview-body { padding: 20px; }
.cf-signature-preview-image {
    display: flex;
    min-height: 160px;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: #fff;
    border: 1px solid #E1EBE7;
    border-radius: 12px;
}
.cf-signature-preview-image img {
    display: block;
    max-width: 100%;
    max-height: 220px;
    width: auto;
    height: auto;
    object-fit: contain;
}
.cf-signature-preview-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 16px;
}
.cf-signature-preview-meta span { display: grid; gap: 4px; min-width: 0; }
.cf-signature-preview-meta b {
    color: #718078;
    font-size: 10px;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.cf-signature-preview-meta strong {
    overflow-wrap: anywhere;
    color: #174D3E;
    font-size: 13px;
}
.cf-signature-preview-footer {
    display: flex;
    justify-content: flex-end;
    padding: 0 20px 18px;
}
@media (max-width: 900px) {
    body[data-judge-page="confirmation"] .cf-landscape-grid {
        grid-template-columns: minmax(0, 1fr) minmax(280px, 0.8fr);
        gap: 14px;
    }
    body[data-judge-page="confirmation"] .cf-wrap {
        min-height: calc(100vh - 60px);
        padding: 16px 14px 26px;
    }
    body[data-judge-page="confirmation"] .cf-card { padding: 16px; }
}
@media (max-width: 700px) {
    body[data-judge-page="confirmation"] .cf-landscape-grid { grid-template-columns: minmax(0, 1fr); }
    body[data-judge-page="confirmation"] .cf-wrap {
        align-items: flex-start;
        min-height: calc(100vh - 60px);
    }
    body[data-judge-page="confirmation"] .cf-right-column { order: 2; }
    body[data-judge-page="confirmation"] .cf-success-banner { padding: 15px; gap: 11px; }
    body[data-judge-page="confirmation"] .cf-success-trophy { flex-basis: 40px; width: 40px; height: 40px; }
    body[data-judge-page="confirmation"] .cf-sign-image-wrap { flex-basis: 112px; }
    body[data-judge-page="confirmation"] .cf-sign-meta { flex-direction: column; }
    .cf-signature-preview-overlay { padding: 12px; }
    .cf-signature-preview-head, .cf-signature-preview-body { padding: 16px; }
    .cf-signature-preview-meta { grid-template-columns: minmax(0, 1fr); gap: 10px; }
    body[data-judge-page="confirmation"] .cf-success-check { flex-basis: 32px; width: 32px; height: 32px; }
}
@media (max-width: 560px) {
    body[data-judge-page="confirmation"] .judge-header {
        flex-basis: 54px;
        min-height: 54px;
        padding: 0 14px;
        gap: 8px;
    }
    body[data-judge-page="confirmation"] .judge-system-brand {
        flex: 1 1 auto;
        min-width: 0;
        font-size: 12px;
        gap: 6px;
    }
    body[data-judge-page="confirmation"] .judge-system-brand .judge-header-logo-text {
        max-width: calc(100vw - 190px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    body[data-judge-page="confirmation"] .judge-profile { flex: 0 0 auto; }
    body[data-judge-page="confirmation"] .cf-wrap {
        min-height: calc(100vh - 54px);
        padding: 12px 10px 20px;
    }
    body[data-judge-page="confirmation"] .cf-card { padding: 12px; border-radius: 14px; }
    body[data-judge-page="confirmation"] .cf-success-copy .cf-title { font-size: 19px; }
    body[data-judge-page="confirmation"] .cf-success-copy p { font-size: 12px; }
    body[data-judge-page="confirmation"] .cf-success-copy > span { font-size: 10.5px; }
    body[data-judge-page="confirmation"] .cf-details-grid { grid-template-columns: minmax(0, 1fr); padding: 2px 12px; }
    body[data-judge-page="confirmation"] .cf-detail-item { padding: 9px 4px; }
    body[data-judge-page="confirmation"] .cf-detail-item:nth-last-child(-n+2) { border-bottom: 1px solid #EDF3F0; }
    body[data-judge-page="confirmation"] .cf-detail-item:last-child { border-bottom: 0; }
    body[data-judge-page="confirmation"] .cf-contest-status-list { padding: 0 12px 12px; }
}

/* =============================================================
   JUDGE ACCESS PAGE (REDESIGN)
   Premium green + gold competition gate. Shares the judge-sheet
   shell (nav bar, gold-framed panel, corner accents) with the rest
   of the judging flow.
   ============================================================= */
.judge-gate {
    background: #F0F7F4;
    background-image:
        radial-gradient(880px 420px at 14% -10%, rgba(8,122,89,0.10), transparent 62%),
        radial-gradient(720px 380px at 88% 4%, rgba(212,175,55,0.13), transparent 60%);
    background-attachment: fixed;
}

/* ---------- Page stage + soft decoration ---------- */
.gate-wrap {
    position: relative; overflow: hidden;
    flex: 1; display: flex; align-items: center; justify-content: center;
    padding: 40px 20px 64px;
}
.gate-orb {
    position: absolute; border-radius: 50%; pointer-events: none;
}
.gate-orb-a {
    width: 420px; height: 420px; top: -140px; left: -120px;
    background: radial-gradient(circle, rgba(8,122,89,0.07), transparent 68%);
}
.gate-orb-b {
    width: 520px; height: 520px; bottom: -220px; right: -160px;
    background: radial-gradient(circle, rgba(212,175,55,0.10), transparent 66%);
}
/* One thin gold arc for a quiet premium touch. */
.gate-ring {
    position: absolute; top: 50%; right: -120px;
    width: 300px; height: 300px; margin-top: -150px;
    border: 1px solid rgba(212,175,55,0.28); border-radius: 50%;
    pointer-events: none;
}

/* ---------- The gate card ---------- */
.gate-card {
    position: relative; width: 100%; max-width: 460px;
    background: #fff;
    border: 1px solid rgba(212,175,55,0.75);
    border-radius: 20px;
    padding: 30px 32px 26px;
    box-shadow:
        0 20px 44px rgba(0,77,59,0.13),
        0 0 0 4px rgba(212,175,55,0.10),
        0 0 26px rgba(212,175,55,0.16);
}
.gate-card > *:not(.sc-corner) { position: relative; z-index: 1; }

/* ---------- Header ---------- */
.gate-head { display: flex; align-items: center; gap: 16px; }
.gate-head-icon {
    position: relative; flex-shrink: 0;
    width: 58px; height: 58px; border-radius: 50%;
    background: linear-gradient(140deg, var(--emerald) 0%, var(--forest) 100%);
    border: 1px solid rgba(212,175,55,0.85);
    color: #F3E3B0;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 16px rgba(0,77,59,0.26);
}
.gate-head-text { min-width: 0; }
.gate-head-text h1 {
    font-size: 23px; font-weight: 800; color: var(--forest);
    letter-spacing: -0.3px; line-height: 1.2;
}
.gate-head-text p { font-size: 13.5px; color: var(--text-muted); margin-top: 3px; line-height: 1.5; }

/* Thin gold divider beneath the header. */
.gate-rule {
    height: 1px; margin: 20px 0 22px;
    background: linear-gradient(90deg, transparent, rgba(212,175,55,0.55) 18%, rgba(212,175,55,0.55) 82%, transparent);
    position: relative;
}
.gate-rule span {
    position: absolute; left: 50%; top: 50%;
    width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px;
    background: var(--gold); transform: rotate(45deg); border-radius: 1px;
}

/* ---------- Fields ---------- */
.gate-field { margin-bottom: 16px; }
.gate-label {
    display: block; margin-bottom: 7px;
    font-size: 12px; font-weight: 800; letter-spacing: 0.5px;
    text-transform: uppercase; color: var(--forest);
}
.gate-req { color: var(--gold-deep); margin-left: 2px; }
.gate-input { position: relative; display: flex; align-items: center; }
.gate-input-icon {
    position: absolute; left: 14px;
    display: flex; color: #8FA8A0; pointer-events: none;
    transition: color 0.2s ease;
}
.gate-control {
    width: 100%; padding: 13px 14px 13px 44px;
    background: #fff;
    border: 1px solid #D5E6DF; border-radius: 12px;
    color: var(--text); font-family: inherit;
    font-size: 15px; font-weight: 500;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.gate-control::placeholder { color: #A9BCB4; font-weight: 400; }
.gate-control:hover { border-color: #B9D3C8; }
.gate-control:focus {
    outline: none;
    border-color: var(--emerald);
    box-shadow: 0 0 0 3px rgba(212,175,55,0.28);
}
.gate-input:focus-within .gate-input-icon { color: var(--emerald); }
.gate-control-code { padding-right: 46px; letter-spacing: 2px; }
.gate-control-code::placeholder { letter-spacing: normal; }
.gate-eye {
    position: absolute; right: 8px;
    width: 32px; height: 32px; padding: 0;
    display: flex; align-items: center; justify-content: center;
    background: transparent; border: 0; border-radius: 8px;
    color: #8FA8A0; cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}
.gate-eye:hover { background: #F3F8F6; color: var(--emerald); }
.gate-eye[aria-pressed="true"] { color: var(--emerald); }

/* ---------- Submit button ---------- */
.btn-gate {
    width: 100%; margin-top: 22px;
    display: inline-flex; align-items: center; justify-content: center; gap: 9px;
    padding: 14px 24px; border-radius: 12px;
    background: linear-gradient(180deg, #04523E 0%, var(--forest) 100%);
    border: 1px solid rgba(212,175,55,0.55);
    color: #fff; font-size: 15px; font-weight: 700; letter-spacing: 0.2px;
    box-shadow: 0 8px 18px rgba(0,77,59,0.26);
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.btn-gate .lucide { color: #F3E3B0; }
.btn-gate:hover:not(:disabled) {
    background: linear-gradient(180deg, #0A6B4F 0%, #055C46 100%);
    border-color: var(--gold);
    box-shadow: 0 12px 26px rgba(212,175,55,0.32);
    transform: translateY(-1px);
}
.btn-gate:focus-visible { outline: 3px solid rgba(212,175,55,0.55); outline-offset: 2px; }
.btn-gate:disabled { opacity: 0.7; cursor: progress; }
.btn-gate.is-loading .lucide { animation: gatePulse 1s ease-in-out infinite; }
@keyframes gatePulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---------- Notice / footer ---------- */
.gate-alert { margin-bottom: 16px; }
.gate-notice {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 15px 16px; border-radius: 12px;
    background: #FCF6E4; border: 1px solid rgba(212,175,55,0.7);
    color: #7A5E12;
}
.gate-notice .lucide { flex-shrink: 0; margin-top: 1px; color: var(--gold-deep); }
.gate-notice p { font-size: 13.5px; line-height: 1.55; }
.gate-foot {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    margin-top: 18px; font-size: 12px; color: var(--text-muted); text-align: center;
}
.gate-foot .lucide { color: var(--gold-deep); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .gate-ring { display: none; }
}
@media (max-width: 560px) {
    .gate-wrap { padding: 26px 14px 44px; }
    .gate-card {
        max-width: 100%; padding: 24px 20px 22px; border-radius: 16px;
        box-shadow: 0 14px 32px rgba(0,77,59,0.12), 0 0 0 3px rgba(212,175,55,0.10);
    }
    .gate-head { gap: 13px; }
    .gate-head-icon { width: 50px; height: 50px; }
    .gate-head-text h1 { font-size: 20px; }
    .gate-head-text p { font-size: 12.5px; }
    .sc-corner { width: 24px; height: 24px; border-top-left-radius: 12px; border-top-right-radius: 12px; border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; }
    .sc-corner-tl { top: 3px; left: 3px; }
    .sc-corner-tr { top: 3px; right: 3px; }
    .sc-corner-bl { bottom: 3px; left: 3px; }
    .sc-corner-br { bottom: 3px; right: 3px; }
    .gate-control { font-size: 16px; /* avoids iOS zoom on focus */ }
    .btn-gate { padding: 14px 20px; }
}

/* =============================================================
   JUDGE SUBMISSION CONFIRMATION PAGE (REDESIGN)
   Premium green + gold success panel. Shares the judge-sheet shell
   with the rest of the judging flow.
   ============================================================= */
.judge-confirm {
    background: #F0F7F4;
    background-image:
        radial-gradient(880px 420px at 16% -10%, rgba(8,122,89,0.10), transparent 62%),
        radial-gradient(720px 380px at 86% 2%, rgba(212,175,55,0.14), transparent 60%);
    background-attachment: fixed;
}

.cf-wrap {
    position: relative; overflow: hidden;
    flex: 1; display: flex; align-items: center; justify-content: center;
    padding: 40px 20px 64px;
}
.cf-orb { position: absolute; border-radius: 50%; pointer-events: none; }
.cf-orb-a {
    width: 460px; height: 460px; top: -160px; left: -140px;
    background: radial-gradient(circle, rgba(8,122,89,0.08), transparent 68%);
}
.cf-orb-b {
    width: 540px; height: 540px; bottom: -240px; right: -180px;
    background: radial-gradient(circle, rgba(212,175,55,0.11), transparent 66%);
}

/* ---------- Panel ---------- */
.cf-card {
    position: relative; width: 100%; max-width: 560px;
    background: #fff;
    border: 1px solid rgba(212,175,55,0.75);
    border-radius: 20px;
    padding: 32px 34px 28px;
    box-shadow:
        0 20px 44px rgba(0,77,59,0.13),
        0 0 0 4px rgba(212,175,55,0.10),
        0 0 26px rgba(212,175,55,0.16);
}
.cf-card > *:not(.sc-corner) { position: relative; z-index: 1; }

/* ---------- Hero ---------- */
.cf-hero { text-align: center; position: relative; }
.cf-icon {
    position: relative;
    width: 92px; height: 92px; margin: 0 auto 18px;
    border-radius: 50%;
    background: #E8F6EF;
    border: 2px solid var(--gold);
    color: var(--emerald);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 22px rgba(8,122,89,0.16);
}
.cf-icon.is-reopened {
    background: #FBF1D6; border-color: rgba(212,175,55,0.9); color: var(--gold-deep);
}
.cf-star {
    position: absolute; color: var(--gold); opacity: 0.55; line-height: 0;
}
.cf-star-a { top: 6px;  left: 50%; margin-left: -78px; }
.cf-star-b { top: 44px; right: 50%; margin-right: -92px; opacity: 0.38; }
.cf-title {
    font-size: 25px; font-weight: 800; color: var(--forest);
    letter-spacing: -0.3px; line-height: 1.2;
}
.cf-sub {
    font-size: 14px; color: var(--text-muted);
    line-height: 1.6; margin-top: 8px;
}

/* ---------- Details summary ---------- */
.cf-details {
    margin-top: 22px; padding: 4px 20px;
    background: #E8F6EF;
    border: 1px solid rgba(212,175,55,0.6);
    border-radius: 14px;
}
.cf-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px; padding: 13px 0;
    border-bottom: 1px solid rgba(212,175,55,0.28);
}
.cf-row:last-child { border-bottom: none; }
.cf-label {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 12.5px; font-weight: 700; color: var(--text-muted);
    text-align: left;
}
.cf-label .lucide { color: var(--gold-deep); flex-shrink: 0; }
.cf-value { font-size: 14px; font-weight: 600; color: var(--text); text-align: right; }
.cf-value.is-strong { font-weight: 800; color: var(--forest); }
.cf-pill {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 700;
    padding: 4px 12px; border-radius: 999px;
    border: 1px solid transparent; white-space: nowrap;
}
.cf-pill-green { background: #D6F2E4; color: #05603A; border-color: rgba(8,122,89,0.4); }
.cf-pill-amber { background: #F7EBCE; color: #8A6524; border-color: rgba(212,175,55,0.7); }
.cf-pill-blue  { background: #DCEAFB; color: #1D4ED8; border-color: #BFDBFE; }

/* ---------- Actions ---------- */
.cf-actions {
    display: flex; align-items: center; justify-content: center;
    gap: 10px; flex-wrap: wrap; margin-top: 20px;
}
.cf-actions .btn {
    padding: 12px 24px; border-radius: 12px; font-size: 14.5px;
}
.cf-btn-ghost {
    background: #fff; color: var(--forest);
    border: 1px solid #A9CFC0;
    box-shadow: 0 2px 6px rgba(0,77,59,0.05);
}
.cf-btn-ghost .lucide { color: var(--emerald); }
.cf-btn-ghost:hover {
    background: #FBF6E6; color: var(--forest);
    border-color: var(--gold);
    box-shadow: 0 6px 16px rgba(212,175,55,0.26);
}
.cf-btn-primary {
    background: linear-gradient(180deg, #04523E 0%, var(--forest) 100%);
    color: #fff; border: 1px solid rgba(212,175,55,0.55);
    box-shadow: 0 6px 16px rgba(0,77,59,0.26);
}
.cf-btn-primary .lucide { color: #F3E3B0; }
.cf-btn-primary:hover {
    background: linear-gradient(180deg, #0A6B4F 0%, #055C46 100%);
    color: #fff; border-color: var(--gold);
    box-shadow: 0 8px 20px rgba(212,175,55,0.32);
}

/* ---------- Notices ---------- */
.cf-notice {
    display: flex; align-items: flex-start; gap: 12px;
    margin-top: 16px; padding: 13px 16px; border-radius: 12px;
    border: 1px solid transparent; text-align: left;
}
.cf-notice .lucide { flex-shrink: 0; margin-top: 1px; }
.cf-notice strong { display: block; font-size: 13.5px; font-weight: 800; }
.cf-notice span { display: block; font-size: 12.5px; line-height: 1.5; margin-top: 2px; }
.cf-notice-gold { background: #FCF6E4; border-color: rgba(212,175,55,0.7); color: #7A5E12; }
.cf-notice-gold .lucide { color: var(--gold-deep); }
.cf-notice-green { background: #E8F6EF; border-color: rgba(8,122,89,0.35); color: #06543B; }
.cf-notice-green .lucide { color: var(--emerald); }

/* ---------- Countdown panel ---------- */
.cf-count {
    display: flex; align-items: center; justify-content: space-between;
    gap: 18px;
    margin-top: 20px; padding: 16px 18px;
    background: #E8F6EF;
    border: 1px solid rgba(212,175,55,0.65);
    border-radius: 14px;
    box-shadow: 0 0 0 3px rgba(212,175,55,0.07);
}
.cf-count.is-redirect { background: #FBF4E2; }
.cf-count-left { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.cf-count-icon {
    flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%;
    background: var(--emerald); color: #fff;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 10px rgba(8,122,89,0.24);
}
.cf-count.is-redirect .cf-count-icon { background: var(--gold-deep); }
.cf-count-text { min-width: 0; }
.cf-count-text strong { display: block; font-size: 14px; font-weight: 800; color: var(--forest); }
.cf-count-text span { display: block; font-size: 12.5px; color: var(--text-muted); margin-top: 2px; line-height: 1.5; }
.cf-count-text b { color: var(--forest); font-weight: 800; }

.cf-count-right {
    display: flex; flex-direction: column; align-items: flex-end;
    gap: 8px; flex: 0 1 auto; max-width: 48%;
}
.cf-badge {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 13px; font-weight: 700; color: #7A5E12;
    background: linear-gradient(180deg, #FBF1D6 0%, #F3E3B0 100%);
    border: 1px solid rgba(212,175,55,0.9);
    padding: 7px 14px; border-radius: 999px; white-space: nowrap;
}
.cf-badge b { font-size: 16px; font-weight: 800; color: var(--forest); }
/* The countdown is gone; this panel is now a static "what happens next" note.
   It is the yellow container, and the status count sits on it - so the pill is
   darkened to forest to stay legible against the gold. */
.cf-count.is-static {
    background: linear-gradient(135deg, #FCF6E4 0%, #FAEFD2 100%);
    border-color: rgba(212,175,55,0.85);
    box-shadow: 0 0 0 3px rgba(212,175,55,0.10);
}
.cf-count.is-static .cf-count-icon { background: var(--gold-deep); }
.cf-count.is-static .cf-count-right { max-width: none; }
/* The pill is the countdown readout again, so it needs the numeric emphasis
   back plus room for "Closing in 10s". */
.cf-count.is-static .cf-badge {
    font-size: 12.5px; padding: 8px 16px;
    letter-spacing: normal; font-weight: 800;
    background: var(--forest); color: #F6E9BE;
    border: 1px solid rgba(212,175,55,0.75);
    box-shadow: 0 2px 8px rgba(0,77,59,0.18);
}
.cf-count.is-static .cf-badge b {
    font-size: 17px; font-weight: 800; color: #FFF6DC;
    letter-spacing: normal;
}
.cf-hint { font-size: 12.5px; color: var(--text-muted); text-align: right; line-height: 1.45; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    .cf-wrap { padding: 24px 14px 44px; }
    .cf-card {
        max-width: 100%; padding: 24px 18px 22px; border-radius: 16px;
        box-shadow: 0 14px 32px rgba(0,77,59,0.12), 0 0 0 3px rgba(212,175,55,0.10);
    }
    .sc-corner { width: 24px; height: 24px; border-top-left-radius: 12px; border-top-right-radius: 12px; border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; }
    .sc-corner-tl { top: 3px; left: 3px; }
    .sc-corner-tr { top: 3px; right: 3px; }
    .sc-corner-bl { bottom: 3px; left: 3px; }
    .sc-corner-br { bottom: 3px; right: 3px; }
    .cf-icon { width: 78px; height: 78px; margin-bottom: 14px; }
    .cf-title { font-size: 21px; }
    .cf-sub { font-size: 13px; }
    .cf-details { padding: 2px 14px; margin-top: 18px; }
    .cf-row { flex-direction: column; align-items: flex-start; gap: 4px; padding: 11px 0; }
    .cf-value { text-align: left; }
    .cf-actions .btn { width: 100%; justify-content: center; }
    /* status panel stacks on small screens */
    .cf-count { flex-direction: column; align-items: flex-start; }
    .cf-count-right { width: 100%; align-items: flex-start; }
    .cf-badge { align-self: flex-start; }
}

/* =============================================================
   JUDGE REVIEW PAGE (REDESIGN)
   Gold-framed container + one evaluation card per contestant.
   Shares the judge-sheet shell with the scoring sheet.
   ============================================================= */

/* ---------- Validation status banner ---------- */
.rv-status {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 18px; border-radius: 12px;
    border: 1px solid transparent;
    transition: background 0.25s ease, border-color 0.25s ease;
}
.rv-status > .lucide { flex-shrink: 0; margin-top: 1px; }
/* .rv-status sets display:flex, which beats the UA stylesheet's [hidden] rule -
   exactly the problem already fixed for .alert above. Without this the
   "Your evaluation was not submitted." banner was painted on EVERY load of the
   review page, permanently, because the hidden attribute it carries did nothing
   and its message span was empty. A judge arriving at a complete sheet saw a
   refusal they had never been given, which reads as "my submit isn't working". */
.rv-status[hidden] { display: none; }
.rv-status strong { display: block; font-size: 14.5px; font-weight: 800; }
.rv-status span { display: block; font-size: 13px; margin-top: 2px; line-height: 1.5; }
.rv-status-missing {
    background: #FCF6E4; border-color: rgba(212,175,55,0.75); color: #7A5E12;
}
.rv-status-missing .lucide { color: var(--gold-deep); }
.rv-status-complete {
    background: #E8F6EF; border-color: rgba(8,122,89,0.35); color: #06543B;
}
.rv-status-complete .lucide { color: var(--emerald); }

/* Missing-entries panel ------------------------------------------------
 * Lists every blank field on the review page, each a link straight to that
 * input on the scoring sheet. Replaces "8 of 12 entries filled" with a list
 * the judge can act on from the page they are already looking at.
 */
.rv-missing {
    background: #FDF8EC;
    border: 1px solid #EFDFBE;
    border-radius: 12px;
    padding: 14px 16px;
    margin: 0 0 18px;
}
.rv-missing-title {
    display: flex; align-items: center; gap: 7px;
    font-size: 13px; font-weight: 800; letter-spacing: .4px;
    text-transform: uppercase; color: #8A6410;
    margin: 0 0 10px;
}
.rv-missing-title .lucide { color: var(--gold-deep); }
.rv-missing-list { list-style: none; margin: 0; padding: 0; }
.rv-missing-list li + li { margin-top: 6px; }
.rv-missing-list a {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #EFDFBE;
    border-radius: 9px;
    font-size: 13.5px; color: var(--text);
    text-decoration: none;
    transition: border-color .15s, background .15s, transform .1s;
}
.rv-missing-list a:hover { border-color: var(--gold); background: #FFFDF7; }
.rv-missing-list a:active { transform: translateY(1px); }
.rv-missing-list a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.rv-missing-c {
    flex-shrink: 0;
    font-weight: 800; color: var(--forest);
    background: var(--mint);
    border-radius: 6px; padding: 2px 8px;
    font-size: 12.5px;
}
.rv-missing-arrow { flex-shrink: 0; color: var(--gold-deep); display: flex; }
.rv-missing-name { font-weight: 600; white-space: nowrap; }
.rv-missing-sep { color: #C3B393; }
.rv-missing-crit { color: var(--text-muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 560px) {
    /* Wrap the separator away rather than letting the row truncate mid-name. */
    .rv-missing-sep { display: none; }
    .rv-missing-list a { flex-wrap: wrap; row-gap: 2px; }
    .rv-missing-crit { flex-basis: 100%; padding-left: 4px; }
}

/* Count of blanks on a contestant's folder tab. */
.sc-folder-badge {
    flex-shrink: 0;
    min-width: 18px; height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--gold);
    color: #4A3A08;
    font-size: 11px; font-weight: 800; line-height: 18px;
    text-align: center;
}
.sc-folder.is-active .sc-folder-badge { background: #B8891C; color: #fff; }

/* ---------- Contestant evaluation card ---------- */
.rv-card {
    background: #fff; border: 1px solid #DCEAE4;
    border-radius: 14px; overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,77,59,0.06);
}
.rv-card[hidden] { display: none !important; }
.rv-card-head {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 20px;
    background: linear-gradient(180deg, #FBFEFC 0%, #F4FAF7 100%);
    border-bottom: 1px solid #DCEAE4;
    box-shadow: inset 3px 0 0 var(--gold);
}
.rv-num {
    flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
    min-width: 46px; height: 32px; padding: 0 12px;
    background: var(--forest); color: #fff;
    font-size: 13px; font-weight: 800; letter-spacing: 0.4px;
    border-radius: 999px;
}
.rv-card-id { min-width: 0; }
.rv-name {
    font-size: 17px; font-weight: 800; color: var(--forest);
    line-height: 1.3; word-break: break-word;
}
.rv-card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 3px; }
.rv-cat, .rv-flag {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11.5px; font-weight: 600; color: var(--text-muted);
}
.rv-cat .lucide { color: var(--gold-deep); }
.rv-category-badge {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11.5px; font-weight: 600; color: var(--emerald);
    background: linear-gradient(135deg, #E8F6EF 0%, #DFF3E7 100%);
    border: 1px solid rgba(8,123,89,0.35);
    padding: 3px 10px; border-radius: 999px;
    box-shadow: 0 1px 2px rgba(0,77,59,0.06);
}
.rv-category-badge .lucide { color: var(--emerald); flex-shrink: 0; }
.rv-flag {
    color: #7A5E12; background: #FBF1D6;
    border: 1px solid rgba(212,175,55,0.5);
    padding: 1px 9px; border-radius: 999px;
}
.rv-trophy {
    margin-left: auto; flex-shrink: 0;
    width: 34px; height: 34px; border-radius: 50%;
    background: rgba(212,175,55,0.14);
    border: 1px solid rgba(212,175,55,0.55);
    color: var(--gold-deep);
    display: flex; align-items: center; justify-content: center;
}

/* ---------- Scoring summary table ---------- */
.rv-table { min-width: 520px; }
.rv-table th:first-child, .rv-table td:first-child { width: 56%; }
.rv-crit { min-width: 0; }
.rv-crit-name {
    display: block; font-size: 14px; font-weight: 700; color: var(--forest); line-height: 1.35;
}
.rv-crit-pct { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.rv-table td { padding: 12px 18px; }
.rv-score { font-size: 15px; font-weight: 700; color: var(--text); }
.rv-weighted { font-size: 15.5px; font-weight: 800; color: var(--emerald); }
.rv-table tr.is-empty .rv-score,
.rv-table tr.is-empty .rv-weighted { color: #B9C7C1; font-weight: 600; }

/* ---------- Per-card total ---------- */
.rv-total {
    display: flex; align-items: center; gap: 14px;
    margin: 16px 20px 20px; padding: 14px 18px;
    background: linear-gradient(115deg, #E8F6EF 0%, #F2FBF6 100%);
    border: 1px solid rgba(212,175,55,0.6);
    border-radius: 12px;
    box-shadow: 0 0 0 3px rgba(212,175,55,0.07);
}
.rv-total-icon {
    flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%;
    background: var(--forest); color: #F3E3B0;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 10px rgba(0,77,59,0.24);
}
.rv-total-text { min-width: 0; }
.rv-total-label { display: block; font-size: 14.5px; font-weight: 800; color: var(--forest); }
.rv-total-sub { display: block; font-size: 12px; color: var(--text-muted); }
.rv-total-value { margin-left: auto; display: flex; align-items: baseline; gap: 7px; }
.rv-total-value b { font-size: 26px; font-weight: 800; color: var(--forest); line-height: 1; }
.rv-total-value span { font-size: 13px; font-weight: 700; color: var(--text-muted); }

/* =============================================================
   SUBMISSION VIEW (admin) - folder-style contestant selector
   =============================================================

   This page deliberately reuses the judge sheet's own folder chrome
   (.sc-folders / .sc-folder*) and its per-contestant card (.rv-*) so the two
   screens cannot drift apart: one selector to maintain, one look.

   The only deliberate difference is the SELECTED folder. The judge sheet fills
   it mint with dark green text; here it is filled forest green with white
   text and a gold halo, which reads better against the white admin canvas.
   Everything else - shape, icon swap, arrows, ellipsis, scroll behaviour -
   is inherited untouched. */

.sv-folders .sc-folder { background: #fff; border-color: #D7E5DF; }
.sv-folders .sc-folder .sc-folder-num { color: var(--emerald); }
.sv-folders .sc-folder .sc-folder-name { color: var(--forest); }
.sv-folders .sc-folder:hover { background: #F7FBF9; border-color: var(--emerald); }

/* Selected: dark green fill, white text, subtle gold highlight. */
.sv-folders .sc-folder.is-active {
    background: linear-gradient(160deg, var(--forest) 0%, var(--forest-dark) 100%);
    border-color: var(--forest-dark);
    box-shadow:
        0 0 0 2px var(--gold),
        0 10px 22px rgba(0, 61, 48, 0.26);
}
.sv-folders .sc-folder.is-active .sc-folder-num { color: var(--gold-light); }
.sv-folders .sc-folder.is-active .sc-folder-name { color: #fff; }
.sv-folders .sc-folder.is-active .sc-folder-icon { color: var(--gold-light); }
/* Hover must not wash the selected fill back out to white. */
.sv-folders .sc-folder.is-active:hover {
    background: linear-gradient(160deg, var(--forest) 0%, var(--forest-dark) 100%);
    border-color: var(--forest-dark);
}

/* Folders get slimmer on narrow screens so more of them fit per swipe. */
@media (max-width: 900px) {
    .sv-folders .sc-folder { min-width: 148px; max-width: 180px; padding: 9px 12px; }
}

/* ---------- Submission meta strip (judge / contest / status) ---------- */
.sv-meta {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px 26px;
    padding: 16px 20px; margin-bottom: 16px;
    background: #fff; border: 1px solid #DCEAE4; border-radius: 14px;
    box-shadow: 0 2px 10px rgba(0, 77, 59, 0.05);
}
.sv-meta-item { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.sv-meta-item .lucide { color: var(--gold-deep); flex-shrink: 0; }
.sv-meta-label {
    font-size: 11px; font-weight: 800; letter-spacing: 0.7px;
    text-transform: uppercase; color: var(--text-muted); white-space: nowrap;
}
.sv-meta-value { font-size: 14px; font-weight: 700; color: var(--forest); }
.sv-status {
    margin-left: auto; display: inline-flex; align-items: center; gap: 7px;
    padding: 5px 13px; border-radius: 999px;
    font-size: 12px; font-weight: 800; letter-spacing: 0.3px;
}
.sv-status-submitted {
    background: #E8F6EF; color: #05603A; border: 1px solid rgba(8, 123, 89, 0.35);
}
.sv-status-other {
    background: #FBF1D6; color: #7A5E12; border: 1px solid rgba(212, 175, 55, 0.55);
}

/* ---------- Panel switching ---------- */
/* Panels reuse .rv-card, whose [hidden] rule already hides them. The fade is
   an entrance animation rather than a transition because toggling [hidden]
   gives a display change nothing can smoothly interpolate. */
.sv-panel { animation: svPanelIn 0.26s ease both; }
@keyframes svPanelIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .sv-panel { animation: none; }
}

/* ---------- Description column (view submission) ----------
   The judge sheet's table is Criteria / Score / Weighted. The admin view adds a
   dedicated Description column so the text an admin typed on the Criteria tab
   is readable in one place instead of being crammed under the criteria name.
   .rv-table already pins the first column at 56%, which is far too greedy once
   a third text column exists, so the widths are rebalanced for this table. */
.sv-table { min-width: 820px; }
.sv-table th:first-child, .sv-table td:first-child { width: 24%; }
.sv-table th:nth-child(2), .sv-table td:nth-child(2) { width: 44%; }
.sv-desc-cell {
    font-size: 13px; line-height: 1.55; color: #5C6B65;
    overflow-wrap: anywhere;
}
/* A criterion this judge left blank. Deliberately muted and unboxed: it is
   absent data rather than a score, so it must not borrow the visual weight of
   a real one and be read as a judgement of zero. */
.sv-unscored {
    color: #A9BDB5; font-size: 15px; font-weight: 700; cursor: help;
}

@media (max-width: 900px) {
    .sv-table { min-width: 720px; }
    .sv-desc-cell { font-size: 12px; }
}

/* ---------- Empty states ---------- */
.sv-empty {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 44px 20px; text-align: center;
    background: #fff; border: 1px dashed #CFE0D9; border-radius: 14px;
}
.sv-empty .lucide { color: #A9BDB5; }
.sv-empty-title { font-size: 15.5px; font-weight: 800; color: var(--forest); }
.sv-empty-sub { font-size: 13px; color: var(--text-muted); }

/* ---------- Actions ---------- */
.judge-review .sc-actions { justify-content: space-between; }
.sc-edit-btn {
    background: #fff; color: var(--forest);
    border: 1px solid #A9CFC0;
    box-shadow: 0 2px 6px rgba(0,77,59,0.05);
}
.sc-edit-btn .lucide { color: var(--emerald); }
.sc-edit-btn:hover {
    background: #FBF6E6; color: var(--forest);
    border-color: var(--gold);
    box-shadow: 0 4px 12px rgba(212,175,55,0.22);
}
.sc-submit-btn {
    background: var(--forest); color: #fff;
    box-shadow: 0 6px 16px rgba(0,77,59,0.26);
}
.sc-submit-btn .lucide { color: #F3E3B0; }
.sc-submit-btn:hover:not(:disabled) {
    background: #0A5B47; color: #fff;
    border-color: rgba(212,175,55,0.85);
    box-shadow: 0 8px 22px rgba(212,175,55,0.34);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .rv-table th:first-child, .rv-table td:first-child { width: auto; }
    .rv-total { flex-wrap: wrap; }
    .rv-total-value { margin-left: 0; width: 100%; }
}
@media (max-width: 900px) {
    .sc-wrap { padding: 18px 16px 52px; }
    .sc-sheet { margin-top: 14px; padding: 20px 18px 20px; }
    .sc-head { flex-wrap: wrap; }
    .sc-head-progress { margin-left: 0; width: 100%; }
    .sc-progress-label { text-align: left; }
    .sc-table th, .sc-table td { padding: 12px 12px; }
    .sc-crit { min-width: 170px; }
    .sc-desc { min-width: 140px; }
}
@media (max-width: 700px) {
    .sc-banner { flex-wrap: wrap; }
    .sc-scorebox { margin-left: 0; width: 100%; }
    .sc-banner-deco { width: 60%; }
}
@media (max-width: 640px) {
    .judge-sheet .judge-header { flex-wrap: wrap; gap: 8px; padding: 12px 16px; }
    .judge-sheet .judge-header .logo { font-size: 17px; }
    .judge-header-judge { font-size: 12.5px; padding: 5px 11px; }
    .sc-wrap { padding: 14px 12px 44px; gap: 12px; }
    .sc-sheet {
        margin-top: 12px; padding: 16px 13px 16px; gap: 13px;
        border-radius: 14px;
        box-shadow: 0 12px 28px rgba(0,77,59,0.12), 0 0 0 3px rgba(212,175,55,0.10);
    }
    .sc-corner { width: 24px; height: 24px; border-top-left-radius: 12px; border-top-right-radius: 12px; border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; }
    .sc-corner-tl { top: 3px; left: 3px; }
    .sc-corner-tr { top: 3px; right: 3px; }
    .sc-corner-bl { bottom: 3px; left: 3px; }
    .sc-corner-br { bottom: 3px; right: 3px; }
    .sc-head { padding: 14px 16px; }
    .sc-head-icon { width: 42px; height: 42px; }
    .sc-head-text h1 { font-size: 18px; }
    .sc-head-text p { font-size: 12.5px; }
    .sc-folder { min-width: 148px; padding: 9px 12px; }
    .sc-banner { padding: 16px 18px; gap: 14px; }
    .sc-banner-badge { width: 48px; height: 48px; }
    .sc-banner-name { font-size: 22px; }
    .sc-scorebox { min-width: 0; padding: 10px 16px 12px; }
    /* This bare selector has lower specificity than the evaluate-scoped
     * .sc-scorebox-value rules, so it never reached the evaluate sheet at any
     * width - a phone was showing the 900px block's number rather than this one,
     * and this declaration was dead. It is lowered to match the new desktop
     * figure rather than left as a number that cannot win.
     *
     * Note it also cannot reach the evaluate page below ~640px, where the
     * evaluate-scoped 16px applies instead. */
    .sc-scorebox-value { font-size: 17px; }
    .sc-card-head { padding: 16px 18px; }
    .sc-card-text p { font-size: 12.5px; }
    .sc-table { min-width: 620px; }
    .sc-table th, .sc-table td { padding: 12px 10px; }
    .sc-crit { min-width: 168px; gap: 10px; }
    .sc-desc { min-width: 148px; }
    .sc-score-input { max-width: 96px; }
    .sc-actions .btn { width: 100%; justify-content: center; }
    .sc-toast { left: 16px; right: 16px; bottom: 16px; text-align: center; }
    /* Three columns still fit on a phone: let the criteria cell wrap
       instead of pushing Score/Weighted into a horizontal scroll. */
    .rv-table { min-width: 0; }
    .rv-table th, .rv-table td { padding: 10px 8px; }
    .rv-table th:first-child, .rv-table td:first-child { width: auto; }
    .rv-crit-name { font-size: 13px; }
    .rv-crit-pct { font-size: 11px; }
    .rv-score, .rv-weighted { font-size: 14px; }
    .rv-card-head { padding: 12px 14px; gap: 10px; }
    .rv-name { font-size: 15.5px; }
    .rv-trophy { width: 30px; height: 30px; }
    .rv-total { margin: 12px 14px 14px; padding: 12px 14px; }
    .rv-total-value b { font-size: 23px; }
    .rv-status { padding: 12px 14px; }
}
@media (max-width: 420px) {
    .sc-folder-arrow { width: 28px; }
    .sc-folder { min-width: 132px; }
}

/* =============================================================
   WINNERS / OFFICIAL RESULTS SCREEN  (admin/winners-screen.php)
   Premium Dark Emerald + Gold + Warm Ivory results dashboard.

   Everything is scoped under body.ws-body so none of it can leak
   into the admin or judge pages. Type and blocks scale with clamp()
   against the viewport, so one layout reads on a laptop preview and
   on a hall projector.
   ============================================================= */
body.ws-body {
    /* Scoped palette. Local to this page rather than :root so the shared
       admin theme is untouched. */
    --ws-ivory:       #FBF8F1;
    --ws-ivory-card:  #FFFDF8;
    --ws-emerald-900: #06291F;
    --ws-emerald-800: #0A3D2E;
    --ws-emerald-700: #0F5340;
    --ws-emerald-600: #156B52;
    --ws-gold-700:    #9A7B18;
    --ws-gold-600:    #B8931F;
    --ws-gold-500:    #C9A227;
    --ws-gold-400:    #DCBE5E;
    --ws-gold-100:    #F6ECCD;
    --ws-silver-500:  #9EA9B4;
    --ws-silver-400:  #BFC8D1;
    --ws-bronze-500:  #A9762F;
    --ws-bronze-400:  #C79A5C;
    --ws-ink:         #14302A;
    --ws-ink-2:       #47615A;
    --ws-ink-3:       #7E928B;
    --ws-serif:       'Playfair Display', 'Poppins', Georgia, 'Times New Roman', serif;
    /* Shared by the card and its emerald band. Declared once so the band's top
       corners can never drift out of line with the card's own radius. */
    --ws-card-radius: clamp(14px, 1.4vw, 20px);

    /* One faint laurel sprig, reused flipped in the opposite corner. Kept at 7%
       so it reads as paper texture and never competes with the results. */
    --ws-laurel: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 200'%3E%3Cg fill='none' stroke='%230F5340' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M14 192C48 168 76 118 96 18'/%3E%3C/g%3E%3Cg fill='%230F5340'%3E%3Cellipse cx='20' cy='180' rx='16' ry='5.6' transform='rotate(-30 20 180)'/%3E%3Cellipse cx='44' cy='164' rx='16' ry='5.6' transform='rotate(30 44 164)'/%3E%3Cellipse cx='54' cy='152' rx='15' ry='5.2' transform='rotate(-32 54 152)'/%3E%3Cellipse cx='74' cy='136' rx='14' ry='5' transform='rotate(32 74 136)'/%3E%3Cellipse cx='82' cy='120' rx='13' ry='4.8' transform='rotate(-34 82 120)'/%3E%3Cellipse cx='96' cy='100' rx='12' ry='4.4' transform='rotate(36 96 100)'/%3E%3Cellipse cx='102' cy='82' rx='11' ry='4.2' transform='rotate(-38 102 82)'/%3E%3Cellipse cx='112' cy='60' rx='10' ry='3.8' transform='rotate(40 112 60)'/%3E%3Cellipse cx='116' cy='44' rx='9' ry='3.4' transform='rotate(-44 116 44)'/%3E%3C/g%3E%3C/svg%3E");

    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--ws-ink);
    background-color: var(--ws-ivory);
    /* Warm ivory field with a whisper of emerald up top and gold bottom-right. */
    background-image:
        radial-gradient(900px 520px at 6% 2%,   rgba(15, 83, 64, 0.11), transparent 62%),
        radial-gradient(760px 460px at 96% 0%,  rgba(15, 83, 64, 0.07), transparent 60%),
        radial-gradient(820px 480px at 96% 98%, rgba(201, 162, 39, 0.14), transparent 64%);
    background-attachment: fixed;
    /* auto, not hidden: the stage is designed to fit one screen, but a long
       contestant name or a 12-place field must still be reachable rather than
       silently clipped. */
    overflow: auto;
}
/* Corner accents: the laurel pair, well outside the reading area. */
body.ws-body::before,
body.ws-body::after {
    content: '';
    position: fixed;
    width: 40vmin; height: 40vmin;
    background-repeat: no-repeat;
    background-size: contain;
    background-image: var(--ws-laurel);
    opacity: 0.07;
    pointer-events: none;
    z-index: 0;
}
body.ws-body::before { top: -5vmin;    left: -5vmin; }
body.ws-body::after  { bottom: -5vmin; right: -5vmin; transform: rotate(180deg); }

body.ws-body .ws-stage {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Centre the whole composition. Top-aligning left a large void between the
       header and the podium on a 16:9 projector. */
    justify-content: center;
    gap: clamp(12px, 2vh, 28px);
    padding: clamp(20px, 3.4vh, 46px) clamp(20px, 4vw, 72px) clamp(18px, 3vh, 40px);
    text-align: center;
}

/* ---- header ---- */
body.ws-body .ws-head {
    flex: 0 0 auto;
    width: 100%; max-width: 1180px;
    display: flex; flex-direction: column; align-items: center;
}

/* Small gold trophy in a refined badge - an identity mark at reading size,
   not a hero graphic that would compete with the winners. */
body.ws-body .ws-badge {
    width: clamp(36px, 4.6vh, 52px); height: clamp(36px, 4.6vh, 52px);
    display: flex; align-items: center; justify-content: center;
    border-radius: 14px;
    color: var(--ws-gold-600);
    background: linear-gradient(160deg, #FFFDF6, var(--ws-gold-100));
    border: 1px solid rgba(154, 123, 24, 0.28);
    box-shadow: 0 4px 14px rgba(6, 41, 31, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    margin-bottom: clamp(8px, 1.2vh, 14px);
}

body.ws-body .ws-eyebrow {
    display: inline-flex; align-items: center;
    padding: 6px 16px; border-radius: 999px;
    font-size: clamp(10px, 1.02vw, 13px); font-weight: 700;
    letter-spacing: 0.22em; text-transform: uppercase;
}
body.ws-body .ws-eyebrow.is-official {
    background: linear-gradient(135deg, #F9F2DD, #E2CB84);
    color: var(--ws-gold-700);
    border: 1px solid rgba(154, 123, 24, 0.26);
}
body.ws-body .ws-eyebrow.is-provisional {
    background: #FFF6E6; color: #8A5A12;
    border: 1px solid rgba(201, 162, 39, 0.55);
}

/* The document title. A serif at this size carries the ceremony; the sans
   supporting line underneath keeps it from reading as a poster. */
body.ws-body .ws-title {
    font-family: var(--ws-serif);
    font-size: clamp(28px, 5vw, 68px);
    font-weight: 700; line-height: 1.06; letter-spacing: 0.015em;
    color: var(--ws-emerald-800);
    margin-top: clamp(8px, 1.2vh, 14px);
    overflow-wrap: anywhere;
}
body.ws-body .ws-event {
    margin-top: clamp(3px, 0.7vh, 8px);
    font-size: clamp(12px, 1.5vw, 20px);
    font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase;
    color: var(--ws-emerald-600);
}

/* Date and office as quiet metadata chips - labelled, so a projector audience
   always knows which field it is looking at. */
body.ws-body .ws-meta {
    margin-top: clamp(9px, 1.4vh, 16px);
    display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
    gap: clamp(7px, 1vw, 14px);
}
body.ws-body .ws-meta-item {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 14px; border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(15, 83, 64, 0.12);
    font-size: clamp(10px, 1.02vw, 14px);
    white-space: nowrap;
}
body.ws-body .ws-meta-item svg { color: var(--ws-gold-600); flex-shrink: 0; }
body.ws-body .ws-meta-label {
    font-size: 0.84em; font-weight: 700;
    letter-spacing: 0.13em; text-transform: uppercase;
    color: var(--ws-ink-3);
}
body.ws-body .ws-meta-value {
    font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
    color: var(--ws-ink);
}

body.ws-body .ws-rule {
    width: min(100%, 400px); height: 1px;
    margin: clamp(9px, 1.4vh, 16px) auto 0;
    background: linear-gradient(90deg, transparent, rgba(201, 162, 39, 0.55), transparent);
}
body.ws-body .ws-org {
    margin-top: clamp(7px, 1.1vh, 12px);
    font-size: clamp(9.5px, 0.9vw, 13px);
    font-weight: 600; letter-spacing: 0.24em; text-transform: uppercase;
    color: var(--ws-ink-3);
}

/* ---- podium ---- */
body.ws-body .ws-podium {
    flex: 0 0 auto;
    width: 100%; max-width: 1180px;
    /* flex-end, not stretch: each card sizes to its own content and the three
       share a common baseline, which is what lets the winner stand visibly
       taller than the other two instead of all three being levelled off. */
    display: flex; align-items: flex-end; justify-content: center;
    gap: clamp(12px, 1.8vw, 30px);
}
body.ws-body .ws-place {
    flex: 1 1 0;
    max-width: 340px; min-width: 0;
    display: flex;
    /* Room for the medal to overhang the card's top edge. Sized for the LARGEST
       medal - the champion's - at 46% of its height, so the winner's disc can
       never break out of this padding and collide with the header above. */
    padding-top: clamp(36px, 4.8vh, 56px);
}

/* ---- graduated podium heights ----
   All three cards stand on one baseline and step down by place: first tallest,
   then second, then third. The extra height is padding rather than a min-height,
   so each card keeps its own border, band and shadow welded to its content and
   nothing needs a transform to fake the step.

   Keyed to .ws-metal-*, which follows rank_position - not to .ws-place-*. On a
   tie for first both joint winners get the tallest step, so neither out-sizes
   the other. */
body.ws-body .ws-metal-1 .ws-card-top {
    padding-top: clamp(52px, 8.2vh, 94px);
    padding-bottom: clamp(24px, 3.6vh, 42px);
}
body.ws-body .ws-metal-1 .ws-card-body {
    padding-top: clamp(20px, 3.2vh, 38px);
    padding-bottom: clamp(30px, 4.6vh, 54px);
}
body.ws-body .ws-metal-2 .ws-card-top {
    padding-top: clamp(42px, 6.6vh, 76px);
    padding-bottom: clamp(20px, 3vh, 36px);
}
body.ws-body .ws-metal-2 .ws-card-body {
    padding-top: clamp(16px, 2.6vh, 30px);
    padding-bottom: clamp(22px, 3.4vh, 40px);
}
body.ws-body .ws-metal-3 .ws-card-top {
    padding-top: clamp(34px, 5.4vh, 62px);
    padding-bottom: clamp(16px, 2.4vh, 30px);
}
body.ws-body .ws-metal-3 .ws-card-body {
    padding-top: clamp(13px, 2.1vh, 24px);
    padding-bottom: clamp(16px, 2.5vh, 30px);
}

/* ---- award card ---- */
body.ws-body .ws-card {
    position: relative;
    width: 100%;
    display: flex; flex-direction: column;
    border-radius: var(--ws-card-radius);
    /* Deliberately NOT overflow:hidden. That would clip the medal, which hangs
       half outside the card's top edge. The emerald band rounds its own top
       corners instead, so nothing here needs clipping. */
    background: var(--ws-ivory-card);
    border: 1px solid rgba(15, 83, 64, 0.14);
    box-shadow: 0 2px 6px rgba(6, 41, 31, 0.05), 0 16px 38px rgba(6, 41, 31, 0.09);
}

/* The award band behind the medal and ribbon: carries the award, not the data.
   Tinted per place - emerald for the winner, silver for second, bronze for
   third - so the whole container reads as its medal at a glance from the back
   of a hall, not just the little disc.

   Each ramp keeps a lit head and a dark foot: the highlight is what makes the
   tint read as metal, while the dark foot is what keeps the pale ribbon and the
   white medal ring legible on top of it. */
body.ws-body .ws-card-top {
    display: flex; flex-direction: column; align-items: center;
    padding: clamp(26px, 4.2vh, 46px) clamp(10px, 1.2vw, 18px) clamp(12px, 1.8vh, 20px);
    border-radius: var(--ws-card-radius) var(--ws-card-radius) 0 0;
    background: linear-gradient(160deg, var(--ws-emerald-700) 0%, var(--ws-emerald-900) 100%);
    /* Bright top edge, so the band reads as raised off the ivory body below. */
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.20);
}
/* Second place: silver. */
body.ws-body .ws-metal-2 .ws-card-top {
    background: linear-gradient(160deg, #D2DDE7 0%, #9AA9B7 46%, #4A5765 100%);
}
/* Third place: bronze. */
body.ws-body .ws-metal-3 .ws-card-top {
    background: linear-gradient(160deg, #EAC98A 0%, #B8843B 46%, #6B4C1D 100%);
}
/* A hairline of the same metal around the card edge and under its shadow, so the
   tint continues past the band instead of stopping at it. */
body.ws-body .ws-metal-2 .ws-card {
    border-color: rgba(154, 169, 183, 0.62);
    box-shadow: 0 2px 6px rgba(6, 41, 31, 0.05), 0 14px 34px rgba(74, 87, 101, 0.17);
}
body.ws-body .ws-metal-3 .ws-card {
    border-color: rgba(214, 165, 90, 0.62);
    box-shadow: 0 2px 6px rgba(6, 41, 31, 0.05), 0 14px 34px rgba(107, 76, 29, 0.17);
}

/* Rank medallion. Anchored to the card's top edge and pulled half out of it, so
   all three discs sit on the same line regardless of how tall a card is - the
   height difference between the cards is what signals the ranking. */
body.ws-body .ws-medal {
    position: absolute; top: 0; left: 50%;
    transform: translate(-50%, -46%);
    width: clamp(54px, 7.4vh, 92px); height: clamp(54px, 7.4vh, 92px);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    z-index: 2;
    border: 3px solid rgba(255, 255, 255, 0.88);
    box-shadow: 0 10px 24px rgba(6, 41, 31, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}
body.ws-body .ws-medal-num {
    font-family: var(--ws-serif);
    font-size: clamp(24px, 3.4vh, 42px); font-weight: 700; line-height: 1;
}

/* ---- the golden crown, on top of the winner's disc ----
   Sits on the disc's upper rim rather than inside it: the disc is only ~100px
   across and the numeral already fills it. bottom is pulled back so the crown
   straddles the rim - resting on the circle, not floating above it.

   Carried only by .ws-champion, which a sole rank-1 holder has, so a shared
   first place crowns neither contestant. */
body.ws-body .ws-crown {
    position: absolute;
    left: 50%;
    bottom: calc(100% - 13px);
    transform: translateX(-50%);
    display: flex;
    color: var(--ws-gold-500);
    filter: drop-shadow(0 2px 4px rgba(6, 41, 31, 0.45));
    pointer-events: none;
}
body.ws-body .ws-crown svg {
    width: clamp(30px, 4.2vh, 46px);
    height: auto;
    stroke-width: 1.6;
}

/* Colours follow the RANK (ws-metal-*), so a two-way tie for first shows two
   gold medals rather than a silver one handed to a joint winner. */
body.ws-body .ws-metal-1 .ws-medal {
    background: linear-gradient(150deg, #F5E7B2 0%, #DCBE5E 45%, #B8931F 100%);
    color: #4A3607; border-color: #FBF3DA;
}
body.ws-body .ws-metal-2 .ws-medal {
    background: linear-gradient(150deg, #F0F3F6 0%, #C3CCD5 45%, #97A3AF 100%);
    color: #2C3A44; border-color: #FFFFFF;
}
body.ws-body .ws-metal-3 .ws-medal {
    background: linear-gradient(150deg, #F4E0C7 0%, #C79A5C 45%, #A9762F 100%);
    color: #40280B; border-color: #FBEEDA;
}

/* Award ribbon: notched at the tail, flat across the head. */
body.ws-body .ws-ribbon {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 6px clamp(13px, 1.7vw, 24px);
    font-size: clamp(9px, 0.92vw, 12px);
    font-weight: 800; letter-spacing: 0.2em; text-transform: uppercase;
    white-space: nowrap;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%);
}
body.ws-body .ws-metal-1 .ws-ribbon { background: linear-gradient(135deg, #F9F1D8, var(--ws-gold-500)); color: #4A3607; }
body.ws-body .ws-metal-2 .ws-ribbon { background: linear-gradient(135deg, #F3F5F8, var(--ws-silver-400)); color: #33414B; }
body.ws-body .ws-metal-3 .ws-ribbon { background: linear-gradient(135deg, #F8EBD9, var(--ws-bronze-400)); color: #3E2A10; }

/* Fourth place: the pale "white" metal the Point System and the Overall
   Standing already name 3rd Runner-Up with. Same ramp as the other three -
   lit head, dark foot - so the band reads as its medal from the back of a hall. */
body.ws-body .ws-metal-4 .ws-card-top {
    background: linear-gradient(160deg, #FDFCF8 0%, #DAD6C9 46%, #7E7A6B 100%);
}
body.ws-body .ws-metal-4 .ws-card {
    border-color: rgba(185, 180, 166, 0.62);
    box-shadow: 0 2px 6px rgba(6, 41, 31, 0.05), 0 14px 34px rgba(126, 122, 107, 0.17);
}
body.ws-body .ws-metal-4 .ws-medal {
    background: linear-gradient(150deg, #FFFFFF 0%, #EAE7DE 45%, #B9B4A6 100%);
    color: #4A4638; border-color: #FFFFFF;
}
body.ws-body .ws-metal-4 .ws-ribbon {
    background: linear-gradient(135deg, #FFFFFF, #DCD8CC); color: #4A4638;
}
body.ws-body .ws-metal-4 .ws-card-top {
    padding-top: clamp(30px, 4.6vh, 54px);
    padding-bottom: clamp(13px, 2vh, 26px);
}
body.ws-body .ws-metal-4 .ws-card-body {
    padding-top: clamp(11px, 1.7vh, 20px);
    padding-bottom: clamp(13px, 2vh, 24px);
}


body.ws-body .ws-card-body {
    flex: 1 1 auto;
    padding: clamp(12px, 2vh, 22px) clamp(12px, 1.4vw, 22px) clamp(14px, 2.2vh, 24px);
    display: flex; flex-direction: column; align-items: center;
}

body.ws-body .ws-name {
    font-family: var(--ws-serif);
    font-size: clamp(15px, 1.85vw, 27px); font-weight: 700; line-height: 1.16;
    color: var(--ws-emerald-900);
    text-align: center; overflow-wrap: anywhere;
    /* Two lines maximum: a long name must not push the score out of the card. */
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
    width: 100%;
}
body.ws-body .ws-number {
    margin-top: clamp(6px, 1vh, 10px);
    display: inline-flex; align-items: center; justify-content: center; flex-wrap: wrap;
    gap: 7px;
    padding: 5px 15px; border-radius: 999px;
    background: rgba(15, 83, 64, 0.07);
    border: 1px solid rgba(15, 83, 64, 0.10);
    /* Larger than the rest of the supporting text: the contestant number is what
       the hall looks up to place a name against a score sheet. */
    font-size: clamp(11.5px, 1.22vw, 17px); font-weight: 700; letter-spacing: 0.1em;
    color: var(--ws-emerald-700);
}
/* Solid, matte gold. A sweeping highlight on a 17px reference number competes
   with the medal for attention and reads as a rendering artefact on a projector,
   so the shine lives on the rank disc instead. */
body.ws-body .ws-num {
    color: var(--ws-gold-700);
}
body.ws-body .ws-cat,
body.ws-body .ws-tie {
    padding: 2px 8px; border-radius: 999px;
    font-size: 0.82em; font-weight: 700; letter-spacing: 0.05em;
}
body.ws-body .ws-cat { background: rgba(201, 162, 39, 0.20); color: var(--ws-gold-700); }
body.ws-body .ws-tie { background: var(--ws-emerald-700); color: var(--ws-gold-100); }

/* The score is the second-most important thing after the name, so it sits
   directly under it rather than being pushed to the floor of the card. */
body.ws-body .ws-score {
    margin-top: clamp(10px, 1.8vh, 20px);
    display: flex; align-items: baseline; justify-content: center;
    font-family: var(--ws-serif);
    font-size: clamp(27px, 3.8vw, 52px); font-weight: 700; line-height: 1;
    color: var(--ws-emerald-800);
    font-variant-numeric: tabular-nums;
}
body.ws-body .ws-score-num { font-variant-numeric: tabular-nums; }
body.ws-body .ws-score-unit {
    font-size: 0.42em; font-weight: 700;
    color: var(--ws-gold-600); margin-left: 2px;
}
body.ws-body .ws-score-label {
    margin-top: clamp(5px, 0.8vh, 8px);
    font-size: clamp(8.5px, 0.8vw, 11px); font-weight: 700;
    letter-spacing: 0.18em; text-transform: uppercase;
    color: var(--ws-ink-3);
}

/* ---- the winner ----
   The champion is the tallest card because of the graduated padding on
   .ws-metal-1, not because it is nudged upwards: the three cards share a
   baseline, and a transform on top of that would float the winner's bottom edge
   in mid-air and break the podium. Its extra height is what lifts its medal
   above the other two.

   Every winner-specific rule hangs off .ws-champion / .ws-metal-1, never
   .ws-place-1: the treatment follows the RANK, not the centre slot. On a tie for
   first both joint winners get the same treatment and neither out-sizes the
   other. .ws-place-1 keeps only the width that balances the 2nd-1st-3rd row. */
body.ws-body .ws-place-1 { max-width: 380px; }
body.ws-body .ws-champion .ws-card {
    border-color: rgba(201, 162, 39, 0.55);
    box-shadow: 0 4px 10px rgba(6, 41, 31, 0.07), 0 24px 56px rgba(6, 41, 31, 0.16);
}
/* Richer emerald than the default band, so the winner's container is the most
   present of the three rather than merely different. */
body.ws-body .ws-champion .ws-card-top {
    background: linear-gradient(160deg, #1C8462 0%, #0C4534 52%, #06291F 100%);
}
/* A bigger disc, and room above it for the crown to sit clear of the header. */
body.ws-body .ws-champion {
    padding-top: clamp(70px, 9.4vh, 92px);
}
body.ws-body .ws-champion .ws-medal {
    width: clamp(70px, 9.6vh, 118px); height: clamp(70px, 9.6vh, 118px);
}
body.ws-body .ws-champion .ws-medal-num { font-size: clamp(32px, 4.6vh, 56px); }
body.ws-body .ws-champion .ws-name { font-size: clamp(17px, 2.1vw, 31px); }
body.ws-body .ws-champion .ws-score { font-size: clamp(31px, 4.3vw, 60px); }

/* ---- runners-up strip ---- */
body.ws-body .ws-rest { flex: 0 0 auto; width: 100%; max-width: 1180px; }
body.ws-body .ws-rest-label {
    margin-bottom: clamp(6px, 1vh, 11px);
    font-size: clamp(8.5px, 0.8vw, 11px); font-weight: 700;
    letter-spacing: 0.22em; text-transform: uppercase;
    color: var(--ws-ink-3);
}
body.ws-body .ws-rest-list {
    display: flex; justify-content: center; flex-wrap: wrap;
    gap: clamp(6px, 0.85vw, 12px);
    padding-top: clamp(8px, 1.2vh, 15px);
    border-top: 1px solid rgba(15, 83, 64, 0.12);
}
body.ws-body .ws-rest-item {
    display: flex; align-items: center; gap: 8px;
    padding: clamp(5px, 0.8vh, 9px) clamp(10px, 1.1vw, 16px);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(15, 83, 64, 0.12);
}
body.ws-body .ws-rest-rank {
    font-size: clamp(10px, 0.95vw, 14px); font-weight: 800;
    color: var(--ws-gold-600);
    font-variant-numeric: tabular-nums;
}
body.ws-body .ws-rest-name {
    font-size: clamp(11px, 1.1vw, 17px); font-weight: 600;
    color: var(--ws-ink);
    max-width: clamp(90px, 12vw, 220px);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
body.ws-body .ws-rest-score {
    font-size: clamp(10px, 0.95vw, 14px); font-weight: 700;
    color: var(--ws-ink-2);
    font-variant-numeric: tabular-nums;
}

/* ---- empty / missing contest ---- */
body.ws-body .ws-empty {
    flex: 1 1 auto;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 12px;
}
body.ws-body .ws-empty-icon { color: var(--ws-gold-500); opacity: 0.75; }
body.ws-body .ws-empty-text {
    font-family: var(--ws-serif);
    font-size: clamp(19px, 2.8vw, 42px); font-weight: 700;
    color: var(--ws-emerald-800);
}
body.ws-body .ws-empty-sub {
    max-width: 54ch;
    font-size: clamp(12px, 1.15vw, 17px);
    color: var(--ws-ink-2); line-height: 1.55;
}
/* The "Contest Not Found" escape hatch out of an invalid presentation link. */
body.ws-body .ws-btn-lg {
    margin-top: 10px;
    font-size: 14px; font-weight: 600;
    padding: 11px 22px; border-radius: 12px;
}

/* ---- standby: the results are withheld until Live is pressed ----
   Opening Present Winners used to put the podium straight on the projector, so
   the winners were readable from the moment the page loaded - long before the
   operator was ready, and readable by anyone walking past a screen left open
   between events. The staged reveal was already gated on the Live button, but
   gating the ANIMATION while leaving the DATA visible gated nothing at all.

   `ws-standby` on <body> hides the podium and the runners-up, which collapses
   .ws-stage's flex column down to the header - so the contest title, event and
   date stay on screen to confirm the right contest is up, and nothing that gives
   the result away is.

   The prompt is the mirror image: it exists only WHILE standby is armed. It was
   in the hide list along with the results, which made it invisible in both
   states - the operator got a blank stage and no instruction. Two rules, keyed
   off the same class in opposite directions, so the Live control still only has
   to remove one class. */
body.ws-body.ws-standby .ws-podium,
body.ws-body.ws-standby .ws-rest { display: none; }
body.ws-body:not(.ws-standby) .ws-standby { display: none; }

/* The prompt itself. Sits in the stage's flex column, so it centres under the
   header without any positioning of its own.

   Colours come from this screen's own variables rather than literals. The stage
   is a LIGHT ivory page, and the first version of these rules was written for a
   dark background - the prompt rendered in near-white on cream and was all but
   invisible on the projector. Matching .ws-title / .ws-empty-text and
   .ws-empty-sub keeps it in the same family as everything around it. */
body.ws-body .ws-standby {
    flex: 0 0 auto;
    width: 100%; max-width: 900px;
    display: flex; flex-direction: column; align-items: center;
    gap: clamp(8px, 1.1vh, 14px);
    padding: clamp(18px, 3vh, 34px) 0;
}
body.ws-body .ws-standby-icon { color: var(--ws-gold-600); opacity: .9; }
body.ws-body .ws-standby-text {
    font-family: var(--ws-serif);
    font-size: clamp(28px, 4.4vh, 54px); font-weight: 700;
    letter-spacing: .04em; color: var(--ws-emerald-800);
}
body.ws-body .ws-standby-sub {
    font-size: clamp(13px, 1.7vh, 19px);
    color: var(--ws-ink-2); letter-spacing: .02em;
}
/* The word "Live" as a pill, so the eye lands on what to press. */
body.ws-body .ws-standby-sub b {
    color: var(--ws-gold-700); font-weight: 700;
    background: var(--ws-gold-100);
    padding: 2px 10px; margin: 0 3px;
    border: 1px solid rgba(201, 162, 39, .5); border-radius: 999px;
}

/* ---- staged reveal ----
   Ceremony order: third place at 5s, second at 10s, first at 15s, so the room
   is walked up the podium one place at a time.

   GATED BEHIND THE LIVE BUTTON, which is also what lifts `ws-standby` and puts
   this one on. Neither class is applied on load: without `ws-standby` the stage
   is showing nothing but its header, and without `ws-play` the cards carry no
   animation - so the two together are what make the reveal a deliberate act
   rather than something that happens because a page loaded.

   The poller strips `ws-play` again after it swaps the stage, so a background
   data refresh lands straight on screen instead of replaying the ceremony.

   Delays are keyed to ws-metal-*, which is derived from rank_position, not from
   the screen slot. On a tie for first both champions therefore arrive together
   at 15s, which is what a shared win should look like - keying off the slot
   would stagger two joint winners by five seconds for no reason.

   Only opacity and transform animate, and the cards stay in flow at all times,
   so nothing reflows as the podium fills in. `both` fill-mode holds the card at
   opacity 0 through its delay and at the final keyframe afterwards, so the
   animation runs once and then simply leaves the cards visible. */
body.ws-body .ws-card { opacity: 1; }
body.ws-body.ws-play .ws-card {
    opacity: 0;
    animation: wsReveal 1.1s cubic-bezier(0.22, 0.68, 0.32, 1.06) both;
}
body.ws-body.ws-play .ws-metal-4 .ws-card { animation-delay: 0s; }
body.ws-body.ws-play .ws-metal-3 .ws-card { animation-delay: 5s; }
body.ws-body.ws-play .ws-metal-2 .ws-card { animation-delay: 10s; }
body.ws-body.ws-play .ws-metal-1 .ws-card { animation-delay: 15s; }
@keyframes wsReveal {
    0%   { opacity: 0; transform: translateY(30px) scale(0.94); }
    55%  { opacity: 1; transform: translateY(-7px) scale(1.022); }
    80%  { opacity: 1; transform: translateY(0) scale(0.994); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}
/* A single-contest podium would otherwise sit dark for 15 seconds. Placed after
   the delay rules above so it wins their source-order tie on specificity. */
body.ws-body.ws-play .ws-podium-solo .ws-card { animation-delay: 0s; }

/* ---- floating controls (auto-hide) ---- */
/* right: 76px leaves clear room for the round "x" close button that Contest
   Results lays over the presentation (38px wide, 16px from the edge). */
body.ws-body .ws-controls {
    position: fixed; top: 16px; right: 76px; z-index: 40;
    display: flex; gap: 8px;
    transition: opacity 0.45s ease, transform 0.45s ease;
}
body.ws-body .ws-controls.is-idle { opacity: 0; transform: translateY(-8px); pointer-events: none; }

/* Compact square-cornered pills that sit on the ivory field without becoming
   a chrome bar. The label is dropped on very narrow screens; the icons and
   their titles keep the controls usable. */
body.ws-body .ws-btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 14px; border-radius: 10px;
    font-size: 12.5px; font-weight: 600;
    font-family: inherit;
    color: var(--ws-emerald-800);
    text-decoration: none;
    background: rgba(255, 253, 248, 0.88);
    border: 1px solid rgba(15, 83, 64, 0.16);
    box-shadow: 0 2px 8px rgba(6, 41, 31, 0.08);
    backdrop-filter: blur(8px);
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
body.ws-body .ws-btn svg { flex-shrink: 0; }
body.ws-body .ws-btn:hover { background: #FFFDF8; border-color: rgba(201, 162, 39, 0.5); }
body.ws-body .ws-btn.is-on {
    background: var(--ws-emerald-800);
    border-color: var(--ws-emerald-700);
    color: var(--ws-gold-100);
}
/* Subtle status dot on the Live control - the one place colour carries meaning. */
body.ws-body .ws-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--ws-ink-3); flex-shrink: 0;
}
body.ws-body .ws-btn.is-on .ws-dot {
    background: #35B779;
    box-shadow: 0 0 0 3px rgba(53, 183, 121, 0.22);
}

body.ws-body .ws-updated {
    position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 40;
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 18px; border-radius: 999px;
    background: var(--ws-emerald-800);
    border: 1px solid rgba(201, 162, 39, 0.5);
    color: var(--ws-gold-100);
    font-size: 12.5px; font-weight: 600;
    box-shadow: 0 10px 30px rgba(6, 41, 31, 0.26);
    animation: wsPop 0.35s ease;
}
body.ws-body .ws-updated[hidden] { display: none; }
@keyframes wsPop { from { opacity: 0; transform: translateX(-50%) translateY(-10px); } }

/* A projector is often driven from a phone or a remote, so touch devices keep
   the controls on screen instead of hiding them. */
@media (hover: none) {
    body.ws-body .ws-controls.is-idle { opacity: 1; transform: none; pointer-events: auto; }
}

/* Anyone who has asked the OS to reduce motion gets the finished podium straight
   away. Without this the whole screen would sit dark for 15 seconds, because the
   reveal holds the cards at opacity 0 until their delay elapses. */
@media (prefers-reduced-motion: reduce) {
    body.ws-body.ws-play .ws-card {
        animation: none;
        opacity: 1;
    }
}

/* ---- responsive ----
   The podium is a three-across row only while it fits. Below that it stacks
   with the winner first, and the stage top-aligns so nothing is cut off. */
@media (max-width: 960px) {
    body.ws-body .ws-stage { justify-content: flex-start; }
    body.ws-body .ws-podium {
        flex-direction: column; align-items: stretch;
        max-width: 480px; gap: clamp(14px, 2.4vh, 22px);
    }
    body.ws-body .ws-place { max-width: none; }
    /* Stacked there is no podium step to show: the cards are full-width columns
       and the graduated height would just be uneven whitespace. */
    body.ws-body .ws-metal-1 .ws-card-top,
    body.ws-body .ws-metal-2 .ws-card-top,
    body.ws-body .ws-metal-3 .ws-card-top { padding-top: clamp(24px, 3.6vh, 40px); }
    body.ws-body .ws-metal-1 .ws-card-body,
    body.ws-body .ws-metal-2 .ws-card-body,
    body.ws-body .ws-metal-3 .ws-card-body {
        padding-top: clamp(12px, 1.8vh, 20px);
        padding-bottom: clamp(12px, 1.8vh, 20px);
    }
    /* The DOM order is 2nd - 1st - 3rd for the row; stacked, the winner leads. */
    body.ws-body .ws-place-1 { order: -1; }
}
@media (max-width: 640px) {
    body.ws-body .ws-title { letter-spacing: 0; }
    body.ws-body .ws-meta-item { white-space: normal; }
    body.ws-body .ws-controls { top: 14px; right: 66px; gap: 6px; }
    /* Labels off, icons and titles still work. */
    body.ws-body .ws-btn span:not(.ws-dot) { display: none; }
    body.ws-body .ws-btn { padding: 8px 10px; }
    body.ws-body .ws-btn#wsLiveLabel { display: inline; }
}
/* Short and wide - a laptop with browser chrome, or a 1280x720 projector. Trim
   the vertical rhythm rather than the type size, so the results stay readable.
   The podium stays whole and the trophy badge stays on screen: a ceremony should
   never have to scroll, and the badge is part of the header it belongs to.

   The graduated paddings are re-stated per place rather than trimmed through
   .ws-card-top: a blanket rule there loses to .ws-metal-* on specificity and
   would silently flatten all three cards back to the same height. */
@media (max-height: 760px) {
    body.ws-body .ws-stage {
        padding-top: clamp(12px, 2.4vh, 22px);
        padding-bottom: clamp(10px, 2vh, 18px);
        gap: clamp(8px, 1.4vh, 16px);
    }
    body.ws-body .ws-rule { margin-top: clamp(6px, 1vh, 12px); }
    body.ws-body .ws-badge { margin-bottom: clamp(6px, 0.9vh, 10px); }
    /* Floor of 30px, not less: the champion's medal has a 62px clamp minimum, so
       below about 650px of height the disc stops shrinking and 30px is what it
       takes to keep the overhang inside this padding. */
    body.ws-body .ws-place { padding-top: clamp(30px, 3.6vh, 38px); }
    /* ...but the winner also carries a crown on top of its disc, which needs
       ~50px. This blanket .ws-place rule outranks .ws-champion on source order
       at the same specificity, so the champion's padding has to be restated
       here or the crown rides up into the header. */
    body.ws-body .ws-champion { padding-top: clamp(52px, 7.4vh, 72px); }

    body.ws-body .ws-metal-1 .ws-card-top {
        padding-top: clamp(40px, 6.4vh, 70px);
        padding-bottom: clamp(17px, 2.7vh, 31px);
    }
    body.ws-body .ws-metal-1 .ws-card-body {
        padding-top: clamp(14px, 2.3vh, 26px);
        padding-bottom: clamp(21px, 3.3vh, 37px);
    }
    body.ws-body .ws-metal-2 .ws-card-top {
        padding-top: clamp(32px, 5.2vh, 58px);
        padding-bottom: clamp(14px, 2.2vh, 26px);
    }
    body.ws-body .ws-metal-2 .ws-card-body {
        padding-top: clamp(11px, 1.9vh, 21px);
        padding-bottom: clamp(15px, 2.4vh, 28px);
    }
    body.ws-body .ws-metal-3 .ws-card-top {
        padding-top: clamp(26px, 4.2vh, 48px);
        padding-bottom: clamp(11px, 1.8vh, 22px);
    }
    body.ws-body .ws-metal-3 .ws-card-body {
        padding-top: clamp(9px, 1.5vh, 17px);
        padding-bottom: clamp(11px, 1.8vh, 21px);
    }
}
/* Tighter still. Everything here is slack rather than information: the badge,
   the runners-up caption, the internal breathing room, and a smaller score. */
@media (max-height: 640px) {
    body.ws-body .ws-badge { display: none; }
    body.ws-body .ws-rest-label { display: none; }
    body.ws-body .ws-meta { margin-top: clamp(5px, 0.9vh, 10px); }
    body.ws-body .ws-rest-list { padding-top: clamp(5px, 0.9vh, 10px); }
    body.ws-body .ws-metal-1 .ws-card-top { padding-top: clamp(34px, 5.4vh, 58px); }
    body.ws-body .ws-metal-1 .ws-card-body { padding-bottom: clamp(15px, 2.4vh, 27px); }
    body.ws-body .ws-metal-2 .ws-card-top { padding-top: clamp(27px, 4.3vh, 47px); }
    body.ws-body .ws-metal-3 .ws-card-top { padding-top: clamp(22px, 3.5vh, 39px); }
    body.ws-body .ws-metal-3 .ws-card-body { padding-bottom: clamp(8px, 1.3vh, 15px); }
    body.ws-body .ws-score { font-size: clamp(25px, 3.2vw, 44px); }
    body.ws-body .ws-champion .ws-score { font-size: clamp(28px, 3.6vw, 50px); }
}
/* Very short and wide. Type steps down once more so the whole podium still fits
   in one screen. Nothing is hidden here - the runners-up strip stays, because
   dropping data to save a few pixels is the wrong trade on a results board. */
@media (max-height: 560px) {
    body.ws-body .ws-stage {
        padding-top: clamp(8px, 1.5vh, 14px);
        padding-bottom: clamp(6px, 1.2vh, 12px);
        gap: clamp(6px, 1vh, 12px);
    }
    body.ws-body .ws-title { font-size: clamp(24px, 4vw, 46px); }
    body.ws-body .ws-event { font-size: clamp(11px, 1.2vw, 16px); }
    body.ws-body .ws-name { font-size: clamp(13px, 1.5vw, 21px); }
    body.ws-body .ws-champion .ws-name { font-size: clamp(15px, 1.7vw, 24px); }
    body.ws-body .ws-score { font-size: clamp(22px, 2.7vw, 36px); }
    body.ws-body .ws-champion .ws-score { font-size: clamp(25px, 3vw, 41px); }
}

@media print {
    body.ws-body { background: #fff; color: #000; overflow: visible; }
    body.ws-body::before, body.ws-body::after { display: none; }
    body.ws-body .ws-stage { min-height: auto; }
    body.ws-body .ws-controls, body.ws-body .ws-updated { display: none; }
    body.ws-body .ws-card {
        break-inside: avoid;
        box-shadow: none; border-color: #C9C9C9;
    }
    /* Drop the emerald wash for paper, but keep the ribbon legible. */
    body.ws-body .ws-card-top {
        background: #fff !important;
        border-bottom: 1px solid #C9C9C9;
    }
    body.ws-body .ws-ribbon, body.ws-body .ws-badge, body.ws-body .ws-medal {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    body.ws-body .ws-name, body.ws-body .ws-title, body.ws-body .ws-score { color: #14302A; }
}

/* Judge evaluation dashboard refinements. */
body[data-judge-page="evaluate"] {
    background-color: #EFF8F3;
    background-image:
        radial-gradient(900px 420px at 50% -12%, rgba(8,122,89,0.08), transparent 68%);
}
body[data-judge-page="evaluate"] .judge-header {
    position: relative;
    z-index: 20;
    flex: 0 0 60px;
    min-height: 60px;
    padding: 0 28px;
    background: #064D3B;
    border-bottom: 1px solid rgba(212,175,55,0.48);
    backdrop-filter: none;
}
body[data-judge-page="evaluate"] .judge-system-brand {
    gap: 10px;
    font-size: 15px;
    letter-spacing: 0.1px;
}
body[data-judge-page="evaluate"] .judge-system-brand > .lucide { color: #E9C85B; }
body[data-judge-page="evaluate"] .judge-profile { font-size: 13px; font-weight: 600; }
body[data-judge-page="evaluate"] .judge-section-label {
    margin: 16px var(--judge-gutter) 8px;
    color: #31574A;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}
/* The contest tab bar's own styling used to sit here, evaluate-only, at three
   different sizes from the base rule and the receipt's. It is one shared block
   now - see JUDGE SCORING SHEET AND RECEIPT at the end of this file - because the
   two bars are the same control read at two different moments, and a judge who
   has learned one has learned the other. */
body[data-judge-page="evaluate"] .judge-score-card-head {
    margin: 12px var(--judge-gutter) 0;
    padding: 14px 16px;
    background: #F7FBF9;
    border: 1px solid #E3EDE8;
    border-radius: 11px 11px 0 0;
    box-shadow: inset 3px 0 0 #D1AE3D;
}
body[data-judge-page="evaluate"] .judge-score-card-head .rv-num {
    background: #064D3B;
}
body[data-judge-page="evaluate"] .judge-score-card-head .rv-trophy {
    color: #9A7B18;
}
/* The .judge-instructions rules that styled the Judging Instructions panel on
   the scoring sheet are gone along with the panel. It rendered unconditionally,
   falling back to a fixed sentence whenever a contest had no instructions
   configured, so every judge saw a note about the form sitting above the form.
   With no element left in either evaluate partial, these rules had nothing to
   match and would only invite someone to wonder whether it still worked. */
body[data-judge-page="evaluate"] .judge-contestants { min-width: 0; margin-bottom: 16px; }
/* The margin above is the only bottom spacing this section has, and it needs one.
 *
 * .sc-sheet is a flex column at gap:0 and padding:0 (see 3b), so nothing on this
 * sheet gets vertical space by default - every band owns its own. This one gave
 * the label a top margin and stopped there, which put the folder bar's own 1px
 * border directly on the 1px rule that opens .sc-card (3e). Two hairlines touching
 * read as one stray double line rather than as two separate bands, and the bar
 * looked welded to the criteria table it is meant to be separated from.
 *
 * 16px, the same gap the contest tab bar above it gets, so the sheet keeps one
 * rhythm instead of two.
 *
 * Declared on the SECTION rather than on .sc-folders, because the grouped sheet's
 * bar already carries an mb-3 utility of its own and a margin-bottom here would
 * collide with it. The nested copy inside .bundle-contest-panel is left at margin:0
 * by the more specific rule further down this block, which is where the grouped
 * sheet's spacing comes from. */
body[data-judge-page="evaluate"] .judge-contestants .judge-section-label { margin-top: 18px; }
body[data-judge-page="evaluate"] .sc-folders,
body[data-judge-page="evaluate"] .sc-folders-nested {
    margin-top: 0;
    padding: 8px;
    background: #F8FCF9;
}
body[data-judge-page="evaluate"] .sc-folder-arrow,
body[data-judge-page="evaluate"] .sc-folders::before,
body[data-judge-page="evaluate"] .sc-folders::after { display: none; }
/* The track is a wrapping grid here and not a scroller, so a roster of any length
   stays fully reachable without the arrows the other sheets use. */
body[data-judge-page="evaluate"] .sc-folder-track {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
    width: 100%;
    gap: 9px;
    overflow: visible;
    padding: 1px;
}
/* The folder CARD itself - its fill, border, radius, the icon chip, the two-line
   name clamp and the selected state - is the shared block at the end of this
   file, the same one the receipt reads. What is left here is the scoring sheet's
   own behaviour: the "Scores complete" caption and the tick that appear as a
   contestant is finished, neither of which exists on a read-only receipt. */
body[data-judge-page="evaluate"] .judge-contestant-status {
    display: block;
    margin-top: 2px;
    color: #73847D;
    font-size: 10px;
    font-weight: 600;
}
body[data-judge-page="evaluate"] .sc-folder[data-score-complete="true"] .judge-contestant-status {
    color: #087B59;
}
body[data-judge-page="evaluate"] .judge-contestant-check {
    display: none;
    color: #087B59;
}
body[data-judge-page="evaluate"] .sc-folder[data-score-complete="true"] .judge-contestant-check { display: inline-flex; }
/* A selected AND finished contestant used to get a gold ring around the whole
   card, on top of the selected card's own state. Two selection treatments on one
   card, and the ring is the same 1px gold halo the contest tabs have just moved
   away from. The shared block marks selection with the gold rule along the
   bottom edge instead, which is enough on its own. */
body[data-judge-page="evaluate"] .bundle-contest-panel .judge-contestants { margin: 0; }
body[data-judge-page="evaluate"] .bundle-contest-panel .judge-section-label { margin-left: var(--judge-gutter); }
body[data-judge-page="evaluate"] .sc-actions [data-open-submit] {
    color: #fff;
    background: #064D3B;
    border: 1px solid #064D3B;
    transition: background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}
body[data-judge-page="evaluate"] .sc-actions [data-open-submit] .lucide { color: #F3E3B0; }
body[data-judge-page="evaluate"] .sc-actions [data-open-submit]:hover:not(:disabled) {
    background: #0A6650;
    box-shadow: 0 5px 14px rgba(0,77,59,0.2);
    transform: translateY(-1px);
}
body[data-judge-page="evaluate"] .sc-actions [data-open-submit]:focus-visible {
    outline: 3px solid rgba(212,175,55,0.55);
    outline-offset: 2px;
}
body[data-judge-page="evaluate"] .sc-actions [data-open-submit]:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    box-shadow: none;
}

@media (max-width: 640px) {
    body[data-judge-page="evaluate"] .judge-header {
        flex-basis: 54px;
        min-height: 54px;
        padding: 0 14px;
        gap: 8px;
    }
    body[data-judge-page="evaluate"] .judge-system-brand { font-size: 12px; gap: 6px; }
    body[data-judge-page="evaluate"] .judge-system-brand .judge-header-logo-text {
        max-width: 52vw;
    }
    /* The name is no longer hidden here. It was hidden while it lived inside a
       menu, where the avatar stood in for it; as plain text on a phone it is the
       one thing that tells the judge whose sheet they are on, so it is allowed to
       truncate (see .judge-profile-name) instead of disappearing. The number
       chip is what gives way first, at 560px. */
    body[data-judge-page="evaluate"] .judge-profile { gap: 6px; }
    body[data-judge-page="evaluate"] .sc-head { gap: 11px; }
    body[data-judge-page="evaluate"] .sc-head-text { flex: 1 1 calc(100% - 62px); }
    body[data-judge-page="evaluate"] .sc-head-progress { flex: 1 1 100%; }
    body[data-judge-page="evaluate"] .sc-head-text h1 { font-size: 17px; }
    body[data-judge-page="evaluate"] .sc-folder-track { grid-template-columns: repeat(auto-fit, minmax(min(100%, 155px), 1fr)); }
    body[data-judge-page="evaluate"] .judge-score-card-head { padding: 12px 13px; gap: 10px; }
    body[data-judge-page="evaluate"] .sc-table { min-width: 760px; }
}

/* Submitted score view follows the same dashboard frame as evaluation. */
body[data-judge-page="view"] {
    --judge-gutter: 28px;
    --judge-rule: #E3EDE8;
    background: #EFF8F3;
    background-image: radial-gradient(900px 420px at 50% -12%, rgba(8,122,89,0.08), transparent 68%);
    background-attachment: fixed;
}
body[data-judge-page="view"] .judge-header {
    flex: 0 0 60px;
    min-height: 60px;
    padding: 0 28px;
    background: #064D3B;
    border-bottom: 1px solid rgba(212,175,55,0.48);
    backdrop-filter: none;
}
body[data-judge-page="view"] .judge-system-brand {
    gap: 10px;
    font-size: 15px;
    letter-spacing: 0.1px;
}
body[data-judge-page="view"] .judge-system-brand > .lucide { color: #E9C85B; }
body[data-judge-page="view"] .judge-profile { font-size: 13px; font-weight: 600; }
body[data-judge-page="view"] .sc-wrap {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px 16px 40px;
    gap: 0;
}
body[data-judge-page="view"] .sc-sheet {
    width: 100%;
    margin-top: 0;
    padding: 0;
    gap: 0;
    align-items: stretch;
    background: #fff;
    border: 1px solid #DCE7E2;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,77,59,0.10);
}
body[data-judge-page="view"] .sc-corner { display: none !important; }
body[data-judge-page="view"] .sc-head,
body[data-judge-page="view"] .rv-status,
body[data-judge-page="view"] .sc-folders,
body[data-judge-page="view"] .rv-card-head,
body[data-judge-page="view"] .sc-table-wrap,
body[data-judge-page="view"] .rv-total,
body[data-judge-page="view"] .sc-actions {
    margin-left: var(--judge-gutter);
    margin-right: var(--judge-gutter);
}
body[data-judge-page="view"] .sc-head {
    margin-top: 16px;
    padding: 20px 22px;
    border: 0;
    border-bottom: 1px solid rgba(212,175,55,0.45);
    border-radius: 15px;
    background: linear-gradient(100deg, #004D3B 0%, #0A6650 60%, #00493A 100%);
    box-shadow: none;
}
body[data-judge-page="view"] .sc-head-icon {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(212,175,55,0.8);
    box-shadow: none;
}
body[data-judge-page="view"] .sc-head-icon::after { display: none; }
body[data-judge-page="view"] .sc-head-text h1 {
    color: #fff;
    font-size: 21px;
}
body[data-judge-page="view"] .sc-head-text p {
    color: rgba(255,255,255,0.78);
    font-size: 13.5px;
}
body[data-judge-page="view"] .sc-head-progress { width: 220px; }
body[data-judge-page="view"] .sc-progress-label {
    color: rgba(255,255,255,0.85);
}
body[data-judge-page="view"] .rv-status {
    margin-top: 14px;
    margin-bottom: 0;
    padding: 13px 16px;
    border-radius: 10px;
}
body[data-judge-page="view"] .sc-folders {
    margin-top: 16px;
    padding: 8px;
    background: #F8FCF9;
    border: 1px solid #DCEAE4;
    border-radius: 13px;
}
body[data-judge-page="view"] .view-contest-section {
    margin: 18px var(--judge-gutter) 0;
    padding: 0 0 16px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #DCEAE4;
    border-radius: 14px;
    box-shadow: 0 3px 12px rgba(0,77,59,0.05);
}
body[data-judge-page="view"] .view-contest-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 16px 18px;
    background: #064D3B;
    border-bottom: 2px solid #D1AE3D;
}
body[data-judge-page="view"] .view-contest-head .sc-card-icon { color: #F3E3B0; }
body[data-judge-page="view"] .view-contest-head .sc-card-text { flex: 1; min-width: 0; }
body[data-judge-page="view"] .view-contest-head h2 { color: #fff; font-size: 17px; }
body[data-judge-page="view"] .view-contest-head p { color: rgba(255,255,255,.78); }
body[data-judge-page="view"] .view-contestant-nav {
    margin-top: 13px;
    margin-right: 14px;
    margin-left: 14px;
    margin-bottom: 0;
    padding: 8px;
}
body[data-judge-page="view"] .view-contestant-nav .sc-folder {
    text-decoration: none;
}
body[data-judge-page="view"] .view-contestant-nav .sc-folder:focus-visible {
    outline: 2px solid #087B59;
    outline-offset: 2px;
}
body[data-judge-page="view"] .view-contestant-card {
    margin: 14px 14px 0;
}
body[data-judge-page="view"] .view-contestant-card .rv-card-head { margin-right: 0; margin-left: 0; }
body[data-judge-page="view"] .view-table-wrap {
    width: auto;
    max-width: 100%;
    margin-right: 0;
    margin-left: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
}
body[data-judge-page="view"] .view-contestant-card .rv-total { margin-right: 14px; margin-left: 14px; }
body[data-judge-page="view"] .view-score-table { min-width: 940px; }
body[data-judge-page="view"] .view-score-table th:nth-child(1) { min-width: 185px; }
body[data-judge-page="view"] .view-score-table th:nth-child(2) { min-width: 260px; }
body[data-judge-page="view"] .view-score-table td:nth-child(2) { white-space: normal; }

/* The receipt inherited .rv-table's 56% first column, a share sized for the
 * admin's submission view, which has no Description column. On this sheet it
 * left the criterion name in over half the table and squeezed the description
 * into a 260px strip - one paragraph wrapped into a tall block beside a
 * one-line label. Above 900px only: below that, width:auto already balances
 * the columns. Line-height matches the scoring sheet's .sc-desc. */
@media screen and (min-width: 901px) {
    body[data-judge-page="view"] .view-score-table th:nth-child(1),
    body[data-judge-page="view"] .view-score-table td:nth-child(1) { width: 28%; }
    body[data-judge-page="view"] .view-score-table th:nth-child(2),
    body[data-judge-page="view"] .view-score-table td:nth-child(2) { width: 40%; line-height: 1.5; }
}

body[data-judge-page="view"] .view-score-table .rv-weighted { color: #087B59; font-weight: 800; }
body[data-judge-page="view"] .view-certification {
    margin: 18px 14px 0;
    padding: 15px 17px;
    background: #F8FCF9;
    border: 1px solid #DCEAE4;
    border-radius: 12px;
}
body[data-judge-page="view"] .view-certification-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
body[data-judge-page="view"] .view-certification-heading h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #064D3B;
    font-size: 14px;
}
body[data-judge-page="view"] .view-certification-heading h3 .lucide { color: #A78314; }
body[data-judge-page="view"] .view-signature-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    color: inherit;
    text-align: left;
    background: none;
    border: 0;
    cursor: pointer;
}
body[data-judge-page="view"] .view-signature-thumb {
    display: flex;
    width: 190px;
    height: 66px;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    background: #fff;
    border: 1px solid #DCEAE4;
    border-radius: 8px;
}
body[data-judge-page="view"] .view-signature-thumb img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}
body[data-judge-page="view"] .view-signature-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #087B59;
    font-size: 12px;
    font-weight: 700;
}
body[data-judge-page="view"] .view-signature-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 10px;
    color: #52665D;
    font-size: 12px;
}
body[data-judge-page="view"] .view-signature-meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
body[data-judge-page="view"] .view-signature-meta .lucide { color: #087B59; }
body[data-judge-page="view"] .view-signature-unavailable { color: #718078; font-size: 12px; }
body[data-judge-page="view"] .sc-folder-arrow,
body[data-judge-page="view"] .sc-folders::before,
body[data-judge-page="view"] .sc-folders::after { display: none; }
body[data-judge-page="view"] .sc-folder-track {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
    width: 100%;
    gap: 9px;
    overflow: visible;
    padding: 1px;
}
body[data-judge-page="view"] .sc-folder {
    width: 100%;
    min-width: 0;
    max-width: none;
    min-height: 66px;
    padding: 10px 12px;
    border-color: #DCEAE4;
    border-radius: 10px;
}
body[data-judge-page="view"] .sc-folder.is-active {
    background: #EAF6EF;
    border-color: #087B59;
    box-shadow: 0 0 0 1px #D7B747;
}
body[data-judge-page="view"] .sc-folder.is-active .sc-folder-num,
body[data-judge-page="view"] .sc-folder.is-active .sc-folder-name,
body[data-judge-page="view"] .sc-folder.is-active .sc-folder-icon {
    color: #064D3B;
}
body[data-judge-page="view"] .rv-card {
    margin: 16px 0 0;
    overflow: hidden;
    background: #fff;
    border: 1px solid #DCEAE4;
    border-radius: 13px;
    box-shadow: 0 3px 12px rgba(0,77,59,0.06);
}
body[data-judge-page="view"] .rv-card-head {
    margin-top: 0;
    margin-bottom: 0;
    padding: 14px 16px;
    background: #F7FBF9;
    border-bottom: 1px solid #E3EDE8;
    box-shadow: inset 3px 0 0 #D1AE3D;
}
body[data-judge-page="view"] .rv-category-badge {
    background: linear-gradient(135deg, #EFF5F2 0%, #E3EDE8 100%);
    border-color: rgba(8,123,89,0.25);
    color: var(--forest);
}
body[data-judge-page="view"] .rv-category-badge .lucide { color: var(--forest); }
body[data-judge-page="view"] .sc-table-wrap {
    margin-top: 0;
    overflow-x: auto;
    border-radius: 0;
}
body[data-judge-page="view"] .rv-table { min-width: 760px; }
body[data-judge-page="view"] .rv-table th,
body[data-judge-page="view"] .rv-table td { padding: 13px 16px; }
body[data-judge-page="view"] .rv-table tbody tr:nth-child(even) { background: #FAFCFB; }
body[data-judge-page="view"] .rv-table td { border-bottom: 1px solid #EFF5F2; }
body[data-judge-page="view"] .rv-total {
    margin-top: 14px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: #FFFDF7;
    border: 1px solid #E7E0CB;
    border-left: 4px solid #D1AE3D;
    border-radius: 10px;
}
/* The figure, the ceiling and the caption, at the scoring sheet's sizes.
 *
 * These four numbers are the scoring sheet's, deliberately restated rather than
 * shared. The scoring sheet's copy lives under
 * body[data-judge-page="evaluate"] .sc-scorebox-* and the shared base rule for
 * .rv-total-* is also what the Review sheet and the admin's submission view read;
 * moving those to 17px would resize a third and fourth page as a side effect of
 * changing this one. Four declarations is cheaper than that.
 *
 *     this page (.rv-total-value b)   26px -> 17px   = evaluate's .sc-scorebox-value
 *     "/ 10"   (.rv-total-value span) 13px -> 11.5px = evaluate's .sc-scorebox-max
 *     label                            14.5 -> 10.5  = evaluate's .sc-scorebox-label
 *     sub                              12   -> 10.5  (evaluate has no sub; it takes the
 *                                                  label's size so the two lines
 *                                                  under the caption do not compete)
 *
 * The 26px figure was larger than the contestant's name in the card header above
 * it, and larger than the score in every row of the table it is summarising - the
 * one number on the page that is not itself a criterion score was the number that
 * shouted loudest. At the scoring sheet's size it reads as the summary of the
 * table instead of competing with it, and the two sheets a judge moves between
 * now present the same total at the same size.
 *
 * Specificity also settles a media query: the bare `.rv-total-value b { font-size:
 * 23px }` inside the narrow-screen block lower down is (0,1,1) and would otherwise
 * win on source order at phone widths, handing this page a third size. */
body[data-judge-page="view"] .rv-total-value b { font-size: 17px; }
body[data-judge-page="view"] .rv-total-value span { font-size: 11.5px; }
body[data-judge-page="view"] .rv-total-label { font-size: 10.5px; }
body[data-judge-page="view"] .rv-total-sub { font-size: 10.5px; }
/* The star disc shrinks with the figure. Left at 38px it becomes the largest
   thing in a block whose whole point is now that the number is not. */
body[data-judge-page="view"] .rv-total-icon {
    width: 32px;
    height: 32px;
}
body[data-judge-page="view"] .rv-total-icon .lucide {
    width: 15px;
    height: 15px;
}
body[data-judge-page="view"] .sc-actions {
    margin-top: 0;
    padding: 16px 0 20px;
    justify-content: flex-end;
    border-top: 1px solid var(--judge-rule);
}
@media (max-width: 900px) {
    body[data-judge-page="view"] { --judge-gutter: 18px; }
    body[data-judge-page="view"] .sc-wrap { padding: 12px 12px 28px; }
    body[data-judge-page="view"] .sc-head { flex-wrap: wrap; }
    body[data-judge-page="view"] .sc-head-progress { width: 100%; margin-left: 0; }
}
@media (max-width: 640px) {
    body[data-judge-page="view"] { --judge-gutter: 14px; }
    body[data-judge-page="view"] .judge-header {
        flex-basis: 54px;
        min-height: 54px;
        padding: 0 14px;
    }
    body[data-judge-page="view"] .judge-system-brand { gap: 6px; font-size: 12px; }
    body[data-judge-page="view"] .judge-system-brand .judge-header-logo-text {
        max-width: 52vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    /* As on evaluate: the name truncates rather than being hidden, because it is
       the plain-text content of the header now, not a stand-in for a menu. */
    body[data-judge-page="view"] .judge-profile { gap: 6px; }
    body[data-judge-page="view"] .sc-wrap { padding: 10px 10px 24px; }
    body[data-judge-page="view"] .sc-head { gap: 11px; padding: 16px; }
    body[data-judge-page="view"] .sc-head-text { flex: 1 1 calc(100% - 62px); }
    body[data-judge-page="view"] .sc-head-text h1 { font-size: 17px; }
    body[data-judge-page="view"] .sc-head-progress { flex: 1 1 100%; }
    body[data-judge-page="view"] .sc-folder-track { grid-template-columns: repeat(auto-fit, minmax(min(100%, 155px), 1fr)); }
    body[data-judge-page="view"] .rv-total { flex-wrap: wrap; gap: 8px; }
    body[data-judge-page="view"] .rv-total-value { margin-left: auto; }
    body[data-judge-page="view"] .sc-actions .btn { width: 100%; justify-content: center; }
}

body[data-judge-page="view"] .cf-signature-preview {
    max-height: calc(100vh - 32px);
    overflow-y: auto;
}
@media print {
    /* Select the named page declared up in the PRINT section. This used to be a
     * bare `@page { size: landscape; margin: 0.45in; }` on the next line, which
     * overrode the default page box for the entire app; see the note on
     * `@page judge-sheet`. */
    body[data-judge-page="view"] { page: judge-sheet; }
    body[data-judge-page="view"] {
        color: #111;
        background: #fff !important;
        background-image: none !important;
    }
    /* .judge-header, .sc-wrap and .sc-sheet are no longer repeated here. They were
     * the receipt's own print reset, and keeping them here while the shared
     * body.judge-sheet block in the PRINT section grew the same declarations meant
     * two copies of one decision - the second one silent about which was in
     * force. One copy now serves all four stages. */
    body[data-judge-page="view"] .view-actions,
    body[data-judge-page="view"] .view-contestant-nav,
    body[data-judge-page="view"] .cf-signature-preview-overlay {
        display: none !important;
    }
    body[data-judge-page="view"] .sc-head {
        margin-top: 0;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    body[data-judge-page="view"] .view-contest-section {
        margin-top: 14px;
        border-color: #AFC3B9;
        box-shadow: none;
        break-inside: auto;
    }
    body[data-judge-page="view"] .view-contest-head {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        break-after: avoid;
    }
    body[data-judge-page="view"] .view-contestant-card {
        margin-top: 10px;
        border-color: #C8D4CE;
        box-shadow: none;
        break-inside: avoid;
    }
    body[data-judge-page="view"] .view-table-wrap {
        width: 100%;
        overflow: visible;
    }
    body[data-judge-page="view"] .view-score-table {
        width: 100%;
        min-width: 0;
        table-layout: fixed;
        font-size: 9pt;
    }
    body[data-judge-page="view"] .view-score-table th,
    body[data-judge-page="view"] .view-score-table td {
        padding: 6px 7px;
        overflow-wrap: anywhere;
    }
    body[data-judge-page="view"] .view-score-table thead { display: table-header-group; }
    body[data-judge-page="view"] .view-certification {
        break-inside: avoid;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    body[data-judge-page="view"] .view-signature-thumb {
        width: 320px;
        height: 105px;
        border-color: #8C9B93;
    }
    body[data-judge-page="view"] .view-signature-link { display: none; }
}

/* The contest tab bar and the contestant folders used to be styled twice, once
   per sheet, with the two copies drifting apart: three different tab heights and
   two different selected states across Evaluate and View. Both bars are the same
   control read at two different moments - pick one of several - so they are now
   one shared block further down, under JUDGE SCORING SHEET AND RECEIPT.
   What remains here is only what genuinely differs between the two sheets. */

/* ==================================================================
   JUDGE SCORING SHEET AND RECEIPT - CONTEST AND TEAM TABS
   ------------------------------------------------------------------
   judge/evaluate.php and judge/view.php: the row of contests at the top
   of either sheet, and the row of contestant folders inside whichever
   contest is open.

   Both are the same shape of control - "one of several, pick one" - so
   they share one language: an equal-width card, an icon in a fixed
   square at the left, the name beside it, and a status chip on a second
   row. A judge who has read the top row has read the bottom one, and a
   judge who scored a contest yesterday recognises the same bar on the
   receipt today, at the same size.

   Nothing in this block touches the Review sheet, which keeps its own
   bar (body[data-judge-page="review"] .bundle-contest-*, further up),
   or the base .bundle-contest-* rules, which the admin's own pages read.

   What changed, and what it was:

   1. CARDS SIZED THEMSELVES. The base rule sizes a tab with
      min-width:180px / max-width:250px. Two contests therefore came out
      250px each with 900px of nothing between them, and the bar read as two
      small cards marooned in a wide sheet rather than as a row. The bar is
      a grid of equal 1fr columns now, so N contests make N equal cards
      that fill the width they have.

   2. HEIGHTS DIFFERED PER CARD. min-height is a floor, not a height: a card
      with a one-line title came out shorter than its neighbour with a
      two-line one. A grid row is as tall as its tallest item and stretches
      the rest, so every card in a row is now the same height whatever its
      title does - and align-content:center then centres the card's own two
      rows inside that height.

   3. THE STATUS BADGE MOVED WITH THE TITLE. Category and status were two
      separate grid areas whose columns are sized by their content, so a
      long category pushed the badge in and a short one let it out, and
      neither lined up with the card beside it. They are now one row with
      its ends pinned, which puts them in the same two places on every
      card regardless of the words in them.

   4. A GLYPH PER LEVEL. The contest tabs and the contestant folders both said
      "folder", so the two nested rows on one page were two rows of the same
      thing and the nesting had to be read off the headings. A contest is a
      folder; a contestant is a person. One glyph per level, and the row can be
      identified without reading it - see judge/partials/stage-view.php.

   5. A GOLD RING AROUND THE SELECTED CARD. It drew a second, fatter
      outline that overlapped the gap and made the selected card look
      larger than its neighbours. It is a 2px rule along the bottom edge
      now, inside the card, which marks the selection without changing
      the card's size.

   6. A HEADING THAT WAS 22px. On the receipt, "Select Contest" was an <h2>
      with .judge-section-label, a class only ever styled on the scoring sheet,
      so there it fell through to the browser's default h2 size and out-scaled
      the page's own title above it. It gets its own small eyebrow label in
      .view-tabs-label below. The scoring sheet's copy of the same heading is
      correctly styled already and keeps .judge-section-label. */
body[data-judge-page="view"] .view-tabs {
    margin: 16px var(--judge-gutter) 0;
}
body[data-judge-page="view"] .view-tabs-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
    color: #31574A;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.9px;
    text-transform: uppercase;
}
body[data-judge-page="evaluate"] .bundle-contest-tabs,
body[data-judge-page="view"] .bundle-contest-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 196px), 1fr));
    align-items: stretch;
    gap: 8px;
    padding: 0;
    overflow: visible;
    background: transparent;
    border: 0;
    border-radius: 0;
}
/* The receipt's bar has no inset to inherit, so it is given the gutter here.
   The scoring sheet's must NOT get a matching declaration: that sheet already
   lists .bundle-contest-tabs in the "every section shares one horizontal inset"
   rule further up, and restating the gutter here would be a second place to keep
   in step. This rule once said `margin: 0`, whose shorthand wiped that inherited
   gutter and pulled the scoring sheet's bar flush against the sheet's edge.
   That is why the two sheets are stated separately rather than merged. */
body[data-judge-page="view"] .bundle-contest-tabs {
    margin-top: 0;
    margin-left: var(--judge-gutter);
    margin-right: var(--judge-gutter);
}
body[data-judge-page="evaluate"] .bundle-contest-tab,
body[data-judge-page="view"] .bundle-contest-tab {
    position: relative;
    /* Width comes from the grid column. min-width/max-width are explicitly
     * cleared because the base rule's 180px/250px pair is what left two cards
     * 250px wide in a sheet 1180px across. */
    width: auto;
    min-width: 0;
    max-width: none;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    grid-template-areas:
        "icon title"
        "icon meta";
    align-content: center;
    align-items: center;
    gap: 5px 10px;
    min-height: 66px;
    padding: 10px 12px;
    overflow: hidden;
    text-align: left;
    color: var(--text);
    background: #fff;
    border: 1px solid #E1EAE5;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: none;
    transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
}
/* The whole card is the target already - it is one <button>, not a chip inside a
   button - so hover has to be visible on the card rather than on the icon.
   Deliberately a whisper: a pale mint wash and a soft edge, one step off white.
   A saturated hover on a card this large reads as a second selected state
   competing with the selected card's own mint fill and gold rule, which is the
   confusion this whole block exists to remove. */
body[data-judge-page="evaluate"] .bundle-contest-tab:hover,
body[data-judge-page="view"] .bundle-contest-tab:hover {
    background: #F4FAF6;
    border-color: #B7D4C6;
}
body[data-judge-page="evaluate"] .bundle-contest-tab:focus-visible,
body[data-judge-page="view"] .bundle-contest-tab:focus-visible {
    outline: 2px solid var(--emerald);
    outline-offset: 2px;
}
body[data-judge-page="evaluate"] .bundle-contest-tab.is-active,
body[data-judge-page="view"] .bundle-contest-tab.is-active {
    color: var(--forest);
    background: #EAF6EF;
    border-color: #0A4A38;
    box-shadow: none;
}
body[data-judge-page="evaluate"] .bundle-contest-tab.is-active::after,
body[data-judge-page="view"] .bundle-contest-tab.is-active::after {
    content: '';
    position: absolute;
    right: 9px;
    bottom: 0;
    left: 9px;
    height: 2px;
    border-radius: 2px 2px 0 0;
    background: linear-gradient(90deg, var(--gold) 0%, var(--gold-deep) 100%);
}
/* A fixed 28px square, so every icon in the row sits on the same left edge and
   the same centre line no matter which glyph it is. The base rule's two-span
   folder swap is gone with the markup that fed it. */
body[data-judge-page="evaluate"] .bundle-contest-tab-icon,
body[data-judge-page="view"] .bundle-contest-tab-icon {
    grid-area: icon;
    align-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    color: #0F6B5E;
    background: #EDF6F3;
    border: 1px solid #D5E9E3;
}
body[data-judge-page="evaluate"] .bundle-contest-tab.is-active .bundle-contest-tab-icon,
body[data-judge-page="view"] .bundle-contest-tab.is-active .bundle-contest-tab-icon {
    color: #fff;
    background: var(--forest);
    border-color: var(--forest);
}
body[data-judge-page="evaluate"] .bundle-contest-tab-title,
body[data-judge-page="view"] .bundle-contest-tab-title {
    grid-area: title;
    align-self: center;
    min-width: 0;
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.25;
    white-space: normal;
    /* Two lines, then an ellipsis.
     *
     * The base rule is white-space:nowrap with overflow/text-overflow, which can
     * only ever clip a single line: a long contest name was either cut mid-word
     * or, once it was allowed to wrap, grew the card and knocked the row out of
     * alignment. A clamp bounds the name instead of the card.
     *
     * overflow-wrap:anywhere is the other half - "Mr & Ms Animolympics" has no
     * space in "Animolympics" long enough to break at, and without it the word
     * pushes past the card's right edge rather than wrapping. */
    overflow-wrap: anywhere;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}
/* The category and the status, as one row with its ends pinned.
 *
 * The cards are equal-width now, so "ends pinned" means the same two positions on
 * every card - which is what the two separate grid areas could not do, because
 * each area's column was sized by its own contents and the two columns therefore
 * sat somewhere different on every card in the row. */
body[data-judge-page="evaluate"] .bundle-contest-tab-meta,
body[data-judge-page="view"] .bundle-contest-tab-meta {
    grid-area: meta;
    align-self: center;
    display: flex;
    align-items: center;
    /* space-between while both fit on one line; wrap when they do not.
     *
     * Without the wrap the status badge - flex:0 0 auto, so it never shrinks -
     * took whatever room was left and the category absorbed all of it. At 420px
     * wide that reduced "CHA-CHA" to "CHA…", which is worse than either word
     * being on its own line. Wrapping is bounded by the card, not by the
     * viewport, so a wider screen simply never takes the second line. */
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 3px 6px;
    min-width: 0;
}
body[data-judge-page="evaluate"] .bundle-contest-tab-cat,
body[data-judge-page="view"] .bundle-contest-tab-cat {
    min-width: 0;
    max-width: 100%;
    padding: 2px 7px;
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #0F6B5E;
    background: #EAF6F3;
    border: 1px solid #CFE7E1;
    border-radius: 999px;
}
/* A contest with no category of its own still needs something in the left-hand
   slot, or that card's status badge sits further right than every other card's.
   The placeholder is deliberately blank-looking: it is spacing, not information. */
body[data-judge-page="evaluate"] .bundle-contest-tab-cat.is-empty,
body[data-judge-page="view"] .bundle-contest-tab-cat.is-empty {
    color: #84968E;
    background: #F4F7F6;
    border-color: #E6EDEA;
}
body[data-judge-page="evaluate"] .bundle-contest-status,
body[data-judge-page="view"] .bundle-contest-status {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.2px;
    white-space: nowrap;
    color: #5E6F67;
    background: #F1F5F3;
    border: 1px solid #E3EBE7;
}
body[data-judge-page="evaluate"] .bundle-contest-status .lucide,
body[data-judge-page="view"] .bundle-contest-status .lucide { stroke-width: 2.6; }
body[data-judge-page="evaluate"] .bundle-contest-status.is-submitted,
body[data-judge-page="view"] .bundle-contest-status.is-submitted {
    color: #075C3D;
    background: #DDF5E8;
    border-color: #BFE6CE;
}

/* ---- The team (contestant) folders, the inner level ----
 * Same treatment as the contest cards above and for the same reasons, at one
 * step smaller. It is a different control bound to different panels, so it is
 * told apart by scale and by the folder glyph rather than by looking unrelated:
 * a judge who has read the outer row reads this one. */
body[data-judge-page="evaluate"] .sc-folder,
body[data-judge-page="view"] .view-contestant-nav .sc-folder {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    align-items: center;
    align-content: center;
    gap: 10px;
    width: auto;
    min-width: 0;
    max-width: none;
    min-height: 62px;
    padding: 10px 12px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #E1EAE5;
    border-radius: 10px;
    transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
}
/* The folder cards hover exactly as quietly as the contest cards above - same
   wash, same edge. A judge moving between the two rows should not feel a change
   of control halfway up the page. */
body[data-judge-page="evaluate"] .sc-folder:hover,
body[data-judge-page="view"] .view-contestant-nav .sc-folder:hover {
    background: #F4FAF6;
    border-color: #B7D4C6;
}
body[data-judge-page="evaluate"] .sc-folder:focus-visible,
body[data-judge-page="view"] .view-contestant-nav .sc-folder:focus-visible {
    outline: 2px solid var(--emerald);
    outline-offset: 2px;
}
body[data-judge-page="evaluate"] .sc-folder-icon,
body[data-judge-page="view"] .view-contestant-nav .sc-folder-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    color: #0F6B5E;
    background: #EDF6F3;
    border: 1px solid #D5E9E3;
}
body[data-judge-page="evaluate"] .sc-folder-text,
body[data-judge-page="view"] .view-contestant-nav .sc-folder-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
body[data-judge-page="evaluate"] .sc-folder-num,
body[data-judge-page="view"] .view-contestant-nav .sc-folder-num {
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.8px;
    line-height: 1.3;
    color: #0F6B5E;
}
body[data-judge-page="evaluate"] .sc-folder-name,
body[data-judge-page="view"] .view-contestant-nav .sc-folder-name {
    /* Two lines, for the same reason the contest title gets two: a roster of
     * real names is not going to fit on one, and the base rule's nowrap +
     * ellipsis turned every name past about eighteen characters into "Red T…". */
    min-width: 0;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
    white-space: normal;
    overflow-wrap: anywhere;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}
body[data-judge-page="evaluate"] .sc-folder.is-active,
body[data-judge-page="view"] .view-contestant-nav .sc-folder.is-active {
    background: #EAF6EF;
    border-color: #0A4A38;
    box-shadow: none;
}
body[data-judge-page="evaluate"] .sc-folder.is-active::after,
body[data-judge-page="view"] .view-contestant-nav .sc-folder.is-active::after {
    content: '';
    position: absolute;
    right: 9px;
    bottom: 0;
    left: 9px;
    height: 2px;
    border-radius: 2px 2px 0 0;
    background: linear-gradient(90deg, var(--gold) 0%, var(--gold-deep) 100%);
}
body[data-judge-page="evaluate"] .sc-folder.is-active .sc-folder-icon,
body[data-judge-page="view"] .view-contestant-nav .sc-folder.is-active .sc-folder-icon {
    color: #fff;
    background: var(--forest);
    border-color: var(--forest);
}
body[data-judge-page="evaluate"] .sc-folder.is-active .sc-folder-num,
body[data-judge-page="view"] .view-contestant-nav .sc-folder.is-active .sc-folder-num {
    color: #31574A;
}
body[data-judge-page="evaluate"] .sc-folder.is-active .sc-folder-name,
body[data-judge-page="view"] .view-contestant-nav .sc-folder.is-active .sc-folder-name {
    color: var(--forest);
}
/* ---- The scoring sheet's third column ----
 *
 * A folder card on the scoring sheet has one child the receipt's does not: the
 * tick that appears once that contestant is fully scored. The card above is a
 * two-column grid, so without a third column the tick files itself into row 2
 * under the icon - which reads as the number and the name having wrapped.
 *
 * margin-left:auto, the flex idiom this used, is gone with the flex layout: as a
 * grid item the tick is aligned to its own column's edge instead, and the column
 * is sized by the tick, so it sits hard against the card's right padding on
 * every card whether or not the contestant is finished. */
body[data-judge-page="evaluate"] .sc-folder {
    grid-template-columns: 30px minmax(0, 1fr) auto;
}
body[data-judge-page="evaluate"] .judge-contestant-check {
    justify-self: end;
    align-self: center;
}
@media (max-width: 640px) {
    body[data-judge-page="evaluate"] .bundle-contest-tabs,
    body[data-judge-page="view"] .bundle-contest-tabs {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
        gap: 7px;
    }
    body[data-judge-page="evaluate"] .bundle-contest-tab,
    body[data-judge-page="view"] .bundle-contest-tab {
        min-height: 62px;
        padding: 9px 10px;
        gap: 4px 8px;
    }
    body[data-judge-page="evaluate"] .bundle-contest-tab-cat,
    body[data-judge-page="view"] .bundle-contest-tab-cat,
    body[data-judge-page="evaluate"] .bundle-contest-status,
    body[data-judge-page="view"] .bundle-contest-status {
        font-size: 8.5px;
        padding: 2px 6px;
    }
    body[data-judge-page="view"] .view-contestant-nav {
        margin-right: 10px;
        margin-left: 10px;
    }
}