/* ===========================================================================
   FCC Web Raffle - design system
   ---------------------------------------------------------------------------
   One stylesheet, three layers: tokens, primitives, then the few page-level
   pieces. Written mobile-first: the base rules are the phone layout and the
   media queries only add space as the screen grows.

   The three slot statuses have exactly one colour each, defined once here and
   reused by the grid, the legend, the stat figures, the bars and the chips -
   so "amber" always means reserved, on every page.
   ======================================================================== */

:root {
    /* Neutrals carry a slight blue cast, so they sit with the brand rather
       than looking like unstyled grey. */
    --ink: #10141f;
    --ink-2: #3d465c;
    --ink-3: #6b7489;
    --line: #e3e6ee;
    --line-strong: #cdd2e0;
    --surface: #ffffff;
    --surface-2: #f7f8fc;
    --ground: #eef0f6;

    --brand: #1f4fd8;
    --brand-ink: #173ca6;
    --brand-soft: #e8edfd;

    --available: #0f7d55;
    --available-soft: #e4f4ed;
    --reserved: #9a6400;
    --reserved-soft: #fbf0d9;
    --paid: #1f4fd8;
    --paid-soft: #e8edfd;
    --danger: #b02a24;
    --danger-soft: #fbeae9;

    --space-1: .25rem; --space-2: .5rem; --space-3: .75rem;
    --space-4: 1rem;   --space-5: 1.5rem; --space-6: 2rem; --space-7: 3rem;

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;

    --shadow-sm: 0 1px 2px rgba(16, 20, 31, .06);
    --shadow: 0 1px 3px rgba(16, 20, 31, .08), 0 8px 24px -12px rgba(16, 20, 31, .18);
    --shadow-lg: 0 24px 60px -24px rgba(16, 20, 31, .35);

    --font-body: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-display: "Fraunces", Georgia, serif;

    --header-height: 60px;

    /* Tells the browser which palette its own widgets (scrollbars, date
       pickers, form controls) should use. Kept in step with the tokens
       below, so a date field doesn't stay white on a dark page. */
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --ink: #eef1f8;
        --ink-2: #b7bed0;
        --ink-3: #868fa6;
        --line: #272d3d;
        --line-strong: #39415a;
        --surface: #161b28;
        --surface-2: #1c2231;
        --ground: #0e121c;

        --brand: #7d9cff;
        --brand-ink: #a9bdff;
        --brand-soft: #1b2440;

        --available: #4cc08d;
        --available-soft: #112e24;
        --reserved: #e0a63f;
        --reserved-soft: #32270f;
        --paid: #7d9cff;
        --paid-soft: #1b2440;
        --danger: #f08279;
        --danger-soft: #35191a;

        --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
        --shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 8px 24px -12px rgba(0, 0, 0, .6);
        --shadow-lg: 0 24px 60px -24px rgba(0, 0, 0, .8);
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --ink: #eef1f8; --ink-2: #b7bed0; --ink-3: #868fa6;
    --line: #272d3d; --line-strong: #39415a;
    --surface: #161b28; --surface-2: #1c2231; --ground: #0e121c;
    --brand: #7d9cff; --brand-ink: #a9bdff; --brand-soft: #1b2440;
    --available: #4cc08d; --available-soft: #112e24;
    --reserved: #e0a63f; --reserved-soft: #32270f;
    --paid: #7d9cff; --paid-soft: #1b2440;
    --danger: #f08279; --danger-soft: #35191a;
}

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

/* An element with [hidden] is hidden, whatever a class says about display. */
[hidden] { display: none !important; }

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

body {
    margin: 0;
    background: var(--ground);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; text-wrap: balance; margin: 0 0 var(--space-2); letter-spacing: -.01em; }
h1 { font-size: clamp(1.5rem, 1.15rem + 1.8vw, 2.25rem); }
h2 { font-size: clamp(1.1rem, 1rem + .5vw, 1.3rem); }
h3 { font-size: 1rem; }
p { margin: 0 0 var(--space-2); }
a { color: var(--brand); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: var(--radius-sm); }

