/* Huis-app: mobile-first, één kolom (max 720 px), systeemlettertype, licht en donker. */
:root {
  --bg: #fafaf8; --kaart: #fff; --tekst: #222; --dof: #6b6f6b; --lijn: #e3e5e0;
  --groen: #2a7d4f; --groen-tekst: #2a7d4f; --groen-licht: #9fc7ae; --chip-bg: #eef2ee; --chip-tekst: #355;
  --rood: #d93025; --rood-bg: #fdecea; --oranje: #f29900; --grijs: #c7c7c7;
  --kosten-bg: #fff3e0; --kosten-tekst: #8a5200; --lenen-bg: #e8f0fe; --lenen-tekst: #1a4fa0; --keuze-bg: #f3f1ff; --keuze-tekst: #4a3f8f;
  --segment-bg: #eceeea; --schaduw: 0 1px 2px rgba(0, 0, 0, .08); --tabs-h: 58px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131513; --kaart: #1e211e; --tekst: #e8eae7; --dof: #9aa19a; --lijn: #343834;
    --groen-tekst: #5fc58c; --groen-licht: #3d6a50; --chip-bg: #2a312b; --chip-tekst: #bcd3c2;
    --rood: #ff6b61; --rood-bg: #3b1f1d; --oranje: #f5a623; --grijs: #5a5f5a;
    --kosten-bg: #3a2e18; --kosten-tekst: #f2c274; --lenen-bg: #1f2c44; --lenen-tekst: #9dbdf5; --keuze-bg: #2a2740; --keuze-tekst: #c5bdf2;
    --segment-bg: #272a27; --schaduw: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--tekst);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
body.sheet-open { overflow: hidden; }
h1, h2 { margin: 0; }
p { margin: 0 0 .5rem; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.dof { color: var(--dof); font-size: .85rem; }
.te-laat { color: var(--rood); font-weight: 600; }
.laden { text-align: center; color: var(--dof); padding: 3rem 0; }

/* --- schil --------------------------------------------------------------- */
#scherm {
  max-width: 720px; margin: 0 auto;
  padding: 0 16px calc(var(--tabs-h) + env(safe-area-inset-bottom) + 96px);
  padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right));
}
#strook { position: sticky; top: 0; z-index: 30; background: var(--kosten-bg); color: var(--kosten-tekst); text-align: center; font-size: .82rem; padding: 4px 12px; }
#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; max-width: 720px; margin: 0 auto; z-index: 20; display: flex;
  background: var(--kaart); border-top: 1px solid var(--lijn); padding-bottom: env(safe-area-inset-bottom);
}
#tabs a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-height: var(--tabs-h); font-size: .72rem; color: var(--dof); text-decoration: none;
}
#tabs a.actief { color: var(--groen-tekst); font-weight: 700; }
.tab-icoon { font-size: 1.2rem; line-height: 1.2; }
#fab {
  position: fixed; z-index: 21; width: 56px; height: 56px; border-radius: 28px; border: 0; background: #2a7d4f; color: #fff;
  font-size: 2rem; line-height: 1; box-shadow: 0 3px 10px rgba(0, 0, 0, .3); cursor: pointer;
  right: max(16px, calc(50% - 344px)); bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 14px);
}
#fab:active { transform: scale(.95); }
body[data-scherm="inloggen"] #fab, body[data-scherm="inloggen"] #tabs { display: none; }
body[data-scherm="inloggen"] #scherm { padding-bottom: 2rem; }

.kop { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(env(safe-area-inset-top) + 14px) 0 6px; }
.kop h1 { font-size: 1.5rem; }
.detail-kop { padding-bottom: 0; }
.terug { color: var(--groen-tekst); text-decoration: none; font-weight: 600; padding: 8px 0; min-height: 44px; display: inline-flex; align-items: center; }
.leeg { text-align: center; padding: 2.5rem 0; color: var(--dof); }
.melding { color: var(--rood); font-weight: 600; }

