:root {
  --bg: #eef1f5; --surface: #ffffff; --sunk: #f3f4f6; --ink: #1c1c1c; --muted: #5c5c5c; --line: #d9d9d9;
  --accent: #1c1c1c; --accent-ink: #ffffff; --brand: #e30613;
  --good: #1e6b3a; --good-bg: #e4f3e8; --bad: #b42318; --bad-bg: #fdecea; --warn: #8a5a00; --warn-bg: #fdf2dc;
  --oefen: #f3c94a; --oefen-ink: #2b2200;
  --g-jongens: #e6f0fb; --g-jongens-v: #7fb0e3;
  --g-meisjes: #fbe9f1; --g-meisjes-v: #e895b8;
  --g-baby: #efefef; --g-baby-v: #b5b5b5;
  --g-overig: #fdf2dc; --g-overig-v: #e0b45a;
  --r: 14px;
  --f: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --f-mono: ui-monospace, SFMono-Regular, Consolas, monospace;
}
* { box-sizing: border-box }
html, body { height: 100% }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f); font-size: 16px;
  display: flex; flex-direction: column; overflow: hidden;
  -webkit-user-select: none; user-select: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
body.oefen { --bg: #fbf3d6 }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation }
input, select, textarea { font: inherit; -webkit-user-select: text; user-select: text }
.mono, code { font-family: var(--f-mono) }
[hidden] { display: none !important }

/* Balk */
.bar {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.merknaam { font-weight: 800; letter-spacing: .02em; font-size: 1.15rem; white-space: nowrap }
.merknaam span { font-weight: 400; color: var(--muted) }
.bar-mid { display: flex; gap: 8px; align-items: center; flex: 1; min-width: 0 }
.bar-rechts { display: flex; gap: 8px; align-items: center }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--sunk); font-size: .9rem; white-space: nowrap; border: 0 }
.knop-chip { background: var(--sunk) }
.net i { width: 9px; height: 9px; border-radius: 50%; background: var(--good) }
.net.uit i { background: var(--bad) }
.net b { font-weight: 500 }
.ikoon-knop, .oefen-knop { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 14px; font-size: .95rem }
.oefen-knop.aan { background: var(--oefen); color: var(--oefen-ink); border-color: var(--oefen); font-weight: 700 }
.oefenband { background: var(--oefen); color: var(--oefen-ink); text-align: center; font-weight: 700; padding: 6px; font-size: .95rem }

