/* Notities — één stylesheet, licht en donker. Geen inline styles: de CSP
   staat alleen 'self' toe; JavaScript zet posities via element.style. */

:root {
  --bg: #f6f5f1;
  --bg-2: #ecebe6;
  --card: #ffffff;
  --card-hover: #fbfaf7;
  --ink: #23211d;
  --ink-2: #5d5a53;
  --ink-3: #8f8b82;
  --line: #dedbd3;
  --line-2: #ebe8e1;
  --accent: #c98a00;
  --accent-bg: #fdf0c8;
  --accent-ink: #5a3d00;
  --danger: #b3261e;
  --ok: #2e7d32;
  --archive: #3d7a5a;
  --shadow: 0 1px 2px rgba(40, 32, 16, .06), 0 2px 8px rgba(40, 32, 16, .06);
  --shadow-up: 0 6px 24px rgba(40, 32, 16, .18);
  --radius: 14px;
  --bar-h: 60px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1b1d;
    --bg-2: #252528;
    --card: #2a2a2d;
    --card-hover: #303034;
    --ink: #ecebe7;
    --ink-2: #b9b6ae;
    --ink-3: #8a877f;
    --line: #3d3d42;
    --line-2: #333337;
    --accent: #f2c14e;
    --accent-bg: #4a3b12;
    --accent-ink: #fbe4a6;
    --danger: #f2827a;
    --ok: #7cc47f;
    --archive: #77c29b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-up: 0 8px 28px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 var(--font);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico {
  width: 24px; height: 24px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.ico .vul, .ico.vul { fill: currentColor; stroke: none; }
.ico.klein { width: 18px; height: 18px; }
.ico.groot { width: 72px; height: 72px; stroke-width: 1.2; color: var(--accent); }
[hidden] { display: none !important; }
.verborgen-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- startscherm en meldingen ------------------------------------------ */
.startscherm { min-height: 100vh; display: grid; place-items: center; }
.welkom { min-height: 100vh; display: grid; place-items: center; padding: 24px; text-align: center; }
.welkom h1 { margin: 12px 0 4px; font-size: 28px; }
.welkom p { color: var(--ink-2); max-width: 320px; margin: 0 auto 24px; }
.knop {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: 999px; border: 0;
  background: var(--accent); color: #fff; font-weight: 600; text-decoration: none;
}
@media (prefers-color-scheme: dark) { .knop { color: #1b1b1d; } }
.knop.zacht { background: var(--bg-2); color: var(--ink); }
.knop.gevaar { background: var(--danger); color: #fff; }
body.melding main { max-width: 480px; margin: 15vh auto; padding: 24px; }
body.melding .knop { margin: 4px 4px 0 0; }
.geen-js { padding: 24px; }

/* --- bovenbalk ----------------------------------------------------------- */
.balk {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 4px;
  padding: calc(8px + var(--safe-top)) 8px 8px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
}
.balk.schaduw { box-shadow: 0 1px 0 var(--line-2); }
.knopje {
  display: inline-grid; place-items: center; flex: none;
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: transparent; color: var(--ink-2);
}
.knopje:hover { background: var(--bg-2); }
.knopje:active { background: var(--line-2); }
.knopje.aan { color: var(--accent); }
.knopje:disabled { opacity: .35; cursor: default; }
.zoek {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px;
  height: 46px; padding: 0 6px 0 14px; border-radius: 999px;
  background: var(--card); box-shadow: var(--shadow); color: var(--ink-3);
}
.zoek input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  color: var(--ink); font-size: 16px;
}
.zoek input::placeholder { color: var(--ink-3); }
.zoek input::-webkit-search-cancel-button { display: none; }
.titelbalk { flex: 1; min-width: 0; font-size: 20px; font-weight: 600; padding-left: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status { position: relative; }
.status .teller {
  position: absolute; top: 6px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--accent); color: #fff; font-size: 11px; line-height: 16px; font-weight: 700;
}
.status.bezig .ico { animation: draai 1s linear infinite; }
.status.fout, .status.login { color: var(--danger); }
.status.offline { color: var(--ink-3); }
@keyframes draai { to { transform: rotate(360deg); } }

.banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 12px 8px; padding: 10px 14px; border-radius: 12px;
  background: var(--accent-bg); color: var(--accent-ink); font-size: 14px;
}
.banner .knop { min-height: 34px; padding: 0 14px; font-size: 14px; margin-left: auto; }

/* --- lijst --------------------------------------------------------------- */
main.lijst { padding: 4px 12px calc(110px + var(--safe-bottom)); max-width: 1280px; margin: 0 auto; }
.sectie { margin: 14px 6px 8px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.kaarten { display: flex; flex-direction: column; gap: 10px; }
.kaarten.raster { display: block; columns: 2 170px; column-gap: 10px; }
.kaarten.raster > .veeg { break-inside: avoid; margin-bottom: 10px; }
@media (min-width: 720px) {
  .kaarten.raster { columns: 4 220px; }
  .kaarten:not(.raster) { max-width: 640px; margin: 0 auto; }
}
.veeg { position: relative; border-radius: var(--radius); }
.veeg-achter {
  position: absolute; inset: 0; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: space-between; padding: 0 22px;
  color: #fff; opacity: 0; transition: opacity .1s;
}
.veeg-achter.rechts { background: var(--archive); }
.veeg-achter.links { background: var(--danger); justify-content: flex-end; }
.veeg-achter .ico { width: 26px; height: 26px; }
.kaart {
  position: relative; display: block; width: 100%; text-align: left;
  padding: 12px 14px; border: 1px solid var(--line-2); border-radius: var(--radius);
  background: var(--card); box-shadow: var(--shadow); color: var(--ink);
  touch-action: pan-y; user-select: none; -webkit-user-select: none;
  overflow: hidden; will-change: transform;
}
.kaart:hover { background: var(--card-hover); }
.kaart:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.kaart.terug { transition: transform .22s ease, opacity .22s ease; }
.kaart h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; padding-right: 22px; }
.kaart .tekst {
  margin: 0; font-size: 14.5px; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 9; -webkit-box-orient: vertical; overflow: hidden;
}
.kaart .tekst.groot { font-size: 18px; color: var(--ink); }
.kaart ul { list-style: none; margin: 4px 0 0; padding: 0; font-size: 14.5px; color: var(--ink-2); }
.kaart li { display: flex; gap: 8px; align-items: flex-start; padding: 1px 0; overflow-wrap: anywhere; }
.kaart li .vak { flex: none; width: 15px; height: 15px; margin-top: 3px; border: 1.6px solid var(--ink-3); border-radius: 4px; }
.kaart li.af { color: var(--ink-3); text-decoration: line-through; }
.kaart li.af .vak { background: var(--ink-3); }
.kaart .meer { font-size: 13px; color: var(--ink-3); margin-top: 4px; }
.kaart .voet { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.kaart .wanneer { font-size: 12px; color: var(--ink-3); margin-left: auto; }
.kaart .speld { position: absolute; top: 10px; right: 10px; color: var(--ink-3); }
.kaart.leeg-kaart .tekst { color: var(--ink-3); font-style: italic; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  padding: 2px 9px; border-radius: 999px; font-size: 12.5px;
  background: var(--bg-2); color: var(--ink-2); border: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chip.leden { background: transparent; padding: 0 6px 0 0; gap: 0; overflow: visible; }
.avatar {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent-bg); color: var(--accent-ink); font-size: 11px; font-weight: 700;
  border: 2px solid var(--card); margin-right: -6px;
}
.leeg { text-align: center; color: var(--ink-3); padding: 18vh 24px 0; }
.leeg .ico { width: 64px; height: 64px; stroke-width: 1.2; opacity: .6; }
.leeg p { margin: 12px 0 0; }

/* --- knoppen rechtsonder ------------------------------------------------- */
.fab-groep {
  position: fixed; right: 18px; bottom: calc(20px + var(--safe-bottom)); z-index: 15;
  display: flex; flex-direction: column; align-items: flex-end; gap: 12px;
}
.fab {
  display: grid; place-items: center; width: 60px; height: 60px; border: 0; border-radius: 18px;
  background: var(--accent); color: #fff; box-shadow: var(--shadow-up);
}
.fab .ico { width: 28px; height: 28px; stroke-width: 2.2; }
.fab.klein { width: 48px; height: 48px; border-radius: 14px; background: var(--card); color: var(--ink-2); }
.fab.klein .ico { width: 24px; height: 24px; stroke-width: 1.9; }
@media (prefers-color-scheme: dark) { .fab:not(.klein) { color: #1b1b1d; } }

/* --- lade ---------------------------------------------------------------- */
.lade-scherm { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .35); opacity: 0; pointer-events: none; transition: opacity .2s; }
.lade-scherm.open { opacity: 1; pointer-events: auto; }
.lade {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 41; width: min(300px, 84vw);
  display: flex; flex-direction: column;
  padding: calc(14px + var(--safe-top)) 10px calc(14px + var(--safe-bottom));
  background: var(--bg); box-shadow: var(--shadow-up);
  transform: translateX(-102%); transition: transform .22s ease; overflow-y: auto;
}
.lade.open { transform: none; }
.lade .merk { display: flex; align-items: center; gap: 10px; padding: 4px 12px 14px; font-size: 20px; font-weight: 600; }
.lade .merk .ico { color: var(--accent); }
.lade nav { display: flex; flex-direction: column; gap: 2px; }
.lade-item {
  display: flex; align-items: center; gap: 16px; width: 100%; min-height: 46px; padding: 0 14px;
  border: 0; border-radius: 999px; background: transparent; color: var(--ink); text-align: left; font-size: 15px;
}
.lade-item:hover { background: var(--bg-2); }
.lade-item.actief { background: var(--accent-bg); color: var(--accent-ink); font-weight: 600; }
.lade-item .aantal { margin-left: auto; font-size: 13px; color: var(--ink-3); }
.lade-item span:not(.aantal) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lade h4 { margin: 18px 14px 6px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.lade .onder { margin-top: auto; padding: 16px 14px 0; border-top: 1px solid var(--line-2); font-size: 14px; color: var(--ink-2); }
.lade .onder .wie { font-weight: 600; color: var(--ink); }
.lade .onder .knop { margin-top: 12px; width: 100%; }
.lade .syncregel { margin-top: 4px; font-size: 13px; color: var(--ink-3); }
@media (min-width: 1100px) {
  .lade { transform: none; box-shadow: none; background: transparent; z-index: 10; }
  .lade-scherm { display: none; }
  .met-lade { padding-left: 300px; }
  .met-lade .knopje.lade-knop { display: none; }
}

/* --- editor -------------------------------------------------------------- */
.editor-scherm {
  position: fixed; inset: 0; z-index: 50; display: flex; justify-content: center; align-items: stretch;
  background: rgba(0, 0, 0, .4);
}
.editor {
  display: flex; flex-direction: column; width: 100%; height: 100%;
  background: var(--card); overflow: hidden;
}
@media (min-width: 720px) {
  .editor-scherm { align-items: center; padding: 24px; }
  .editor { max-width: 640px; height: auto; max-height: min(88vh, 900px); border-radius: 18px; box-shadow: var(--shadow-up); }
}
.editor .balk { background: var(--card); backdrop-filter: none; -webkit-backdrop-filter: none; }
.editor .balk .ruimte { flex: 1; }
.editor-inhoud { flex: 1; overflow-y: auto; padding: 4px 18px 18px; -webkit-overflow-scrolling: touch; }
.editor .titel {
  width: 100%; border: 0; outline: 0; background: transparent; padding: 6px 0;
  font-size: 22px; font-weight: 600; line-height: 1.3; resize: none; overflow: hidden;
}
.editor .titel::placeholder, .editor .tekstveld::placeholder, .regel textarea::placeholder { color: var(--ink-3); }
.editor .tekstveld {
  width: 100%; min-height: 3.2em; border: 0; outline: 0; background: transparent; padding: 6px 0;
  font-size: 17px; line-height: 1.5; resize: none; overflow: hidden;
}
.editor .tekstveld.compact { min-height: 0; }
.regels { margin: 4px 0 0; padding: 0; list-style: none; }
.regel { display: flex; align-items: flex-start; gap: 4px; margin: 0 -8px; padding: 0 4px; border-radius: 10px; }
.regel:focus-within { background: var(--bg); }
.regel .vinkje {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px; border: 0; background: transparent; color: var(--ink-2); padding: 0;
}
.regel .vinkje span {
  display: grid; place-items: center; width: 20px; height: 20px; border: 2px solid var(--ink-3); border-radius: 5px;
}
.regel .vinkje .ico { width: 16px; height: 16px; stroke-width: 3; opacity: 0; color: #fff; }
.regel.af .vinkje span { background: var(--ink-3); border-color: var(--ink-3); }
.regel.af .vinkje .ico { opacity: 1; }
.regel textarea {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; resize: none; overflow: hidden;
  padding: 9px 0; font-size: 16.5px; line-height: 1.35;
}
.regel.af textarea { color: var(--ink-3); text-decoration: line-through; }
.regel .weg { flex: none; width: 40px; height: 40px; border: 0; background: transparent; color: var(--ink-3); opacity: 0; display: grid; place-items: center; }
.regel:focus-within .weg, .regel:hover .weg { opacity: 1; }
@media (hover: none) { .regel .weg { opacity: .7; } }
.nieuwe-regel {
  display: flex; align-items: center; gap: 4px; width: calc(100% + 16px); margin: 0 -8px; padding: 0 4px; min-height: 42px;
  border: 0; background: transparent; color: var(--ink-3); text-align: left; border-radius: 10px;
}
.nieuwe-regel .ico { width: 40px; }
.nieuwe-regel:hover { background: var(--bg); }
.afgevinkt-kop {
  display: flex; align-items: center; gap: 6px; margin: 10px -8px 0; padding: 6px 8px; width: calc(100% + 16px);
  border: 0; border-top: 1px solid var(--line-2); background: transparent; color: var(--ink-3); font-size: 14px; text-align: left;
}
.afgevinkt-kop .ico { width: 18px; height: 18px; transition: transform .15s; }
.afgevinkt-kop.open .ico { transform: rotate(90deg); }
.editor .labels { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; }
.editor .labels .chip { cursor: pointer; font-size: 13px; padding: 4px 10px; }
.editor .gedeeld { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 13.5px; color: var(--ink-2); }
.editor-voet {
  display: flex; align-items: center; gap: 2px;
  padding: 4px 6px calc(4px + var(--safe-bottom)); border-top: 1px solid var(--line-2); background: var(--card);
}
.editor-voet .bewerkt { flex: 1; min-width: 0; text-align: right; padding-right: 8px; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.editor.alleen-lezen .titel, .editor.alleen-lezen .tekstveld { pointer-events: none; }

/* --- menu, dialogen, snackbar -------------------------------------------- */
.menu {
  position: fixed; z-index: 70; min-width: 220px; padding: 6px; border-radius: 12px;
  background: var(--card); box-shadow: var(--shadow-up); border: 1px solid var(--line-2);
}
.menu button {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 12px;
  border: 0; border-radius: 8px; background: transparent; text-align: left; font-size: 15px;
}
.menu button:hover { background: var(--bg-2); }
.menu button.gevaar { color: var(--danger); }
.menu-scherm { position: fixed; inset: 0; z-index: 69; }

dialog {
  width: min(420px, calc(100vw - 32px)); max-height: min(80vh, 640px); padding: 0; border: 0; border-radius: 18px;
  background: var(--card); color: var(--ink); box-shadow: var(--shadow-up);
}
dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog form { display: flex; flex-direction: column; max-height: min(80vh, 640px); }
dialog h2 { margin: 0; padding: 18px 20px 6px; font-size: 18px; }
dialog .uitleg { margin: 0; padding: 0 20px 8px; color: var(--ink-2); font-size: 14px; }
dialog .keuzes { overflow-y: auto; padding: 4px 8px; }
dialog .keuze { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px; cursor: pointer; }
dialog .keuze:hover { background: var(--bg); }
dialog .keuze input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
dialog .keuze .sub { margin-left: auto; color: var(--ink-3); font-size: 13px; }
dialog .invoer { display: flex; gap: 8px; padding: 8px 20px 4px; }
dialog .invoer input {
  flex: 1; min-width: 0; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); outline: 0;
}
dialog .invoer input:focus { border-color: var(--accent); }
dialog .knoppen { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px 16px; }
dialog .knoppen .knop { min-height: 40px; }
dialog .fout { color: var(--danger); padding: 0 20px; font-size: 14px; }

.snackbar {
  position: fixed; left: 50%; bottom: calc(20px + var(--safe-bottom)); z-index: 80;
  display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px);
  padding: 6px 6px 6px 18px; border-radius: 12px; background: #2c2b28; color: #f3f1ea;
  box-shadow: var(--shadow-up); font-size: 14.5px;
  transform: translate(-50%, 150%); transition: transform .22s ease;
}
.snackbar.zichtbaar { transform: translate(-50%, 0); }
.snackbar button { border: 0; background: transparent; color: #f6cf6a; font-weight: 600; padding: 10px 12px; border-radius: 8px; }
@media (prefers-color-scheme: dark) { .snackbar { background: #ecebe7; color: #1b1b1d; } .snackbar button { color: #8a5b00; } }
.met-fab .snackbar { bottom: calc(96px + var(--safe-bottom)); }

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