.muted { color: var(--ink-3); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.inline { display: inline; }
.centered { text-align: center; }
.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;
}

/* --- app chrome ---------------------------------------------------------- */
.site-header {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
    min-height: var(--header-height);
    padding: var(--space-2) var(--space-4);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: var(--space-2); font-weight: 700; text-decoration: none; color: var(--ink); font-size: 1rem; }
.brand-mark {
    display: grid; place-items: center; width: 30px; height: 30px; flex: none;
    border-radius: 9px; background: var(--brand); color: #fff; font-size: .95rem;
    box-shadow: var(--shadow-sm);
}
.brand-text { font-family: var(--font-display); letter-spacing: -.02em; }
.site-nav { display: flex; align-items: center; gap: var(--space-1); flex-wrap: nowrap; }
.site-nav a, .site-nav .link-button {
    padding: .4rem .6rem; border-radius: var(--radius-sm); white-space: nowrap;
    color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: .92rem;
    background: none; border: 0; font-family: inherit; cursor: pointer;
}
.site-nav a:hover, .site-nav .link-button:hover { background: var(--surface-2); color: var(--ink); }
.site-nav a.active { background: var(--brand-soft); color: var(--brand-ink); }
@media (max-width: 520px) {
    .brand-text { display: none; }
    .site-header { padding-inline: var(--space-3); gap: var(--space-2); }
    .site-nav { gap: 2px; }
    .site-nav a, .site-nav .link-button { padding: .4rem .35rem; font-size: .85rem; }
}

.page { max-width: 1180px; margin: 0 auto; padding: var(--space-4) var(--space-4) var(--space-7); }
@media (min-width: 768px) { .page { padding: var(--space-6) var(--space-5) var(--space-7); } }

.site-footer {
    padding: var(--space-5) var(--space-4);
    text-align: center; color: var(--ink-3); font-size: .85rem;
    border-top: 1px solid var(--line);
}

.theme-toggle {
    display: grid; place-items: center;
    width: 36px; height: 36px; flex: none; margin-left: var(--space-1);
    padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--ink-2); cursor: pointer;
}
.theme-toggle:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line-strong); }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
/* The chosen theme reads at a glance, rather than every state looking the same. */
.theme-toggle[data-theme="light"] { color: var(--reserved); border-color: color-mix(in srgb, var(--reserved) 40%, var(--line)); }
.theme-toggle[data-theme="dark"] { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }

/* --- page header --------------------------------------------------------- */
.page-head {
    display: flex; flex-direction: column; gap: var(--space-3);
    margin-bottom: var(--space-5);
}
.page-head-main { min-width: 0; }
.page-head .lede { color: var(--ink-3); margin: 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
@media (min-width: 768px) {
    .page-head { flex-direction: row; align-items: flex-start; justify-content: space-between; }
    .page-actions { justify-content: flex-end; }
}
.back { display: inline-flex; align-items: center; gap: .3rem; margin-bottom: var(--space-1); font-size: .88rem; text-decoration: none; color: var(--ink-3); }
.back:hover { color: var(--brand); }

/* --- surfaces ------------------------------------------------------------ */
.panel {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
    padding: var(--space-4); margin-bottom: var(--space-4);
}
@media (min-width: 768px) { .panel { padding: var(--space-5); } }
.panel-head {
    display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4);
    align-items: baseline; justify-content: space-between; margin-bottom: var(--space-3);
}
.panel-head h2 { margin: 0; }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.narrow { max-width: 460px; margin-inline: auto; }
.wide-form { max-width: 820px; margin-inline: auto; }

