/* ==========================================================================
   My SARK - bento grid design
   Colours from the SARK logo: red, yellow, orange gradient, black outlines.
   ========================================================================== */

:root {
    --red: #e32b24;
    --red-dark: #b81f19;
    --orange: #f26b21;
    --amber: #fbb03b;
    --yellow: #ffe500;
    --ink: #161616;
    --text: #2a2a2a;
    --muted: #6d6a66;
    --bg: #f3f0eb;
    --tile: #ffffff;
    --line: #e6e1d9;
    --green: #1e8e4e;
    --green-bg: #e3f5ea;
    --amber-bg: #fff4d6;
    --amber-text: #8a5a00;
    --red-bg: #fde8e7;
    --blue-bg: #e7f0fb;
    --blue-text: #1e4f8a;
    --gradient: linear-gradient(160deg, #ec3e24 0%, #f47a20 45%, #fbb03b 75%, #ffe500 100%);
    --radius: 22px;
    --radius-sm: 12px;
    --shadow: 0 1px 2px rgba(22, 22, 22, .04), 0 6px 20px rgba(22, 22, 22, .05);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

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

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--red-dark); }
a:hover { color: var(--red); }

h1, h2, h3 { color: var(--ink); line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 800; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 1em; }

.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 1rem; }
.mb-0 { margin-bottom: 0; }
.hidden, [hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- Top bar ---------------------------------------------------------------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--ink);
    color: #fff;
}
.topbar__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: .6rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    font-size: 1.1rem;
    margin-right: auto;
}
.brand:hover { color: var(--yellow); }
.brand img { width: 40px; height: 40px; border-radius: 8px; }
.brand__tag {
    font-size: .7rem;
    font-weight: 700;
    background: var(--yellow);
    color: var(--ink);
    padding: .1rem .45rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.nav { display: flex; align-items: center; gap: .25rem; }
.nav a, .nav button {
    color: #ddd;
    text-decoration: none;
    font: inherit;
    font-weight: 600;
    font-size: .95rem;
    padding: .45rem .8rem;
    border-radius: 999px;
    background: none;
    border: 0;
    cursor: pointer;
}
.nav a:hover, .nav button:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.nav a.is-active { color: var(--ink); background: var(--yellow); }
.nav form { margin: 0; }

.nav-toggle {
    display: none;
    background: none;
    border: 2px solid rgba(255, 255, 255, .3);
    color: #fff;
    border-radius: 999px;
    padding: .35rem .9rem;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

@media (max-width: 860px) {
    .nav-toggle { display: block; }
    .nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        background: var(--ink);
        padding: .5rem 1rem 1rem;
        border-top: 1px solid rgba(255, 255, 255, .1);
    }
    .nav.is-open { display: flex; }
    .nav a, .nav button { text-align: left; width: 100%; border-radius: var(--radius-sm); }
}

/* --- Layout ----------------------------------------------------------------- */

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
    flex: 1;
}

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: .75rem 1rem;
    margin-bottom: 1.25rem;
}
.page-head h1 { margin: 0; }
.page-head p { margin: .25rem 0 0; }
.page-head__actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.breadcrumb { font-size: .875rem; margin-bottom: .25rem; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--red); }

.footer {
    text-align: center;
    color: var(--muted);
    font-size: .8rem;
    padding: 1.5rem 1rem;
}

/* --- Bento grid ------------------------------------------------------------- */

.bento {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-flow: dense;
    gap: 1rem;
}
.bento + .bento { margin-top: 1rem; }

.tile {
    background: var(--tile);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.35rem;
    min-width: 0;
    position: relative;
    display: flex;
    flex-direction: column;
}
.tile--2 { grid-column: span 2; }
.tile--3 { grid-column: span 3; }
.tile--full { grid-column: 1 / -1; }
.tile--tall { grid-row: span 2; }

.tile__label {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    margin: 0 0 .5rem;
}
.tile__value {
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 800;
    color: var(--ink);
    line-height: 1;
    margin: 0 0 .35rem;
}
.tile__foot { margin-top: auto; padding-top: .75rem; }
.tile__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .75rem;
}
.tile__head h2 { margin: 0; }

