:root {
    --ink: #0b0f14;
    --paper: #f7fafc;
    --mist: #9aa3ae;
    --lime: #39ff6b;
    --green: #00c76a;
    --line: rgba(247, 250, 252, 0.1);
    --sans: "Schibsted Grotesk", "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.5;
    font-weight: 500;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
h1, h2, h3 {
    font-weight: 700;
    letter-spacing: -0.045em;
    line-height: 1.05;
    text-wrap: balance;
}
h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.75rem, 3vw, 2.5rem); }

body.public {
    background: var(--ink);
    color: var(--paper);
    min-height: 100vh;
    padding-bottom: env(safe-area-inset-bottom);
}
body.admin {
    background: var(--paper);
    color: var(--ink);
    min-height: 100vh;
}

.wrap { width: min(880px, calc(100% - 40px)); margin: 0 auto; }
.narrow { width: min(560px, 100%); padding: 8px 0 72px; }

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    padding-top: env(safe-area-inset-top);
}
.brand img { height: 34px; width: auto; }
.nav-end { display: flex; align-items: center; gap: 14px; }
.nav-mark {
    margin: 0;
    color: var(--mist);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.nav-user {
    max-width: 9rem;
    overflow: hidden;
    color: var(--paper);
    font-size: 0.875rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.nav-link, button.nav-link {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--lime);
    font-size: 0.9375rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    cursor: pointer;
}

.intro { padding: 28px 0 8px; }
.kicker {
    margin-bottom: 12px;
    color: var(--lime);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.kicker a { border-bottom: 1px solid rgba(57, 255, 107, 0.4); }
.lede {
    max-width: 36rem;
    margin-top: 14px;
    color: var(--mist);
    font-size: 1.0625rem;
    font-weight: 500;
    line-height: 1.55;
}
.meta { color: var(--mist); font-size: 0.875rem; font-weight: 500; line-height: 1.45; }
.run-meta { margin-top: 10px; }

.run { padding: 36px 0 8px; }
.run + .run { border-top: 1px solid var(--line); margin-top: 28px; }
.run-head { margin-bottom: 8px; }

.distances { margin-top: 22px; border-top: 1px solid var(--line); }
.distance {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "name price"
        "action action";
    gap: 4px 16px;
    align-items: center;
    padding: 18px 0;
    border-bottom: 1px solid var(--line);
    scroll-margin-bottom: 120px;
}
.distance > div { grid-area: name; min-width: 0; }
.distance .price { grid-area: price; }
.distance form, .distance > .btn, .distance > .meta:last-child { grid-area: action; }
.narrow h1 { font-size: clamp(2rem, 4vw, 2.75rem); }
.distance-name {
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.03em;
}
.price {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}
.distance .btn { justify-self: start; margin-top: 10px; }
.party { display: flex; align-items: center; gap: 8px; }
.party [hidden] { display: none !important; }
.party .count {
    width: 28px;
    min-height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: center;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.party .count::-webkit-outer-spin-button,
.party .count::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper { display: inline-flex; align-items: center; gap: 6px; color: var(--mist); font-size: 0.8125rem; font-weight: 600; }
.stepper input { width: 36px; min-height: 44px; padding: 0; text-align: center; border: 0; background: transparent; }
.party-sum { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.party-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 20px 0 16px; }
.party-bar .stepper input { width: 52px; background: transparent; }
.step {
    width: 44px;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: transparent;
    color: var(--paper);
    font-size: 1.25rem;
    cursor: pointer;
}
.member { margin: 0 0 14px; padding: 8px 14px 0; border: 1px solid var(--line); border-radius: 16px; }
.member legend { padding: 0 6px; color: var(--lime); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.people { display: grid; gap: 6px; margin: 14px 0 0; }
.people li { color: var(--paper); font-size: 0.9375rem; font-weight: 600; }

.policies {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    margin: 36px 0 12px;
}
.policies h2 { font-size: 1rem; letter-spacing: -0.03em; margin-bottom: 6px; }

.btn, button.btn, a.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    border: 0;
    border-radius: 999px;
    background: var(--lime);
    color: #06210f;
    font-size: 0.9375rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    cursor: pointer;
}
.btn:hover { background: var(--green); }
.btn.secondary {
    background: transparent;
    color: var(--paper);
    border: 1px solid rgba(247, 250, 252, 0.22);
}
.btn.block, .distance .btn { min-width: 112px; }
.btn.small { min-height: 40px; }

label {
    display: block;
    margin: 0 0 6px;
    color: var(--mist);
    font-size: 0.8125rem;
    font-weight: 600;
}
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.field { margin-bottom: 14px; }
.field.full { grid-column: 1 / -1; }
input, select, textarea {
    width: 100%;
    min-height: 48px;
    margin: 0;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #10151c;
    color: var(--paper);
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus {
    outline: 2px solid rgba(57, 255, 107, 0.75);
    outline-offset: 1px;
}
.check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 18px 0;
    color: var(--paper);
    font-size: 0.9375rem;
    font-weight: 600;
}
.check input { width: 20px; min-height: 20px; margin-top: 2px; accent-color: var(--green); }
.choices { border: 0; padding: 0; margin: 8px 0 16px; }
.choices legend { margin-bottom: 8px; color: var(--mist); font-size: 0.8125rem; font-weight: 600; }
.choice { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; }
.choice input { width: 18px; min-height: 18px; accent-color: var(--green); }
.summary { display: grid; gap: 10px; margin-top: 16px; }
.summary div { display: flex; justify-content: space-between; gap: 16px; font-variant-numeric: tabular-nums; }
.summary .total {
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    font-size: 1.125rem;
    font-weight: 700;
}
.perks {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    margin: 14px 0 0;
}
.perks li {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--paper);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}
.perks svg { width: 18px; height: 18px; flex: none; color: var(--lime); }
.event-block { margin-top: 28px; }
.event-name {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.04em;
}
.ticket {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 20px;
    margin-top: 28px;
    padding: 20px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}
.ticket div { min-width: 0; }
.ticket dt {
    margin-bottom: 4px;
    color: var(--mist);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.ticket dd {
    margin: 0;
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.3;
}
.note { margin-top: 18px; }
.card {
    margin-top: 20px;
    padding: 20px 0 4px;
    border-top: 1px solid var(--line);
    background: transparent;
}
.code-digits {
    margin: 22px 0 18px;
    color: var(--lime);
    font-size: clamp(2rem, 9vw, 2.75rem);
    font-weight: 800;
    letter-spacing: 0.28em;
    line-height: 1;
}
.steps { display: flex; gap: 6px; margin: 8px 0 20px; }
.steps span { height: 3px; flex: 1; border-radius: 999px; background: rgba(247, 250, 252, 0.14); }
.steps span.on { background: var(--lime); }

.snack {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(16px + env(safe-area-inset-bottom));
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 12px;
    width: min(520px, calc(100% - 32px));
    margin: 0 auto;
    padding: 10px 10px 10px 18px;
    border-radius: 20px;
    background: var(--lime);
    color: #06210f;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.snack.on { opacity: 1; pointer-events: auto; transform: translateY(0); }
.snack-copy { min-width: 0; flex: 1; }
.snack-copy span {
    display: block;
    overflow: hidden;
    color: #0b3d1c;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.snack-copy strong {
    display: block;
    margin-top: 1px;
    font-size: 1.125rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}
.snack button {
    flex: 0 0 auto;
    min-height: 48px;
    padding: 0 18px;
    border: 0;
    border-radius: 14px;
    background: #06210f;
    color: var(--lime);
    font-size: 0.9375rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    cursor: pointer;
}
body.public:has(.snack.on) .site-footer { margin-bottom: 88px; }
.alert, .ok { margin: 12px 0; padding: 12px 14px; border-radius: 12px; font-size: 0.9375rem; }
.alert { background: rgba(255, 93, 115, 0.12); color: #ffd5dc; border: 1px solid rgba(255, 143, 163, 0.45); }
.ok { background: rgba(57, 255, 107, 0.1); color: var(--lime); border: 1px solid rgba(57, 255, 107, 0.28); }

.site-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 48px;
    padding: 20px 0 calc(28px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    color: var(--mist);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

body.admin .admin-shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
body.admin .side {
    background: var(--ink);
    color: var(--paper);
    padding: calc(18px + env(safe-area-inset-top)) 14px 18px;
}
body.admin .side .brand { margin-bottom: 18px; }
body.admin .side nav { display: grid; gap: 4px; }
body.admin .side a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0 12px;
    border-radius: 10px;
    color: var(--mist);
    font-weight: 600;
}
body.admin .side a:hover { background: #17202a; color: var(--lime); }
body.admin .main { padding: 28px 28px 48px; min-width: 0; }
body.admin h1 { font-size: clamp(1.75rem, 3vw, 2.25rem); margin-bottom: 8px; }
body.admin .panel {
    background: #fff;
    border: 1px solid #e6ebf0;
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 16px;
    overflow-x: auto;
}
body.admin .panel h2 { font-size: 1.125rem; letter-spacing: -0.03em; margin-bottom: 4px; }
body.admin .panel .help { margin: 0 0 4px; }
body.admin input, body.admin select, body.admin textarea {
    background: #fff;
    border-color: #d5dee7;
    color: var(--ink);
}
body.admin label, body.admin .help { color: #52606d; }
body.admin .stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
body.admin .stats .panel strong, body.admin .stat strong {
    display: block;
    margin-top: 6px;
    font-size: 1.75rem;
    letter-spacing: -0.04em;
}
body.admin table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
body.admin th, body.admin td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #e6ebf0; vertical-align: top; }
body.admin .row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
body.admin .event-actions form { display: inline; }
body.admin .event-actions button {
    padding: 0;
    border: 0;
    background: none;
    color: #8d2438;
    font: inherit;
    cursor: pointer;
}
body.admin form.delete-event { margin-top: 16px; }
body.admin form.delete-event .btn { color: #8d2438; border-color: #f0c2cb; }
body.admin .inclusion-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: end;
    margin-bottom: 8px;
}
body.admin .btn.secondary { color: #06210f; border-color: #c5d0da; background: #fff; }
body.admin .category-row, body.admin .shirt-row {
    display: grid;
    grid-template-columns: 1.3fr 0.7fr 0.7fr 0.7fr 0.55fr 0.5fr 0.55fr;
    gap: 8px;
    align-items: end;
}
.login-card { width: min(420px, 100%); }
body.admin .alert { color: #8d2438; background: #fff1f3; }
body.admin .ok { color: #0b6b32; background: #e9fff1; }

@media (min-width: 720px) {
    .distance {
        grid-template-columns: minmax(0, 1.4fr) auto auto;
        grid-template-areas: "name price action";
        gap: 16px 24px;
        padding: 16px 0;
    }
    .distance .btn { margin-top: 0; justify-self: end; }
    .intro { padding-top: 48px; }
}

@media (max-width: 720px) {
    .wrap { width: min(880px, calc(100% - 28px)); }
    .policies, .fields, body.admin .stats { grid-template-columns: 1fr; }
    .distance { padding: 16px 0; }
    .distance form.party:not(.is-added) .btn { width: 100%; margin-top: 8px; }
    .distance form.party.is-added {
        justify-content: flex-end;
        width: 100%;
        margin-top: 2px;
    }
    .nav { min-height: 60px; }
    .nav-mark { display: none; }
    .nav-user { max-width: 7rem; }
    .intro { padding-top: 18px; }
    .lede { font-size: 1rem; }
    .snack {
        bottom: 0;
        width: 100%;
        max-width: none;
        border-radius: 22px 22px 0 0;
        padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.28);
    }
    .snack button { min-height: 52px; min-width: 118px; }
    body.public:has(.snack.on) .site-footer { margin-bottom: 104px; }
    body.admin .admin-shell { grid-template-columns: 1fr; }
    body.admin .side { padding-bottom: 8px; }
    body.admin .side nav { display: flex; gap: 6px; overflow-x: auto; }
    body.admin .side a { white-space: nowrap; }
    body.admin .main { padding: 18px 16px 40px; }
    body.admin .category-row, body.admin .shirt-row { grid-template-columns: 1fr 1fr; }
    .site-footer { flex-direction: column; }
}

@media (max-width: 480px) {
    .ticket { grid-template-columns: 1fr; }
}