/* --- buttons ------------------------------------------------------------- */
.button {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    min-height: 42px; padding: .5rem .9rem;
    border: 1px solid var(--line-strong); border-radius: var(--radius);
    background: var(--surface); color: var(--ink);
    font: 500 .95rem/1.2 var(--font-body); text-decoration: none; cursor: pointer;
    transition: background-color .14s ease, border-color .14s ease, transform .14s ease;
}
.button:hover { background: var(--surface-2); border-color: var(--ink-3); }
.button:active { transform: translateY(1px); }
.button.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.button.primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); }
.button.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.button.ghost:hover { background: var(--surface-2); color: var(--ink); }
.button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.button.tiny { min-height: 34px; padding: .25rem .55rem; font-size: .85rem; }
.button[disabled], .button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.button.block { width: 100%; }
@media (max-width: 560px) { .page-actions .button { flex: 1 1 auto; } }

/* --- banners and chips --------------------------------------------------- */
.banner {
    display: flex; gap: var(--space-2);
    padding: var(--space-3); margin-bottom: var(--space-4);
    border: 1px solid; border-left-width: 4px; border-radius: var(--radius);
    font-size: .94rem;
}
.banner.ok { background: var(--available-soft); border-color: var(--available); }
.banner.bad { background: var(--danger-soft); border-color: var(--danger); }
.banner.info { background: var(--brand-soft); border-color: var(--brand); }

.chip {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .15rem .55rem; border-radius: 99px;
    font-size: .76rem; font-weight: 600; letter-spacing: .01em; text-transform: capitalize;
    border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink-2);
}
.chip::before { content: ""; width: .45rem; height: .45rem; border-radius: 99px; background: currentColor; }
.chip.is-open, .chip.is-available { background: var(--available-soft); border-color: transparent; color: var(--available); }
.chip.is-closed, .chip.is-reserved { background: var(--reserved-soft); border-color: transparent; color: var(--reserved); }
.chip.is-drawn, .chip.is-paid { background: var(--paid-soft); border-color: transparent; color: var(--paid); }
.chip.is-draft { color: var(--ink-3); }
/* Inside a flex column (a card, a page header) a chip would otherwise
   stretch the full width and read as a banner rather than a label. */
.card-link > .chip, .page-head .chip { align-self: flex-start; }

/* --- cards --------------------------------------------------------------- */
.card-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-4); grid-template-columns: 1fr; }
@media (min-width: 600px) { .card-grid { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); } }
.card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
    transition: box-shadow .16s ease, transform .16s ease, border-color .16s ease;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--line-strong); }
.card-link { display: flex; flex-direction: column; gap: var(--space-2); height: 100%; padding: var(--space-4); text-decoration: none; color: inherit; }
.card-link h2 { margin: 0; font-size: 1.15rem; }
.card .prize { color: var(--ink-2); margin: 0; font-size: .94rem; }

.facts { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-5); margin: 0; }
.facts > div { min-width: 0; }
.facts dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 600; }
.facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.facts.wide { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-4); margin-bottom: var(--space-4); }

.bar { display: flex; height: 6px; border-radius: 99px; overflow: hidden; background: var(--line); }
.bar-part { display: block; min-width: 0; }
.bar-part.is-available { background: var(--available); }
.bar-part.is-reserved { background: var(--reserved); }
.bar-part.is-paid { background: var(--paid); }

.card-body { display: flex; flex-direction: column; gap: var(--space-2); height: 100%; padding: var(--space-4); }
.card-body > .chip { align-self: flex-start; }
.card-title-link { color: inherit; text-decoration: none; }
.card-title-link:hover { color: var(--brand); text-decoration: underline; }
/* The actions sit at the bottom of every card, so a row of cards with
   different amounts of text still lines its buttons up. */
.card-actions { display: flex; flex-direction: column; gap: var(--space-2); margin-top: auto; padding-top: var(--space-2); }
.button.block { width: 100%; }
.counts { font-size: .9rem; color: var(--ink-3); margin: 0; }

