@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter:wght@300;400;600&display=swap');

/* ===========================================================
   AFTA — Kiosk, Vantablack
   Standalone stylesheet. No framework, no build step.
   Near-black base, glass layers, violet/cyan glow, serif display type.
   Dark is the native look; light is the same system inverted.
   Still a door tablet first: big targets, instant feedback.
   =========================================================== */

:root {
    color-scheme: light;

    --bg:          #F7F7FA;
    --surface:     rgba(255, 255, 255, 0.78);
    --surface-2:   #F1F1F6;
    --surface-3:   #E5E5EE;
    --glass:       rgba(255, 255, 255, 0.7);
    --text:        #0A0A0F;
    --muted:       #5B5B6B;
    --line:        rgba(10, 10, 20, 0.10);
    --line-strong: rgba(10, 10, 20, 0.20);

    /* Violet is the one action colour. #7C3AED takes white text at 5.7:1;
       the spec's #8B5CF6 is kept for glows only (white on it is 4.2:1). */
    --accent:      #7C3AED;
    --accent-ink:  #6D28D9;
    --on-accent:   #FFFFFF;
    --accent-soft: rgba(124, 58, 237, 0.12);
    --cyan:        #0E7490;
    --cyan-soft:   rgba(6, 182, 212, 0.14);

    --success:      #047857;
    --success-soft: rgba(16, 185, 129, 0.14);
    --danger:       #C0362C;
    --danger-soft:  rgba(192, 54, 44, 0.12);
    --on-strong:    #FFFFFF;

    --shadow-sm: 0 1px 2px rgba(20, 10, 40, 0.06);
    --shadow:    0 0 20px -10px rgba(139, 92, 246, 0.6), 0 8px 24px -8px rgba(20, 10, 40, 0.14);
    --shadow-lg: 0 0 40px -16px rgba(139, 92, 246, 0.6), 0 24px 64px -12px rgba(20, 10, 40, 0.3);
    --glow:      0 0 20px -6px rgba(139, 92, 246, 0.7);
    --backdrop:  rgba(10, 8, 20, 0.5);
    --orb-opacity: 0.28;
    --shimmer: linear-gradient(90deg, #7C3AED 0%, #0A0A0F 40%, #0A0A0F 60%, #0891B2 100%);

    --font:  'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;

    --r-sm: 10px;
    --r:    16px;
    --r-lg: 24px;
    --r-pill: 999px;

    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    --dur:  160ms;

    --sp-1: 0.25rem;
    --sp-2: 0.5rem;
    --sp-3: 1rem;
    --sp-4: 1.5rem;
    --sp-5: 2.5rem;
    --sp-6: 4rem;

    --topbar-h: 68px;
    --shell: 1600px;

    /* Legacy names still referenced from inline view styles. */
    --rule: var(--line);
    --rule-soft: var(--line);
    --warm-grey: var(--muted);
    --paper: var(--bg);
    --ink: var(--text);
    --gold: var(--accent);
}

/* Dark tokens: once for the system preference (unless light was chosen),
   once for an explicit choice. Generated from one source; keep identical. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg:          #030303;
        --surface:     rgba(14, 14, 16, 0.72);
        --surface-2:   #101012;
        --surface-3:   #1B1B1F;
        --glass:       rgba(10, 10, 10, 0.7);
        --text:        #F4F4F5;
        --muted:       #A1A1AA;
        --line:        rgba(255, 255, 255, 0.10);
        --line-strong: rgba(255, 255, 255, 0.20);
        --accent:      #7C3AED;
        --accent-ink:  #A78BFA;
        --accent-soft: rgba(139, 92, 246, 0.18);
        --cyan:        #22D3EE;
        --cyan-soft:   rgba(6, 182, 212, 0.16);
        --success:      #10B981;
        --success-soft: rgba(16, 185, 129, 0.15);
        --danger:       #F87171;
        --danger-soft:  rgba(248, 113, 113, 0.15);
        --on-strong:    #030303;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.6);
        --shadow:    0 0 20px -10px #8B5CF6, 0 8px 24px -8px rgba(0, 0, 0, 0.8);
        --shadow-lg: 0 0 40px -16px #8B5CF6, 0 24px 64px -12px rgba(0, 0, 0, 0.9);
        --glow:      0 0 20px -6px rgba(139, 92, 246, 0.9);
        --backdrop:  rgba(0, 0, 0, 0.7);
        --orb-opacity: 0.55;
        --shimmer: linear-gradient(90deg, #A78BFA 0%, #FFFFFF 40%, #FFFFFF 60%, #22D3EE 100%);
    }
    :root:not([data-theme="light"]) .theme-toggle .fa-moon { display: none; }
    :root:not([data-theme="light"]) .theme-toggle .fa-sun  { display: inline-block; }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg:          #030303;
    --surface:     rgba(14, 14, 16, 0.72);
    --surface-2:   #101012;
    --surface-3:   #1B1B1F;
    --glass:       rgba(10, 10, 10, 0.7);
    --text:        #F4F4F5;
    --muted:       #A1A1AA;
    --line:        rgba(255, 255, 255, 0.10);
    --line-strong: rgba(255, 255, 255, 0.20);
    --accent:      #7C3AED;
    --accent-ink:  #A78BFA;
    --accent-soft: rgba(139, 92, 246, 0.18);
    --cyan:        #22D3EE;
    --cyan-soft:   rgba(6, 182, 212, 0.16);
    --success:      #10B981;
    --success-soft: rgba(16, 185, 129, 0.15);
    --danger:       #F87171;
    --danger-soft:  rgba(248, 113, 113, 0.15);
    --on-strong:    #030303;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.6);
    --shadow:    0 0 20px -10px #8B5CF6, 0 8px 24px -8px rgba(0, 0, 0, 0.8);
    --shadow-lg: 0 0 40px -16px #8B5CF6, 0 24px 64px -12px rgba(0, 0, 0, 0.9);
    --glow:      0 0 20px -6px rgba(139, 92, 246, 0.9);
    --backdrop:  rgba(0, 0, 0, 0.7);
    --orb-opacity: 0.55;
    --shimmer: linear-gradient(90deg, #A78BFA 0%, #FFFFFF 40%, #FFFFFF 60%, #22D3EE 100%);
}
:root[data-theme="dark"] .theme-toggle .fa-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .fa-sun  { display: inline-block; }

/* ===========================
   Reset
   =========================== */

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

html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }

