/* CoolMail inbox en loginpagina, ontwerp A (Luchtpost).
   Kobalt, luchtpoststrepen, harde schaduwen, afzenders als postzegel, poststempel op de geopende mail. */
:root {
  --cobalt: #2337ff;
  --ink: #16133d;
  --paper: #f4f5fa;
  --white: #ffffff;
  --red: #ff3d2e;
  --babe: #ff5cc8;
  --dad: #ffc21a;
  --guy: #29d9ff;
  --mom: #3ee89a;
  --c: var(--mom);
  --font: "Bricolage Grotesque", system-ui, sans-serif;
  --hand: "Caveat", "Comic Sans MS", cursive;
  --stripes: repeating-linear-gradient(-45deg,
    var(--red) 0 12px, var(--paper) 12px 24px,
    var(--cobalt) 24px 36px, var(--paper) 36px 48px);
  --shadow-hard: 5px 5px 0 var(--ink);
  --shadow-small: 3px 3px 0 var(--ink);
  --line: 2.5px solid var(--ink);
}
[data-domain="babe"] { --c: var(--babe); }
[data-domain="dad"]  { --c: var(--dad); }
[data-domain="guy"]  { --c: var(--guy); }
[data-domain="mom"]  { --c: var(--mom); }

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul { margin: 0; }
ul { list-style: none; padding: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--cobalt); }
:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.test-pill {
  display: inline-block;
  padding: 1px 9px;
  font-family: var(--font);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--dad);
  border: 2px solid var(--ink);
  border-radius: 999px;
  vertical-align: 2px;
  white-space: nowrap;
}

/* ---------- Postzegel ---------- */
.stamp {
  grid-row: span 2;
  width: 50px; height: 60px;
  padding: 4px;
  display: grid; place-items: center;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--ink);
  background: var(--s, var(--c));
  outline: 2px solid var(--ink);
  outline-offset: -7px;
  /* geperforeerde rand: halve gaatjes langs de buitenkant, midden dicht */
  -webkit-mask: linear-gradient(#000 0 0) content-box, radial-gradient(circle 3px, #0000 96%, #000) -5px -5px / 10px 10px;
          mask: linear-gradient(#000 0 0) content-box, radial-gradient(circle 3px, #0000 96%, #000) -5px -5px / 10px 10px;
}
.s-babe  { --s: var(--babe); }
.s-dad   { --s: var(--dad); }
.s-guy   { --s: var(--guy); }
.s-mom   { --s: var(--mom); }
.s-paper { --s: var(--paper); }
.s-eigen { --s: var(--c); }

/* ---------- Poststempel ---------- */
.postmark {
  position: absolute; top: 18px; right: 22px;
  width: 132px; height: 132px;
  color: var(--red);
  opacity: .82;
  transform: rotate(-14deg);
  pointer-events: none;
}
.postmark circle { fill: none; stroke: currentColor; stroke-width: 4; }
.postmark text { fill: currentColor; font-family: var(--font); font-weight: 800; font-size: 15px; letter-spacing: 2px; }
.postmark .pm-center { font-size: 22px; letter-spacing: 0; }

/* =================================================================
   Inbox
   ================================================================= */
.app {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  grid-template-columns: minmax(0, 1fr);
  border: 10px solid transparent;
  border-image: var(--stripes) 10;
}
.topbar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 22px;
  background: var(--cobalt);
  color: var(--white);
  border-bottom: var(--line);
}
.logo { font-size: 1.6rem; font-weight: 800; letter-spacing: -.04em; white-space: nowrap; }
.logo span { color: var(--c); }
.test-pill-top { margin-left: -10px; }
.search {
  flex: 1;
  max-width: 560px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px 0 16px;
  background: var(--white);
  color: var(--ink);
  border: var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-small);
  font-size: .95rem;
}
.search input {
  flex: 1;
  min-width: 0;
  padding: 10px 0;
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
}
.search input::placeholder { color: var(--ink); opacity: .55; }
.search:focus-within { outline: 3px solid var(--c); outline-offset: 2px; }
.search kbd {
  padding: 0 7px;
  font: 700 .75rem var(--font);
  border: 2px solid rgba(22, 19, 61, .35);
  border-radius: 6px;
  opacity: .7;
}
.me {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: .9rem;
}
.me-menu { position: relative; }
.me-menu summary { list-style: none; }
.me-menu summary::-webkit-details-marker { display: none; }
.me-avatar {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: var(--c);
  color: var(--ink);
  font-weight: 800;
  border: var(--line);
  border-radius: 50%;
  cursor: pointer;
}
.me-pop {
  position: absolute; right: 0; top: calc(100% + 10px);
  width: 260px;
  padding: 14px;
  color: var(--ink);
  background: var(--white);
  border: var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-hard);
}
.me-pop p { margin-bottom: 12px; overflow-wrap: anywhere; }
.me-pop b, .me-pop small { display: block; }
.me-naam { font-weight: 800; }
.me-pop small { font-weight: 500; opacity: .65; }
.menu-knop {
  display: none;
  width: 42px; height: 42px;
  padding: 9px 8px;
  flex-direction: column; justify-content: space-between;
  background: var(--white);
  border: var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-small);
}
.menu-knop span { display: block; height: 3px; background: var(--ink); border-radius: 2px; }

