@import url("https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:ital,wght@0,400;0,700;1,400&display=swap");

:root {
  --vlak: #eef1f4;
  --papier: #ffffff;
  --inkt: #1c2430;
  --grijs: #5b6675;
  --lijn: #d6dce3;
  --zacht: #f6f8fa;
  --rood: #b8322a;
  --focus: #1f5fbf;
  --goyou: #2a64d8;
  --leslab: #1d8358;
  --persoonlijk: #7a4fc4;
  --stempel-groen: #23704a;
  --stempel-blauw: #2853a6;
  --stempel-grijs: #6a7480;
  --radius: 6px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --vlak: #151a21; --papier: #1d242d; --inkt: #e6eaef; --grijs: #9aa5b3; --lijn: #2f3945; --zacht: #222a34;
    --rood: #ef6a5f; --focus: #7aa7ff; --goyou: #6c9bff; --leslab: #4fc08d; --persoonlijk: #b08cf0;
    --stempel-groen: #62c592; --stempel-blauw: #85a8f0; --stempel-grijs: #a0aab6; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --vlak: #151a21; --papier: #1d242d; --inkt: #e6eaef; --grijs: #9aa5b3; --lijn: #2f3945; --zacht: #222a34;
  --rood: #ef6a5f; --focus: #7aa7ff; --goyou: #6c9bff; --leslab: #4fc08d; --persoonlijk: #b08cf0;
  --stempel-groen: #62c592; --stempel-blauw: #85a8f0; --stempel-grijs: #a0aab6; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--vlak);
  color: var(--inkt);
  font-family: "Atkinson Hyperlegible", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.verborgen { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Kop ---------- */
.kop {
  display: flex; align-items: center; gap: 24px;
  padding: 10px 20px; background: var(--papier); border-bottom: 1px solid var(--lijn);
  position: sticky; top: 0; z-index: 5;
}
.merk { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; white-space: nowrap; }
.tabs { display: flex; gap: 4px; overflow-x: auto; }
.tabs a {
  text-decoration: none; padding: 6px 12px; border-radius: var(--radius); color: var(--grijs); white-space: nowrap;
}
.tabs a[aria-current="page"] { color: var(--inkt); background: var(--zacht); font-weight: 700; }
.wie { margin-left: auto; color: var(--grijs); font-size: 13px; display: flex; gap: 12px; align-items: center; white-space: nowrap; }
.wie button { background: none; border: 0; color: var(--grijs); text-decoration: underline; cursor: pointer; padding: 0; }
.demo-band { background: var(--inkt); color: var(--papier); text-align: center; font-size: 13px; padding: 4px 16px; }

/* ---------- Werkvlak ---------- */
.werk { display: grid; grid-template-columns: 232px minmax(320px, 1fr) minmax(380px, 1.3fr); min-height: calc(100vh - 53px); }
.werk.twee { grid-template-columns: 232px 1fr; }
.rail { padding: 16px 12px; border-right: 1px solid var(--lijn); }
.lijst { border-right: 1px solid var(--lijn); background: var(--papier); overflow: auto; max-height: calc(100vh - 53px); }
.detail { overflow: auto; max-height: calc(100vh - 53px); padding: 24px 28px 48px; }
.vol { padding: 24px 28px 48px; max-width: 980px; }

/* Postvakken */
.postvak-groep { margin-bottom: 18px; }
.postvak-groep h2 {
  font-size: 13px; color: var(--grijs); margin: 0 0 6px 8px; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.postvak-groep h2::before { content: ""; width: 10px; height: 10px; border-radius: 2px; background: var(--kleur); }
.postvak {
  display: flex; justify-content: space-between; gap: 8px; width: 100%; text-align: left;
  border: 0; background: none; padding: 5px 8px; border-radius: var(--radius); cursor: pointer; color: var(--inkt);
}
.postvak:hover { background: var(--zacht); }
.postvak[aria-pressed="true"] { background: var(--papier); box-shadow: inset 3px 0 0 var(--kleur); font-weight: 700; }
.postvak .n { color: var(--grijs); font-size: 13px; }
.e-goyou { --kleur: var(--goyou); }
.e-leslab { --kleur: var(--leslab); }
.e-persoonlijk { --kleur: var(--persoonlijk); }

.filters { display: flex; gap: 6px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--lijn); position: sticky; top: 0; background: var(--papier); z-index: 1; }
.chip {
  border: 1px solid var(--lijn); background: var(--papier); border-radius: 999px; padding: 3px 11px; cursor: pointer; font-size: 13px;
}
.chip[aria-pressed="true"] { background: var(--inkt); color: var(--papier); border-color: var(--inkt); }

/* Lijst met post */
.groep-kop { font-size: 13px; font-weight: 700; color: var(--grijs); padding: 14px 16px 6px; }
.groep-kop.rood { color: var(--rood); }
.regel {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 16px 11px 13px;
  border-left: 3px solid var(--kleur, transparent); border-bottom: 1px solid var(--lijn);
  text-decoration: none; position: relative; cursor: pointer;
}
.regel:hover { background: var(--zacht); }
.regel[aria-current="true"] { background: var(--zacht); }
.regel .van { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.regel .tijd { color: var(--grijs); font-size: 13px; }
.regel .samen { grid-column: 1 / -1; color: var(--grijs); font-size: 14px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.regel .tags { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.tag { font-size: 12px; padding: 0 7px; border-radius: 4px; background: var(--zacht); color: var(--grijs); border: 1px solid var(--lijn); }
.tag.rood { color: var(--rood); border-color: currentColor; background: transparent; }
.tag.concept { color: var(--stempel-blauw); border-color: currentColor; background: transparent; }
.leeg { padding: 32px 20px; color: var(--grijs); }

/* De stempel: het ene opvallende element */
.stempel {
  display: inline-block; font-weight: 700; font-size: 12px; line-height: 1; padding: 4px 7px 3px;
  border: 2px solid currentColor; border-radius: 4px; transform: rotate(-4deg); letter-spacing: 0.02em;
  color: var(--stempel-grijs); opacity: 0.9; white-space: nowrap;
}
.stempel.beantwoord, .stempel.betaald, .stempel.geboekt { color: var(--stempel-groen); }
.stempel.wacht, .stempel.opvolgen { color: var(--stempel-blauw); }
.regel .stempel { position: absolute; right: 14px; bottom: 9px; }
.stempel.nieuw { animation: stempel 260ms cubic-bezier(.2,.8,.3,1.2); }
@keyframes stempel { from { transform: rotate(-4deg) scale(1.6); opacity: 0; } to { transform: rotate(-4deg) scale(1); opacity: 0.9; } }
@media (prefers-reduced-motion: reduce) { .stempel.nieuw { animation: none; } }

/* Bericht */
.detail h1 { font-size: 22px; line-height: 1.25; margin: 0 0 6px; letter-spacing: -0.01em; }
.meta { color: var(--grijs); font-size: 14px; margin-bottom: 18px; }
.meta a { color: var(--inkt); }
.blok { background: var(--papier); border: 1px solid var(--lijn); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.blok h2, .vol .blok h2 { font-size: 14px; margin: 0 0 8px; }
.blok p { margin: 0 0 8px; }
.blok ul { margin: 0; padding-left: 18px; }
.samenvatting { font-size: 16px; }
.mailtekst { white-space: pre-wrap; font-size: 14px; max-height: 420px; overflow: auto; color: var(--inkt); }
details summary { cursor: pointer; color: var(--grijs); }
.reden { color: var(--grijs); font-size: 13px; }

.afhandelen { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.knop {
  border: 1px solid var(--lijn); background: var(--papier); padding: 6px 12px; border-radius: var(--radius); cursor: pointer;
}
.knop:hover { border-color: var(--inkt); }
a.knop { text-decoration: none; display: inline-block; }
.knop.hoofd { background: var(--inkt); color: var(--papier); border-color: var(--inkt); }
.knop[aria-pressed="true"] { border-color: var(--inkt); box-shadow: inset 0 0 0 1px var(--inkt); font-weight: 700; }
.knop:disabled { opacity: 0.5; cursor: not-allowed; }
.veld { display: grid; gap: 4px; margin-bottom: 10px; }
.veld label { font-size: 13px; color: var(--grijs); }
input[type="text"], input[type="email"], input[type="date"], input[type="search"], textarea, select {
  border: 1px solid var(--lijn); background: var(--papier); border-radius: var(--radius); padding: 6px 9px; width: 100%;
}
textarea { min-height: 70px; resize: vertical; }
.rij { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.rij > * { flex: 1 1 160px; }

/* Tabellen (facturen, beheer) */
table { width: 100%; border-collapse: collapse; background: var(--papier); border: 1px solid var(--lijn); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--lijn); vertical-align: top; }
th { font-size: 13px; color: var(--grijs); font-weight: 700; background: var(--zacht); }
td.bedrag { text-align: right; white-space: nowrap; }
th.bedrag { text-align: right; }
tr.verlopen td.datum { color: var(--rood); font-weight: 700; }
.vol h1 { font-size: 22px; margin: 0 0 4px; }
.vol .intro { color: var(--grijs); margin: 0 0 18px; }
.vol h2 { font-size: 17px; margin: 28px 0 10px; }

/* Tijdlijn bij een contact */
.tijdlijn { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--lijn); }
.tijdlijn > li { position: relative; padding: 0 0 16px 18px; }
.tijdlijn > li::before { content: ""; position: absolute; left: -6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--papier); border: 2px solid var(--kleur, var(--grijs)); }
.tijdlijn .wanneer { color: var(--grijs); font-size: 13px; }
.tijdlijn .notitie { background: var(--zacht); border-radius: var(--radius); padding: 8px 10px; }

.melding {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--inkt); color: var(--papier);
  padding: 8px 14px; border-radius: var(--radius); font-size: 14px; z-index: 20;
}
.melding.fout { background: var(--rood); }

/* Inloggen */
.inlog { max-width: 420px; margin: 12vh auto; padding: 0 16px; }
.inlog h1 { font-size: 28px; margin: 0 0 8px; letter-spacing: -0.02em; }
.inlog p { color: var(--grijs); }
.inlog .knop { margin-top: 12px; }

.terug { display: none; }

/* ---------- Smal scherm ---------- */
@media (max-width: 1100px) {
  .werk { grid-template-columns: 200px 1fr; }
  .werk .detail { grid-column: 1 / -1; border-top: 1px solid var(--lijn); max-height: none; }
}
@media (max-width: 720px) {
  .kop { flex-wrap: wrap; gap: 8px 16px; padding: 10px 16px; }
  .wie { margin-left: 0; width: 100%; justify-content: space-between; }
  .werk, .werk.twee { display: block; }
  .rail { border-right: 0; border-bottom: 1px solid var(--lijn); padding: 10px 16px; display: flex; gap: 8px; overflow-x: auto; }
  .postvak-groep { margin: 0; min-width: max-content; }
  .postvak-groep .postvak:not([aria-pressed="true"]):not(.alles) { display: none; }
  .lijst, .detail { max-height: none; border-right: 0; }
  .werk.met-bericht .lijst, .werk.met-bericht .rail { display: none; }
  .werk:not(.met-bericht) .detail { display: none; }
  .detail, .vol { padding: 16px; }
  .terug { display: inline-block; margin-bottom: 12px; }
  table { font-size: 14px; }
  .verberg-smal { display: none; }
}