.past-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.past-list li { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--line); }
.past-list li:last-child { border-bottom: 0; }
.past-list a { display: flex; flex-direction: column; text-decoration: none; color: inherit; min-width: 0; }
.past-list a:hover .past-title { color: var(--brand); }
.past-title { font-weight: 600; }
.past-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Open raffles as a list: one row each, figures aligned down the page. */
.raffle-list { list-style: none; margin: 0 0 var(--space-4); padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.raffle-row {
    display: flex; flex-direction: column; gap: var(--space-3);
    padding: var(--space-4); background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.raffle-row:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.raffle-main { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.raffle-title { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; color: inherit; text-decoration: none; }
.raffle-title:hover { color: var(--brand); text-decoration: underline; }
.raffle-facts { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); margin: 0; }
.raffle-facts dt { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 600; }
.raffle-facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.raffle-actions { display: flex; }
.raffle-actions .button { width: 100%; }
@media (min-width: 820px) {
    .raffle-row { flex-direction: row; align-items: center; gap: var(--space-5); }
    .raffle-main { flex: 1 1 auto; }
    .raffle-facts { flex: 0 0 auto; }
    .raffle-actions { flex: 0 0 auto; }
    .raffle-actions .button { width: auto; min-width: 160px; }
}

/* Bulk actions on the admin slot grid. Sticky so they stay reachable while
   scrolling a 1000-slot raffle. */
.select-tools { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-3); }
.action-bar {
    position: sticky; bottom: var(--space-3); z-index: 15;
    display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; justify-content: space-between;
    margin-bottom: var(--space-4); padding: var(--space-3) var(--space-4);
    background: var(--surface); border: 1px solid var(--brand);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.action-count { min-width: 0; }
.action-buttons { display: flex; gap: var(--space-2); flex: 1 1 auto; justify-content: flex-end; }
@media (max-width: 560px) { .action-buttons { flex-wrap: wrap; } .action-buttons .button { flex: 1 1 auto; } }

.holder-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.holder-list li {
    display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap;
    padding: var(--space-2) 0; border-bottom: 1px solid var(--line);
}
.holder-list li:last-child { border-bottom: 0; }
.holder-name { font-weight: 600; }
.holder-contact { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- stats --------------------------------------------------------------- */
.stat-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); margin-bottom: var(--space-4); }
@media (min-width: 560px) { .stat-row { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); } }
.stat { padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.stat-value { display: block; font-size: 1.55rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: .78rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.is-available-text { color: var(--available); }
.is-reserved-text { color: var(--reserved); }
.is-paid-text { color: var(--paid); }

/* --- legend -------------------------------------------------------------- */
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); margin: 0; padding: 0; font-size: .85rem; color: var(--ink-2); }
.legend li { display: flex; align-items: center; gap: .4rem; }
.swatch { width: .85rem; height: .85rem; border-radius: 4px; border: 1px solid; }
.swatch.is-available { background: var(--available-soft); border-color: var(--available); }
.swatch.is-reserved { background: var(--reserved-soft); border-color: var(--reserved); }
.swatch.is-paid { background: var(--paid-soft); border-color: var(--paid); }

/* --- slot grid ----------------------------------------------------------- */
/* content-visibility keeps a 1000-slot grid cheap: the browser skips layout
   and paint for rows that are nowhere near the viewport. */
.slot-grid {
    list-style: none; margin: 0; padding: 0;
    display: grid; gap: var(--space-2);
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    content-visibility: auto;
    contain-intrinsic-size: auto 600px;
}
@media (min-width: 768px) { .slot-grid { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); } }