/* --- knoppen en velden ---------------------------------------------------- */
.knop {
  min-height: 44px; padding: 0 1rem; border-radius: 10px; border: 1px solid var(--lijn); background: var(--kaart);
  font-weight: 600; cursor: pointer;
}
.knop.primair { background: #2a7d4f; border-color: #2a7d4f; color: #fff; }
.knop.gevaar { color: var(--rood); }
.knop.breed { display: block; width: 100%; margin: .5rem 0; }
.knop.klein { min-height: 36px; font-size: .85rem; padding: 0 .7rem; }
.knop.aan { background: var(--chip-bg); }
.knop:disabled { opacity: .55; }
.tekst-knop { background: none; border: 0; color: var(--groen-tekst); font-weight: 600; padding: 0 .4rem; min-height: 44px; cursor: pointer; }
.icoon-knop { background: none; border: 0; min-width: 44px; min-height: 44px; font-size: 1.1rem; color: var(--dof); cursor: pointer; }
.invoer {
  width: 100%; min-height: 44px; padding: .55rem .75rem; border-radius: 10px; border: 1px solid var(--lijn);
  background: var(--kaart); font-size: 1rem;
}
.invoer.groot { font-size: 1.15rem; min-height: 52px; }
.invoer.smal { width: auto; flex: 1; min-width: 0; }
textarea.invoer { resize: vertical; }
.bestand { width: 100%; padding: .4rem 0; }
.veld { display: grid; gap: .3rem; margin-bottom: .75rem; font-weight: 600; font-size: .9rem; }
.rij-invoer { display: flex; gap: .5rem; align-items: center; }
.rij-invoer .invoer { flex: 1; min-width: 0; }
.toevoeg-blok { display: grid; gap: .5rem; padding: .6rem 0 .8rem; }
.toevoeg-form { display: grid; gap: .6rem; }

/* --- Klussen --------------------------------------------------------------- */
.segment { display: flex; background: var(--segment-bg); border-radius: 10px; padding: 2px; margin: 6px 0 8px; }
.segment button { flex: 1; border: 0; background: none; border-radius: 8px; min-height: 38px; padding: 0 2px; font-size: .78rem; color: var(--dof); cursor: pointer; }
.segment button.aan { background: var(--kaart); color: var(--tekst); font-weight: 700; box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.klein-wissel { display: inline-flex; background: var(--segment-bg); border-radius: 8px; padding: 2px; }
.klein-wissel button { border: 0; background: none; border-radius: 6px; min-height: 32px; padding: 0 .7rem; font-size: .82rem; color: var(--dof); cursor: pointer; }
.klein-wissel button.aan { background: var(--kaart); color: var(--tekst); font-weight: 700; }
.groep-kop { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--dof); margin: 14px 2px 2px; }
.kaart {
  display: block; margin: 8px 0; padding: 10px 12px 10px 14px; background: var(--kaart); border-radius: 12px;
  box-shadow: var(--schaduw); border: 1px solid transparent; border-left: 4px solid var(--grijs); text-decoration: none;
}
@media (prefers-color-scheme: dark) { .kaart { border-color: var(--lijn); border-left-color: var(--grijs); } }
.kaart.urgentie-hoog { border-left-color: #d93025; }
.kaart.urgentie-normaal { border-left-color: #f29900; }
.kaart.urgentie-laag { border-left-color: #c7c7c7; }
.kaart.klaar { opacity: .6; }
.kaart.klaar .kaart-titel { text-decoration: line-through; }
.kaart-titel { display: block; }
.meta { font-size: .8rem; color: var(--dof); margin-top: 2px; }
.chips { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 4px; margin-top: 5px; }
.chip { font-size: .72rem; padding: 1px 8px; border-radius: 10px; background: var(--chip-bg); color: var(--chip-tekst); }
.chip.kosten { background: var(--kosten-bg); color: var(--kosten-tekst); }
.chip.lenen { background: var(--lenen-bg); color: var(--lenen-tekst); }
.chip.keuze { background: var(--keuze-bg); color: var(--keuze-tekst); }
.chip.bezig { background: var(--lenen-bg); color: var(--lenen-tekst); font-weight: 600; }

/* --- lade en meldingen ------------------------------------------------------- */
.sheet-achter { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 40; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; max-width: 720px; margin: 0 auto; z-index: 41; background: var(--kaart);
  border-radius: 16px 16px 0 0; padding: 4px 16px calc(14px + env(safe-area-inset-bottom)); max-height: 88vh; overflow-y: auto;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, .25); animation: omhoog .18s ease-out;
}
@keyframes omhoog { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-kop { display: flex; align-items: center; justify-content: space-between; }
.sheet-kop h2 { font-size: 1.05rem; }
#toasts { position: fixed; top: calc(env(safe-area-inset-top) + 8px); left: 0; right: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; padding: 0 12px; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: 100%; background: #26292a; color: #fff; padding: 10px 14px; border-radius: 12px; box-shadow: 0 3px 12px rgba(0, 0, 0, .3); font-size: .92rem; animation: omhoog .15s ease-out; }
.toast-fout { background: #8c1d18; }
.toast-actie { background: none; border: 0; color: #8fdcae; font-weight: 700; min-height: 32px; padding: 0 4px; cursor: pointer; }
.foto-laag { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .92); display: flex; align-items: center; justify-content: center; padding: 8px; }
.foto-laag img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* --- klusdetail ----------------------------------------------------------------- */
.titel-invoer { width: 100%; border: 0; border-bottom: 1px dashed transparent; background: transparent; padding: .2rem 0; margin-bottom: .5rem; font-size: 1.5rem; font-weight: 700; border-radius: 0; }
.titel-invoer:focus { outline: 0; border-bottom-color: var(--groen); }
.doos { background: var(--kaart); border-radius: 12px; padding: 2px 12px; box-shadow: var(--schaduw); border: 1px solid transparent; margin: 4px 0 8px; }
@media (prefers-color-scheme: dark) { .doos { border-color: var(--lijn); } }
.eig { border-top: 1px solid var(--lijn); }
.eig:first-child { border-top: 0; }
.eig-rij { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; background: none; border: 0; text-align: left; cursor: pointer; padding: 0; }
.eig-naam { width: 92px; flex: none; color: var(--dof); font-size: .9rem; }
.eig-waarde { flex: 1; min-width: 0; }
.afkap { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pijl { color: var(--dof); }
.editor { display: grid; gap: .5rem; padding: 0 0 12px; }
.planning-invoer { display: flex; gap: .5rem; }
.planning-invoer .invoer { flex: 1; min-width: 0; }
.keuzeknoppen { display: flex; flex-wrap: wrap; gap: 6px; }
.optie { min-height: 40px; padding: 0 .9rem; border-radius: 20px; border: 1px solid var(--lijn); background: var(--kaart); cursor: pointer; }
.optie.aan { background: #2a7d4f; border-color: #2a7d4f; color: #fff; font-weight: 600; }
.urg-punt::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 5px; margin-right: 8px; background: var(--grijs); }
.urg-hoog::before { background: #d93025; } .urg-normaal::before { background: #f29900; } .urg-laag::before { background: #c7c7c7; }
.sectie-balk { display: flex; align-items: baseline; gap: 8px; margin-top: 10px; }
.sectie-balk .sectie-kop { flex: 1; }
.sectie-kop { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--dof); margin: 14px 2px 2px; font-weight: 600; }
.sectie-balk .sectie-kop { margin: 0 2px; }
.keuze { padding: 8px 0; display: grid; gap: 6px; }
.keuze + .keuze { border-top: 1px solid var(--lijn); }
.regel { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; }
.toevoeg-rij { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 6px; }
.acties { margin-top: 18px; display: grid; gap: 2px; }
.notitie { display: flex; gap: 12px; padding: 8px 0; }
.notitie + .notitie { border-top: 1px solid var(--lijn); }
.foto-knop { padding: 0; border: 0; border-radius: 8px; overflow: hidden; width: 76px; height: 76px; flex: none; background: var(--lijn); cursor: pointer; }
.foto-knop img { width: 100%; height: 100%; object-fit: cover; display: block; }
.notitie-tekst { min-width: 0; overflow-wrap: anywhere; }
.keuze-rij { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 4px 0; }
.keuze-rij input { width: 22px; height: 22px; flex: none; accent-color: #2a7d4f; }
.keuze-tekst { display: grid; }
.keuzelijst { max-height: 42vh; overflow-y: auto; }
.totaal-regel { font-weight: 600; margin: .4rem 0 .8rem; }

/* --- lijsten met afvinken (Kopen en kopen/lenen in de klus) ------------------------------- */
.rij { display: flex; align-items: center; gap: 6px; min-height: 48px; }
.rij + .rij { border-top: 1px solid var(--lijn); }
.rij-blok + .rij-blok { border-top: 1px solid var(--lijn); }
.vink-rij { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 48px; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.rij-tekst { display: grid; min-width: 0; }
.vink { flex: none; width: 24px; height: 24px; border: 2px solid #9aa09a; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: .85rem; font-weight: 700; }
.vink.aan { background: #2a7d4f; border-color: #2a7d4f; }
.klaar-tekst { color: var(--dof); text-decoration: line-through; }
.prijs, .prijs-knop { font-weight: 700; white-space: nowrap; }
.prijs-knop { background: none; border: 0; min-height: 44px; padding: 0 4px; cursor: pointer; }
.uitlink { color: var(--lenen-tekst); text-decoration: none; padding: 10px 6px; font-size: 1.05rem; }
.voor { display: block; margin: -8px 0 8px 34px; font-size: .78rem; color: var(--dof); text-decoration: none; }
.kopen-lijst details.gekocht { margin-top: 14px; }
.gekocht summary { cursor: pointer; color: var(--dof); font-weight: 600; font-size: .9rem; min-height: 44px; display: flex; align-items: center; }

/* --- Planning ---------------------------------------------------------------------------------- */
.klusdag { padding-bottom: 6px; }
.klusdag-kop { display: flex; justify-content: space-between; padding: 8px 0 2px; }
.tijdlijn { border-left: 2px solid var(--lijn); margin: 4px 0 8px 10px; padding-left: 14px; }
.tl-item { position: relative; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 7px 0; text-decoration: none; min-height: 36px; }
.tl-item::before { content: ""; position: absolute; left: -20px; top: 14px; width: 8px; height: 8px; border-radius: 4px; background: #2a7d4f; }
.tl-item.ver { color: var(--dof); }
.tl-item.ver::before { background: var(--groen-licht); }
.tl-titel { font-weight: 600; }
.tl-item.ver .tl-titel { font-weight: 400; }
.pill { font-size: .72rem; padding: 1px 8px; border-radius: 10px; background: var(--rood-bg); color: var(--rood); font-weight: 600; }
.tl-kop .dof { text-transform: none; letter-spacing: 0; }
.tl-samen summary { cursor: pointer; padding: 8px 0; color: var(--dof); }

/* --- Kosten -------------------------------------------------------------------------------------- */
.jaar-staven { display: flex; gap: 6px; padding: 12px 8px 8px; height: 190px; overflow-x: auto; }
.staaf-kolom { flex: 1 0 50px; display: flex; flex-direction: column; align-items: stretch; text-align: center; }
.staaf-vak { flex: 1; position: relative; margin: 4px 4px 0; }
.staaf { position: absolute; left: 0; right: 0; }
.staaf.uitgegeven { background: #2a7d4f; border-radius: 0 0 3px 3px; min-height: 0; }
.staaf.gepland { background: var(--groen-licht); border-radius: 4px 4px 0 0; }
.staaf-bedrag, .staaf-jaar { font-size: .68rem; color: var(--dof); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.staaf-jaar { padding-top: 4px; }
.balk-rij { padding: 8px 0; }
.balk-tekst { display: flex; justify-content: space-between; gap: 12px; }
.balk { height: 8px; border-radius: 4px; background: var(--lijn); overflow: hidden; margin-top: 4px; }
.balk i { display: block; height: 100%; background: #2a7d4f; border-radius: 4px; }
.account { text-align: center; color: var(--dof); font-size: .85rem; margin-top: 2rem; }

/* --- Inloggen -------------------------------------------------------------------------------------- */
.inlog-kaart { max-width: 340px; margin: 10vh auto 0; display: grid; gap: .7rem; text-align: center; }
.inlog-icoon { border-radius: 16px; margin: 0 auto; }
.klusdag .tl-item { padding-left: 16px; }
.klusdag .tl-item::before { left: 0; }

/* --- projecten en onderdelen ------------------------------------------------------------ */
.chip.project { background: var(--keuze-bg); color: var(--keuze-tekst); font-weight: 600; }
.onderdeel-van, .vorige-keer { display: block; color: var(--groen-tekst); text-decoration: none; font-size: .9rem; margin: 2px 0 6px; }
.voortgang { padding: 10px 0 6px; }
.voortgang-tekst { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.vink-alleen { flex: none; width: 44px; }
.onderdeel-link { flex: 1; min-width: 0; display: grid; text-decoration: none; padding: 6px 0; overflow-wrap: anywhere; }
.urgentie-rand { border-left: 3px solid var(--grijs); padding-left: 6px; }
.urgentie-rand.urgentie-hoog { border-left-color: #d93025; }
.urgentie-rand.urgentie-normaal { border-left-color: #f29900; }
