:root {
    --bg: #f3f5f8;
    --surface: #ffffff;
    --surface-2: #f7f9fb;
    --text: #1d2521;
    --muted: #66706a;
    --line: #dde3ea;
    --brand: #24507a;
    --brand-ink: #ffffff;
    --brand-soft: #e4edf6;
    --accent: #b8862b;
    --danger: #b3261e;
    --live: #d93a2b;
    --pause-short: #b3261e;
    --pause-medium: #2e7d4f;
    --pause-long: #6e5000;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(20, 30, 25, .06), 0 4px 16px rgba(20, 30, 25, .05);

}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f1620;
        --surface: #172231;
        --surface-2: #1c2939;
        --text: #e8ece9;
        --muted: #9aa59f;
        --line: #2a3a4e;
        --brand: #7fb3e6;
        --brand-ink: #0c1620;
        --brand-soft: #1c3048;
        --accent: #e0b25a;
        --pause-short: #f2867c;
        --pause-medium: #6fcf97;
        --pause-long: #f2c94c;
        --shadow: none;
    }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
.muted { color: var(--muted); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 24px; padding-bottom: 48px; min-height: 70vh; }

/* Topbar */
.topbar { background: linear-gradient(90deg, #1a334d, #335980); color: #fff; position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; }
.brand:hover { text-decoration: none; }
.mainnav { display: flex; gap: 4px; overflow-x: auto; }
.mainnav a { color: inherit; padding: 8px 12px; border-radius: 999px; white-space: nowrap; opacity: .85; }
.mainnav a:hover { text-decoration: none; opacity: 1; background: rgba(255, 255, 255, .12); }
.mainnav a.active { opacity: 1; background: rgba(255, 255, 255, .2); font-weight: 600; }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: .75rem; text-align: center; }

/* Sidehoved og filtre */
.page-head { margin-bottom: 16px; }
.filters { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.filters .search { width: 100%; font-size: 1.05rem; padding: 12px 14px; margin-bottom: 10px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-row select, .filter-row input[type=month] { flex: 1 1 150px; }
input, select, textarea {
    font: inherit; color: var(--text); background: var(--surface-2);
    border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    font: inherit; font-weight: 600; cursor: pointer; border: 1px solid var(--brand);
    background: var(--brand); color: var(--brand-ink); border-radius: 10px; padding: 9px 16px;
}
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--brand); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); cursor: pointer; }
.link.danger { color: var(--danger); }

.tabs { display: flex; align-items: center; gap: 4px; margin: 20px 0 8px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs a { padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a.active { color: var(--brand); border-color: var(--brand); font-weight: 600; }
.tabs .count { margin-left: auto; color: var(--muted); font-size: .9rem; }
.inline-search { margin-left: auto; padding-bottom: 6px; }

.month-title { margin: 28px 0 12px; font-size: 1.15rem; color: var(--muted); text-transform: capitalize; }

/* Kort */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 20px; margin-bottom: 16px; }
.show-card { position: relative; transition: transform .12s ease, border-color .12s ease; }
.show-card:hover { transform: translateY(-1px); border-color: var(--brand); }
.card-link { display: flex; gap: 14px; padding: 16px; padding-right: 52px; color: inherit; }
.card-link:hover { text-decoration: none; }
.card-body { min-width: 0; }
.card-body h3 { font-size: 1.05rem; margin: 6px 0 2px; }
.card-body p { margin: 0; font-size: .9rem; }
.datebox {
    flex: 0 0 56px; height: 60px; border-radius: 12px; background: var(--brand-soft);
    display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--brand);
}
.datebox .day { font-size: 1.5rem; font-weight: 800; line-height: 1; }
.datebox .mon { font-size: .75rem; text-transform: uppercase; font-weight: 600; }
.deadline { margin-top: 6px !important; font-size: .82rem !important; color: var(--muted); }
.deadline.soon { color: var(--accent); font-weight: 600; }
.is-cancelled h3, .is-cancelled strong { text-decoration: line-through; opacity: .6; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { font-size: .75rem; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.status { font-size: .75rem; font-weight: 600; color: var(--muted); }
.status-live { color: var(--live); }
.status-upcoming { color: var(--brand); }
.status-aflyst { color: var(--danger); }

.fav-form { position: absolute; top: 10px; right: 10px; margin: 0; }
.fav-btn { font: inherit; background: none; border: 0; cursor: pointer; color: var(--muted); font-size: 1.4rem; line-height: 1; padding: 6px; border-radius: 8px; }
.fav-btn:hover { background: var(--surface-2); }
.fav-btn.on { color: var(--accent); }
.actions .fav-form { position: static; }
.actions .fav-btn { font-size: 1rem; font-weight: 600; border: 1px solid var(--accent); color: var(--accent); padding: 9px 14px; border-radius: 10px; }
.actions .fav-btn.on { background: var(--accent); color: #fff; }

/* Live-bjælke */
.live-strip { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--live); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 20px; }
.pulse { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--live); animation: pulse 1.4s infinite; vertical-align: middle; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(217, 58, 43, .6); } 100% { box-shadow: 0 0 0 10px rgba(217, 58, 43, 0); } }