.slot-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.slot {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 1px; min-height: 58px; padding: var(--space-2) var(--space-1);
    border: 1px solid var(--available); border-radius: var(--radius);
    background: var(--available-soft); color: var(--ink);
    text-align: center; transition: transform .12s ease, box-shadow .12s ease;
}
@media (min-width: 768px) { .slot { min-height: 64px; } }
label.slot { cursor: pointer; -webkit-tap-highlight-color: transparent; }
label.slot:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.slot-number { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 1rem; }
.slot-holder { font-size: .68rem; color: var(--ink-3); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot.is-reserved { background: var(--reserved-soft); border-color: var(--reserved); }
.slot.is-paid { background: var(--paid-soft); border-color: var(--paid); }
.slot-input:disabled + .slot { cursor: not-allowed; }
.slot-input:checked + .slot { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: var(--shadow); }
.slot-input:checked + .slot .slot-holder { color: rgba(255, 255, 255, .85); }
.slot-input:checked + .slot .slot-number::after { content: " ✓"; font-size: .8em; }
.slot-input:focus-visible + .slot { outline: 2px solid var(--brand); outline-offset: 2px; }

.draw-grid .slot.excluded { opacity: .3; filter: grayscale(.7); }
.draw-grid .slot.winner { background: var(--brand); border-color: var(--brand); color: #fff; animation: pop .6s ease; }
/* Already won an earlier prize: still readable, clearly out of the running. */
.draw-grid .slot.won { opacity: 1; filter: none; border-color: var(--brand); border-style: dashed; }
.draw-grid .slot.won .slot-number::after { content: " 🏆"; font-size: .75em; }
.draw-grid .slot.winner.won { border-style: solid; }
.draw-grid .slot.winner .slot-holder { color: rgba(255, 255, 255, .9); }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.2); } 100% { transform: scale(1); } }

/* --- forms --------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: var(--space-1); }
.field > span, .field legend { font-weight: 600; font-size: .88rem; }
.field input, .field textarea, .field select {
    width: 100%; min-height: 44px; padding: .55rem .7rem;
    font: inherit; color: var(--ink);
    background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius);
}
.field textarea { min-height: 88px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
.field small { color: var(--ink-3); font-size: .8rem; }
.field-row { display: grid; gap: var(--space-4); grid-template-columns: 1fr; }
@media (min-width: 640px) { .field-row { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); } }
fieldset.field { border: 0; padding: 0; margin: 0; }
.form-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
@media (max-width: 480px) { .form-actions .button { flex: 1 1 100%; } }
.selected-line { font-weight: 500; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-2) var(--space-3); }

.style-choices, .style-previews { list-style: none; margin: var(--space-2) 0 0; padding: 0; display: grid; gap: var(--space-3); grid-template-columns: 1fr; }
@media (min-width: 520px) { .style-choices, .style-previews { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); } }
.style-choices input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.style-choices label { display: block; padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; background: var(--surface); }
.style-choices label strong { display: block; margin-top: var(--space-2); }
.style-choices label small { color: var(--ink-3); }
.style-choices input:checked + label { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.style-choices input:focus-visible + label { outline: 2px solid var(--brand); outline-offset: 2px; }
.style-preview { display: block; height: 68px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; position: relative; }

/* --- results, row actions, split layouts (admin) ------------------------ */
.split { display: grid; gap: var(--space-4); grid-template-columns: 1fr; align-items: start; }
/* Grid and flex children size to their content by default, which lets a wide
   table stretch its panel past the screen; this keeps the scrolling inside
   the table's own box where it belongs. */
.split > * { min-width: 0; }
@media (min-width: 900px) { .split { grid-template-columns: 1.6fr 1fr; } }

