:root {
    --night: #121a24;
    --ink: #1b2430;
    --muted: #5b6a7a;
    --sheet: #eef3f7;
    --paper: #f7fafc;
    --line: #c3d0dc;
    --lane: #ff5a1f;
    --ok: #14685c;
    --bad: #b42318;
    --tick: #0e7c66;
    --safe: env(safe-area-inset-bottom, 0px);
    font-family: Geologica, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    background: var(--sheet);
    color: var(--ink);
    font-size: 17px;
    line-height: 1.45;
    font-weight: 420;
}
a { color: var(--ok); }
h1, h2, h3 { font-weight: 760; letter-spacing: -0.03em; line-height: 1.15; }
h1 { font-size: 1.7rem; margin: 0 0 0.6rem; }
h2 { font-size: 1.15rem; margin: 1.6rem 0 0.5rem; }
p { margin: 0 0 1rem; }
label { display: flex; flex-direction: column; gap: 0.35rem; font-weight: 520; }
input, select, button, textarea {
    font: inherit;
    font-size: 16px;
}
input, select {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    padding: 0.75rem 0.8rem;
    border-radius: 2px;
    width: 100%;
}
input:focus, select:focus, button:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--lane) 70%, white);
    outline-offset: 1px;
}

.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    background: var(--night);
    color: #f3f6f8;
}
.mark {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: inherit;
    text-decoration: none;
    font-weight: 640;
}
.mark span {
    width: 2rem;
    height: 2rem;
    display: grid;
    place-items: center;
    background: var(--lane);
    color: #fff;
    font-weight: 860;
}
.out { color: #d5dee6; text-decoration: none; font-weight: 520; }
.stage { width: min(920px, 100%); margin: 0 auto; padding: 1.1rem 1rem 5rem; }
.lead { color: var(--muted); margin-bottom: 0.2rem; }
.crumb { color: var(--muted); font-size: 0.92rem; }
.crumb a { color: inherit; }
.kicker { color: var(--lane); font-weight: 640; margin-bottom: 0.2rem; }

.menu { display: grid; gap: 0.7rem; margin-top: 1.2rem; }
.menu a {
    display: block;
    padding: 1rem 1rem 1rem 1.1rem;
    background: #fff;
    color: var(--ink);
    text-decoration: none;
    border-left: 6px solid var(--night);
}
.menu a small { display: block; color: var(--muted); font-weight: 420; margin-top: 0.2rem; }
.menu a span { font-weight: 760; font-size: 1.2rem; }
.menu-hot { border-left-color: var(--lane) !important; background: #fff7f3 !important; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0.7rem 1.1rem;
    border: 1px solid var(--ink);
    background: #fff;
    color: var(--ink);
    text-decoration: none;
    font-weight: 640;
    cursor: pointer;
    border-radius: 2px;
}
.btn-primary { background: var(--lane); border-color: var(--lane); color: #fff; }
.btn-ghost { border-color: var(--line); background: transparent; }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.8rem 0 1.2rem; }
.stack { display: grid; gap: 0.9rem; max-width: 520px; }
.card-form { background: #fff; padding: 1rem; }
.grid-2 { display: grid; gap: 0.8rem; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.toolbar-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    align-items: end;
    background: #fff;
    padding: 0.9rem;
    margin-bottom: 1rem;
}
.toolbar-form .grow { flex: 1 1 180px; }
.grow { flex: 1; }

.flash { padding: 0.8rem 0.9rem; margin: 0 0 1rem; }
.flash-ok { background: #e6f4f0; color: #0d4f44; }
.flash-err { background: #fdecec; color: var(--bad); }
.empty { background: #fff; padding: 1rem; color: var(--muted); }
.hint { color: var(--muted); font-size: 0.95rem; }

.plain-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.plain-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.7rem;
    background: #fff;
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid var(--sheet);
}
.table-wrap { overflow: auto; background: #fff; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: 0.65rem 0.7rem; border-bottom: 1px solid var(--sheet); }
table.data th { font-weight: 640; color: var(--muted); }

.mode-login {
    min-height: 100dvh;
    background: var(--night);
    color: #eef3f6;
    display: grid;
    place-items: center;
    padding: 1.2rem;
}
.gate { width: min(420px, 100%); }
.gate-card { background: #182230; padding: 1.4rem 1.2rem 1.6rem; border-top: 6px solid var(--lane); }
.gate-card h1 { color: #fff; }
.gate-card label { color: #c9d4de; }
.gate-card input { background: #101820; color: #fff; border-color: #314256; }
.code-reveal {
    font-size: 1.6rem;
    font-weight: 760;
    letter-spacing: 0.12em;
    background: #101820;
    padding: 0.8rem;
    text-align: center;
}

body.mode-attend .topbar { display: none; }
body.mode-attend .stage { width: 100%; padding: 0 0 6.5rem; }
.attend-form { display: flex; flex-direction: column; min-height: 100dvh; }
.attend-head {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--night);
    color: #f4f7fa;
    padding: 0.9rem 1rem 1rem;
}
.attend-head .crumb, .attend-head .crumb a { color: #b7c4d0; }
.attend-head h1 { font-size: 1.35rem; margin-bottom: 0.25rem; }
.attend-meta { margin: 0; color: #f0c2b0; font-weight: 520; }
.attend-form .hint { padding: 0.8rem 1rem 0.2rem; margin: 0; }
.roster { list-style: none; margin: 0; padding: 0.4rem 0 1rem; }
.roster-row {
    display: grid;
    grid-template-columns: 2rem 1fr 3.2rem;
    align-items: center;
    gap: 0.4rem;
    min-height: 64px;
    padding: 0.55rem 0.9rem;
    background: #fff;
    border-bottom: 1px solid #e3ebf2;
    flex-direction: row;
    font-weight: 420;
    touch-action: manipulation;
    user-select: none;
}
.roster-row:has(.tick:checked),
.roster-row.is-present { background: #e7f5f1; }
.num { color: var(--muted); font-weight: 640; }
.who { display: flex; flex-direction: column; }
.who strong { font-size: 1.12rem; }
.who small { color: var(--muted); }
.tick {
    width: 28px;
    height: 28px;
    accent-color: var(--tick);
    justify-self: end;
}
.attend-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    gap: 0.6rem;
    padding: 0.7rem 0.9rem calc(0.7rem + var(--safe));
    background: #fff;
    border-top: 1px solid var(--line);
    z-index: 3;
}
.attend-bar .btn { flex: 1; }

.report-pick { background: #fff; padding: 1rem; margin-bottom: 0.8rem; }
.report-pick h2 { margin-top: 0; }
.grid-report { border-collapse: collapse; min-width: 100%; }
.grid-report th, .grid-report td {
    border: 1px solid #d5dee6;
    padding: 0.4rem 0.45rem;
    text-align: center;
    white-space: nowrap;
}
.grid-report thead th {
    background: var(--night);
    color: #fff;
    font-weight: 520;
    min-width: 3.2rem;
}
.grid-report thead th span { display: block; font-size: 0.75rem; opacity: 0.8; }
.grid-report tbody th { text-align: left; background: #f4f7fa; font-weight: 640; position: sticky; left: 0; }
.grid-report .is-on { color: var(--tick); font-size: 1.1rem; }
.grid-report .is-off { color: transparent; }

.print-toolbar { padding: 0.8rem 1rem; display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.print-sheet { padding: 1rem; }
.print-club { font-weight: 760; margin-bottom: 0.2rem; }

@media print {
    .no-print, .topbar, .print-toolbar { display: none !important; }
    body { background: #fff; }
    .print-sheet { padding: 0; }
    .grid-report thead th { background: #222 !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    @page { size: landscape; margin: 12mm; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