/* Stævnedetaljer */
.back { display: inline-block; margin-bottom: 12px; font-size: .95rem; }
.hero {
    display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
}
.hero h1 { margin-top: 10px; }
.lead { font-size: 1.1rem; color: var(--muted); margin: 0 0 12px; }
.facts { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.facts span { display: inline-block; width: 24px; }
.actions { display: flex; flex-direction: column; gap: 8px; min-width: 200px; }
.two-col { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px; margin-top: 24px; }
.day-title { font-size: 1rem; margin: 20px 0 8px; color: var(--muted); }
.class-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.class-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; color: inherit; border-top: 1px solid var(--line); }
.class-row:first-child { border-top: 0; }
.class-row:hover { background: var(--surface-2); text-decoration: none; }
.class-row .time { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--brand); width: 48px; }
.class-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pill { font-size: .75rem; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill-start { background: var(--brand-soft); color: var(--brand); }
.pill-result { background: var(--accent); color: #fff; }
.map { overflow: hidden; }
.map iframe { display: block; width: 100%; height: 260px; border: 0; }
.notice { background: #fdecea; color: var(--danger); border-radius: 10px; padding: 12px 16px; margin: 16px 0; font-weight: 600; }
.notice.ok { background: var(--brand-soft); color: var(--brand); }

/* Tabeller */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 14px; border-top: 1px solid var(--line); }
.table thead th { border-top: 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.podium td:first-child { font-weight: 800; }
.podium.p1 td:first-child { color: #c9a227; }
.podium.p2 td:first-child { color: #8c9aa3; }
.podium.p3 td:first-child { color: #b0703a; }
.row-actions { display: flex; gap: 14px; align-items: center; white-space: nowrap; }
.row-actions form { margin: 0; }

/* Kalender */
.cal-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-head h1 { margin: 0 8px; min-width: 200px; text-align: center; }
.cal-filter { margin-left: auto; }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--line); gap: 1px; }
.cal-wd { background: var(--surface-2); padding: 8px; font-size: .8rem; font-weight: 600; color: var(--muted); text-align: center; }
.cal-day { background: var(--surface); min-height: 110px; padding: 6px; display: flex; flex-direction: column; gap: 3px; }
.cal-day.other { background: var(--surface-2); opacity: .55; }
.cal-day.today .cal-num { background: var(--brand); color: var(--brand-ink); }
.cal-num { font-size: .8rem; font-weight: 600; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal-event { font-size: .72rem; padding: 2px 6px; border-radius: 6px; border-left: 3px solid currentColor; background: var(--surface-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event:hover { text-decoration: none; filter: brightness(1.1); }

/* Tom tilstand */
.empty { text-align: center; padding: 48px 16px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); margin-top: 16px; }

/* Formularer (admin) */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid label, .login label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; font-weight: 600; }
.form-grid .span2 { grid-column: 1 / -1; }
label.check { flex-direction: row !important; align-items: center; gap: 8px; font-weight: 400; margin: 10px 0; }
textarea { width: 100%; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }
.login { max-width: 380px; margin: 40px auto; display: grid; gap: 12px; }
.login form { display: grid; gap: 12px; }
.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.danger-zone { margin-top: 32px; text-align: right; }

.footer { border-top: 1px solid var(--line); padding: 20px 0; color: var(--muted); font-size: .9rem; }
.footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

@media (max-width: 800px) {
    .two-col { grid-template-columns: 1fr; }
    .actions { flex-direction: row; flex-wrap: wrap; min-width: 0; width: 100%; }
    .grid { grid-template-columns: 1fr; }
    .hide-sm { display: none; }
    .form-grid { grid-template-columns: 1fr; }
    .cal-day { min-height: 70px; }
    .cal-event { font-size: 0; padding: 0; height: 6px; border-left: 0; background: currentColor; }
    .inline-search { margin-left: 0; width: 100%; }
    .inline-search input { width: 100%; }
    .brand-tagline { display: none; }
}

/* DRF-stævner */
.search-row { display: flex; gap: 8px; }
.search-row .search { flex: 1; margin: 0; }
.filter-panel { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.filter-panel summary { cursor: pointer; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 600; list-style: none; }
.filter-panel summary::-webkit-details-marker { display: none; }
.filter-panel summary::after { content: '▾'; margin-left: auto; color: var(--muted); }
.filter-panel[open] summary::after { content: '▴'; }
.filter-summary { display: flex; flex-wrap: wrap; gap: 6px; font-weight: 400; }
.filter-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 0; min-width: 0; }
legend { font-weight: 700; padding: 0 6px; }
legend.sub { display: block; padding: 0; margin: 14px 0 4px; font-size: .9rem; }
fieldset select { width: 100%; }
.check { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-weight: 400; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.hint { font-size: .8rem; color: var(--muted); margin: 8px 0 0; }
.level-row { display: flex; gap: 6px; flex-wrap: wrap; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle span { display: inline-grid; place-items: center; min-width: 42px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 700; cursor: pointer; }
.toggle input:checked + span { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.toggle input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.region + .region { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.district-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding-left: 26px; }
.filter-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.result-count { margin: 16px 0 0; font-size: .9rem; }
.small { font-size: .8rem; }

.card-body .event-title { color: var(--text); opacity: .85; margin: 0 0 4px; }
.card-body .chips { margin-top: 8px; }
.chip-animal { color: #2e7d4f; border-color: currentColor; }
.chip-level { color: var(--brand); border-color: currentColor; font-weight: 700; }
.card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.signup { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); }
.signup .dot { width: 8px; height: 8px; border-radius: 50%; background: #c62828; }
.signup.open .dot { background: #2e9d57; }
.signup.open { color: #2e7d4f; font-weight: 600; }

.hero-main { min-width: 0; flex: 1 1 420px; }
.class-row { align-items: flex-start; }
.class-row .time { padding-top: 1px; }
.class-row.is-service { opacity: .65; }
.class-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.fee { white-space: nowrap; }
.remark { font-size: .95rem; overflow-wrap: anywhere; }
.remark p { margin: 0 0 .7em; }
.fav-row { align-items: center; }
.fav-row .fav-form { position: static; }
.fav-link { flex: 1; min-width: 0; display: flex; flex-direction: column; color: inherit; }
.fav-link:hover { text-decoration: none; }
.fav-link:hover strong { color: var(--brand); }
.cal-event { color: var(--brand); }
.cal-event.open { color: #2e7d4f; }

@media (max-width: 900px) {
    .filter-groups { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
    .class-row { flex-wrap: wrap; }
    .class-meta { flex-direction: row; align-items: center; width: 100%; padding-left: 62px; justify-content: flex-start; }
    .filter-summary { display: none; }
}
.filters + .live-strip { margin-top: 16px; }

/* Deltagere pr. dag */
.day-summary { margin-bottom: 6px; }
.day-summary tfoot th { border-top: 2px solid var(--line); background: var(--surface-2); }
.day-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; scroll-margin-top: 80px; }
.day-total { font-size: .85rem; font-weight: 700; color: var(--brand); background: var(--brand-soft); padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.pill-late { background: var(--surface-2); color: var(--accent); border: 1px solid currentColor; }

/* Kalender: vælg en dag */
.cal-hint { margin: 14px 0 8px; }
.cal-day { position: relative; cursor: pointer; transition: background-color .12s ease; }
.cal-day:hover { background: var(--brand-soft); }
.cal-day.other:hover { opacity: .8; }
.cal-num { color: var(--text); }
.cal-num:hover { text-decoration: none; }
.cal-day.has-events .cal-num { color: var(--brand); font-weight: 800; }
.cal-day.today .cal-num { color: var(--brand-ink); }
.cal-day.selected { background: var(--brand-soft); box-shadow: inset 0 0 0 2px var(--brand); }
.cal-day.selected .cal-num { background: var(--brand); color: var(--brand-ink); }
.cal-count { display: none; }
.day-events-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; scroll-margin-top: 80px; }
.btn-sm { padding: 5px 12px; font-size: .9rem; }
.grid-item[hidden], [data-show-month][hidden], [data-day-empty][hidden] { display: none; }
.grid-item > .card { height: 100%; }

@media (max-width: 800px) {
    /* På mobil er stævnerne små streger – et tryk på dagen viser dem i listen */
    .cal-day { min-height: 58px; padding: 4px; align-items: center; }
    .cal-event { pointer-events: none; width: 100%; }
    .cal-day .cal-event:nth-of-type(n+4) { display: none; }
    .cal-wd { padding: 6px 2px; font-size: .72rem; }
}

/* Logo */
.topbar-inner { min-height: 88px; padding-top: 6px; padding-bottom: 6px; }
.brand { gap: 14px; }
.brand picture { display: block; line-height: 0; }
.brand-logo { display: block; height: 76px; width: auto; }
.brand-tagline { font-size: .8rem; opacity: .8; padding-left: 14px; border-left: 1px solid rgba(255, 255, 255, .3); max-width: 13em; line-height: 1.3; }
@media (max-width: 800px) {
    .topbar-inner { min-height: 64px; gap: 6px; }
    .brand-logo { height: 56px; }
}

/* Kort */
.period-form { margin-bottom: 12px; }
.period-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.period-row label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; font-weight: 600; }
.quick-periods { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.quick-periods .chip { font-size: .85rem; padding: 4px 12px; color: var(--brand); }
.quick-periods .chip:hover { text-decoration: none; border-color: var(--brand); }
.chip-active { background: var(--brand) !important; color: var(--brand-ink) !important; border-color: var(--brand) !important; }

.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; margin-top: 16px; }
.map-wrap { position: relative; }
#map { height: 72vh; min-height: 420px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); z-index: 0; }
.map-list { display: flex; flex-direction: column; max-height: 72vh; min-height: 420px; overflow: hidden; }
.map-list-head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: grid; gap: 4px; }
.map-progress { height: 4px; border-radius: 4px; background: var(--brand-soft); overflow: hidden; }
.map-progress span { display: block; height: 100%; width: 0; background: var(--brand); transition: width .3s ease; }
.map-progress[hidden] { display: none; }
.map-events { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.map-item button {
    all: unset; box-sizing: border-box; display: grid; gap: 1px; width: 100%; padding: 10px 16px;
    border-bottom: 1px solid var(--line); cursor: pointer; font-size: .9rem;
}
.map-item button:hover, .map-item.active button { background: var(--brand-soft); }
.map-item button:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.map-item-date { font-size: .75rem; font-weight: 700; color: var(--brand); text-transform: capitalize; }
.map-item-place { font-size: .8rem; color: var(--muted); }
.map-item.no-location .map-item-place { font-style: italic; }
.loading-dots::after { content: '…'; animation: dots 1.2s steps(3) infinite; display: inline-block; width: 1em; overflow: hidden; vertical-align: bottom; }
@keyframes dots { from { width: 0; } to { width: 1em; } }

.map-pin { background: var(--brand); border: 3px solid #fff; border-radius: 50%; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
.map-pin.open { background: #2e9d57; }
.map-cluster { background: rgba(36, 80, 122, .25); border-radius: 50%; }
.map-cluster span {
    display: grid; place-items: center; width: 28px; height: 28px; margin: 4px; border-radius: 50%;
    background: var(--brand); color: #fff; font-weight: 700; font-size: .8rem;
}
.map-popup { display: grid; gap: 4px; font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.map-popup .btn { justify-self: start; margin-top: 6px; color: #fff; }
.leaflet-popup-content { margin: 12px 14px; }
.leaflet-container a.btn { color: #fff; }

@media (prefers-color-scheme: dark) {
    .map-pin { border-color: #0f1620; }
    .leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--text); }
    .map-cluster span { color: var(--brand-ink); }
}

@media (max-width: 900px) {
    .map-layout { grid-template-columns: 1fr; }
    #map { height: 60vh; min-height: 320px; }
    .map-list { max-height: none; min-height: 0; }
    .map-events { max-height: 60vh; }
}

@media (max-width: 480px) {
    .mainnav { width: 100%; justify-content: space-between; gap: 0; }
    .mainnav a { padding: 6px 8px; font-size: .88rem; }
}

/* Tilmeldingsfrist på stævnesiden */
.deadline-fact { font-weight: 600; }
.deadline-open { color: #2e7d4f; }
.deadline-urgent { color: #b86e00; }
.deadline-closed { color: var(--danger); }
@media (prefers-color-scheme: dark) {
    .deadline-open { color: #6fcf97; }
    .deadline-urgent { color: #f2b24c; }
    .deadline-closed { color: #ff8a80; }
}

/* Konto-link i toppen */
.mainnav { margin-left: auto; }
.account-link {
    display: inline-flex; align-items: center; gap: 6px; color: #fff; padding: 7px 12px;
    border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px; white-space: nowrap; font-size: .92rem;
}
.account-link:hover, .account-link.active { text-decoration: none; background: rgba(255, 255, 255, .15); }
.account-icon { font-size: .95rem; line-height: 1; }
@media (max-width: 800px) {
    .brand { order: 1; }
    .account-link { order: 2; margin-left: auto; padding: 5px 10px; font-size: .85rem; }
    .mainnav { order: 3; width: 100%; margin-left: 0; }
}

/* Konto-sider */
.auth-wrap { display: grid; place-items: start center; padding: 12px 0 24px; }
.auth-card { width: 100%; max-width: 440px; }
.auth-card h1 { font-size: 1.6rem; }
.auth-form { display: grid; gap: 12px; margin-top: 8px; }
.auth-form label:not(.check) { display: grid; gap: 4px; font-size: .9rem; font-weight: 600; }
.auth-form label.check { align-items: flex-start; font-size: .9rem; }
.auth-form label.check input { margin-top: 2px; flex: 0 0 auto; }
.auth-form .btn { justify-self: start; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; font-size: .92rem; }
.account-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.account-grid .card.pad { margin: 0; }
.account-grid h2 { font-size: 1.15rem; }
.account-grid h3 { font-size: .95rem; margin-top: 16px; }
.danger-card { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
@media (max-width: 800px) { .account-grid { grid-template-columns: 1fr; } }

/* Testmail (administrator) */
.mail-test h2 .chip { font-size: .7rem; vertical-align: middle; margin-left: 6px; }
.transcript { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: .78rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow: auto; }
.mail-test details { margin: 8px 0 12px; }
.mail-test summary { cursor: pointer; font-size: .9rem; color: var(--brand); }

/* Administration */
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.head-actions form { margin: 0; }
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { padding: 14px 16px; display: grid; gap: 2px; }
.stat-value { font-size: 1.6rem; font-weight: 800; color: var(--brand); line-height: 1.1; }
.admin-search { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.admin-search input { flex: 1 1 240px; }
.admin-users td { vertical-align: middle; }
.admin-users .chip { margin-left: 6px; }
.admin-users .row-actions { justify-content: flex-end; }
@media (max-width: 800px) {
    .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    /* Tabellen bliver til kort på mobil */
    .admin-users thead { display: none; }
    .admin-users, .admin-users tbody, .admin-users tr, .admin-users td { display: block; width: 100%; }
    .admin-users tr { border-top: 1px solid var(--line); padding: 8px 0; }
    .admin-users td { border: 0; padding: 3px 14px; text-align: left !important; }
    .admin-users td[data-label]:not(:first-child)::before { content: attr(data-label) ': '; color: var(--muted); font-size: .85rem; }
    .admin-users .row-actions { justify-content: flex-start; padding-top: 6px; }
}

/* Forbedringsønsker og opdateringer */
.admin-wishes, .admin-updates { margin: 16px 0; }
.admin-updates h3 { margin-top: 20px; }
#oensker, #opdateringer { scroll-margin-top: 130px; }
.wish-list { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 8px; }
.wish-list li { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.wish-list li.is-done .wish-body { color: var(--muted); }
.wish-body { overflow-wrap: anywhere; }
.wish-list .row-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.wish-list .row-actions form { margin: 0; }

/* Påmindelser */
.reminder-box { display: grid; gap: 4px; }
.reminder-box > .btn { width: 100%; }
.reminder-form { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-size: .9rem; }
.reminder-days { display: flex; gap: 6px; flex-wrap: wrap; }
.reminder-days .toggle span { min-width: 0; height: 32px; padding: 0 10px; font-size: .85rem; }
.reminder-actions { display: flex; gap: 12px; align-items: center; }
.reminder-on { color: #2e7d4f; font-weight: 600; }
.reminder-list { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 6px; }
.reminder-list li { display: grid; }
.admin-reminders { margin-top: 24px; }
.cron-url { display: block; margin-top: 4px; padding: 6px 8px; background: var(--surface-2); border-radius: 6px; overflow-wrap: anywhere; font-size: .78rem; }
@media (prefers-color-scheme: dark) { .reminder-on { color: #6fcf97; } }

/* Klasser på tværs af stævner */
.class-filters { margin-top: 16px; display: grid; gap: 14px; }
.class-filter-row { display: flex; gap: 12px; flex-wrap: wrap; }
.class-filter-row label { display: grid; gap: 4px; font-size: .85rem; font-weight: 600; flex: 0 1 220px; }
.class-filter-row label.grow { flex: 1 1 260px; }
.code-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 4px; }
.code-groups { display: grid; gap: 8px; }
.code-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.code-level { width: 52px; font-size: .78rem; font-weight: 800; color: var(--muted); letter-spacing: .03em; }
.code-chip {
    font: inherit; font-size: .85rem; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
}
.code-chip small { font-size: .7rem; font-weight: 600; color: var(--muted); }
.code-chip:hover { border-color: var(--brand); }
.code-chip.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.code-chip.on small { color: inherit; opacity: .8; }
.class-status { display: grid; gap: 6px; }
.class-day { display: flex; align-items: baseline; gap: 6px; }
.cross-class { color: inherit; }
.cross-class:hover { text-decoration: none; background: var(--surface-2); }
.class-codes { display: flex; flex-direction: column; gap: 3px; width: 74px; flex: 0 0 74px; }
.pill-code { background: var(--brand-soft); color: var(--brand); font-weight: 800; text-align: center; }
.class-event { color: var(--brand); font-size: .82rem; }
@media (max-width: 800px) {
    .code-level { width: 100%; }
    .class-codes { flex-direction: row; flex-wrap: wrap; width: 100%; flex-basis: 100%; }
    .class-filter-row label { flex: 1 1 100%; }
}

/* Fem menupunkter skal kunne være på en smal telefon */
@media (max-width: 480px) {
    .mainnav a { padding: 6px 5px; font-size: .85rem; }
    .cross-class .class-meta { padding-left: 0; }
}

/* Info-siden */
.info-toc { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 8px; }
.info-toc a { font-weight: 600; }
.info-section { margin-top: 32px; scroll-margin-top: 90px; }
.info-section h2 { font-size: 1.35rem; }
.info-section p, .info-section li { max-width: 72ch; }
.install-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 16px 0 8px; }
.install-card { margin: 0; }
.install-card.is-current { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.install-card.is-current h3::after { content: 'Din telefon'; margin-left: 8px; font-size: .72rem; padding: 2px 8px; border-radius: 999px; background: var(--brand); color: var(--brand-ink); vertical-align: middle; }
.steps { padding-left: 1.3em; display: grid; gap: 8px; margin: 12px 0; }
.steps li::marker { font-weight: 800; color: var(--brand); }
.ios-share { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 1.5px solid currentColor; border-radius: 5px; font-size: .75rem; color: #0a84ff; }
.install-btn { width: 100%; margin: 4px 0 6px; }
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.feature { margin: 0; display: grid; gap: 4px; color: inherit; }
a.feature:hover { text-decoration: none; border-color: var(--brand); }
.feature span { color: var(--muted); font-size: .92rem; }
.faq { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 10px 14px; margin-bottom: 8px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin: 8px 0 2px; color: var(--muted); }
@media (max-width: 800px) {
    .install-grid, .feature-grid { grid-template-columns: 1fr; }
}

/* "GO" ved logoet */
.brand-go {
    align-self: center; margin-left: -6px; padding: 3px 9px; border-radius: 8px;
    background: #fff; color: #1a334d; font-weight: 900; font-size: 1.05rem; letter-spacing: .06em; line-height: 1.1;
}
@media (max-width: 800px) { .brand-go { font-size: .9rem; padding: 2px 7px; margin-left: -4px; } }

/* Live fra stævnet */
.live-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.live-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--live); vertical-align: middle; margin-right: 4px; animation: pulse 1.4s infinite; }
.live-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.live-days { display: flex; gap: 6px; flex-wrap: wrap; }
.live-days .chip { font-size: .85rem; padding: 4px 12px; color: var(--brand); }
.live-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.live-arena { padding: 18px; display: grid; gap: 10px; align-content: start; container-type: inline-size; }
.live-flow { display: grid; gap: 10px; align-content: start; }
.live-next-wrap { display: grid; gap: 10px; align-content: start; }
/* Bred bane-boks: foreløbigt resultat i højre side. Ellers står det over de næste ryttere. */
@container (min-width: 680px) {
    .live-flow { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto auto 1fr; column-gap: 20px; }
    .live-flow > .live-current { grid-column: 1; grid-row: 1; }
    .live-flow > .live-last { grid-column: 1; grid-row: 2; }
    .live-flow > .live-next-wrap { grid-column: 1; grid-row: 3; }
    .live-flow > .live-standings { grid-column: 2; grid-row: 1 / span 3; }
}
.live-standings { display: grid; gap: 6px; align-content: start; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }
.live-standings-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.live-standings-list li { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 5px 4px; border-bottom: 1px solid var(--line); font-size: .9rem; }
.live-standings-list li:last-child { border-bottom: 0; }
.live-rank { font-weight: 800; color: var(--brand); text-align: center; font-variant-numeric: tabular-nums; }
.live-st-name { min-width: 0; }
.live-st-result { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.live-standings-more summary { cursor: pointer; font-size: .85rem; color: var(--brand); font-weight: 600; padding: 4px; }
.live-arena-name { font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 0; }
.live-status { margin: 0; font-weight: 800; font-size: .85rem; }
.live-status.running { color: var(--live); }
.live-status.upcoming { color: var(--brand); }
.live-status.done { color: #2e7d4f; }
.live-class { margin: 0; font-size: 1.2rem; }
.live-class-meta { margin: 0; }
.live-numbers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.live-numbers > div { display: grid; background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.live-big { font-size: 2rem; font-weight: 800; line-height: 1.1; color: var(--brand); font-variant-numeric: tabular-nums; }
.live-pause { margin: 10px 0 0; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); font-size: .9rem; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.live-pause.short, .tt-pause.short { --tone: var(--pause-short); }
.live-pause.medium, .tt-pause.medium { --tone: var(--pause-medium); }
.live-pause.long, .tt-pause.long { --tone: var(--pause-long); --tone-bg: color-mix(in srgb, #f2c94c 32%, var(--surface)); }
.live-pause.short, .live-pause.medium, .live-pause.long { color: var(--tone); background: var(--tone-bg, color-mix(in srgb, var(--tone) 12%, var(--surface))); }
.live-pause .muted { color: inherit; opacity: .8; }
.live-pause.none { color: var(--muted); }
.live-progress { height: 8px; border-radius: 8px; background: var(--brand-soft); overflow: hidden; }
.live-progress span { display: block; height: 100%; background: var(--brand); transition: width .4s ease; }
.live-label { font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.live-current { display: grid; grid-template-columns: auto auto 1fr; gap: 4px 12px; align-items: center; padding: 12px; border-radius: 12px; border: 2px solid var(--live); background: color-mix(in srgb, var(--live) 7%, var(--surface)); }
.live-current .live-label { grid-column: 1 / -1; color: var(--live); }
.live-current strong { font-size: 1.1rem; }
.live-no { display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 6px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); font-weight: 800; font-variant-numeric: tabular-nums; }
.live-current .live-no { background: var(--live); color: #fff; min-width: 42px; height: 42px; font-size: 1.1rem; }
.live-last { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: center; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }
.live-last .live-label { grid-column: 1 / -1; }
.live-result { display: grid; justify-items: end; text-align: right; font-variant-numeric: tabular-nums; }
.live-result strong { font-size: 1.1rem; }
.live-hno { display: inline-block; padding: 0 5px; border-radius: 4px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font-weight: 700; font-size: .85em; font-variant-numeric: tabular-nums; }
.live-hinfo { display: inline-block; margin-top: 2px; padding: 1px 6px; border-radius: 4px; background: color-mix(in srgb, #7c9fd8 22%, var(--surface)); color: var(--text); font-size: .78rem; }
.live-rider { color: inherit; }
.live-rider:hover { color: var(--brand); }
.live-next { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.live-next li { display: flex; gap: 10px; align-items: center; font-size: .95rem; }
.live-program summary { cursor: pointer; font-size: .9rem; color: var(--brand); font-weight: 600; }
.live-program ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 2px; }
.live-program li { display: grid; grid-template-columns: 48px 1fr auto; gap: 8px; font-size: .85rem; padding: 5px 6px; border-radius: 6px; }
.live-program li.done { color: var(--muted); }
.live-program li.running, .live-program li.focus { background: var(--brand-soft); font-weight: 600; }
.live-time { font-variant-numeric: tabular-nums; font-weight: 700; }
.live-prog-state { white-space: nowrap; font-size: .8rem; }
.live-program li.running .live-prog-state { color: var(--live); }
.btn-live { background: var(--live); border-color: var(--live); color: #fff; }

/* Springstatistik */
.stats-link { font-weight: 600; white-space: nowrap; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin: 12px 0; }
.stats-box { display: grid; align-content: start; background: var(--surface-2); border-radius: 10px; padding: 10px 12px; border-left: 5px solid var(--tone); }
.stats-box .live-big { color: var(--tone); }
.stats-pct { font-weight: 700; font-size: .85rem; color: var(--tone); }
.stats-box.clear, .stats-bar .clear { --tone: var(--pause-medium); }
.stats-box.faults, .stats-bar .faults { --tone: #b86e00; }
.stats-box.out, .stats-bar .out { --tone: var(--pause-short); }
.stats-bar { display: flex; height: 12px; border-radius: 8px; overflow: hidden; background: var(--surface-2); margin-bottom: 16px; }
.stats-bar span { display: block; height: 100%; background: var(--tone); }
.stats-details { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.stats-details .card { padding: 14px 16px; }
.stats-title { font-size: 1rem; margin: 0 0 8px; }
.stats-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.stats-list li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.stats-list li:last-child { border-bottom: 0; }
@media (max-width: 480px) { .live-grid { grid-template-columns: 1fr; } .live-big { font-size: 1.7rem; } }

/* Knap til Equipe på stævnekort og stævneside */
.equipe-btn { display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--brand); color: var(--brand); background: var(--surface); }
.equipe-btn:hover { text-decoration: none; background: var(--brand-soft); }
.equipe-btn.btn { font-size: 1rem; padding: 9px 16px; border-radius: 10px; }
.equipe-btn.is-disabled { border-color: var(--line); color: var(--muted); background: var(--surface-2); cursor: not-allowed; opacity: .75; }
.equipe-btn.is-disabled:hover { background: var(--surface-2); }
.equipe-btn.is-disabled .equipe-ext { display: none; }

/* Tidsplan */
.tt-jump { margin-bottom: 8px; }
.tt-day { margin-top: 28px; scroll-margin-top: 90px; }
.tt-day h2 { display: flex; align-items: center; gap: 8px; }
.tt-day h2 .chip { font-size: .75rem; }
.tt-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 8px 0 12px; }
.tt-summary > div { display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.tt-summary .live-big { font-size: 1.5rem; }
.tt-info { margin-bottom: 12px; }
.tt-info summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: .92rem; }
.tt-info ul { margin: 8px 0; padding-left: 1.2em; font-size: .9rem; color: var(--muted); }
.tt-list { list-style: none; margin: 0 0 12px; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tt-class { display: grid; grid-template-columns: 70px 1fr auto; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); align-items: start; }
.tt-list > li:first-child { border-top: 0; }
.tt-time { font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; }
.tt-main { display: grid; gap: 2px; min-width: 0; }
.tt-state { font-size: .8rem; white-space: nowrap; color: var(--muted); }
.tt-class.done { opacity: .65; }
.tt-class.running { background: var(--brand-soft); }
.tt-class.running .tt-state { color: var(--live); font-weight: 700; }
.tt-pause { padding: 6px 14px 6px 94px; font-size: .85rem; color: var(--muted); background: var(--surface-2); border-top: 1px dashed var(--line); }
.tt-pause.short, .tt-pause.medium, .tt-pause.long { color: var(--tone); font-weight: 700; background: var(--tone-bg, color-mix(in srgb, var(--tone) 12%, var(--surface))); }
.tt-pause.overlap { color: var(--muted); font-style: italic; }
@media (max-width: 800px) {
    .tt-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tt-class { grid-template-columns: 52px 1fr; }
    .tt-state { grid-column: 2; }
    .tt-pause { padding-left: 76px; }
}
