:root {
  --bg: #f3f8fb;
  --card: #ffffff;
  --ink: #1d2b36;
  --muted: #5d6f7d;
  --line: #dbe6ee;
  --brand: #0b7fab;
  --brand-dark: #075f80;
  --brand-soft: #e2f3fa;
  --ok: #1f8a4c;
  --ok-soft: #e3f5ea;
  --warn: #b26a00;
  --warn-soft: #fff3dc;
  --bad: #c62f2f;
  --bad-soft: #fde8e8;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 40, 60, .06), 0 2px 8px rgba(16, 40, 60, .05);
  --s0: #c9d3db; --s1: #f2b544; --s2: #7cc4e4; --s3: #2fa56a;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* --- layout --- */
.shell { display: flex; min-height: 100vh; }
.side { width: 230px; background: #0d3b52; color: #e7f3f9; padding: 1rem .75rem; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .logo { font-weight: 700; font-size: 1.15rem; padding: .25rem .5rem 1rem; display: flex; gap: .5rem; align-items: center; color: #fff; text-decoration: none; }
.side nav a { display: flex; align-items: center; gap: .6rem; color: #cfe6f1; text-decoration: none; padding: .6rem .7rem; border-radius: 8px; font-size: .95rem; }
.side nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.side nav a.actief { background: var(--brand); color: #fff; }
.side .kop { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: #8fb5c8; margin: 1rem .7rem .3rem; }
.side .wie { border-top: 1px solid rgba(255,255,255,.12); margin-top: 1rem; padding: .75rem .7rem 0; font-size: .85rem; color: #b8d4e1; }
.side .wie button { background: none; border: 0; color: #cfe6f1; padding: 0; text-decoration: underline; cursor: pointer; font: inherit; }
.main { flex: 1; min-width: 0; padding: 1.5rem 2rem 3rem; max-width: 1200px; }
.topbar { display: none; }
.fictief { background: var(--warn-soft); color: var(--warn); border: 1px solid #f0d49a; padding: .4rem .8rem; border-radius: 8px; font-size: .85rem; margin-bottom: 1rem; }

@media (max-width: 899px) {
  .shell { display: block; }
  .side { position: fixed; inset: 0 auto 0 0; z-index: 30; transform: translateX(-100%); transition: transform .2s; width: 260px; }
  #navtoggle:checked ~ .shell .side { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .topbar { display: flex; align-items: center; gap: .75rem; background: #0d3b52; color: #fff; padding: .6rem 1rem; position: sticky; top: 0; z-index: 20; }
  .topbar label { font-size: 1.5rem; cursor: pointer; line-height: 1; padding: .25rem .4rem; }
  .topbar b { font-size: 1.05rem; }
  .main { padding: 1rem 1rem 3rem; }
}
#navtoggle { display: none; }

/* --- components --- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.grid { display: grid; gap: 1rem; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); }
.stat { font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .85rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }
.stack > * + * { margin-top: .6rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: .55rem 1rem; border-radius: 10px; border: 1px solid var(--brand); background: var(--brand); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--brand-dark); }
.btn.sec { background: #fff; color: var(--brand); }
.btn.sec:hover { background: var(--brand-soft); }
.btn.ok { background: var(--ok); border-color: var(--ok); }
.btn.bad { background: #fff; color: var(--bad); border-color: #e6b3b3; }
.btn.sm { min-height: 36px; padding: .3rem .7rem; font-size: .9rem; }
.btn.big { min-height: 56px; font-size: 1.1rem; padding: .7rem 1.4rem; }
.linkbtn { background: none; border: 0; color: var(--brand); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }

.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--brand-soft); color: var(--brand-dark); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.grijs { background: #eef2f5; color: var(--muted); }
.saldo-groot { font-size: 2.2rem; font-weight: 800; }
.saldo-groot.bad { color: var(--bad); }
.saldo-groot.ok { color: var(--ok); }
.alert { padding: .75rem 1rem; border-radius: 10px; margin-bottom: 1rem; background: var(--ok-soft); color: #145c33; border: 1px solid #bfe5cd; }
.alert.bad { background: var(--bad-soft); color: #8d1f1f; border-color: #f1c2c2; }
.alert.warn { background: var(--warn-soft); color: #7a4a00; border-color: #f0d49a; }

/* --- forms --- */
label.f { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .25rem; }
.field { margin-bottom: .9rem; }
.field .hint { font-size: .82rem; color: var(--muted); margin-top: .2rem; }
.field .err { font-size: .85rem; color: var(--bad); margin-top: .2rem; }
.field.has-err input, .field.has-err select, .field.has-err textarea { border-color: var(--bad); background: #fffafa; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=date], input[type=time],
input[type=number], input[type=search], select, textarea {
  width: 100%; min-height: 44px; padding: .55rem .7rem; border: 1px solid #c3d3de; border-radius: 9px; font: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(11,127,171,.25); border-color: var(--brand); }
.check { display: flex; gap: .55rem; align-items: flex-start; min-height: 36px; cursor: pointer; }
.check input { width: 22px; height: 22px; margin-top: .1rem; flex-shrink: 0; accent-color: var(--brand); }
.chips { display: flex; gap: .5rem; flex-wrap: wrap; }
.chips label { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid #c3d3de; border-radius: 999px; padding: .4rem .9rem; cursor: pointer; background: #fff; min-height: 40px; }
.chips input { accent-color: var(--brand); width: 18px; height: 18px; }
.inline-form { display: inline; }
.search-big { font-size: 1.2rem !important; min-height: 56px !important; padding-left: 1rem !important; }

/* --- tables --- */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.klik { cursor: pointer; }
tr.klik:hover td { background: #f7fbfd; }

/* --- desk --- */
.desk-result { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; text-decoration: none; color: inherit; margin-bottom: .6rem; box-shadow: var(--shadow); }
.desk-result:hover { border-color: var(--brand); }
.desk-result .naam { font-weight: 700; font-size: 1.05rem; }
.desk-result .badge { font-size: 1rem; padding: .35rem .8rem; }
.kidline { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .6rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.kidline:last-child { border-bottom: 0; }

/* --- attendance --- */
.att { display: inline-flex; gap: .3rem; }
.att button { min-height: 40px; min-width: 44px; border-radius: 9px; border: 1px solid #c3d3de; background: #fff; font: inherit; font-size: .85rem; cursor: pointer; padding: 0 .55rem; }
.att button.on.aanwezig { background: var(--ok); color: #fff; border-color: var(--ok); }
.att button.on.afwezig { background: var(--bad); color: #fff; border-color: var(--bad); }
.att button.on.afgemeld { background: var(--warn); color: #fff; border-color: var(--warn); }

/* --- scoring --- */
.kid { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.kid-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .6rem; }
.kid-head .naam { font-size: 1.15rem; font-weight: 700; }
.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .5rem; }
.skill { display: flex; flex-direction: column; gap: .4rem; padding: .55rem .6rem; border: 1px solid var(--line); border-radius: 10px; }
.skill .sn { font-size: .92rem; line-height: 1.25; min-height: 2.5em; }
.lvl { display: flex; gap: 4px; }
.lvl button { flex: 1; height: 44px; border-radius: 8px; border: 1px solid #c3d3de; background: #fff; cursor: pointer; font-weight: 700; color: var(--muted); font-size: 1rem; }
.lvl button.on[data-n="0"] { background: var(--s0); color: #333; border-color: var(--s0); }
.lvl button.on[data-n="1"] { background: var(--s1); color: #3d2800; border-color: var(--s1); }
.lvl button.on[data-n="2"] { background: var(--s2); color: #06384d; border-color: var(--s2); }
.lvl button.on[data-n="3"] { background: var(--s3); color: #fff; border-color: var(--s3); }
.progress { height: 10px; background: #e7eef3; border-radius: 999px; overflow: hidden; min-width: 120px; }
.progress > span { display: block; height: 100%; background: var(--s3); border-radius: 999px; }
.legend { display: flex; gap: .9rem; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: .3rem; }

/* --- mail preview --- */
.mailpreview { border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
.mailpreview .hdr { background: #f6f9fb; padding: .6rem .9rem; border-bottom: 1px solid var(--line); font-size: .9rem; }
.placeholders code { display: inline-block; background: var(--brand-soft); color: var(--brand-dark); padding: .1rem .4rem; border-radius: 6px; margin: .15rem .15rem; cursor: pointer; font-size: .85rem; }

/* --- public --- */
.pub-head { background: linear-gradient(135deg, #0b7fab, #13a3c9); color: #fff; padding: 1.4rem 1rem 3.2rem; text-align: center; }
.pub-head .naam { font-size: 1.6rem; font-weight: 800; letter-spacing: .01em; }
.pub-head .sub { opacity: .9; }
.pub-main { max-width: 760px; margin: -2.2rem auto 3rem; padding: 0 1rem; }
.pub-main .card { padding: 1.4rem; }
.keuze { display: block; padding: 1.2rem; border: 2px solid var(--line); border-radius: 14px; text-decoration: none; color: inherit; background: #fff; }
.keuze:hover { border-color: var(--brand); }
.keuze b { font-size: 1.15rem; color: var(--brand-dark); }
fieldset { min-width: 0; border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1rem .25rem; margin: 0 0 1rem; }
legend { font-weight: 700; padding: 0 .4rem; }
.hp { position: absolute; left: -5000px; width: 1px; height: 1px; overflow: hidden; }
.fakepay { max-width: 420px; margin: 3rem auto; }

/* --- scan --- */
.scan-naam { font-size: 2rem; font-weight: 800; line-height: 1.15; }
.scan-kaart.geblokkeerd { border: 3px solid var(--bad); background: #fff7f7; }
.big-badge { font-size: 1.05rem; padding: .4rem .9rem; }
.badge.feest { background: #fde7f6; color: #a3237c; }
.popup { position: fixed; inset: 0; margin: auto; z-index: 50; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; border: 0; border-radius: 16px; padding: 1.4rem; box-shadow: 0 0 0 100vmax rgba(10, 30, 45, .55), 0 10px 40px rgba(0,0,0,.3); background: #fff; color: var(--ink); }
.popup::backdrop { background: rgba(10, 30, 45, .55); }
.popup-blok { border-top: 10px solid var(--bad); }
.popup-titel { font-size: 1.6rem; font-weight: 900; color: var(--brand-dark); }
.popup-blok .popup-titel { color: var(--bad); font-size: 2rem; }
.popup-naam { font-size: 1.2rem; font-weight: 700; margin: .2rem 0 .8rem; }
.popup-regel { padding: .6rem .8rem; border-radius: 10px; background: var(--brand-soft); margin: 0 0 .6rem; }
.popup-regel.blokkade { background: var(--bad-soft); color: #8d1f1f; font-weight: 700; }
.popup-regel.waarschuwing { background: var(--warn-soft); color: #7a4a00; }
.feedback-knop { position: fixed; right: 16px; bottom: 16px; z-index: 40; border: 0; border-radius: 999px; padding: .7rem 1.1rem; min-height: 44px; background: var(--brand); color: #fff; font: inherit; font-weight: 700; box-shadow: 0 4px 14px rgba(11,127,171,.35); cursor: pointer; }
.feedback-knop:hover { background: var(--brand-dark); }
@media print { .feedback-knop, .side, .topbar, .fictief { display: none !important; } }
.pub-main { padding-bottom: 4.5rem; }