body {
    margin: 0;
    min-height: 100dvh;
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Tabular figures only where numbers line up: Inter's tnum also widens
   hyphens, which spaced out "Check-in" when it was set on body. */
.stat-value, .fact-value, .sync-pill, .result-count, .table td, .custom-table td, .page-link, .pager button {
    font-variant-numeric: tabular-nums;
}

/* Ambient orbs: two blurred glows drifting behind everything. Body's
   background paints on the canvas, so z-index -1 still sits above it. */
body::before,
body::after {
    content: "";
    position: fixed;
    z-index: -1;
    width: 46vmax;
    height: 46vmax;
    border-radius: 50%;
    filter: blur(100px);
    opacity: var(--orb-opacity);
    pointer-events: none;
    animation: orb-float 12s ease-in-out infinite alternate;
}

body::before { top: -18vmax; left: -12vmax; background: rgba(139, 92, 246, 0.4); }
body::after  { bottom: -20vmax; right: -14vmax; background: rgba(6, 182, 212, 0.4); animation-duration: 15s; animation-delay: -4s; }

@keyframes orb-float {
    to { transform: translateY(-20px) scale(1.05); }
}

img, svg { vertical-align: middle; }
.img-fluid { max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ===========================
   Typography
   =========================== */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--serif);
    font-weight: 400;
    color: var(--text);
    margin: 0 0 var(--sp-3);
    letter-spacing: -0.02em;
    line-height: 1.05;
    text-wrap: balance;
}

h1, .display-4 { font-size: clamp(2.5rem, 1.6rem + 3vw, 3.75rem); letter-spacing: -0.03em; }
h2 { font-size: clamp(1.875rem, 1.3rem + 1.8vw, 2.75rem); }
h3 { font-size: 1.875rem; }
h4, h5, h6 { font-size: 1.5rem; }

/* Violet → white → cyan sweep, for one headline per screen at most. */
.text-shimmer {
    background: var(--shimmer);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: shimmer 6s linear infinite;
}

@keyframes shimmer {
    to { background-position: -200% center; }
}

/* Staggered entrance for short lists (never the participant grid: at 100+
   cards a 0.2s stagger would take 20s to land). */
