/* Parkeer — zie DESIGN.md voor de principes achter deze waarden. */

/* ---------- Tokens ---------- */
:root {
  /* Donker (standaard) */
  --bg: #0e0e11;
  --surface: #17171b;
  --surface-2: #222228;
  --surface-3: #2c2c33;
  --text: #f4f4f6;
  --text-2: #a1a1ab;
  --text-3: #6e6e78;
  --accent: #ec0000;
  --accent-press: #c80000;
  --on-accent: #ffffff;
  --go: #34d27f;
  --go-bg: #12291d;
  --plan: #f5b52e;
  --plan-bg: #2a2212;
  --danger: #ff8080;
  --danger-bg: #331616;
  --selected: #f4f4f6;
  --on-selected: #0e0e11;
  --shadow: 0 10px 30px rgba(0,0,0,.45);
  --plate: #f6c500;
  --plate-blue: #1f4fbf;

  /* Schalen */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --r-sm: 12px; --r: 20px;
  --t-xs: 12px; --t-sm: 14px; --t-md: 16px; --t-lg: 20px; --t-xl: 28px; --t-2xl: 40px;

  color-scheme: dark;
}

/* Licht: expliciet gekozen, of systeem staat op licht */
:root[data-theme="light"] {
  --bg: #f3f3f5;
  --surface: #ffffff;
  --surface-2: #eeeef1;
  --surface-3: #e2e2e7;
  --text: #121216;
  --text-2: #5c5c66;
  --text-3: #8a8a94;
  --accent: #d90000;
  --accent-press: #b50000;
  --go: #0f8a4a;
  --go-bg: #e3f5ea;
  --plan: #9a6400;
  --plan-bg: #fbf0d9;
  --danger: #c22424;
  --danger-bg: #fbe5e5;
  --selected: #121216;
  --on-selected: #ffffff;
  --shadow: 0 10px 30px rgba(20,20,30,.12);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]):not([data-theme="light"]) {
    --bg: #f3f3f5;
    --surface: #ffffff;
    --surface-2: #eeeef1;
    --surface-3: #e2e2e7;
    --text: #121216;
    --text-2: #5c5c66;
    --text-3: #8a8a94;
    --accent: #d90000;
    --accent-press: #b50000;
    --go: #0f8a4a;
    --go-bg: #e3f5ea;
    --plan: #9a6400;
    --plan-bg: #fbf0d9;
    --danger: #c22424;
    --danger-bg: #fbe5e5;
    --selected: #121216;
    --on-selected: #ffffff;
    --shadow: 0 10px 30px rgba(20,20,30,.12);
    color-scheme: light;
  }
}

/* ---------- Basis ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: var(--t-md)/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) var(--s4) calc(env(safe-area-inset-bottom) + var(--s4));
  max-width: 520px; margin: 0 auto;
  transition: background-color .2s, color .2s;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
h1 { font-size: var(--t-xl); line-height: 1.2; margin: var(--s2) 0 var(--s1); letter-spacing: -0.02em; }
h2, .label {
  font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .09em;
  color: var(--text-3); font-weight: 650; margin: 0 0 var(--s3);
}
.muted { color: var(--text-2); }
.small { font-size: var(--t-sm); }
.hint { color: var(--text-3); font-weight: 400; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: var(--t-xs); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Kop ---------- */
.top { display: flex; align-items: center; justify-content: space-between; padding: var(--s4) 0 var(--s3); }
.profile {
  display: flex; align-items: center; gap: var(--s2); background: none; border: 0;
  font-size: var(--t-lg); font-weight: 750; letter-spacing: -0.01em; min-height: 48px; padding: 0;
}
.profile svg { color: var(--text-3); }
.xxx { color: var(--accent); font-size: var(--t-sm); letter-spacing: -1px; font-weight: 900; }
.icon-btn {
  background: var(--surface); border: 0; border-radius: 50%; width: 48px; height: 48px;
  display: grid; place-items: center; color: var(--text-2);
}
.icon-btn:active { background: var(--surface-2); }