.result-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.result-row {
    display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3);
    align-items: center; justify-content: space-between;
    padding: var(--space-3); border: 1px solid var(--line);
    border-left: 3px solid var(--paid); border-radius: var(--radius); background: var(--surface-2);
}
.result-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.result-prize { font-weight: 600; display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.result-row.is-forfeited { border-left-color: var(--reserved); opacity: .85; }
.result-row.is-forfeited .result-prize { text-decoration: line-through; text-decoration-color: var(--ink-3); }

/* A disclosure keeps destructive forms out of the way until wanted, without
   a modal and without a second page. */
.row-actions { position: relative; }
.row-actions > summary { list-style: none; cursor: pointer; }
.row-actions > summary::-webkit-details-marker { display: none; }
.row-actions[open] > summary { background: var(--surface-2); color: var(--ink); }
.row-actions-body {
    display: flex; flex-direction: column; gap: var(--space-3);
    margin-top: var(--space-2); padding: var(--space-3);
    border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
    box-shadow: var(--shadow-sm); min-width: min(280px, 80vw);
}
@media (min-width: 900px) {
    .row-actions[open] > .row-actions-body { position: absolute; right: 0; z-index: 5; box-shadow: var(--shadow); }
}
.stack-tight { display: flex; flex-direction: column; gap: var(--space-2); padding-bottom: var(--space-3); border-bottom: 1px solid var(--line); }
.stack-tight:last-of-type { border-bottom: 0; padding-bottom: 0; }
.check { display: flex; align-items: center; gap: var(--space-2); font-size: .9rem; }
.check input { width: 18px; height: 18px; min-height: 0; accent-color: var(--brand); }
.actions-col { width: 1%; }
.who { display: none; padding-left: var(--space-2); border-left: 1px solid var(--line); }
@media (min-width: 900px) { .who { display: inline; } }

.forfeit-heading { margin: var(--space-4) 0 var(--space-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-family: var(--font-body); font-weight: 700; }
.forfeited-list li { border-left-color: var(--reserved); opacity: .85; }
.forfeited-list .winner-prize { text-decoration: line-through; text-decoration-color: var(--ink-3); }

.side-stack { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.side-stack > .panel { margin-bottom: 0; }
.code-block {
    margin: 0 0 var(--space-2); padding: var(--space-2) var(--space-3);
    background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
    font-size: .82rem; overflow-x: auto; white-space: pre; color: var(--ink-2);
}

/* Rows that behave: columns on a wide screen, a stacked card on a phone.
   Used by the raffle manager and the admin list, which were tables with far
   too many columns for 390px. */
.manager-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.manager-row {
    display: flex; flex-direction: column; gap: var(--space-3);
    padding: var(--space-4); background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.manager-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.manager-title { font-weight: 600; font-size: 1.02rem; color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
a.manager-title:hover { color: var(--brand); text-decoration: underline; }
.manager-counts { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-2); margin: 0; }
.manager-counts dt { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 600; }
.manager-counts dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.manager-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
@media (min-width: 860px) {
    .manager-row { flex-direction: row; align-items: center; gap: var(--space-4); }
    .manager-main { flex: 1 1 auto; }
    .manager-counts { flex: 0 0 auto; width: 280px; }
    .manager-actions { flex: 0 0 auto; justify-content: flex-end; }
}

/* The slot number as a badge, coloured by status, so a row is identifiable
   at a glance without reading the chip. */
.slot-badge {
    display: inline-grid; place-items: center; min-width: 2.1rem; height: 1.8rem; padding: 0 .4rem;
    border-radius: var(--radius-sm); font-variant-numeric: tabular-nums; font-weight: 700;
    border: 1px solid var(--available); background: var(--available-soft); color: var(--available);
}
.slot-badge.is-reserved { border-color: var(--reserved); background: var(--reserved-soft); color: var(--reserved); }
.slot-badge.is-paid { border-color: var(--paid); background: var(--paid-soft); color: var(--paid); }
.slot-row .manager-main { gap: 1px; }

/* Filter bar: status tabs with counts, plus a search box. */
.filter-bar {
    display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; justify-content: space-between;
    margin-bottom: var(--space-4);
}
.filter-tabs { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.filter-tab {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .4rem .7rem; border-radius: 99px;
    border: 1px solid var(--line); background: var(--surface);
    color: var(--ink-2); text-decoration: none; font-size: .9rem; font-weight: 500;
    text-transform: capitalize;
}
.filter-tab:hover { border-color: var(--line-strong); color: var(--ink); }
.filter-tab.is-current { background: var(--brand); border-color: var(--brand); color: #fff; }
.filter-count {
    font-size: .78rem; font-variant-numeric: tabular-nums; font-weight: 700;
    padding: 0 .35rem; border-radius: 99px; background: var(--surface-2); color: var(--ink-3);
}
.filter-tab.is-current .filter-count { background: rgba(255, 255, 255, .22); color: #fff; }
.filter-search { display: flex; gap: var(--space-2); align-items: center; flex: 1 1 240px; justify-content: flex-end; }
.filter-search input {
    flex: 0 1 260px; min-height: 40px; padding: .4rem .7rem;
    border: 1px solid var(--line-strong); border-radius: var(--radius);
    background: var(--surface); color: var(--ink); font: inherit;
}
.filter-search input:focus { outline: 2px solid var(--brand); border-color: var(--brand); }
@media (max-width: 640px) {
    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-search { justify-content: stretch; }
    .filter-search input { flex: 1 1 auto; }
}

/* --- tables -------------------------------------------------------------- */
/* Wide tables scroll inside their own box. No negative-margin "bleed": inside
   a padded panel that pushes the panel itself past the screen edge. */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; min-width: 0; max-width: 100%; }
.table-wrap .table { min-width: 460px; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: left; padding: var(--space-3) var(--space-2); border-bottom: 1px solid var(--line); vertical-align: top; }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 700; background: var(--surface-2); position: sticky; top: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { display: flex; gap: var(--space-1); flex-wrap: wrap; }

/* --- lists --------------------------------------------------------------- */
.prize-list, .winner-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.prize-list li { display: flex; align-items: center; gap: var(--space-2); }
.prize-pos { display: grid; place-items: center; width: 1.6rem; height: 1.6rem; flex: none; border-radius: 99px; background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; font-size: .78rem; }
.winner-list li {
    display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); align-items: baseline;
    padding: var(--space-3); border: 1px solid var(--line); border-left: 4px solid var(--paid);
    border-radius: var(--radius); background: var(--surface-2);
}
.winner-prize { font-weight: 600; }
.winner-slot { font-variant-numeric: tabular-nums; color: var(--paid); font-weight: 700; }
.winner-name { color: var(--ink-2); }
.winner-action { margin-left: auto; }

.empty {
    text-align: center; padding: var(--space-7) var(--space-4);
    background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius-lg);
}
.empty h1 { font-size: clamp(2.5rem, 2rem + 4vw, 4rem); margin-bottom: var(--space-2); }
.empty .button { margin-top: var(--space-3); }

/* --- draw page ----------------------------------------------------------- */
.draw-counters { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
@media (min-width: 768px) { .draw-counters { display: flex; gap: var(--space-5); } }
.counter { padding: var(--space-2) var(--space-3); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
@media (min-width: 768px) { .counter { text-align: right; border: 0; background: none; padding: 0; } }
.counter-value { display: block; font-size: 1.35rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.counter-label { font-size: .74rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }

.stage-panel { text-align: center; background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%); }
.draw-stage { min-height: 230px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-3); margin-bottom: var(--space-4); }
@media (min-width: 768px) { .draw-stage { min-height: 300px; } }
.stage-idle { color: var(--ink-3); font-size: 1rem; }
.draw-controls { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); }
.draw-controls .button { min-width: min(100%, 280px); }
.stage-result { font-family: var(--font-display); animation: rise .4s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.stage-result .big { font-size: clamp(3rem, 1.5rem + 11vw, 6rem); font-weight: 700; line-height: 1; color: var(--brand); font-variant-numeric: tabular-nums; margin: var(--space-2) 0; }
.stage-result .who { font-size: clamp(1.05rem, .9rem + .8vw, 1.4rem); }

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

@media print {
    .site-header, .site-footer, .page-actions, .draw-controls, .button { display: none !important; }
    body { background: #fff; }
    .panel { break-inside: avoid; box-shadow: none; }
}