.stagger > * { animation: rise 600ms var(--ease) both; }
.stagger > :nth-child(2) { animation-delay: 0.2s; }
.stagger > :nth-child(3) { animation-delay: 0.4s; }
.stagger > :nth-child(4) { animation-delay: 0.6s; }
.stagger > :nth-child(n+5) { animation-delay: 0.8s; }

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

p { margin: 0 0 var(--sp-3); }

.eyebrow,
.micro,
.stat-label,
.fact-label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--muted);
}

.micro { letter-spacing: 0.12em; }

.eyebrow { display: inline-block; margin-bottom: var(--sp-1); }

.lede {
    font-size: 1.125rem;
    font-weight: 300;
    color: var(--muted);
    max-width: 36rem;
    text-wrap: pretty;
}

a {
    color: var(--accent-ink);
    text-decoration: none;
}

a:hover { text-decoration: underline; text-underline-offset: 3px; }

hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: var(--sp-4) 0;
}

:focus-visible {
    outline: 3px solid #8B5CF6;
    outline-offset: 2px;
}

/* ===========================
   Layout
   =========================== */

.container {
    width: 100%;
    max-width: var(--shell);
    margin-inline: auto;
    padding-inline: 1rem;
}

@media (min-width: 768px) {
    .container { padding-inline: 1.5rem; }
}

/* Nested containers (layout's main + a view's own .container) must not
   double the gutter. */
.container .container,
.kiosk-container .container { padding-inline: 0; }

.kiosk-container {
    max-width: var(--shell);
    margin-inline: auto;
    padding: var(--sp-4) 1rem var(--sp-6);
}

@media (min-width: 768px) {
    .kiosk-container { padding-inline: 1.5rem; }
}

main.container { padding-top: var(--sp-4); }

.row {
    display: flex;
    flex-wrap: wrap;
    margin-inline: calc(var(--sp-3) * -1);
}

.row > [class*="col-"] { padding-inline: var(--sp-3); width: 100%; }
.col-12 { width: 100%; }

@media (min-width: 768px) {
    .col-md-4 { width: 33.3333%; }
    .col-md-6 { width: 50%; }
}

/* ===========================
   Top bar (all layouts)
   =========================== */

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: var(--topbar-h);
    background: var(--glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
}

.topbar-inner {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    height: 100%;
    max-width: var(--shell);
    margin-inline: auto;
    padding-inline: 1rem;
}

@media (min-width: 768px) {
    .topbar-inner { padding-inline: 1.5rem; }
}

.topbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--serif);
    font-size: 1.5rem;
    letter-spacing: -0.02em;
    color: var(--text);
}

.topbar-brand:hover { text-decoration: none; color: var(--text); }

.brand-mark {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: linear-gradient(135deg, #8B5CF6, #06B6D4);
    color: #FFFFFF;
    font-family: var(--serif);
    font-size: 1.25rem;
    box-shadow: var(--glow);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    margin-left: auto;
}

.topbar .btn { min-height: 48px; }

.theme-toggle .fa-sun { display: none; }

/* ===========================
   Utilities (only what the views use)
   =========================== */

.d-flex   { display: flex !important; }
.d-grid   { display: grid !important; }
.d-inline { display: inline !important; }
.d-none   { display: none !important; }

.flex-column { flex-direction: column; }
.flex-wrap   { flex-wrap: wrap; }

.justify-content-center  { justify-content: center; }
.justify-content-between { justify-content: space-between; }
.align-items-center      { align-items: center; }

.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }

.ms-auto { margin-left: auto; }
.me-auto { margin-right: auto; }

.m-0  { margin: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: var(--sp-1) !important; }
.mb-2 { margin-bottom: var(--sp-2) !important; }
.mb-3 { margin-bottom: var(--sp-3) !important; }
.mb-4 { margin-bottom: var(--sp-4) !important; }
.mb-5 { margin-bottom: var(--sp-5) !important; }
.mt-1 { margin-top: var(--sp-1) !important; }
.mt-2 { margin-top: var(--sp-2) !important; }
.mt-3 { margin-top: var(--sp-3) !important; }
.mt-4 { margin-top: var(--sp-4) !important; }
.mt-5 { margin-top: var(--sp-5) !important; }
.my-4 { margin-block: var(--sp-4) !important; }
.me-1 { margin-right: var(--sp-1) !important; }
.ms-2 { margin-left: var(--sp-2) !important; }