/* ---------- Tegoed ---------- */
.balance { display: flex; justify-content: space-between; align-items: flex-end; padding: var(--s2) 0 var(--s5); }
.balance .label { display: block; margin-bottom: var(--s1); }
.balance .sub { display: block; font-size: var(--t-sm); color: var(--text-2); font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; min-height: 20px; }
.balance strong { font-size: var(--t-xl); font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.balance .right { text-align: right; }
.balance .right strong { font-size: var(--t-lg); color: var(--text-2); font-weight: 650; }

/* ---------- Vlakken ---------- */
.card { background: var(--surface); border-radius: var(--r); padding: var(--s4); margin-bottom: var(--s3); }

/* ---------- Sessies ---------- */
.sessions { display: grid; gap: var(--s3); margin-bottom: var(--s3); }
.session {
  background: var(--go-bg); border-radius: var(--r); padding: var(--s4);
  display: grid; grid-template-columns: 1fr auto; gap: 2px var(--s3); align-items: center;
}
.session.future { background: var(--plan-bg); }
.session .tag { display: flex; align-items: center; gap: var(--s2); font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .09em; color: var(--go); font-weight: 750; }
.session .tag::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulse 2s infinite; }
.session.future .tag { color: var(--plan); }
.session.future .tag::before { animation: none; }
.session .plate-sm { font-weight: 750; font-size: var(--t-md); letter-spacing: .05em; color: var(--text-2); }
.session .time { color: var(--text-2); font-size: var(--t-sm); font-variant-numeric: tabular-nums; }
.session .left { font-size: var(--t-2xl); line-height: 1.1; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.session.future .left { font-size: var(--t-xl); }
.session .bar { grid-column: 1 / -1; height: 4px; border-radius: 4px; background: color-mix(in srgb, var(--go) 20%, transparent); margin-top: var(--s3); overflow: hidden; }
.session .bar i { display: block; height: 100%; background: var(--go); border-radius: 4px; transition: width 1s linear; }
.session .actions { grid-row: 1 / span 4; grid-column: 2; display: grid; gap: var(--s2); }
.session .actions button {
  border: 0; background: var(--surface); border-radius: var(--r-sm); min-height: 48px; padding: 0 var(--s4); font-weight: 650;
}
.session .actions .stop { background: var(--danger-bg); color: var(--danger); }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip {
  border: 0; background: var(--surface-2); border-radius: 999px; min-height: 48px; padding: 0 var(--s4);
  font-weight: 650; font-variant-numeric: tabular-nums; transition: background-color .15s, color .15s;
}
.chip:active { background: var(--surface-3); }
.chip small { color: var(--text-3); font-weight: 500; margin-left: 6px; }
.chip[aria-checked="true"], .chip.on { background: var(--selected); color: var(--on-selected); }
.chip[aria-checked="true"] small, .chip.on small { color: inherit; opacity: .6; }

/* ---------- Kentekenplaat ---------- */
.plate-input-row { margin-top: var(--s3); }
input.plate {
  width: 100%; text-align: center; text-transform: uppercase;
  background: var(--plate); color: #111; border: 0; border-radius: var(--r-sm);
  font-size: 24px; font-weight: 800; letter-spacing: .12em; min-height: 56px;
  padding: var(--s2) var(--s3) var(--s2) 44px;
  box-shadow: inset 30px 0 0 var(--plate-blue);
}
input.plate::placeholder { color: rgba(0,0,0,.4); font-size: var(--t-md); letter-spacing: .04em; font-weight: 700; text-transform: none; }

/* ---------- Segment ---------- */
.seg { display: grid; grid-template-columns: repeat(var(--n, 2), 1fr); background: var(--surface-2); border-radius: var(--r-sm); padding: var(--s1); margin-bottom: var(--s5); }
.seg button { border: 0; background: none; min-height: 44px; border-radius: 9px; font-weight: 650; color: var(--text-2); transition: background-color .15s, color .15s; }
.seg button[aria-selected="true"], .seg button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.15); }

/* ---------- Formulier ---------- */
.plan { display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--s3); margin-bottom: var(--s5); }
label { display: grid; gap: var(--s2); font-size: var(--t-sm); font-weight: 650; margin-bottom: var(--s4); color: var(--text); }
.plan label { margin: 0; }
.until { grid-template-columns: auto 1fr; align-items: center; gap: var(--s3); margin: var(--s4) 0 0; color: var(--text-2); }
input, textarea {
  font: inherit; color: var(--text); background: var(--surface-2); border: 0;
  border-radius: var(--r-sm); min-height: 48px; padding: var(--s3) var(--s4); width: 100%; min-width: 0;
}
input:focus-visible, textarea:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.summary { color: var(--text-2); margin: var(--s4) 0 0; font-size: var(--t-sm); min-height: 20px; font-variant-numeric: tabular-nums; }
#setup .card { padding: var(--s5) var(--s4); }

/* ---------- Hoofdknop ---------- */
.spacer { height: 112px; }
.cta-bar {
  position: fixed; left: 0; right: 0; bottom: 0;
  padding: var(--s5) var(--s4) calc(env(safe-area-inset-bottom) + var(--s4));
  background: linear-gradient(transparent, var(--bg) 35%);
}
.cta-bar .cta { max-width: 488px; margin: 0 auto; display: block; }
.cta {
  width: 100%; border: 0; border-radius: var(--r); min-height: 60px; font-size: 18px; font-weight: 800;
  background: var(--accent); color: var(--on-accent); letter-spacing: .01em;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: transform .1s, background-color .15s;
}
.cta:active { background: var(--accent-press); transform: scale(.98); }
.cta.busy { opacity: .7; pointer-events: none; }
.ghost {
  width: 100%; background: var(--surface-2); border: 0; border-radius: var(--r-sm);
  min-height: 48px; margin-top: var(--s2); font-weight: 650;
}
.ghost:active { background: var(--surface-3); }
.danger { color: var(--danger); background: var(--danger-bg); }
.error { color: var(--danger); min-height: 20px; font-size: var(--t-sm); }