/* Kassascherm */
.kassa { flex: 1; min-height: 0; display: grid; grid-template-columns: 170px 1fr 340px; gap: 12px; padding: 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)) }
.groepen { display: flex; flex-direction: column; gap: 10px; overflow-y: auto }
.groep {
  border: 0; border-radius: var(--r); padding: 18px 12px; text-align: left; font-weight: 700; font-size: 1.05rem;
  background: var(--g, var(--surface)); border-left: 8px solid var(--gv, var(--line)); min-height: 64px;
}
.groep.actief { outline: 3px solid var(--ink); outline-offset: -3px }
.knoppen { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); grid-auto-rows: 96px; gap: 10px; overflow-y: auto; align-content: start }
.merk {
  border: 0; border-radius: var(--r); background: var(--g, var(--surface)); border-bottom: 5px solid var(--gv, var(--line));
  padding: 10px; font-size: 1.05rem; font-weight: 600; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.merk:active, .groep:active, .toets:active, .bw:active { transform: scale(.97) }
.merk small { font-weight: 400; color: var(--muted); font-size: .85rem }

/* Bon */
.bon { background: var(--surface); border-radius: var(--r); display: flex; flex-direction: column; min-height: 0; box-shadow: 0 1px 3px rgba(0,0,0,.08) }
.bon-kop { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); font-weight: 700 }
.link-knop { border: 0; background: none; color: var(--bad); font-size: .9rem; padding: 4px }
.link-knop:disabled { color: var(--line) }
.regels { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1 }
.regels li { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--sunk) }
.regels li .nm { flex: 1; min-width: 0 }
.regels li .nm small { display: block; color: var(--muted); font-size: .8rem }
.regels li .bd { font-variant-numeric: tabular-nums; font-weight: 600 }
.regels li.retour .bd { color: var(--bad) }
.regels li .nm { cursor: pointer }
.regels li .bd s { display: block; color: var(--muted); font-weight: 400; font-size: .8rem; text-align: right }
.regels li .kort { color: var(--warn); font-size: .8rem; display: block }
.regels li button.pct { font-size: .95rem; font-weight: 700; color: var(--warn) }
.regels li button { border: 0; background: var(--sunk); border-radius: 8px; width: 34px; height: 34px; font-size: 1.1rem; color: var(--muted) }
.leeg-tekst { color: var(--muted); text-align: center; padding: 30px 16px; flex: 1 }
.bon-voet { border-top: 1px solid var(--line); padding: 14px 16px }
.bonkort-rij { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px }
.kort-knop { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 12px; font-size: .9rem; color: var(--warn); font-weight: 600 }
.kort-knop:disabled { color: var(--line) }
.kort-knop.aan { background: var(--warn-bg); border-color: var(--warn) }
#bonkort-bedrag { color: var(--warn); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; font-size: .92rem }
.totaal { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.1rem }
.totaal b { font-size: 1.9rem; font-variant-numeric: tabular-nums }
.stuks { color: var(--muted); font-size: .9rem; margin: 2px 0 12px }
.hoofdknop { width: 100%; border: 0; border-radius: 12px; padding: 16px; background: var(--accent); color: var(--accent-ink); font-size: 1.15rem; font-weight: 700 }
.hoofdknop:disabled { background: var(--line); color: #fff }
.tweede { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 14px 16px; font-size: 1rem }
.gevaar { border: 1px solid var(--bad); background: var(--bad-bg); color: var(--bad); border-radius: 12px; padding: 14px 16px; font-size: 1rem }

/* Dialogen */
.dlg { border: 0; padding: 0; border-radius: 20px; max-width: min(760px, 96vw); width: 100%; background: var(--surface); color: var(--ink); max-height: 94vh }
.dlg::backdrop { background: rgba(20,20,20,.45) }
.dlg-in { padding: 22px 24px; position: relative }
.dlg-in.smal { max-width: 440px; margin: 0 auto }
.dlg:has(.smal) { max-width: 460px }
.dlg h2 { margin: 0 0 14px; font-size: 1.35rem }
.dlg h3 { margin: 0 0 10px; font-size: 1.05rem }
.sluit { position: absolute; right: 12px; top: 10px; border: 0; background: none; font-size: 1.8rem; color: var(--muted); width: 44px; height: 44px }
.dlg-knoppen { display: flex; gap: 10px; margin-top: 18px; align-items: center }
.dlg-knoppen > * { flex: 1 }
.dlg-knoppen.rij-wrap { flex-wrap: wrap }
.dlg-knoppen.rij-wrap > * { flex: 1 1 200px }
.hint { color: var(--muted); font-size: .92rem; margin: 6px 0 }
.groot-hint { font-size: 1.25rem; line-height: 1.5; text-align: center; margin: 18px 0 }

.prijs-scherm { font-size: 2.6rem; text-align: right; padding: 10px 14px; background: var(--sunk); border-radius: 12px; font-variant-numeric: tabular-nums; margin-bottom: 10px }
.prijs-scherm.retour { color: var(--bad) }
.vink { display: flex; gap: 10px; align-items: center; margin: 8px 0; font-size: 1rem }
.vink input { width: 22px; height: 22px }
.toetsen { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px }
.toets { border: 0; background: var(--sunk); border-radius: 12px; height: 64px; font-size: 1.5rem; font-weight: 600 }
.toets.klein { font-size: 1rem }
.toets:disabled { opacity: .3 }

.soort { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px }
.soort button { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px; font-size: 1.05rem; font-weight: 600 }
.soort button.gekozen { background: var(--ink); color: #fff; border-color: var(--ink) }
#kort-snel { grid-template-columns: repeat(4, 1fr); margin: 8px 0 }
.af-totaal { font-size: 1.2rem; display: flex; justify-content: space-between; align-items: baseline; padding: 12px 16px; background: var(--sunk); border-radius: 12px }
.af-totaal b { font-size: 2.2rem; font-variant-numeric: tabular-nums }
.betaalwijzen { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px }
.bw { border: 0; border-radius: 16px; height: 120px; font-size: 1.3rem; font-weight: 700; color: #fff }
.bw.contant { background: #1e6b3a } .bw.pin { background: #1f4f9a } .bw.cc { background: #55595e }
.snel { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 }
.snel button { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; height: 58px; font-size: 1.15rem; font-weight: 600 }
.snel button.gekozen { background: var(--ink); color: #fff; border-color: var(--ink) }
.ontvangen, .wissel { display: flex; justify-content: space-between; font-size: 1.15rem; padding: 6px 4px }
.wissel b { font-size: 1.8rem; color: var(--good) }
.klaar { text-align: center }
.klaar-titel { font-size: 1.6rem; font-weight: 800; color: var(--good); margin-top: 14px }
.klaar-wissel { font-size: 2.4rem; font-weight: 800; margin: 10px 0 }

.rapport { font-size: .98rem }
.rapport table { width: 100%; border-collapse: collapse; margin: 6px 0 14px }
.rapport td { padding: 6px 4px; border-bottom: 1px solid var(--sunk) }
.rapport td:last-child { text-align: right; font-variant-numeric: tabular-nums }
.rapport h4 { margin: 12px 0 2px; font-size: .95rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em }
.rapport .kolommen { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px }

.mw-lijst { display: grid; gap: 10px }
.mw-lijst button { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 16px; font-size: 1.1rem; text-align: left }

.instel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 24px; max-height: 64vh; overflow-y: auto }
.instel-grid .volle { grid-column: 1 / -1 }
.instel-grid label:not(.vink) { display: block; margin-bottom: 10px; font-size: .92rem; color: var(--muted) }
.instel-grid input[type=text], .instel-grid select, .instel-grid textarea { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--surface) }
.instel-grid textarea.mono { font-size: .9rem }
.rij { display: flex; gap: 10px }
.rij > * { flex: 1 }
.versie { color: var(--muted); font-size: .85rem; flex: 0 0 auto !important }

.melding { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 12px; z-index: 50; max-width: 90vw; font-size: .98rem }
.melding.fout { background: var(--bad) }

@media (max-width: 900px) {
  .kassa { grid-template-columns: 120px 1fr; grid-template-rows: 1fr auto }
  .bon { grid-column: 1 / -1; max-height: 40vh }
  .bar-rechts .ikoon-knop { padding: 8px 10px; font-size: .85rem }
  .instel-grid { grid-template-columns: 1fr }
}
/* Telefoon (komt na de tabletregels, zodat deze voorgaan) */
@media (max-width: 600px) {
  .bar { flex-wrap: wrap; gap: 6px 8px; padding: 8px 10px }
  .bar-mid { flex: 1 1 auto; gap: 6px }
  #kassanaam { display: none }
  .net b { display: none }
  .net { padding: 6px 8px }
  .bar-rechts { flex: 1 1 100%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px }
  .bar-rechts .ikoon-knop, .oefen-knop { padding: 8px 4px; font-size: .82rem }
  .kassa { grid-template-columns: 96px 1fr; gap: 8px; padding: 8px }
  .groep { padding: 12px 8px; font-size: .92rem; min-height: 52px }
  .knoppen { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); grid-auto-rows: 76px; gap: 8px }
  .merk { font-size: .95rem }
  .bon { max-height: 46vh }
  .betaalwijzen { gap: 8px } .bw { height: 90px; font-size: 1.1rem }
  .dlg-in { padding: 18px 16px }
  .rapport .kolommen { grid-template-columns: 1fr }
}