.p-3  { padding: var(--sp-3) !important; }
.py-2 { padding-block: var(--sp-2) !important; }
.pb-5 { padding-bottom: var(--sp-6) !important; }

.w-100 { width: 100% !important; }

.border-bottom { border-bottom: 1px solid var(--line); }

.text-center   { text-align: center; }
.text-sm       { font-size: 0.875rem; }
.fw-bold       { font-weight: 600; }

.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger) !important; }
.text-muted   { color: var(--muted) !important; }

.shadow { box-shadow: var(--shadow); }

/* ===========================
   Buttons
   =========================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    min-height: 48px;
    padding: 0 1.25rem;
    border: 1px solid transparent;
    border-radius: 14px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
    user-select: none;
    transition: background-color var(--dur) var(--ease),
                border-color var(--dur) var(--ease),
                color var(--dur) var(--ease),
                transform var(--dur) var(--ease),
                box-shadow var(--dur) var(--ease);
}

.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--accent);
    color: var(--on-accent);
    box-shadow: 0 0 24px -8px #8B5CF6;
}

.btn-primary:hover { background: #6D28D9; color: var(--on-accent); box-shadow: 0 0 32px -6px #8B5CF6; }

.btn-secondary,
.btn-light,
.btn-info {
    background: var(--surface);
    border-color: var(--line-strong);
    color: var(--text);
}

.btn-secondary:hover,
.btn-light:hover,
.btn-info:hover { background: var(--surface-3); color: var(--text); }

.btn-outline-secondary,
.btn-outline-light,
.btn-outline-primary {
    background: transparent;
    border-color: var(--line-strong);
    color: var(--text);
}

.btn-outline-secondary:hover,
.btn-outline-light:hover,
.btn-outline-primary:hover { background: var(--surface-3); color: var(--text); }

.btn-success { background: var(--success); color: var(--on-strong); }
.btn-success:hover { background: color-mix(in srgb, var(--success) 85%, var(--text)); color: var(--on-strong); }

.btn-danger { background: var(--danger); color: var(--on-strong); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 85%, var(--text)); color: var(--on-strong); }

.btn-outline-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-outline-danger:hover { background: var(--danger-soft); }

.btn:disabled,
.btn.disabled { opacity: 0.55; pointer-events: none; box-shadow: none; }

.btn-sm    { min-height: 40px; padding: 0 0.9rem; font-size: 0.875rem; border-radius: 12px; }
.btn-lg    { min-height: 60px; padding: 0 2rem; font-size: 1.0625rem; border-radius: 18px; }
.btn-touch { min-height: 56px; }
.btn-icon  { padding: 0; width: 48px; flex: 0 0 auto; }

/* The × is drawn, not iconised. */
.btn-close {
    position: relative;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--muted);
    cursor: pointer;
    flex: 0 0 auto;
}

.btn-close::before,
.btn-close::after {
    content: "";
    position: absolute;
    inset: 50% auto auto 50%;
    width: 16px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
}

.btn-close::before { transform: translate(-50%, -50%) rotate(45deg); }
.btn-close::after  { transform: translate(-50%, -50%) rotate(-45deg); }
.btn-close:hover { color: var(--text); background: var(--surface-3); }

