/* jij of ik — zie DESIGN_SYSTEM.md. Tokens hier, nergens hard-coded waarden.
   Deze waarden zijn dezelfde als Ink in de iOS-app (Theme.swift). */

:root {
  /* Papier in plaats van grijs, diep groen in plaats van cyaan. Rustig, warm,
     en alleen echte urgentie krijgt verzadiging. Elke combinatie tekst-op-vlak
     haalt minimaal 4.5:1, in beide standen. */
  --bg: #fbf7f1;
  --surface: #ffffff;
  --surface-2: #f3ece1;
  --line: #e5dbcb;
  --text: #201d18;
  --muted: #6a6155;

  /* Jij. Ook de kleur van knoppen, links en alles wat af is. */
  --accent: #1f6f54;
  --accent-soft: #e2f0e9;
  --accent-op: #16503e;          /* tekst óp accent-soft */
  --accent-contrast: #ffffff;    /* tekst óp accent */

  /* De andere ouder. Nooit dezelfde kleur als jij, ook niet in het donker. */
  --ander: #3d5f91;
  --ander-soft: #e4eaf3;
  --ander-op: #33507a;

  /* Blokkeert je tijd, of vraagt aandacht. */
  --busy: #8f5310;
  --busy-soft: #fbeedb;
  --busy-op: #6a4208;

  /* Nog van niemand. De enige kleur die echt om je aandacht vraagt. */
  --open: #a6402a;
  --open-soft: #fae7e0;
  --open-op: #8c3520;

  --done: var(--accent);

  /* Schaal van 4. Geen tussenwaarden verzinnen. */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px;

  --fs-xs: 13px; --fs-sm: 14px; --fs-base: 16px; --fs-lg: 18px; --fs-xl: 22px;
  --fs-display: 27px;
  --lh: 1.55;

  --r1: 8px; --r2: 12px; --r3: 16px; --r-pill: 999px;
  --shadow: 0 1px 2px rgba(32, 29, 24, .06), 0 1px 8px rgba(32, 29, 24, .04);
  /* Regel 1 van het ontwerpsysteem: niets kleiner dan 44x44 om aan te raken. */
  --tap: 44px;
  --speed: 160ms;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16140f;
    --surface: #201d17;
    --surface-2: #2a2620;
    --line: #3a342b;
    --text: #f0eae0;
    --muted: #a79c8c;

    --accent: #62c8a3;
    --accent-soft: #14352b;
    --accent-op: #8adbbc;
    --accent-contrast: #16140f;

    --ander: #8fb3e0;
    --ander-soft: #1b2a40;
    --ander-op: #b7cdeb;

    --busy: #e8b168;
    --busy-soft: #33260f;
    --busy-op: #f0cb98;

    --open: #f0997e;
    --open-soft: #3a1e16;
    --open-op: #f4b7a3;

    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--fs-base)/var(--lh) -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: var(--s7);
}

a { color: var(--accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r1);
}

/* ── raamwerk ───────────────────────────────────────────────────────────── */

.bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s4);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.bar h1 { margin: 0; font-size: var(--fs-lg); font-weight: 650; }
.bar .spacer { margin-left: auto; }

.wrap { max-width: 720px; margin: 0 auto; padding: var(--s4); }

.nav {
  display: flex; gap: var(--s1); overflow-x: auto;
  padding: var(--s2) var(--s4); background: var(--surface);
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  flex: none; min-height: var(--tap);
  display: inline-flex; align-items: center; gap: var(--s2);
  padding: 0 var(--s3); border-radius: var(--r-pill);
  color: var(--muted); text-decoration: none; font-size: var(--fs-sm);
  font-weight: 550; white-space: nowrap;
  transition: background var(--speed), color var(--speed);
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-op); }
.nav .count {
  min-width: 20px; padding: 0 6px; border-radius: var(--r-pill);
  background: var(--accent); color: var(--accent-contrast);
  font-size: var(--fs-xs); font-weight: 650; text-align: center;
}

/* ── kaarten ────────────────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r3);
  box-shadow: var(--shadow);
  margin-bottom: var(--s3);
  overflow: hidden;
}
.card > a { display: block; padding: var(--s4); color: inherit; text-decoration: none; }
.card > a:hover { background: var(--surface-2); }
.card-body { padding: var(--s4); }
.card h2 { margin: 0 0 var(--s1); font-size: var(--fs-base); font-weight: 620; }
.card p { margin: 0; color: var(--muted); font-size: var(--fs-sm); }

.item { padding: var(--s4); border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item h3 { margin: var(--s2) 0 var(--s1); font-size: var(--fs-base); font-weight: 600; }
.meta { color: var(--muted); font-size: var(--fs-sm); display: block; }
.meta + .meta { margin-top: 2px; }

/* ── etiketten ──────────────────────────────────────────────────────────── */

