@import url("/css/brand.css");
/* RaceTime – gedeelde stijl. Hoog contrast, grote raakvlakken, rustig tijdens drukte. */
:root {
  --bg: #f4f6fa; --surface: #ffffff; --surface-2: #eef1f6; --text: #0d1526; --muted: #5a6478; --border: #d7dce6;
  --brand: #0b6bcb; --brand-ink: #ffffff; --accent: #ff6b00; --ok: #0f8a43; --ok-bg: #e3f6ea; --warn: #9a6200; --warn-bg: #fff3d6;
  --err: #c4231b; --err-bg: #fde7e5; --info-bg: #e5f0fc; --sim: #7a3cc4; --sim-bg: #f0e7fb;
  --radius: 12px; --shadow: 0 1px 2px rgba(13,21,38,.06), 0 4px 16px rgba(13,21,38,.06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1120; --surface: #131b2e; --surface-2: #1b2540; --text: #eef2f9; --muted: #9aa6bd; --border: #2a3654;
    --brand: #3d93f0; --ok: #3ccf7a; --ok-bg: #12301f; --warn: #ffc24d; --warn-bg: #3a2c0a; --err: #ff6b62; --err-bg: #3a1513; --info-bg: #13294a; --sim: #b88af0; --sim-bg: #2a1a44;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1120; --surface: #131b2e; --surface-2: #1b2540; --text: #eef2f9; --muted: #9aa6bd; --border: #2a3654;
  --brand: #3d93f0; --ok: #3ccf7a; --ok-bg: #12301f; --warn: #ffc24d; --warn-bg: #3a2c0a; --err: #ff6b62; --err-bg: #3a1513; --info-bg: #13294a; --sim: #b88af0; --sim-bg: #2a1a44;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 16px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.05rem; }
.tabular, .time { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Layout */
.wrap { max-width: 1240px; margin: 0 auto; padding: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stack > * + * { margin-top: 12px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.stat { padding: 14px 16px; }
.stat .v { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: .85rem; }

/* Topbar */
.topbar { background: #0C0B14; color: #fff; position: sticky; top: 0; z-index: 20; }
.topbar .wrap { display: flex; align-items: center; gap: 16px; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
.brandmark { font-size: 1.3rem; font-weight: 800; color: #fff; text-decoration: none; display: inline-flex; gap: 8px; align-items: center; }
.brandmark .sub { font-family: var(--font); font-weight: 600; font-size: .62em; letter-spacing: 0; color: #A49FB8; margin-left: .2em; }
.brandmark .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(255,107,0,.3); }
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; }
.topbar nav a { color: #c9d3e6; text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 600; font-size: .95rem; }
.topbar nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.topbar nav a.active { background: rgba(255,255,255,.14); color: #fff; }
.topbar .user { margin-left: auto; display: flex; gap: 10px; align-items: center; color: #c9d3e6; font-size: .9rem; }

/* Knoppen & formulieren */
button, .btn { font: inherit; font-weight: 650; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 9px 16px; border-radius: 10px; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; justify-content: center; text-decoration: none; min-height: 42px; }
button:hover, .btn:hover { border-color: var(--brand); }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 4px 10px; min-height: 32px; font-size: .88rem; border-radius: 8px; }
.btn-xl { font-size: 1.3rem; min-height: 64px; padding: 14px 28px; border-radius: 14px; }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.field { margin-bottom: 12px; min-width: 0; }
.field .hint { color: var(--muted); font-size: .82rem; font-weight: 400; margin-top: 3px; }
input, select, textarea { font: inherit; width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); min-height: 42px; }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; min-height: 0; vertical-align: middle; accent-color: var(--brand); }
input[type="color"] { padding: 2px; height: 42px; }
textarea { min-height: 90px; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; }
.form-grid { display: grid; gap: 0 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* Tabellen */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; background: var(--surface-2); position: sticky; top: 0; }
tr.clickable { cursor: pointer; } tr.clickable:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; }

/* Badges & meldingen */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--err-bg); color: var(--err); } .badge.info { background: var(--info-bg); color: var(--brand); }
.badge.sim { background: var(--sim-bg); color: var(--sim); }
.notice { padding: 12px 14px; border-radius: 10px; background: var(--info-bg); border: 1px solid transparent; }
.notice.warn { background: var(--warn-bg); color: var(--warn); } .notice.err { background: var(--err-bg); color: var(--err); } .notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.sim { background: var(--sim-bg); color: var(--sim); font-weight: 700; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.spinner { width: 22px; height: 22px; border: 3px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Verbindingsstatus */
.conn { display: inline-flex; align-items: center; gap: 7px; font-size: .85rem; font-weight: 650; }
.conn::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.conn.live::before { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.25); }
.conn.reconnecting::before { background: #f59e0b; animation: pulse 1s infinite; }
.conn.offline::before { background: #ef4444; }
@keyframes pulse { 50% { opacity: .3; } }

/* Toasts & dialogen */
#toasts { position: fixed; bottom: 16px; right: 16px; left: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; z-index: 1000; pointer-events: none; }
.toast { background: #0d1526; color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow); max-width: 440px; pointer-events: auto; font-weight: 550; }
.toast.err { background: var(--err); } .toast.ok { background: var(--ok); }
dialog { border: none; border-radius: 16px; padding: 0; max-width: min(560px, calc(100vw - 32px)); width: 100%; background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(5,10,20,.55); }
dialog .dlg-body { padding: 20px; }
dialog .dlg-actions { display: flex; gap: 10px; justify-content: flex-end; padding: 0 20px 20px; flex-wrap: wrap; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: none; background: none; border-radius: 0; border-bottom: 3px solid transparent; margin-bottom: -2px; color: var(--muted); padding: 10px 14px; min-height: 44px; white-space: nowrap; }
.tabs button.active { color: var(--text); border-bottom-color: var(--brand); }

/* Statuskleuren */
.st-finished { color: var(--ok); } .st-running { color: var(--brand); } .st-dnf, .st-dsq, .st-dns { color: var(--err); }

/* Publieke live-pagina */
.hero { background: linear-gradient(135deg, #0d1526 0%, #13244a 100%); color: #fff; }
.hero .wrap { padding-top: 22px; padding-bottom: 22px; }
.hero h1 { font-size: clamp(1.5rem, 4vw, 2.6rem); margin: 0; }
.bigclock { font-size: clamp(3.2rem, 13vw, 8.5rem); font-weight: 850; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1; color: #ffd400; }
.racestate { display: inline-flex; padding: 4px 12px; border-radius: 999px; font-weight: 800; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; background: rgba(255,255,255,.12); }
.racestate.running { background: #16a34a; } .racestate.paused { background: #d97706; } .racestate.finished { background: #475569; }
.finisher { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.finisher .bib { font-weight: 850; font-size: 1.1rem; min-width: 56px; text-align: center; background: var(--surface-2); border-radius: 8px; padding: 4px 6px; font-variant-numeric: tabular-nums; }
.finisher .t { margin-left: auto; font-weight: 800; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
@keyframes flashin { from { background: var(--ok-bg); } to { background: transparent; } }
.flash { animation: flashin 2.5s ease-out; }

@media (max-width: 640px) {
  .wrap { padding: 12px 16px; }
  h1 { font-size: 1.4rem; }
  .hide-sm { display: none !important; }
  th, td { padding: 8px 6px; }
}
@media print { .no-print { display: none !important; } body { background: #fff; } }