/* ===========================
   Badges
   =========================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    border-radius: var(--r-pill);
    background: var(--surface-3);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    color: var(--muted);
}

.bg-primary { background: var(--cyan-soft); color: var(--cyan); }
.bg-success { background: var(--success-soft); color: var(--success); }

/* Award recipients: the accent fill. */
.badge-award { background: var(--accent); color: var(--on-accent); box-shadow: 0 0 14px -6px #8B5CF6; }

/* Escort to holding room: red, so it can't be confused with the award chip. */
.badge-holding { background: var(--danger); color: var(--on-strong); }

/* ===========================
   Cards / panels
   =========================== */

.card,
.panel {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    color: var(--text);
}

.panel,
.tile {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.panel { padding: var(--sp-4); }

.card-body { padding: var(--sp-4); }

.card-header {
    padding: var(--sp-4) var(--sp-4) 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.card-title { font-family: var(--serif); font-size: 1.75rem; font-weight: 400; line-height: 1.05; margin-bottom: var(--sp-2); }

/* ===========================
   Forms
   =========================== */

.form-label,
label {
    display: inline-block;
    margin-bottom: var(--sp-2);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--muted);
}

.form-control,
.form-select {
    display: block;
    width: 100%;
    min-height: 52px;
    padding: 0.75rem 1rem;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 14px;
    color: var(--text);
    font-size: 1rem;
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

textarea.form-control { min-height: 120px; resize: vertical; }

.form-select {
    appearance: none;
    padding-right: 2.75rem;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 22px) calc(50% + 2px), calc(100% - 16px) calc(50% + 2px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

.form-control::placeholder { color: var(--muted); opacity: 1; }

.form-control:focus,
.form-select:focus {
    outline: none;
    background-color: var(--surface);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.form-control.is-invalid,
.form-select.is-invalid { border-color: var(--danger); }

.invalid-feedback {
    display: block;
    margin-top: var(--sp-2);
    font-size: 0.875rem;
    color: var(--danger);
}

.form-check {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    margin: 0;
    accent-color: var(--accent);
    flex: 0 0 auto;
    cursor: pointer;
}

.form-check-label { margin: 0; font-weight: 500; color: var(--text); cursor: pointer; }

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
    margin-top: var(--sp-4);
}

/* ===========================
   Tables
   =========================== */

.table-responsive,
.table-scroll {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
}

.table-scroll { max-height: 65vh; }

.table,
.custom-table {
    width: 100%;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    color: var(--text);
}

.table th, .table td,
.custom-table th, .custom-table td {
    padding: 0.9rem 1rem;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--line);
}

.table tbody tr:last-child td,
.custom-table tbody tr:last-child td { border-bottom: 0; }

.table thead th,
.custom-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-2);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
}

.table-hover tbody tr:hover td,
.custom-table tbody tr:hover td { background: var(--surface-2); }

/* ===========================
   Alerts
   =========================== */

.alert {
    padding: var(--sp-3) var(--sp-4);
    margin-bottom: var(--sp-4);
    border-radius: var(--r);
    background: var(--surface-2);
    border: 1px solid var(--line);
}

.alert ul { margin: var(--sp-2) 0 0; padding-left: 1.25rem; }
.alert-success { background: var(--success-soft); border-color: transparent; color: var(--success); font-weight: 600; }
.alert-danger  { background: var(--danger-soft);  border-color: transparent; color: var(--danger); }
.alert-info    { background: var(--accent-soft);  border-color: transparent; }

/* ===========================
   Modals — native <dialog>
   =========================== */

dialog.modal {
    width: min(40rem, calc(100vw - 2rem));
    max-height: calc(100dvh - 3rem);
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: var(--text);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

dialog.modal[open] { animation: modal-in 200ms var(--ease); }

@keyframes modal-in {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
}

dialog.modal::backdrop {
    background: var(--backdrop);
    backdrop-filter: blur(4px);
}

.modal-header,
.modal-footer {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-4);
}

.modal-header { justify-content: space-between; padding-bottom: 0; }

.modal-footer {
    justify-content: flex-end;
    background: transparent;
    border-top: 1px solid var(--line);
}

.modal-title { font-size: 1.75rem; margin: 0; }

.modal-body {
    padding: var(--sp-4);
    overflow-y: auto;
    max-height: 60dvh;
}

/* ===========================
   Toasts
   =========================== */

.toast-stack {
    position: fixed;
    right: var(--sp-4);
    bottom: var(--sp-4);
    z-index: 60;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.toast {
    min-width: 20rem;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 250ms var(--ease), transform 250ms var(--ease);
}

.toast.show { opacity: 1; transform: none; }

.toast-header {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 0.6rem 0.6rem 0 var(--sp-3);
    font-weight: 600;
}

.toast-body { padding: 0.25rem var(--sp-3) var(--sp-3); }

/* ===========================
   Pagination (Laravel links + attendees pager)
   =========================== */

.pagination,
.pager {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--sp-2);
    list-style: none;
    padding: 0;
    margin: var(--sp-4) 0;
}

.page-link,
.pager button {
    display: inline-grid;
    place-items: center;
    min-width: 48px;
    min-height: 48px;
    padding: 0 0.9rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
}

.page-link:hover,
.pager button:hover { background: var(--surface-3); text-decoration: none; }

.page-item.active .page-link,
.pager button[aria-current] { background: var(--text); border-color: var(--text); color: var(--bg); }

.page-item.disabled .page-link { opacity: 0.4; pointer-events: none; }

/* ===========================
   Page header (shared)
   =========================== */

.page-head,
.dash-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-end;
    gap: var(--sp-3);
    margin-bottom: var(--sp-4);
}

