:root {
  --bg: #f6efe6;
  --surface: #fffaf4;
  --surface-2: #efe5d8;
  --text: #2b211b;
  --muted: #7a6a5e;
  --line: #e3d6c6;
  --accent: #d9583b;
  --accent-text: #ffffff;
  --accent-soft: #fbe1d8;
  --good: #2f8f5b;
  --good-soft: #dcf1e4;
  --warn: #b7791f;
  --warn-soft: #fbecd0;
  --bad: #b23a3a;
  --bad-soft: #f6dcdc;
  --shadow: 0 1px 2px rgb(60 40 20 / 6%), 0 6px 20px rgb(60 40 20 / 8%);
  --radius: 18px;
  --font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1714;
    --surface: #26201c;
    --surface-2: #322a24;
    --text: #f4ebe2;
    --muted: #b3a294;
    --line: #3c332c;
    --accent: #f07a5c;
    --accent-text: #1b1714;
    --accent-soft: #4a2a21;
    --good: #6fd19a;
    --good-soft: #1f3a2a;
    --warn: #f1b75a;
    --warn-soft: #3d2f17;
    --bad: #f08b8b;
    --bad-soft: #432323;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 6px 20px rgb(0 0 0 / 25%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 20px) 16px calc(env(safe-area-inset-bottom) + 96px);
}

