:root {
  --bg: #0f172a;
  --paneel: #1e293b;
  --paneel-2: #273449;
  --rand: #334155;
  --tekst: #f1f5f9;
  --gedimd: #94a3b8;
  --groen: #16a34a;
  --oranje: #d97706;
  --rood: #dc2626;
  --accent: #38bdf8;
  --radius: 12px;
  --kop-hoogte: auto;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Eigen display-regels mogen [hidden] niet overrulen. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--tekst);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  overscroll-behavior-y: none;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

/* ---------------------------------------------------------------- login */
.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(360px, 100%);
  background: var(--paneel);
  border: 1px solid var(--rand);
  border-radius: 16px;
  padding: 28px 22px;
  display: grid;
  gap: 12px;
  text-align: center;
}
.login-card h1 { margin: 0; font-size: 24px; }
.login-card .sub { margin: -6px 0 8px; color: var(--gedimd); font-size: 14px; }
.login-card input {
  background: var(--bg);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}
.login-card input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.primary {
  background: var(--accent);
  color: #062338;
  font-weight: 700;
  border-radius: var(--radius);
  padding: 14px;
}
.primary:disabled { opacity: .6; }
.fout {
  margin: 4px 0 0;
  color: #fca5a5;
  font-size: 14px;
  background: rgba(220, 38, 38, .12);
  border: 1px solid rgba(220, 38, 38, .4);
  border-radius: 10px;
  padding: 10px;
}

/* ------------------------------------------------------------------ kop */
.kop {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(15, 23, 42, .96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rand);
  padding: max(8px, env(safe-area-inset-top)) 12px 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}
.kop-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kop-titel { display: flex; flex-direction: column; min-width: 0; }
.kop-titel strong { font-size: 17px; }
.bron { font-size: 11px; color: var(--gedimd); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kop-acties { display: flex; gap: 6px; flex: none; }
.icoonknop {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--paneel);
  border: 1px solid var(--rand);
  font-size: 18px;
  display: grid; place-items: center;
}
.icoonknop:active { background: var(--paneel-2); }
.icoonknop.bezig { animation: draai 1s linear infinite; }
@keyframes draai { to { transform: rotate(360deg); } }