.page-head h1,
.page-head h3,
.dash-header h1 { margin: 0; }

.dash-header-actions { display: flex; gap: var(--sp-2); }

/* ===========================
   Welcome / login
   =========================== */

.welcome {
    display: grid;
    place-items: center;
    min-height: calc(100dvh - var(--topbar-h) - 3rem);
    text-align: center;
}

.welcome-inner { max-width: 40rem; }

.welcome .brand-mark {
    width: 88px;
    height: 88px;
    margin: 0 auto var(--sp-4);
    border-radius: 26px;
    font-size: 3rem;
    box-shadow: 0 0 60px -10px #8B5CF6;
    animation: bob 4s ease-in-out infinite;
}

@keyframes bob {
    50% { transform: translateY(-6px); }
}

.welcome h1 { font-size: clamp(3rem, 1.8rem + 4.5vw, 5.5rem); letter-spacing: -0.04em; }
.welcome .lede { margin: 0 auto var(--sp-5); }

.auth-shell {
    display: grid;
    place-items: center;
    min-height: calc(100dvh - var(--topbar-h) - 3rem);
}

.auth-shell .panel { width: min(28rem, 100%); padding: var(--sp-5) var(--sp-4); }
.auth-shell h1 { font-size: 2.75rem; margin-bottom: var(--sp-1); }

.form-panel { max-width: 44rem; }

/* ===========================
   Launcher tiles (event manage, dashboard)
   =========================== */

.launcher-head {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    margin-bottom: var(--sp-5);
}

.launcher-logo {
    width: 96px;
    height: 96px;
    object-fit: contain;
    padding: 0.5rem;
    border-radius: var(--r);
    background: var(--surface);
    border: 1px solid var(--line);
}

.launcher-head h1 { margin: 0 0 var(--sp-1); }
.launcher-head p { margin: 0; color: var(--muted); font-weight: 500; }

.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--sp-3);
}

.tile {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    min-height: 200px;
    padding: var(--sp-4);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-sm);
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.tile:hover { text-decoration: none; color: var(--text); border-color: rgba(139, 92, 246, 0.5); box-shadow: var(--shadow); }
.tile:hover .tile-arrow { animation: nudge 600ms var(--ease); }

@keyframes nudge {
    50% { transform: translateX(4px); }
}
.tile:active { transform: scale(0.98); }

.tile-icon {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    margin-bottom: auto;
    border-radius: 16px;
    background: var(--surface-3);
    font-size: 1.375rem;
}

.tile-title { font-family: var(--serif); font-size: 2rem; line-height: 1; letter-spacing: -0.02em; }
.tile-note  { color: var(--muted); font-size: 0.9375rem; }

.tile-arrow {
    position: absolute;
    top: var(--sp-4);
    right: var(--sp-4);
    color: var(--muted);
}

.tile-primary { background: linear-gradient(135deg, #7C3AED, #5B21B6 60%, #0E7490); border-color: transparent; color: var(--on-accent); box-shadow: 0 0 40px -14px #8B5CF6; }
.tile-primary:hover { color: var(--on-accent); }
.tile-primary .tile-icon { background: rgba(255, 255, 255, 0.16); }
.tile-primary .tile-note,
.tile-primary .tile-arrow { color: var(--on-accent); opacity: 0.75; }

/* ===========================
   Dashboard (events index)
   =========================== */

.event-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--sp-3);
}

.event-card { height: 100%; }
.event-card .card-body { display: flex; flex-direction: column; flex: 1; gap: var(--sp-1); }
.event-card .card-title { font-size: 2rem; letter-spacing: -0.02em; }
.event-card .micro i { width: 1.1em; }

.event-card-actions {
    display: flex;
    gap: var(--sp-2);
    margin-top: auto;
    padding-top: var(--sp-3);
}

.event-card-actions .btn-primary { flex: 1 1 auto; }

/* ===========================
   Empty state
   =========================== */