.body {
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-columns: 230px minmax(340px, 440px) 1fr;
}

/* ---------- Zijbalk ---------- */
.side {
  padding: 22px 16px;
  border-right: var(--line);
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  background: var(--paper);
}
.compose {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 18px;
  background: var(--red);
  color: var(--white);
  font-weight: 800;
  font-size: 1.05rem;
  border: var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-hard);
  transition: transform .12s, box-shadow .12s;
}
.compose:hover, .compose-fab:hover, .act:hover, .login-send:hover { transform: translate(-1px, -1px); box-shadow: 6px 6px 0 var(--ink); }
.compose:active, .compose-fab:active, .act:active, .login-send:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.folders { display: grid; gap: 4px; }
.folder {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px;
  font-weight: 600;
  text-align: left;
  background: transparent;
  border: 2.5px solid transparent;
  border-radius: 10px;
}
.folder:hover { border-color: rgba(22, 19, 61, .25); }
.folder.is-active {
  background: var(--c);
  border-color: var(--ink);
  box-shadow: var(--shadow-small);
}
.folder b {
  min-width: 26px;
  padding: 0 7px;
  text-align: center;
  font-size: .8rem;
  background: var(--ink);
  color: var(--white);
  border-radius: 999px;
}
.side-label { font-family: var(--hand); font-size: 1.35rem; font-weight: 700; color: var(--cobalt); }
.labels { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; font-size: .92rem; font-weight: 600; }
.label-knop {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 3px 12px;
  text-align: left;
  background: transparent;
  border: 2px solid transparent;
  border-radius: 8px;
}
.label-knop:hover { border-color: rgba(22, 19, 61, .25); }
.label-knop.is-active { background: var(--white); border-color: var(--ink); }
.label-knop i { width: 14px; height: 14px; border: 2px solid var(--ink); border-radius: 4px; }
.lb-babe { background: var(--babe); }
.lb-dad  { background: var(--dad); }
.lb-guy  { background: var(--guy); }
.lb-mom  { background: var(--mom); }
.lb-cobalt { background: var(--cobalt); }
.lb-red  { background: var(--red); }
.label-rij { position: relative; min-width: 0; }
.label-naam { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.label-knop i, .label-menu-rij i, .kleur-keuze i { flex: none; }
.label-rij .label-knop { padding-right: 30px; }
.label-weg {
  position: absolute; top: 50%; right: 4px;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  font-size: 1.05rem; font-weight: 800; line-height: 1;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 50%;
  transform: translateY(-50%);
  opacity: 0;
}
.label-rij:hover .label-weg, .label-rij:focus-within .label-weg { opacity: 1; }
.label-weg:hover { color: var(--white); background: var(--red); }
/* Geen muis: de knop is er altijd, anders is hij niet te bereiken. */
@media (hover: none) { .label-weg { opacity: 1; } }
.label-nieuw {
  margin-top: -10px;
  padding: 3px 12px;
  font-size: .88rem; font-weight: 700;
  text-align: left;
  color: var(--cobalt);
  background: transparent;
  border: 2px solid transparent;
  border-radius: 8px;
}
.label-nieuw:hover { border-color: rgba(22, 19, 61, .25); }
.side-foot {
  margin-top: auto;
  padding: 12px;
  font-size: .82rem;
  background: var(--white);
  border: var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-small);
}
.meter { height: 10px; margin-top: 8px; background: var(--paper); border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; }
.meter span { display: block; width: 18%; height: 100%; background: var(--cobalt); }
.meter span.is-leeg { width: 0; }
.side-scrim { display: none; }