h1 { font-size: 1.75rem; line-height: 1.15; margin: 0 0 4px; letter-spacing: -0.02em; }
h2 { font-size: 1.1rem; margin: 0 0 10px; }
h3 { font-size: 1rem; margin: 0; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

.header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.header .sub { color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

button, .btn {
  font: inherit;
  font-weight: 650;
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--text);
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: transform 0.08s ease, opacity 0.15s ease;
}
button:active { transform: scale(0.98); }
button:disabled { opacity: 0.55; cursor: default; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-ghost { background: transparent; border: 1px solid var(--line); }
.btn-small { min-height: 36px; padding: 6px 12px; font-size: 0.875rem; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-big { margin-bottom: 14px; min-height: 58px; font-size: 1.1rem; border-radius: 18px; }
.btn-danger { color: var(--bad); }
.icon-btn { min-height: 40px; width: 40px; padding: 0; border-radius: 12px; }

label { display: block; font-weight: 600; margin-bottom: 6px; }
input, textarea, select {
  font: inherit;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
}
textarea { min-height: 90px; resize: vertical; }
.field + .field { margin-top: 14px; }
.pin-input { letter-spacing: 0.4em; font-size: 1.4rem; text-align: center; }

.tabs { display: flex; background: var(--surface-2); padding: 4px; border-radius: 14px; margin-bottom: 16px; }
.tabs button { flex: 1; min-height: 40px; background: transparent; }
.tabs button[aria-selected="true"] { background: var(--surface); box-shadow: var(--shadow); }

/* Voortgang */
.progress { display: flex; align-items: center; gap: 18px; }
.ring { width: 112px; height: 112px; flex: none; }
.ring circle { fill: none; stroke-width: 10; }
.ring .track { stroke: var(--surface-2); }
.ring .bar { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 0.6s ease; }
.ring .done { stroke: var(--good); }
.ring text { fill: var(--text); font-family: var(--font); font-weight: 800; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 700;
  background: var(--surface-2); color: var(--muted);
}
.badge.verdiend { background: var(--warn-soft); color: var(--warn); }
.badge.goedgekeurd { background: var(--good-soft); color: var(--good); }
.badge.uitbetaald { background: var(--good-soft); color: var(--good); }
.badge.afgewezen { background: var(--bad-soft); color: var(--bad); }

.idea { font-size: 1.15rem; font-weight: 650; line-height: 1.35; min-height: 3em; }

/* Familielijst */
.family li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.family li:first-child { border-top: 0; }
.dot { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font-weight: 800; background: var(--kid, var(--accent)); }
.bars { display: flex; gap: 4px; }
.bars span { width: 18px; height: 8px; border-radius: 4px; background: var(--surface-2); }
.bars span.on { background: var(--kid, var(--accent)); }
ul { list-style: none; padding: 0; margin: 0; }

/* Album */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.grid button { padding: 0; min-height: 0; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-2); position: relative; }
.grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.grid .date { position: absolute; left: 6px; bottom: 6px; font-size: 0.7rem; background: rgb(0 0 0 / 55%); color: #fff; padding: 2px 6px; border-radius: 6px; }
.empty { text-align: center; color: var(--muted); padding: 24px 8px; }

/* Foto kiezen */
.photo-pick {
  display: grid; place-items: center; gap: 6px;
  width: 100%; aspect-ratio: 4 / 3; border-radius: var(--radius);
  border: 2px dashed var(--line); background: var(--surface-2); color: var(--muted);
  overflow: hidden; padding: 0; min-height: 0;
}
.photo-pick img { width: 100%; height: 100%; object-fit: cover; }
.photo-pick .big { font-size: 2.4rem; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 40px; padding: 8px 14px; border-radius: 999px;
  border: 2px solid var(--line); background: var(--surface); font-weight: 650;
}
.chip[aria-pressed="true"] { border-color: var(--kid, var(--accent)); background: var(--kid, var(--accent)); color: #fff; }

/* Verhalen */
.story q { display: block; font-weight: 700; quotes: none; margin-bottom: 6px; }
.story .answer { white-space: pre-wrap; }

/* Navigatie onderin */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center; gap: 4px;
  padding: 8px 12px calc(env(safe-area-inset-bottom) + 8px);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.nav a {
  flex: 1; max-width: 140px; text-align: center; text-decoration: none; color: var(--muted);
  font-size: 0.75rem; font-weight: 700; padding: 6px 4px; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.nav a .ic { font-size: 1.35rem; line-height: 1; }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

/* Dialoog */
dialog {
  border: 0; padding: 0; border-radius: var(--radius); background: var(--surface); color: var(--text);
  width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 40px);
}
dialog::backdrop { background: rgb(0 0 0 / 55%); }
dialog img { width: 100%; display: block; max-height: 65dvh; object-fit: contain; background: #000; }
dialog .body { padding: 16px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 50;
  bottom: calc(env(safe-area-inset-bottom) + 88px);
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 14px;
  font-weight: 650; max-width: calc(100vw - 32px); box-shadow: var(--shadow);
}
.toast.error { background: var(--bad); color: #fff; }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; }

.admin-kid { border-left: 6px solid var(--kid, var(--accent)); }
.admin-kid .actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.month-nav strong { text-transform: capitalize; }
.inactive { opacity: 0.55; }

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

/* ---------- Inchecken, oma en meldingen ---------- */
.center { text-align: center; }
.hint { margin: 6px 0 0; }
.warning { color: var(--warn); background: var(--warn-soft); padding: 8px 12px; border-radius: 10px; font-weight: 600; }
.notice { border-color: var(--warn); }
.checked-in { background: var(--good-soft); border-color: transparent; }
.checked-in h2 { color: var(--good); }

.qr-box { display: grid; place-items: center; min-height: 240px; }
.qr { width: min(100%, 320px); height: auto; image-rendering: pixelated; border-radius: 12px; }

.btn-huge { min-height: 84px; font-size: 1.4rem; border-radius: 22px; margin-bottom: 14px; }
.oma-text { font-size: 1.15rem; }
.today-list li { padding: 6px 0; font-size: 1.15rem; font-weight: 650; }
.more { margin-top: 12px; }

.scanner { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; aspect-ratio: 3 / 4; margin-bottom: 14px; }
.scanner-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner-target {
  position: absolute; inset: 18%; border: 4px solid rgb(255 255 255 / 85%); border-radius: 18px;
  box-shadow: 0 0 0 9999px rgb(0 0 0 / 35%);
}
.scan-result { text-align: center; padding: 24px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.scan-result > * + * { margin-top: 14px; }
.scan-result.ok { background: var(--good-soft); border-color: var(--kid, var(--good)); border-width: 3px; }
.scan-result.error { background: var(--bad-soft); }
.big-text { font-size: 3.5rem; line-height: 1; margin: 0; }
.big-name { font-size: 1.8rem; font-weight: 800; line-height: 1.2; }

.grid .flag { position: absolute; right: 6px; top: 6px; font-size: 0.9rem; background: rgb(255 255 255 / 85%); border-radius: 6px; padding: 0 4px; }
.grid .no-photo { display: grid; place-items: center; width: 100%; height: 100%; font-size: 1.6rem; opacity: 0.5; }
.checkin-list li { padding: 6px 0; gap: 8px; border-top: 1px solid var(--line); }
.checkin-list li:first-child { border-top: 0; }
.kids-admin li { flex-direction: column; align-items: stretch; }

/* ---------- Zonder internet ---------- */
.queue-card { border-color: var(--warn); background: var(--warn-soft); }
.queue-card > * + * { margin-top: 12px; }
.queue-failed { border-top: 1px solid var(--line); padding-top: 10px; }
.offline-note { background: var(--warn-soft); color: var(--text); padding: 10px 12px; border-radius: 12px; font-weight: 600; }