/* Linked tiles first, so the colour variants below win */
.tile--link { text-decoration: none; color: var(--text); transition: transform .15s ease, box-shadow .15s ease; }
.tile--link:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(22, 22, 22, .1); color: var(--text); }

.tile--accent, .tile--accent:hover { background: var(--gradient); color: var(--ink); }
.tile--accent .tile__label { color: rgba(22, 22, 22, .7); }
.tile--dark, .tile--dark:hover { background: var(--ink); color: #eee; }
.tile--dark h2, .tile--dark .tile__value { color: #fff; }
.tile--dark .tile__label { color: #aaa; }
.tile--dark a:not(.btn) { color: var(--yellow); }
.tile--red, .tile--red:hover { background: var(--red); color: #fff; }
.tile--red .tile__value, .tile--red h2 { color: #fff; }
.tile--red .tile__label { color: rgba(255, 255, 255, .8); }
.tile--yellow { background: var(--yellow); }

.welcome {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}
.welcome img { width: 84px; height: 84px; border-radius: 16px; flex-shrink: 0; box-shadow: 0 4px 14px rgba(0, 0, 0, .15); }
.welcome h1 { margin: 0 0 .2rem; }
.welcome p { margin: 0; font-weight: 600; }

.big-letter {
    font-size: 4rem;
    font-weight: 900;
    line-height: 1;
    color: var(--ink);
    margin: 0;
}
.big-letter--yellow { color: var(--yellow); }

@media (max-width: 1000px) {
    .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tile--3 { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
    .bento { grid-template-columns: minmax(0, 1fr); }
    .tile--2, .tile--3 { grid-column: auto; }
    .tile--tall { grid-row: auto; }
    .welcome img { width: 64px; height: 64px; }
}

/* --- Buttons ---------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    font: inherit;
    font-weight: 700;
    font-size: .95rem;
    line-height: 1.2;
    padding: .7rem 1.2rem;
    border-radius: 999px;
    border: 2px solid var(--ink);
    background: var(--tile);
    color: var(--ink);
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, transform .1s ease;
}
.btn:hover { background: var(--ink); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn--primary:hover { background: var(--red-dark); border-color: var(--red-dark); color: #fff; }
.btn--dark { background: var(--ink); color: #fff; }
.btn--dark:hover { background: #000; }
.btn--yellow { background: var(--yellow); border-color: var(--ink); }
.btn--ghost { border-color: transparent; background: transparent; }
.btn--ghost:hover { background: rgba(22, 22, 22, .06); color: var(--ink); }
.btn--danger { border-color: var(--red); color: var(--red-dark); background: transparent; }
.btn--danger:hover { background: var(--red); color: #fff; }
.btn--sm { padding: .4rem .8rem; font-size: .85rem; }
.btn--block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.inline-form { display: inline; margin: 0; }

/* --- Forms ------------------------------------------------------------------ */

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 1rem;
}
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 600px) {
    .form-grid { grid-template-columns: minmax(0, 1fr); }
}

.field { margin-bottom: 1rem; }
.field label, .field .label {
    display: block;
    font-weight: 700;
    font-size: .9rem;
    color: var(--ink);
    margin-bottom: .3rem;
}
.field .hint { font-size: .825rem; color: var(--muted); margin: .3rem 0 0; }
.optional { font-weight: 400; color: var(--muted); }

input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number],
input[type=date], input[type=datetime-local], input[type=search], select, textarea {
    width: 100%;
    font: inherit;
    color: var(--ink);
    background: #fbfaf8;
    border: 2px solid var(--line);
    border-radius: var(--radius-sm);
    padding: .65rem .8rem;
    transition: border-color .15s ease, background .15s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--ink);
    background: #fff;
}
input[readonly] { background: var(--bg); color: var(--muted); }
textarea { min-height: 110px; resize: vertical; }
input[type=file] { font: inherit; max-width: 100%; }
.is-invalid, .field--error input, .field--error select, .field--error textarea { border-color: var(--red); }

.field-error { color: var(--red-dark); font-size: .85rem; font-weight: 600; margin: .3rem 0 0; }

.choice-group { display: flex; flex-wrap: wrap; gap: .5rem; }
.choice {
    position: relative;
    display: flex;
    align-items: center;
    gap: .5rem;
    border: 2px solid var(--line);
    border-radius: var(--radius-sm);
    padding: .6rem .9rem;
    cursor: pointer;
    font-weight: 600;
    background: #fbfaf8;
}
.choice:hover { border-color: var(--muted); }
.choice input { accent-color: var(--red); width: 1.1rem; height: 1.1rem; margin: 0; }
.choice:has(input:checked) { border-color: var(--ink); background: var(--yellow); }
.choice-group--stack { flex-direction: column; }

.checkbox { display: flex; align-items: center; gap: .5rem; font-weight: 600; cursor: pointer; }
.checkbox input { accent-color: var(--red); width: 1.15rem; height: 1.15rem; }

fieldset {
    border: 0;
    padding: 0;
    margin: 0 0 1.25rem;
    min-width: 0;
}
legend {
    font-weight: 800;
    color: var(--ink);
    font-size: 1.05rem;
    margin-bottom: .75rem;
    padding: 0;
}

.form-section {
    border-top: 2px dashed var(--line);
    padding-top: 1.25rem;
    margin-top: .25rem;
}

/* --- Alerts ----------------------------------------------------------------- */

.alert {
    border-radius: var(--radius-sm);
    padding: .85rem 1rem;
    margin-bottom: 1rem;
    font-weight: 600;
    border-left: 5px solid;
}
.alert--success { background: var(--green-bg); color: #145c33; border-color: var(--green); }
.alert--error { background: var(--red-bg); color: var(--red-dark); border-color: var(--red); }
.alert--info { background: var(--blue-bg); color: var(--blue-text); border-color: #3b7fd1; }
.alert--warning { background: var(--amber-bg); color: var(--amber-text); border-color: var(--amber); }
.alert p:last-child { margin-bottom: 0; }

/* --- Badges ----------------------------------------------------------------- */

.badge {
    display: inline-block;
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .02em;
    padding: .2rem .6rem;
    border-radius: 999px;
    white-space: nowrap;
    background: var(--bg);
    color: var(--text);
}
.badge--betaald, .badge--ok { background: var(--green-bg); color: #145c33; }
.badge--openstaand, .badge--warn { background: var(--amber-bg); color: var(--amber-text); }
.badge--danger { background: var(--red-bg); color: var(--red-dark); }
.badge--dark { background: var(--ink); color: #fff; }
.badge--class { background: var(--ink); color: var(--yellow); min-width: 1.8rem; text-align: center; }
.badge--title { background: var(--yellow); color: var(--ink); border: 1px solid var(--ink); margin-left: .25rem; }
td.dropped { color: var(--muted); text-decoration: line-through; }

/* --- Tables ----------------------------------------------------------------- */

.table-wrap { overflow-x: auto; margin: 0 -1.35rem; padding: 0 1.35rem; }
table { width: 100%; border-collapse: collapse; font-size: .925rem; }
th, td { text-align: left; padding: .65rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    font-weight: 700;
    white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfbf9; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table--compact td, .table--compact th { padding: .45rem .5rem; }
.table--results input, .table--results select { padding: .4rem .5rem; min-width: 5rem; }
.table--results input[name$="[note]"] { min-width: 9rem; }
tr.row-error td { background: var(--red-bg); }

/* Mobile: tables become cards */
@media (max-width: 700px) {
    .table--stack thead { display: none; }
    .table--stack, .table--stack tbody, .table--stack tr, .table--stack td { display: block; width: 100%; }
    .table--stack tr { border-bottom: 1px solid var(--line); padding: .5rem 0; }
    .table--stack td { border: 0; padding: .2rem 0; }
    .table--stack td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: .7rem;
        text-transform: uppercase;
        letter-spacing: .05em;
        color: var(--muted);
        font-weight: 700;
    }
    .table--stack td.num { text-align: left; }
}

/* --- Definition lists --------------------------------------------------------- */

.dl { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: .45rem 1rem; margin: 0; }
.dl dt { color: var(--muted); font-size: .875rem; font-weight: 600; }
.dl dd { margin: 0; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.tile--dark .dl dt { color: #aaa; }
.tile--dark .dl dd { color: #fff; }

/* A column of tiles inside the bento grid (e.g. form sidebar) */
.stack { display: flex; flex-direction: column; gap: 1rem; min-width: 0; align-self: start; }
@media (min-width: 1001px) {
    .stack--sticky { position: sticky; top: 76px; }
}

/* --- Lists ------------------------------------------------------------------ */

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: .7rem 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.tile--dark .list li { border-color: rgba(255, 255, 255, .12); }
.list li:last-child { border-bottom: 0; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 1rem 1.5rem; border-left: 2px solid var(--line); margin-left: .5rem; }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
    content: "";
    position: absolute;
    left: -7px;
    top: .3rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--red);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px var(--red);
}

/* --- Rally cards ------------------------------------------------------------ */

.rally-date {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--ink);
    color: #fff;
    border-radius: 14px;
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    line-height: 1;
}
.rally-date strong { font-size: 1.6rem; font-weight: 800; color: var(--yellow); }
.rally-date span { font-size: .75rem; text-transform: uppercase; font-weight: 700; margin-top: .15rem; }
.rally-head { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.rally-head h2 { margin: 0; }
.price { font-size: 1.4rem; font-weight: 800; color: var(--ink); }

.price-box {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 1rem;
}
.price-box .dl dd { text-align: right; }
.price-box .total { border-top: 2px solid var(--ink); padding-top: .4rem; font-size: 1.1rem; }

/* --- Auth pages ------------------------------------------------------------- */

.auth {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1rem;
    gap: 1rem;
    align-items: stretch;
}
.auth__brand {
    background: var(--gradient);
    border-radius: var(--radius);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1.5rem;
}
.auth__brand img { width: min(220px, 60%); filter: drop-shadow(0 8px 20px rgba(0, 0, 0, .2)); }
.auth__brand h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0; }
.auth__brand p { font-weight: 600; margin: 0; }
.auth__card { background: var(--tile); border-radius: var(--radius); box-shadow: var(--shadow); padding: 2rem; }
.auth__card h2 { font-size: 1.5rem; }
.auth__links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; margin-top: 1rem; font-size: .9rem; }
.auth--admin .auth__brand { background: var(--ink); color: #fff; }
.auth--admin .auth__brand h1 { color: #fff; }

@media (max-width: 760px) {
    .auth { grid-template-columns: minmax(0, 1fr); padding-top: 1rem; }
    .auth__brand { flex-direction: row; align-items: center; padding: 1.25rem; }
    .auth__brand img { width: 72px; }
    .auth__brand h1 { font-size: 1.5rem; }
    .auth__brand p { display: none; }
    .auth__card { padding: 1.5rem; }
}

/* --- Pagination / filters --------------------------------------------------- */

.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; }
.filters .field { margin: 0; flex: 1 1 160px; }
.filters .field--grow { flex: 3 1 240px; }

.tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.tabs a {
    text-decoration: none;
    font-weight: 700;
    font-size: .9rem;
    padding: .4rem .9rem;
    border-radius: 999px;
    background: var(--tile);
    color: var(--ink);
    box-shadow: var(--shadow);
}
.tabs a.is-active { background: var(--ink); color: var(--yellow); }

.pagination { display: flex; gap: .5rem; align-items: center; justify-content: center; margin-top: 1rem; }

.empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--muted);
}
.empty strong { display: block; color: var(--ink); font-size: 1.05rem; margin-bottom: .25rem; }

.position {
    display: inline-flex;
    width: 2rem;
    height: 2rem;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 800;
    background: var(--bg);
    color: var(--ink);
}
.position--1 { background: var(--yellow); }
.position--2 { background: #e4e4e4; }
.position--3 { background: #f2c8a0; }

.error-page { text-align: center; }
.error-page .tile__value { font-size: 4rem; color: var(--red); }