.empty-state {
    text-align: center;
    padding: var(--sp-6) var(--sp-3);
    color: var(--muted);
    background: var(--surface);
    border: 1px dashed var(--line-strong);
    border-radius: var(--r-lg);
}

.empty-state i {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin: 0 auto var(--sp-3);
    border-radius: 20px;
    background: var(--surface-3);
    font-size: 1.5rem;
    color: var(--text);
}

.empty-state .lede { margin: 0 auto var(--sp-4); }

/* ===========================================================
   Check-in desk — landscape tablet
   =========================================================== */

/* Sticky under the top bar; full-bleed background so cards don't show
   through its gutters as they scroll past. */
.checkin-bar {
    position: sticky;
    top: var(--topbar-h);
    z-index: 20;
    margin: calc(var(--sp-4) * -1) calc(50% - 50vw) var(--sp-3);
    padding: var(--sp-3) calc(50vw - 50%);
    background: var(--glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
}

body.kiosk { overflow-x: clip; }

.checkin-bar-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-3);
    margin-bottom: var(--sp-3);
}

.checkin-title-block { flex: 1 1 16rem; min-width: 0; }

.checkin-event-label {
    margin: 0;
    font-size: 2.25rem;
    letter-spacing: -0.02em;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.checkin-bar-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-2);
}

.checkin-actions { display: flex; align-items: center; gap: var(--sp-2); }

/* Inline, not flex: the script rewrites its innerHTML as text + <span>, and
   flex gaps would split "20" from "s". */
.sync-pill {
    display: inline-block;
    line-height: 34px;
    padding: 0 0.8rem;
    border-radius: var(--r-pill);
    background: var(--surface);
    border: 1px solid var(--line);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
}

.sync-pill::before {
    content: "";
    display: inline-block;
    margin-right: 0.45rem;
    vertical-align: 1px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
}

.sync-pill:not(.is-paused)::before { animation: pulse 2s ease-in-out infinite; }
.sync-pill.is-paused { color: var(--accent-ink); }

@keyframes pulse {
    50% { box-shadow: 0 0 0 4px var(--success-soft); }
}
.sync-pill.is-paused::before { background: var(--accent); }

/* --- Counters --- */

.stat-row { display: flex; gap: var(--sp-2); }

.stat {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 84px;
    min-height: 56px;
    padding: 0.4rem 0.9rem;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
}

.stat-value { font-size: 1.375rem; font-weight: 600; line-height: 1.1; }
.stat-label { font-size: 0.625rem; }

.stat-in { background: var(--success-soft); border-color: transparent; }
.stat-in .stat-value { color: var(--success); }

/* --- Search + filters --- */

.checkin-controls {
    position: relative;
    display: flex;
    gap: var(--sp-2);
}

.search-field { position: relative; flex: 1 1 auto; }

.checkin-bar .search-input {
    min-height: 60px;
    padding-left: 3.25rem;
    padding-right: 3.5rem;
    border-radius: 18px;
    background: var(--surface);
    font-size: 1.125rem;
}

.search-input::-webkit-search-cancel-button { display: none; }

.search-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}

.search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 12px;
    background: var(--surface-3);
    color: var(--text);
    cursor: pointer;
}

.filters { margin: 0; display: flex; }

.filters > summary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    cursor: pointer;
    min-height: 60px;
    padding: 0 1.25rem;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: var(--surface);
    font-weight: 600;
    white-space: nowrap;
    user-select: none;
}

.filters > summary::-webkit-details-marker { display: none; }
.filters[open] > summary { background: var(--text); border-color: var(--text); color: var(--bg); }

.filter-active-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
}

/* Overlays the grid instead of pushing it down. */
.filters-grid {
    position: absolute;
    top: calc(100% + 0.6rem);
    left: 0;
    right: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--sp-3);
    padding: var(--sp-4);
    background: var(--glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
}

.filters-reset { display: flex; align-items: flex-end; }

.result-count {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: var(--sp-3);
}

/* --- Participant grid --- */

.attendee-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: var(--sp-3);
}

/* .card is display:flex, which would beat the [hidden] UA rule. */
.attendee-card[hidden] { display: none !important; }