.tag {
  display: inline-flex; align-items: center; gap: var(--s1);
  padding: 3px var(--s2); border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 650; letter-spacing: .02em;
  text-transform: uppercase;
  background: var(--surface-2); color: var(--muted);
}
.tag.busy  { background: var(--busy-soft);   color: var(--busy-op); }
.tag.open  { background: var(--open-soft);   color: var(--open-op); }
.tag.ander { background: var(--ander-soft);  color: var(--ander-op); }
.tag.done  { background: var(--accent-soft); color: var(--accent-op); }

.warn {
  display: flex; gap: var(--s2); align-items: flex-start;
  margin-top: var(--s3); padding: var(--s3);
  background: var(--busy-soft);
  border-radius: var(--r2);
  font-size: var(--fs-sm); color: var(--busy-op);
}
.warn svg { flex: none; margin-top: 2px; }

/* ── knoppen en formulieren ─────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--tap); padding: 0 var(--s4);
  border: 1px solid var(--line); border-radius: var(--r2);
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; font-size: var(--fs-sm);
  cursor: pointer;
  transition: background var(--speed), border-color var(--speed);
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.btn.primary:hover { filter: brightness(1.08); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.block { width: 100%; }

.row { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); }
.row .btn { flex: 1 1 auto; min-width: 0; }

label { display: block; font-size: var(--fs-sm); font-weight: 600; margin-bottom: var(--s1); }
input[type="text"], input[type="password"], input[type="email"], select {
  width: 100%; min-height: var(--tap); padding: 0 var(--s3);
  border: 1px solid var(--line); border-radius: var(--r2);
  background: var(--surface); color: var(--text); font: inherit;
}
.field { margin-bottom: var(--s4); }

/* Vinkje: het hele blok is het raakvlak, niet alleen het vierkantje. */
.check {
  display: flex; align-items: center; gap: var(--s3);
  min-height: var(--tap); padding: var(--s3) var(--s4);
  cursor: pointer; border-bottom: 1px solid var(--line);
  transition: background var(--speed);
}
.check:last-child { border-bottom: 0; }
.check:hover { background: var(--surface-2); }
.check input { width: 22px; height: 22px; flex: none; accent-color: var(--accent); cursor: pointer; }
.check .txt { min-width: 0; }
.check.is-done .txt > span:first-child { text-decoration: line-through; color: var(--muted); }

.empty { padding: var(--s7) var(--s4); text-align: center; color: var(--muted); }
.empty svg { color: var(--line); margin-bottom: var(--s3); }

.flash {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: var(--s3);
  padding: var(--s3) var(--s4); margin-bottom: var(--s4);
  border-radius: var(--r2); background: var(--accent-soft);
  color: var(--accent-op); font-size: var(--fs-sm); font-weight: 600;
}
.flash span { min-width: 0; }
.flash.bad { background: var(--open-soft); color: var(--open-op); }

.section-title {
  margin: var(--s5) 0 var(--s2); font-size: var(--fs-sm);
  text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  font-weight: 650;
}
.section-title:first-child { margin-top: 0; }

/* Brede inhoud schuift binnen zijn eigen kader, nooit de hele pagina. */
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (min-width: 600px) {
  .wrap { padding: var(--s5) var(--s4); }
  .row .btn { flex: 0 0 auto; }
}

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

/* ── bronfragmenten ──────────────────────────────────────────────────────── */
/* Bij twijfel staat de zin uit de mail onder de knop: de keuze is alleen te
   maken mét het bewijs erbij, dus verhuist het bewijs naar het scherm. */

.keuzes { display: flex; flex-direction: column; gap: var(--s2); margin-top: var(--s3); }

.keuze {
  flex-direction: column; align-items: flex-start; gap: var(--s1);
  padding: var(--s3) var(--s4); height: auto; text-align: left;
}
.keuze-waarde { font-weight: 650; }
.keuze-bron { font-size: var(--fs-xs); font-weight: 400; color: var(--muted); }

.bron {
  margin: var(--s2) 0 0; font-size: var(--fs-xs); font-style: italic;
  color: var(--muted);
}

/* Hoever de klok op een verzoek gelopen heeft. Dun en rustig: hij vertelt
   hoeveel tijd er nog is, hij roept er niet om. */
.klok {
  height: 3px; margin-top: var(--s2);
  background: var(--line); border-radius: var(--r-pill); overflow: hidden;
}
.klok span { display: block; height: 100%; background: var(--busy); }
