:root {
  /* Kleuren zoals gevraagd: lichte blauwgrijze achtergrond, witte kaarten, helder blauw voor knoppen en accenten. */
  --kleur: #3767ea;
  --kleur-donker: #2a52c4;
  --kleur-licht: #e2eafd;
  --achtergrond: #c4d4fa;
  --vlak: #ffffff;
  --tekst: #17181c;
  --zacht: #5b6170;
  --lijn: #e3e7f0;
  --gevaar: #c62828;
  --schaduw: 0 1px 2px rgba(23,40,90,.06), 0 8px 24px rgba(23,40,90,.10);
  --rond: 18px;
  --veilig-boven: env(safe-area-inset-top, 0px);
  --veilig-onder: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--achtergrond);
  color: var(--tekst);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
svg.i { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---- Knoppen ---- */
.knop {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--lijn); background: var(--vlak); border-radius: 12px;
  padding: 9px 16px; cursor: pointer; white-space: nowrap; min-height: 40px;
}
.knop:hover { border-color: var(--kleur); }
.knop.hoofd { background: var(--kleur); border-color: var(--kleur); color: #fff; }
.knop.hoofd:hover { background: var(--kleur-donker); }
.knop.gevaar { color: var(--gevaar); }
.knop.gevaar.hoofd { background: var(--gevaar); border-color: var(--gevaar); color: #fff; }
.knop:disabled { opacity: .5; cursor: default; }
.icoon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border: 0; background: transparent; border-radius: 10px; cursor: pointer; flex: none;
}
.icoon:hover { background: rgba(127,127,127,.12); }

/* ---- Aanmelden ---- */
.midden { min-height: 100%; display: grid; place-items: center; padding: 24px; padding-top: calc(24px + var(--veilig-boven)); }
.kaart {
  width: 100%; max-width: 420px; background: var(--vlak); border-radius: 24px; box-shadow: var(--schaduw); padding: 28px;
}
.kaart h1 { margin: 0 0 4px; font-size: 22px; display: flex; align-items: center; gap: 10px; }
.kaart h1 svg { color: var(--kleur); width: 30px; height: 30px; }
.kaart p.uitleg { color: var(--zacht); margin: 0 0 20px; }
.veld { display: block; margin-bottom: 14px; }
.veld span { display: block; font-size: 13px; color: var(--zacht); margin-bottom: 4px; }
.veld input[type=text], .veld input[type=email], .veld input[type=password], .veld input[type=number], .invoer {
  width: 100%; padding: 11px 12px; border: 1px solid var(--lijn); border-radius: 12px; background: #f4f7fe;
}
.veld input:focus, .invoer:focus { outline: 2px solid var(--kleur); outline-offset: -1px; }
.vinkje { display: flex; gap: 8px; align-items: center; margin: 4px 0 18px; color: var(--zacht); }
.kaart .knop.hoofd { width: 100%; }
.fout { color: var(--gevaar); margin: 10px 0 0; min-height: 1.4em; }
.wachtbol { width: 46px; height: 46px; border-radius: 50%; border: 4px solid var(--kleur-licht); border-top-color: var(--kleur); animation: draai 1s linear infinite; margin: 8px auto 18px; }
@keyframes draai { to { transform: rotate(360deg); } }

/* ---- Hoofdscherm ---- */
.balk {
  position: sticky; top: 0; z-index: 20;
  background: var(--vlak); color: var(--tekst); box-shadow: 0 1px 0 var(--lijn);
  padding: calc(6px + var(--veilig-boven)) 8px 6px;
  display: flex; align-items: center; gap: 4px;
}
.balk .titel { flex: 1; font-weight: 600; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 6px; }
.balk .icoon { color: var(--tekst); }
.balk .icoon:hover { background: var(--kleur-licht); }
.zoekbalk { flex: 1; display: flex; }
.zoekbalk input { flex: 1; border: 1px solid var(--lijn); border-radius: 12px; padding: 9px 12px; background: var(--kleur-licht); color: var(--tekst); }

.kruimels {
  display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 2px; padding: 8px 10px; align-items: center;
  background: transparent; scrollbar-width: none;
}
.kruimels::-webkit-scrollbar { display: none; }
.kruimels button { border: 0; background: none; padding: 4px 6px; border-radius: 6px; cursor: pointer; white-space: nowrap; color: var(--zacht); }
.kruimels button { color: #3a4566; }
.kruimels button:last-child { color: var(--tekst); font-weight: 600; }
.kruimels button:hover { background: rgba(127,127,127,.12); }
.kruimels .sep { color: var(--zacht); opacity: .6; }

.werkbalk { display: flex; gap: 8px; padding: 10px; flex-wrap: wrap; align-items: center; }
.werkbalk .duw { flex: 1; }
.werkbalk select { border: 1px solid var(--lijn); border-radius: 12px; background: var(--vlak); padding: 8px; min-height: 40px; }

main { padding-bottom: calc(110px + var(--veilig-onder)); }

/* Lijstweergave */
.lijst { list-style: none; margin: 0 10px; padding: 0; background: var(--vlak); border-radius: var(--rond); box-shadow: var(--schaduw); overflow: hidden; }
.lijst li {
  display: flex; align-items: center; gap: 12px; padding: 8px 6px 8px 12px; border-bottom: 1px solid var(--lijn);
  cursor: pointer; user-select: none; -webkit-user-select: none; min-height: 58px;
}
.lijst li:last-child { border-bottom: 0; }
.lijst li:hover { background: rgba(127,127,127,.06); }
.lijst li.gekozen { background: var(--kleur-licht); }
.lijst .duim { width: 42px; height: 42px; border-radius: 10px; flex: none; display: grid; place-items: center; overflow: hidden; background: var(--kleur-licht); }
.lijst .duim img { width: 100%; height: 100%; object-fit: cover; }
.lijst .duim svg { width: 26px; height: 26px; }
.lijst .tekst { flex: 1; min-width: 0; }
.lijst .naam { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lijst .meta { color: var(--zacht); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lijst .kies { width: 22px; height: 22px; accent-color: var(--kleur); flex: none; }
.lijst.kiezen .kies { display: block; }
.lijst:not(.kiezen) .kies { display: none; }

/* Rasterweergave */
.raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; margin: 0 10px; padding: 0; list-style: none; }
.raster li {
  background: var(--vlak); border-radius: var(--rond); box-shadow: var(--schaduw); overflow: hidden; cursor: pointer;
  user-select: none; -webkit-user-select: none; position: relative; display: flex; flex-direction: column;
}
.raster li.gekozen { outline: 3px solid var(--kleur); }
.raster .duim { aspect-ratio: 1; display: grid; place-items: center; background: var(--kleur-licht); }
.raster .duim img { width: 100%; height: 100%; object-fit: cover; }
.raster .duim svg { width: 44px; height: 44px; }
.raster .tekst { padding: 6px 8px; }
.raster .naam { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.raster .meta { display: none; }
.raster .kies { position: absolute; top: 6px; left: 6px; width: 22px; height: 22px; accent-color: var(--kleur); }
.raster:not(.kiezen) .kies { display: none; }
.raster .meer { position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,.35); color: #fff; width: 34px; height: 34px; }

.s-map { color: var(--kleur); }
.s-afbeelding { color: #7c3aed; }
.s-video { color: #db2777; }
.s-audio { color: #0891b2; }
.s-pdf { color: #dc2626; }
.s-document { color: #2563eb; }
.s-rekenblad { color: #16a34a; }
.s-presentatie { color: #ea580c; }
.s-archief { color: #78716c; }
.s-tekst, .s-anders { color: var(--zacht); }

.leeg { text-align: center; color: var(--zacht); padding: 48px 20px; }
.leeg svg { width: 56px; height: 56px; opacity: .4; }
.kop { margin: 16px 14px 6px; font-size: 13px; color: var(--zacht); text-transform: uppercase; letter-spacing: .04em; }

/* Selectiebalk */
.selectie {
  position: fixed; left: 0; right: 0; top: 0; z-index: 30;
  background: var(--kleur); color: #fff; padding: calc(6px + var(--veilig-boven)) 8px 6px;
  display: flex; align-items: center; gap: 4px;
}
.selectie .titel { flex: 1; font-weight: 600; padding: 0 6px; }
.selectie .icoon { color: #fff; }

/* Opladen */
.zweef {
  position: fixed; right: 18px; bottom: calc(18px + var(--veilig-onder)); z-index: 25;
  width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--kleur); color: #fff;
  box-shadow: 0 6px 20px rgba(55,103,234,.45); display: grid; place-items: center; cursor: pointer;
}
.zweef svg { width: 28px; height: 28px; }
.opladen {
  position: fixed; left: 10px; right: 10px; bottom: calc(10px + var(--veilig-onder)); z-index: 26;
  max-width: 520px; margin-left: auto; background: var(--vlak); border-radius: 14px; box-shadow: var(--schaduw);
  max-height: 50vh; display: flex; flex-direction: column; border: 1px solid var(--lijn);
}
.opladen header { display: flex; align-items: center; gap: 6px; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--lijn); }
.opladen header .titel { flex: 1; font-weight: 600; }
.opladen ul { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.opladen li { padding: 8px 14px; border-bottom: 1px solid var(--lijn); display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center; }
.opladen li .naam { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.opladen li .meta { font-size: 12px; color: var(--zacht); grid-column: 1; }
.opladen li .icoon { grid-row: 1 / span 3; grid-column: 2; width: 34px; height: 34px; }
.opladen progress { grid-column: 1; width: 100%; height: 6px; accent-color: var(--kleur); }
.opladen li.mis .meta { color: var(--gevaar); }
.opladen.dicht ul { display: none; }

.sleepvlak {
  position: fixed; inset: 0; z-index: 50; background: rgba(55,103,234,.18); border: 4px dashed var(--kleur);
  display: grid; place-items: center; font-size: 22px; font-weight: 600; color: var(--kleur-donker); pointer-events: none;
}

/* Dialogen en menu's */
.scherm { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.45); display: grid; place-items: end center; }
@media (min-width: 640px) { .scherm { place-items: center; } }
.dialoog {
  width: 100%; max-width: 460px; background: var(--vlak); border-radius: 18px 18px 0 0; padding: 18px;
  padding-bottom: calc(18px + var(--veilig-onder)); max-height: 85vh; display: flex; flex-direction: column;
}
@media (min-width: 640px) { .dialoog { border-radius: 16px; padding-bottom: 18px; } }
.dialoog h2 { margin: 0 0 12px; font-size: 18px; }
.dialoog .knoppen { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.dialoog .rol { overflow-y: auto; margin: 0 -18px; padding: 0 18px; }
.menu { list-style: none; margin: 0 -18px; padding: 0; }
.menu li button {
  width: 100%; display: flex; align-items: center; gap: 14px; padding: 13px 20px; border: 0; background: none; cursor: pointer; text-align: left;
}
.menu li button:hover { background: rgba(127,127,127,.1); }
.menu li button.gevaar { color: var(--gevaar); }
.menu .kopje { padding: 0 20px 10px; color: var(--zacht); font-size: 13px; border-bottom: 1px solid var(--lijn); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mapkiezer { list-style: none; margin: 0; padding: 0; }
.mapkiezer li button { width: 100%; display: flex; gap: 10px; align-items: center; padding: 10px 4px; border: 0; background: none; cursor: pointer; text-align: left; border-bottom: 1px solid var(--lijn); }

/* Voorbeeld */
.voorbeeld { position: fixed; inset: 0; z-index: 70; background: #000; color: #fff; display: flex; flex-direction: column; }
.voorbeeld header { display: flex; align-items: center; gap: 4px; padding: calc(6px + var(--veilig-boven)) 6px 6px; background: rgba(0,0,0,.6); }
.voorbeeld header .titel { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 6px; }
.voorbeeld header .icoon { color: #fff; }
.voorbeeld .inhoud { flex: 1; display: grid; place-items: center; overflow: hidden; position: relative; touch-action: pan-y pinch-zoom; }
.voorbeeld .inhoud img, .voorbeeld .inhoud video { max-width: 100%; max-height: 100%; object-fit: contain; }
.voorbeeld .inhoud iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.voorbeeld .inhoud pre { width: 100%; height: 100%; margin: 0; overflow: auto; padding: 16px; background: var(--vlak); color: var(--tekst); white-space: pre-wrap; font-size: 13px; }
.voorbeeld .geen { text-align: center; padding: 24px; }
.voorbeeld .geen svg { width: 72px; height: 72px; margin-bottom: 10px; }
.voorbeeld .pijl { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.12); color: #fff; width: 46px; height: 46px; border-radius: 50%; }
.voorbeeld .pijl.links { left: 10px; }
.voorbeeld .pijl.rechts { right: 10px; }
@media (hover: none) { .voorbeeld .pijl { display: none; } }

/* Lijsten in prullenbak/toestellen */
.paneel { margin: 0 10px; }
.regel { display: flex; align-items: center; gap: 10px; background: var(--vlak); padding: 10px 12px; border-bottom: 1px solid var(--lijn); }
.regel:first-child { border-radius: var(--rond) var(--rond) 0 0; }
.regel:last-child { border-radius: 0 0 var(--rond) var(--rond); border-bottom: 0; }
.regel:only-child { border-radius: var(--rond); }
.regel .tekst { flex: 1; min-width: 0; }
.regel .naam { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.regel .meta { color: var(--zacht); font-size: 12.5px; }
.label { display: inline-block; font-size: 11.5px; padding: 1px 7px; border-radius: 99px; background: var(--kleur-licht); color: var(--kleur-donker); margin-left: 6px; }

.melding {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + var(--veilig-onder)); z-index: 100;
  background: #111827; color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--schaduw); max-width: calc(100% - 32px);
}
.melding.fout { background: var(--gevaar); }
.schijf { padding: 6px 20px 12px; font-size: 12.5px; color: var(--zacht); }
.schijf progress { width: 100%; height: 6px; accent-color: var(--kleur); }

/* Slot: aanmelden met vingerafdruk, Face ID of Windows Hello */
.slot { position: fixed; inset: 0; z-index: 150; background: var(--achtergrond); overflow: auto; }
.knop.breed { width: 100%; margin-top: 10px; }

/* Versturen via link */
.regel.klikbaar { cursor: pointer; }
.regel.klikbaar:hover { background: rgba(127,127,127,.06); }
.label.stand-verlopen, .label.stand-verwijderd, .label.stand-afgebroken { background: rgba(127,127,127,.18); color: var(--zacht); }
.label.stand-mislukt { background: #fee2e2; color: var(--gevaar); }
.formulier { max-width: 640px; margin: 0 auto; padding: 4px 12px 24px; }
.sleepzone {
  border: 0; border-radius: 16px; background: var(--kleur-licht); text-align: center;
  padding: 40px 16px; cursor: pointer; margin: 8px 0 10px;
}
.sleepzone:hover, .sleepzone:focus-visible { outline: none; filter: brightness(.97); }
.sleepzone .plusrond { width: 56px; height: 56px; border-radius: 50%; background: var(--kleur); color: #fff; display: grid; place-items: center; margin: 0 auto 10px; }
.sleepzone .plusrond svg { width: 28px; height: 28px; }
.sleepzone .groot { font-size: 18px; font-weight: 600; }
.zendlijst { list-style: none; margin: 10px 0 4px; padding: 0; background: var(--vlak); border-radius: var(--rond); overflow: hidden; }
.zendlijst:empty { display: none; }
.zendlijst li { display: flex; align-items: center; gap: 10px; padding: 6px 4px 6px 12px; border-bottom: 1px solid var(--lijn); }
.zendlijst li:last-child { border-bottom: 0; }
.zendlijst .tekst { flex: 1; min-width: 0; }
.zendlijst .naam { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.formulier .meta { color: var(--zacht); font-size: 12.5px; }
.formulier > .meta { margin: 4px 2px 14px; }
.formulier .veld { margin-top: 12px; }
textarea.invoer { resize: vertical; font: inherit; }
.veldrij { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.veldrij .veld { width: 150px; }
.veldrij .vinkje { margin: 0 0 12px; }
.voortgang { margin: 14px 0 4px; }
.voortgang progress { width: 100%; height: 8px; accent-color: var(--kleur); }
.formulier .knop.breed { margin-top: 14px; }
.kaartje { background: var(--vlak); border-radius: var(--rond); box-shadow: var(--schaduw); padding: 14px 16px; margin: 12px 0; }
.kaartje h2 { margin: 0 0 4px; font-size: 18px; word-break: break-word; }
.kaartje h3 { margin: 0 0 10px; font-size: 14px; color: var(--kleur); }
.kaartje .bericht { white-space: pre-wrap; background: #f4f7fe; border-radius: 10px; padding: 10px 12px; margin: 10px 0 0; }
.knoppenrij { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
a.knop { text-decoration: none; color: inherit; }
.logboek { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow: auto; }
.logboek li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--lijn); font-size: 14px; }
.logboek li:last-child { border-bottom: 0; }
.logboek .naam { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logboek .meta { flex: none; }
.fouttekst { color: var(--gevaar) !important; }
.formulier.nieuw { background: var(--vlak); border-radius: 24px; box-shadow: var(--schaduw); padding: 14px 16px 18px; margin: 12px auto; max-width: 620px; }
@media (max-width: 660px) { .formulier.nieuw { margin: 10px; } }
.formulier.nieuw .zendlijst { background: #f4f7fe; }