/* ---------- Lijst ---------- */
.list {
  min-height: 0;
  overflow-y: auto;
  border-right: var(--line);
  background: var(--paper);
}
.list-head {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 18px 18px 12px;
  background: var(--paper);
  border-bottom: var(--line);
}
.list-head h1 { font-size: 1.7rem; font-weight: 800; letter-spacing: -.03em; }
.list-head p { font-family: var(--hand); font-size: 1.25rem; color: var(--cobalt); white-space: nowrap; }
.mail {
  position: relative;
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) auto;
  gap: 4px 14px;
  padding: 14px 18px;
  color: inherit;
  text-decoration: none;
  border-bottom: 2px dashed rgba(22, 19, 61, .25);
}
.mail:hover { background: rgba(255, 255, 255, .6); }
.mail.is-open {
  margin: 10px 12px;
  background: var(--white);
  border: var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-hard);
}
.subj b { font-weight: 600; }
.mail.is-unread .from, .mail.is-unread .subj b { font-weight: 800; }
.mail.is-unread::before {
  content: "";
  position: absolute; left: 6px; top: 50%;
  width: 8px; height: 8px;
  margin-top: -4px;
  background: var(--red);
  border-radius: 50%;
}
.from { font-size: .98rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.time { font-size: .8rem; font-weight: 600; opacity: .7; white-space: nowrap; }
.star-mini { color: var(--red); opacity: 1; }
.subj {
  grid-column: 2 / 4;
  font-size: .92rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.subj .preview { font-weight: 400; opacity: .6; }
.tag {
  display: inline-block;
  margin-right: 6px;
  padding: 0 8px;
  font-size: .72rem;
  font-weight: 700;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--white);
  vertical-align: 1px;
}
.tag-kort { max-width: 8.5em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: -4px; }
.leeg { display: grid; gap: 4px; padding: 40px 24px; text-align: center; }
.leeg-hand { font-family: var(--hand); font-size: 1.8rem; font-weight: 700; color: var(--cobalt); }

/* ---------- Lezer ---------- */
.reader {
  position: relative;
  min-height: 0;
  overflow-y: auto;
  padding: 28px 36px 40px;
  background:
    radial-gradient(circle at 1px 1px, rgba(22, 19, 61, .12) 1px, transparent 1.5px) 0 0 / 22px 22px,
    var(--paper);
}
.reader:focus { outline: 0; }
.letter {
  position: relative;
  max-width: 760px;
  padding: 30px 34px 34px;
  background: var(--white);
  border: var(--line);
  border-radius: 16px;
  box-shadow: 8px 8px 0 var(--ink);
}
.letter::before {
  content: "";
  position: absolute; inset: -2.5px -2.5px auto;
  height: 12px;
  background: var(--stripes);
  border: var(--line);
  border-radius: 16px 16px 0 0;
}
.letter { container-type: inline-size; }
.letter.is-spam { background: repeating-linear-gradient(-45deg, var(--white) 0 14px, #fff6f5 14px 28px); }
.terug {
  display: none;
  margin-bottom: 14px;
  padding: 4px 12px 4px 8px;
  font-weight: 700;
  font-size: .9rem;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
}
.brief-kop { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px 18px; margin-bottom: 20px; }
.actions { display: flex; flex: 0 1 auto; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.act {
  padding: 7px 14px;
  font-size: .88rem;
  font-weight: 700;
  background: var(--white);
  border: var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-small);
  transition: transform .12s, box-shadow .12s;
}
.act.primary { background: var(--c); }
.act.act-ico { display: inline-grid; place-items: center; width: 38px; height: 36px; padding: 0; font-size: 1rem; line-height: 1; }
.act-kort { display: none; }
.act-gevaar { color: var(--white); background: var(--red); }
.act:disabled { opacity: .55; cursor: wait; }
.label-wrap { position: relative; }
.label-menu {
  position: absolute; z-index: 6; top: calc(100% + 8px); right: 0;
  width: 250px;
  max-width: calc(100vw - 60px);
  padding: 8px;
  background: var(--white);
  border: var(--line);
  border-radius: 12px;
  box-shadow: 5px 5px 0 var(--ink);
}
.label-menu-lijst { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; max-height: 248px; overflow-y: auto; }
.label-menu-rij {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px;
  font-size: .92rem; font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
}
.label-menu-rij:hover, .label-menu-rij:focus-within { background: var(--paper); }
.label-menu-rij input { flex: none; width: 17px; height: 17px; margin: 0; accent-color: var(--cobalt); }
.label-menu-rij i, .kleur-keuze i { width: 14px; height: 14px; border: 2px solid var(--ink); border-radius: 4px; }
.label-menu-leeg { padding: 5px 8px; font-size: .88rem; opacity: .65; }
.label-menu-nieuw {
  width: 100%;
  margin-top: 6px;
  padding: 7px 8px 3px;
  font-size: .88rem; font-weight: 700;
  text-align: left;
  color: var(--cobalt);
  background: transparent;
  border: 0;
  border-top: 2px solid var(--paper);
}
.label-menu-nieuw:hover { text-decoration: underline; }
.brief-labels { margin: -6px 0 18px; }
.act-star.is-on { color: var(--white); background: var(--red); }
.brief-onderwerp { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.letter h2 { flex: 1 1 auto; min-width: 0; font-size: 1.9rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; overflow-wrap: anywhere; }
.brief-onderwerp .postmark { position: static; flex: none; width: 64px; height: 64px; }
.meta { display: flex; flex: 1 1 200px; align-items: flex-start; gap: 12px; min-width: 200px; font-size: .9rem; }
.meta-tekst { min-width: 0; }
.meta .stamp, .stamp-sm { width: 40px; height: 50px; font-size: .78rem; grid-row: auto; flex: none; }
.meta b { display: block; font-size: 1rem; }
.meta small { opacity: .65; overflow-wrap: anywhere; }
.text p { margin-bottom: 14px; max-width: 62ch; }
.sign { font-family: var(--hand); font-size: 1.6rem; color: var(--cobalt); }
.files { display: flex; gap: 14px; margin-top: 22px; flex-wrap: wrap; }
.file {
  width: 150px;
  padding: 8px 8px 10px;
  background: var(--white);
  border: var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-small);
  font-size: .78rem; font-weight: 600;
}
.file i { display: block; height: 92px; margin-bottom: 8px; border-radius: 6px; border: 2px solid var(--ink); }
.f-koud  { background: linear-gradient(160deg, var(--guy), var(--cobalt)); }
.f-warm  { background: linear-gradient(160deg, var(--dad), var(--red)); }
.f-groen { background: linear-gradient(160deg, var(--mom), var(--guy)); }
.reader-empty {
  display: grid; justify-items: center; gap: 6px;
  max-width: 420px;
  margin: 12vh auto 0;
  text-align: center;
}
.empty-env {
  width: 150px; height: 96px;
  margin-bottom: 10px;
  background: var(--white);
  border: 8px solid transparent;
  border-image: var(--stripes) 8;
  box-shadow: var(--shadow-hard);
}

.m-head, .compose-fab { display: none; }

/* ---------- Schrijven ---------- */
.schrijf {
  width: min(640px, calc(100vw - 32px));
  padding: 0;
  color: var(--ink);
  background: var(--white);
  border: var(--line);
  border-radius: 16px;
  box-shadow: 8px 8px 0 var(--ink);
}
.schrijf::backdrop { background: rgba(22, 19, 61, .45); }
.schrijf-form { position: relative; display: grid; gap: 12px; padding: 30px 26px 22px; }
.schrijf-form::before {
  content: "";
  position: absolute; inset: 0 0 auto;
  height: 12px;
  background: var(--stripes);
  border-bottom: var(--line);
}
.schrijf-kop { display: flex; align-items: center; justify-content: space-between; }
.schrijf-kop h2 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; }
.schrijf-dicht {
  width: 36px; height: 36px;
  font-size: 1.4rem; font-weight: 800; line-height: 1;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 50%;
}
.schrijf-van { font-size: .85rem; opacity: .7; }
.schrijf-klein { width: min(420px, calc(100vw - 32px)); }
.schrijf-kop h2 { overflow-wrap: anywhere; }
.kleuren { padding: 0; border: 0; font-weight: 700; font-size: .88rem; }
.kleuren legend { padding: 0; margin-bottom: 6px; }
.kleuren-rij { display: flex; gap: 14px; flex-wrap: wrap; padding: 6px; }
.kleur-keuze { position: relative; display: block; cursor: pointer; }
.kleur-keuze input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.kleur-keuze i { display: block; width: 34px; height: 34px; border-width: 2.5px; border-radius: 10px; }
.kleur-keuze input:checked + i { box-shadow: 0 0 0 3px var(--white), 0 0 0 6px var(--ink); }
.kleur-keuze input:focus-visible + i { outline: 3px solid var(--c); outline-offset: 7px; }
.form-fout { padding: 8px 12px; font-size: .88rem; font-weight: 700; color: var(--ink); background: #ffe6e3; border: 2px solid var(--red); border-radius: 10px; }
.schrijf-knoppen { display: flex; gap: 10px; flex-wrap: wrap; }

.field { display: grid; gap: 4px; font-weight: 700; font-size: .88rem; }
.field input, .field textarea {
  width: 100%;
  padding: 11px 14px;
  font: 500 1rem var(--font);
  color: var(--ink);
  background: var(--paper);
  border: var(--line);
  border-radius: 12px;
}
.field textarea { resize: vertical; min-height: 160px; line-height: 1.5; }
.field input:focus, .field textarea:focus { outline: 3px solid var(--c); outline-offset: 1px; background: var(--white); }

.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  /* Zonder max-content krimpt hij door left: 50% tot de helft van het scherm. */
  width: max-content;
  max-width: min(720px, calc(100vw - 32px));
  padding: 12px 18px;
  font-weight: 700;
  color: var(--white);
  background: var(--ink);
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  box-shadow: 5px 5px 0 var(--c);
  transform: translateX(-50%);
  transition: opacity .3s, transform .3s;
}
/* display: flex hierboven gaat anders boven het hidden-attribuut. */
.toast[hidden] { display: none; }
.toast-tekst { min-width: 0; overflow-wrap: anywhere; }
.toast-knop {
  flex: none;
  min-height: 36px;
  padding: 4px 12px;
  font: inherit;
  white-space: nowrap;
  color: var(--ink);
  background: var(--c);
  border: 2px solid var(--c);
  border-radius: 10px;
  cursor: pointer;
}
.toast-knop:hover { background: var(--white); border-color: var(--white); }
.toast-knop:focus-visible { outline: 3px solid var(--white); outline-offset: 2px; }
.toast.is-weg { opacity: 0; transform: translate(-50%, 10px); }
.noscript { position: fixed; inset: auto 16px 16px; padding: 14px; background: var(--white); border: var(--line); border-radius: 12px; }

/* ---------- Breedte van de brief, niet van het scherm: de brief is op 1101px
   smaller dan op 1100px. ---------- */
/* Te krap voor tekst op Doorsturen naast de afzender: ook die wordt een icoon. */
@container (min-width: 421px) and (max-width: 670px) {
  .act.act-doorsturen { display: inline-grid; place-items: center; width: 38px; height: 36px; padding: 0; font-size: 1rem; line-height: 1; }
  .act-lang { display: none; }
  .act-kort { display: inline; }
}
/* Geen plek naast de afzender: knoppen eronder. */
@container (max-width: 420px) {
  .brief-kop { flex-direction: column; align-items: stretch; }
  .meta { flex: none; min-width: 0; }
  .actions { position: relative; justify-content: flex-start; }
  .label-wrap { position: static; }
  .label-menu { left: 0; right: 0; width: auto; max-width: none; }
}

/* Telefoon: knop onder de tekst, zodat de tekst de hele breedte houdt. */
@media (max-width: 760px) {
  .toast { flex-wrap: wrap; gap: 8px 14px; }
  .toast-tekst { flex: 1 1 100%; }
  .toast-knop { min-height: 44px; margin-left: auto; }
}

/* ---------- Tablet: zijbalk als lade ---------- */
@media (max-width: 1100px) {
  .compose-fab {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 12px;
    font-size: .9rem;
    background: var(--red); color: var(--white);
    font-weight: 800;
    white-space: nowrap;
    border: var(--line); border-radius: 999px;
    box-shadow: var(--shadow-small);
  }
  .menu-knop { display: flex; }
  .topbar { gap: 14px; }
  .me-address { display: none; }
  .body { grid-template-columns: minmax(300px, 380px) 1fr; }
  .side {
    position: absolute; z-index: 4; inset: 0 auto 0 0;
    width: 260px;
    box-shadow: var(--shadow-hard);
    transform: translateX(calc(-100% - 12px));
    visibility: hidden;
    transition: transform .2s ease, visibility 0s .2s;
  }
  .zijbalk-open .side { transform: none; visibility: visible; transition: transform .2s ease; }
  .side-scrim:not([hidden]) { display: block; position: absolute; inset: 0; z-index: 3; background: rgba(22, 19, 61, .35); }
  .reader { padding: 24px 24px 36px; }
}

/* ---------- Telefoon: lijst of brief over het hele scherm ---------- */
@media (max-width: 760px) {
  .app { border-width: 6px; border-image: var(--stripes) 6; }
  .topbar { padding: 10px 12px; gap: 10px; }
  .topbar .search { display: none; }
  .test-pill-top { margin-left: -4px; }
  .logo { font-size: 1.4rem; }
  .me-avatar { width: 36px; height: 36px; }
  .menu-knop { width: 38px; height: 38px; padding: 8px 7px; }
  .body { grid-template-columns: minmax(0, 1fr); }
  .list { border-right: 0; }
  .test-pill-top { font-size: .6rem; padding: 0 6px; }
  .reader { display: none; padding: 14px 10px 28px; }
  .app[data-view="lezer"] .list { display: none; }
  .app[data-view="lezer"] .reader { display: block; }
  .m-head {
    display: block;
    padding: 12px 14px;
    background: var(--paper);
    border-bottom: var(--line);
  }
  .m-head .search { display: flex; max-width: none; }
  .m-head .search input { padding: 9px 0; }
  .list-head { padding: 14px 16px 10px; }
  .list-head h1 { font-size: 1.5rem; }
  .mail { padding: 12px 16px; gap: 2px 12px; }
  .mail.is-open { margin: 8px 10px; }
  .letter { padding: 22px 18px 24px; box-shadow: 5px 5px 0 var(--ink); }
  .terug { display: inline-flex; }
  .act { padding: 6px 12px; }
  .terug { margin-bottom: 22px; }
  .letter h2 { font-size: 1.55rem; }
  .brief-onderwerp .postmark { width: 52px; height: 52px; }
  .file { width: calc(50% - 7px); }
  .file i { height: 76px; }
  .me-pop { width: min(260px, calc(100vw - 40px)); }
}
@media (max-width: 440px) {
  .fab-tekst { display: none; }
  .compose-fab { padding: 6px 10px; }
}
@media (max-width: 340px) {
  .test-pill-top { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* =================================================================
   Loginpagina
   ================================================================= */
.login-page {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 28px 16px;
  border: 10px solid transparent;
  border-image: var(--stripes) 10;
  background:
    radial-gradient(circle at 1px 1px, rgba(22, 19, 61, .12) 1px, transparent 1.5px) 0 0 / 22px 22px,
    var(--paper);
}
.envelope-wrap { width: min(560px, 100%); display: grid; gap: 22px; justify-items: center; }
.login-logo { font-size: 2.2rem; font-weight: 800; letter-spacing: -.04em; color: var(--cobalt); text-decoration: none; }
.login-logo span { color: var(--ink); background: var(--c); padding: 0 6px; border: var(--line); border-radius: 10px; margin-left: 2px; box-shadow: var(--shadow-small); }
.envelope {
  position: relative;
  width: 100%;
  padding: 38px 36px 30px;
  background: var(--white);
  border: 12px solid transparent;
  border-image: var(--stripes) 12;
  outline: var(--line);
  box-shadow: 10px 10px 0 var(--ink);
}
/* envelopklep: een V vanaf de bovenrand */
.envelope::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0;
  height: 70px;
  background:
    linear-gradient(to top right, transparent calc(50% - 1.5px), rgba(22, 19, 61, .18) calc(50% - 1px), rgba(22, 19, 61, .18) calc(50% + 1px), transparent calc(50% + 1.5px)) left / 50% 100% no-repeat,
    linear-gradient(to top left, transparent calc(50% - 1.5px), rgba(22, 19, 61, .18) calc(50% - 1px), rgba(22, 19, 61, .18) calc(50% + 1px), transparent calc(50% + 1.5px)) right / 50% 100% no-repeat;
  pointer-events: none;
}
.env-stamp {
  position: absolute; top: 18px; right: 20px;
  width: 86px; height: 104px;
  padding: 5px;
  background: var(--c);
  transform: rotate(4deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, radial-gradient(circle 4px, #0000 96%, #000) -6px -6px / 12px 12px;
          mask: linear-gradient(#000 0 0) content-box, radial-gradient(circle 4px, #0000 96%, #000) -6px -6px / 12px 12px;
}
.env-stamp-inner {
  height: 100%;
  display: grid; place-items: center; align-content: center; gap: 2px;
  border: 2px solid var(--ink);
  text-align: center;
}
.env-stamp-inner b { font-size: 2rem; line-height: 1; }
.env-stamp-inner small { font-size: .62rem; font-weight: 800; letter-spacing: .02em; }
.env-postmark { top: 64px; right: 70px; width: 120px; height: 120px; opacity: .7; }
.env-hand { position: relative; font-family: var(--hand); font-size: 1.5rem; font-weight: 700; color: var(--cobalt); margin-top: 26px; }
.envelope h1 { position: relative; font-size: 2.2rem; font-weight: 800; letter-spacing: -.04em; line-height: 1.05; max-width: 11ch; }
.env-sub { position: relative; margin: 8px 0 22px; font-weight: 500; }
.login-form { position: relative; display: grid; gap: 14px; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 92px; }
.pw-toggle {
  position: absolute; top: 50%; right: 8px;
  padding: 4px 12px;
  font-size: .82rem; font-weight: 800;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 999px;
  transform: translateY(-50%);
}
.login-send {
  justify-self: start;
  margin-top: 6px;
  padding: 13px 26px;
  font-size: 1.08rem; font-weight: 800;
  color: var(--white);
  background: var(--red);
  border: var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-hard);
  transition: transform .12s, box-shadow .12s;
}
.notice {
  position: relative;
  margin-bottom: 16px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: .92rem;
  border: var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-small);
}
.notice-fout { background: #ffe3e0; }
.notice-goed { background: var(--c); }
.notice-info { background: #fff2c7; }
.env-foot { position: relative; margin-top: 22px; padding-top: 14px; font-size: .88rem; border-top: 2px dashed rgba(22, 19, 61, .25); }
.login-links { display: flex; gap: 18px; font-size: .88rem; font-weight: 700; }
.login-links a { color: var(--ink); }

@media (max-width: 560px) {
  .login-page { padding: 18px 10px; border-width: 6px; border-image: var(--stripes) 6; }
  .envelope { padding: 30px 20px 24px; border-width: 9px; border-image: var(--stripes) 9; box-shadow: 6px 6px 0 var(--ink); }
  .env-stamp { width: 68px; height: 84px; top: 12px; right: 12px; }
  .env-stamp-inner b { font-size: 1.5rem; }
  .env-stamp-inner small { font-size: .5rem; }
  .env-postmark { top: 6px; right: 62px; width: 78px; height: 78px; opacity: .6; }
  .envelope h1 { font-size: 1.85rem; }
  .login-send { justify-self: stretch; }
}