/* ---------- Sheets ---------- */
.sheet {
  background: var(--surface); color: var(--text); border: 0; border-radius: 28px;
  width: min(480px, calc(100vw - 32px)); padding: var(--s5); box-shadow: var(--shadow);
}
.sheet::backdrop { background: rgba(0,0,0,.5); backdrop-filter: blur(2px); }
.sheet h2 { margin-bottom: var(--s4); }
.sheet .group { margin-bottom: var(--s5); }
.sheet .seg { margin-bottom: 0; }
.profile-row {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  background: var(--surface-2); border: 0; border-radius: var(--r-sm); min-height: 56px;
  padding: 0 var(--s4); margin-bottom: var(--s2); font-weight: 650; text-align: left;
}
.profile-row.on { box-shadow: inset 0 0 0 2px var(--accent); }

/* ---------- Melding ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 112px);
  background: var(--text); color: var(--bg); padding: var(--s3) var(--s4); border-radius: var(--r-sm);
  font-weight: 650; font-size: var(--t-sm); max-width: calc(100vw - 32px); z-index: 10; box-shadow: var(--shadow);
  animation: rise .2s ease-out;
}
.toast.err { background: var(--danger); color: #fff; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }

@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }

/* ---------- Parkeerregels & kosten ---------- */
.rules { background: var(--surface); border-radius: var(--r-sm); margin-bottom: var(--s3); }
.rules summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: var(--s2);
  min-height: 48px; padding: 0 var(--s4); font-size: var(--t-sm); font-weight: 650;
}
.rules summary::-webkit-details-marker { display: none; }
.rules-title { flex: 1; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rules-title::before { content: "P"; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; background: var(--plate-blue); color: #fff; font-size: 12px; font-weight: 800; margin-right: var(--s2); vertical-align: -4px; }
.rules .chev { color: var(--text-3); transition: transform .2s; flex: none; }
.rules[open] .chev { transform: rotate(180deg); }
.rules-body { padding: 0 var(--s4) var(--s4); }
.rules-body p { margin: 0; }
.pill { font-size: var(--t-xs); font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.pill.paid { background: var(--plan-bg); color: var(--plan); }
.pill.free { background: var(--go-bg); color: var(--go); }
.rules-times { margin-top: var(--s3); display: grid; gap: var(--s1); font-size: var(--t-sm); font-variant-numeric: tabular-nums; }
.rules-times div { display: flex; justify-content: space-between; color: var(--text-2); }
.rules-times div span:first-child { color: var(--text); font-weight: 600; }
.quote { margin: var(--s1) 0 0; font-size: var(--t-sm); font-weight: 650; color: var(--text); min-height: 20px; font-variant-numeric: tabular-nums; }
.diag { background: var(--surface-2); border-radius: var(--r-sm); padding: var(--s3); font-size: 11px; white-space: pre-wrap; word-break: break-word; max-height: 200px; overflow: auto; margin: var(--s2) 0 0; }

/* ---------- Aanvraagpagina ---------- */
.landing .hero { padding: var(--s3) 0 var(--s4); }
.landing .hero h1 { font-size: 30px; line-height: 1.15; letter-spacing: -0.03em; margin: 0 0 var(--s3); }
.lead { font-size: var(--t-md); color: var(--text-2); margin: 0; }
.features { list-style: none; padding: 0; margin: 0 0 var(--s5); display: grid; gap: var(--s3); }
.features li { display: grid; gap: 2px; padding-left: 28px; position: relative; }
.features li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.features b { font-size: var(--t-md); }
.features span { font-size: var(--t-sm); color: var(--text-2); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.done { font-size: var(--t-lg); font-weight: 750; color: var(--go); margin: 0 0 var(--s2); }
.disclaimer { margin: var(--s4) 0 var(--s6); }
.install { display: grid; gap: var(--s2); margin-top: var(--s3); }
.install details { background: var(--surface-2); border-radius: var(--r-sm); }
.install summary { cursor: pointer; list-style: none; min-height: 48px; display: flex; align-items: center; padding: 0 var(--s4); font-weight: 650; }
.install summary::-webkit-details-marker { display: none; }
.install summary::after { content: "⌄"; margin-left: auto; color: var(--text-3); }
.install details[open] summary::after { content: "⌃"; }
.install ol { margin: 0; padding: 0 var(--s4) var(--s4) 36px; font-size: var(--t-sm); color: var(--text-2); display: grid; gap: var(--s1); }
.sheet .install details { background: var(--surface-2); }
.sheet { max-height: 90dvh; overflow: auto; }

body:has(#invite:not([hidden])) .profile svg { display: none; }
.row .actions button, .row .actions a { white-space: nowrap; }

/* ---------- powered by ---------- */
.powered { display: block; width: max-content; margin: var(--s4) auto var(--s2); padding: 6px 12px; border-radius: 999px;
  font-size: var(--t-xs); color: var(--text-3); text-decoration: none; letter-spacing: .02em; }
.powered b { color: var(--text-2); font-weight: 700; }
.powered:hover b, .powered:active b { color: var(--text); }