/* -------------------------------------------------------------- dagen */
.dagen {
  display: grid;
  grid-auto-flow: column;
  /* minmax(0,…) zodat lange dagnamen de kop niet breder maken dan het scherm */
  grid-auto-columns: minmax(0, 1fr);
  gap: 4px;
  background: var(--paneel);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  padding: 4px;
}
.dagen button {
  padding: 10px 4px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 14px;
  color: var(--gedimd);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dagen button[aria-selected="true"] { background: var(--accent); color: #062338; }

/* ----------------------------------------------------------- zoekbalk */
.zoekbalk { display: flex; gap: 6px; }
.zoekbalk input {
  flex: 1;
  min-width: 0;
  background: var(--paneel);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.zoekbalk input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.filterknop {
  flex: none;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--paneel);
  border: 1px solid var(--rand);
  font-size: 13px;
  color: var(--gedimd);
}
.filterknop[aria-pressed="true"] {
  background: rgba(217, 119, 6, .2);
  border-color: var(--oranje);
  color: #fbbf24;
}

/* --------------------------------------------------------- voortgang */
.voortgang { display: grid; gap: 5px; }
.balk { height: 6px; background: var(--paneel); border-radius: 99px; overflow: hidden; }
.balk span { display: block; height: 100%; width: 0; background: var(--groen); transition: width .25s; }
.tellers { display: flex; gap: 10px; font-size: 12px; color: var(--gedimd); flex-wrap: wrap; }
.tellers b { font-weight: 700; }
.t-aanwezig { color: #4ade80; }
.t-checken { color: #fbbf24; }
.t-afwezig { color: #f87171; }

/* -------------------------------------------------------------- lijst */
.lijst { padding: 0 0 90px; }
.groep-kop {
  position: sticky;
  top: var(--kop-hoogte);
  z-index: 10;
  background: var(--paneel-2);
  border-top: 1px solid var(--rand);
  border-bottom: 1px solid var(--rand);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}
.groep-kop .groep-naam { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.groep-kop .groep-telling { flex: none; font-weight: 600; font-size: 12px; color: var(--gedimd); }
.groep-kop.klaar .groep-telling { color: #4ade80; }

.rij {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 0;
  border-bottom: 1px solid rgba(51, 65, 85, .6);
  border-left: 4px solid transparent;
}
.rij.s-aanwezig { border-left-color: var(--groen); }
.rij.s-checken { border-left-color: var(--oranje); }
.rij.s-afwezig { border-left-color: var(--rood); background: rgba(220, 38, 38, .07); }
.rij.niet-vandaag { opacity: .45; }

.rij-naam {
  flex: 1;
  min-width: 0;
  text-align: left;
  padding: 12px 4px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rij-naam .naam { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rij-naam .meta { font-size: 11px; color: var(--gedimd); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--paneel-2);
  border: 1px solid var(--rand);
}
.badge.leiding { background: rgba(56, 189, 248, .15); border-color: var(--accent); color: #7dd3fc; }
.badge.notitie { background: rgba(217, 119, 6, .18); border-color: var(--oranje); color: #fbbf24; text-transform: none; }
.badge.medisch { background: rgba(220, 38, 38, .18); border-color: var(--rood); color: #fca5a5; }

/* ------------------------------------------------------ statusknoppen */
.statusknoppen { display: flex; gap: 4px; flex: none; }
.statusknoppen button {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: var(--paneel);
  border: 1px solid var(--rand);
  color: var(--gedimd);
  font-size: 19px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.statusknoppen button:active { transform: scale(.94); }
.statusknoppen button[aria-pressed="true"].k-aanwezig { background: var(--groen); border-color: var(--groen); color: #fff; }
.statusknoppen button[aria-pressed="true"].k-checken { background: var(--oranje); border-color: var(--oranje); color: #fff; }
.statusknoppen button[aria-pressed="true"].k-afwezig { background: var(--rood); border-color: var(--rood); color: #fff; }

.statusknoppen.groot { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.statusknoppen.groot button {
  width: auto;
  height: 54px;
  font-size: 14px;
  flex-direction: column;
  gap: 2px;
}
.statusknoppen.groot .k-label { font-size: 11px; font-weight: 600; }

/* -------------------------------------------------------------- modal */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; }
.modal-achtergrond { position: absolute; inset: 0; background: rgba(0, 0, 0, .6); }
.modal-kaart {
  position: relative;
  width: 100%;
  max-height: 92dvh;
  overflow-y: auto;
  background: var(--paneel);
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  border-top: 1px solid var(--rand);
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  animation: omhoog .18s ease-out;
}
@keyframes omhoog { from { transform: translateY(14px); opacity: .4; } }
.modal-kop { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.modal-kop h2 { margin: 0; font-size: 20px; }
.modal-groep { margin: 2px 0 0; font-size: 13px; color: var(--gedimd); }
.modal-inhoud { display: grid; gap: 12px; margin-top: 14px; }

.veldlabel { font-size: 13px; font-weight: 600; color: var(--gedimd); margin-bottom: -6px; }
.dagnoot { font-weight: 400; }
#mOpmerking {
  background: var(--bg);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  padding: 12px;
  resize: vertical;
  width: 100%;
}
#mOpmerking:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.opslagstatus { margin: -8px 0 0; font-size: 12px; color: var(--gedimd); min-height: 16px; }

.contact { display: grid; gap: 6px; }
.contact a, .contact .regel {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  padding: 12px;
  color: inherit;
  text-decoration: none;
  word-break: break-word;
}
.contact a:active { background: var(--paneel-2); }
.contact .label { font-size: 11px; color: var(--gedimd); display: block; }
.contact .waarde { font-size: 15px; font-weight: 600; }
.contact .ico { font-size: 18px; flex: none; }

.extra { display: grid; gap: 6px; font-size: 13px; color: var(--gedimd); }
.extra .item { background: var(--bg); border: 1px solid var(--rand); border-radius: 10px; padding: 10px 12px; }
.extra .item b { color: var(--tekst); }
.extra .item.waarschuwing { border-color: var(--rood); background: rgba(220, 38, 38, .1); color: #fecaca; }

/* -------------------------------------------------------------- overig */
.leeg { text-align: center; color: var(--gedimd); padding: 30px 20px; }
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 200;
  background: var(--paneel-2);
  border: 1px solid var(--rand);
  border-radius: 16px;
  padding: 10px 18px;
  font-size: 13px;
  width: max-content;
  max-width: min(420px, calc(100vw - 24px));
  text-align: left;
  white-space: pre-line;
  line-height: 1.5;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
}
.toast.fout { border-color: var(--rood); color: #fca5a5; }
.toast.ok { border-color: var(--groen); }

@media (min-width: 700px) {
  .kop, .lijst, .leeg { max-width: 720px; margin-inline: auto; }
  .modal { align-items: center; justify-content: center; padding: 20px; }
  .modal-kaart { max-width: 520px; border-radius: 18px; border: 1px solid var(--rand); }
}