.attendee-card {
    position: relative;
    order: 0;
    gap: 0.75rem;
    padding: var(--sp-3);
    border-radius: 20px;
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.attendee-card:hover { border-color: var(--line-strong); }

/* Checked-in groups sink below everyone still waiting; ties keep DOM order. */
.attendee-card.is-complete { order: 1; background: var(--surface-2); box-shadow: none; }
.attendee-card.is-complete .attendee-name,
.attendee-card.is-complete .attendee-facts { opacity: 0.6; }

.attendee-card.is-partial { border-color: #8B5CF6; box-shadow: 0 0 0 1px #8B5CF6, 0 0 28px -10px #8B5CF6; }

.attendee-name {
    font-family: var(--serif);
    font-size: 1.75rem;
    font-weight: 400;
    line-height: 1.05;
    letter-spacing: -0.02em;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.1em;
}

.attendee-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    min-height: 1.6rem;
}

.attendee-facts {
    display: flex;
    gap: var(--sp-2);
}

.fact {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1 1 0;
    padding: 0.6rem 0.75rem;
    border-radius: 12px;
    background: var(--surface-2);
}

.attendee-card.is-complete .fact { background: var(--surface-3); }

.fact-label { font-size: 0.625rem; }
.fact-value { font-size: 1.375rem; font-weight: 600; line-height: 1.1; }
.fact-of { font-size: 0.8125rem; font-weight: 500; color: var(--muted); }

.attendee-actions {
    display: flex;
    gap: var(--sp-2);
    margin-top: auto;
}

.attendee-primary { flex: 1 1 auto; }
.attendee-history { flex: 0 0 56px; padding: 0; }

.attendee-card.is-complete .attendee-primary {
    opacity: 1;
    background: var(--success-soft);
    color: var(--success);
    box-shadow: none;
}

/* --- Confirm dialog: wide, never tall --- */

.modal-checkin { width: min(46rem, calc(100vw - 2rem)); }

.confirm-holding {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0 0 var(--sp-3);
    padding: 1rem var(--sp-3);
    border-radius: var(--r);
    background: var(--danger);
    color: var(--on-strong);
    font-size: 1.0625rem;
    font-weight: 600;
}

.checkin-confirm {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: var(--sp-4);
    align-items: center;
}

.confirm-badges { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.confirm-name {
    font-family: var(--serif);
    font-size: 3rem;
    font-weight: 400;
    letter-spacing: -0.03em;
    line-height: 1.05;
    margin: 0 0 var(--sp-2);
}

.confirm-remarks { margin: 0; color: var(--muted); }

.confirm-facts { display: flex; gap: var(--sp-2); }

.confirm-facts .fact { align-items: center; padding: var(--sp-3); border-radius: var(--r); }
.confirm-facts .fact-value { font-size: 2.5rem; white-space: nowrap; }

.confirm-actions .btn-light { flex: 0 0 9rem; }
.confirm-submit { flex: 1 1 auto; min-height: 64px; font-size: 1.125rem; }

/* --- Narrow screens --- */

@media (max-width: 899.98px) {
    .checkin-bar-controls { width: 100%; }
    .stat-row { flex: 1 1 auto; }
    .stat { flex: 1 1 0; min-width: 0; }
    .checkin-confirm { grid-template-columns: 1fr; }
    .btn-label { display: none; }
    .attendee-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
    .filters-grid { grid-template-columns: repeat(2, 1fr); }
    .launcher-head { flex-direction: column; align-items: flex-start; }
}

/* A hover state on a touch screen reads as a stuck button. */
@media (hover: none) {
    .tile:hover, .card:hover { box-shadow: var(--shadow-sm); }
}

/* ===========================
   Attendees list page
   =========================== */

.attendee-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-2);
}

.attendee-filters .form-control,
.attendee-filters .form-select {
    flex: 1 1 200px;
    min-width: 150px;
    background-color: var(--surface);
}

/* ===========================
   Motion preferences
   =========================== */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition-duration: 1ms !important;
    }
    .btn:active, .tile:active { transform: none; }
}

/* ===========================
   Error pages (404, 419)
   =========================== */

.error-code {
    margin: 0 0 var(--sp-2);
    font-family: var(--serif);
    font-size: clamp(6rem, 3rem + 10vw, 11rem);
    font-weight: 400;
    letter-spacing: -0.05em;
    line-height: 1;
}

/* Institution guests: inverted solid chip, distinct from award (violet),
   VIP (cyan) and holding (red). */
.badge-institution { background: var(--text); color: var(--bg); }
