/* Onkosten - een kasboek dat in je broekzak past.
   Beeldtaal: groen bandpapier uit de boekhouding, inktgroene regels,
   cijfers in tabelstand zodat de kolom optelt zoals op papier. */

:root {
  --papier: #fbfaf6;
  --band: #e4ede1;
  --inkt: #1f4033;
  --inkt-zacht: #5c7466;
  --lijn: #c9d6c5;
  --stempel: #b0472f;
  --goud: #e3b93f;
  --wit: #ffffff;

  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius: 4px;
  --rand: 1px solid var(--lijn);
  --veilig-onder: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--papier);
  color: var(--inkt);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

body { padding-bottom: calc(84px + var(--veilig-onder)); }

.cijfer { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--inkt); outline-offset: 2px; }

/* --- maandbalk ---------------------------------------------------------- */

.maandbalk {
  position: sticky; top: 0; z-index: 20;
  background: var(--inkt); color: var(--papier);
  padding: 14px 16px 12px;
  border-bottom: 3px double rgba(251, 250, 246, .45);
}

.maandbalk .rij { display: flex; align-items: baseline; gap: 12px; }

.maandbalk h1 {
  font-family: var(--serif);
  font-size: 1.35rem; font-weight: 400; margin: 0;
  letter-spacing: .01em;
}

.maandbalk .pijl {
  background: none; border: 1px solid rgba(251, 250, 246, .4);
  color: inherit; border-radius: var(--radius);
  width: 32px; height: 32px; cursor: pointer; line-height: 1;
}
.maandbalk .pijl:hover { background: rgba(251, 250, 246, .12); }

.maandbalk .totaal {
  margin-left: auto; text-align: right;
  font-family: var(--serif); font-size: 1.6rem;
}
.maandbalk .onder {
  display: flex; gap: 14px; align-items: center;
  margin-top: 4px; font-size: .78rem; color: rgba(251, 250, 246, .75);
}

.stempel {
  border: 1.5px solid currentColor; border-radius: 2px;
  padding: 1px 7px; font-size: .68rem; letter-spacing: .06em;
  color: var(--goud);
}
.stempel[data-status="klaar"] { color: #9fd6a8; }
.stempel[data-status="ingediend"] { color: rgba(251, 250, 246, .6); }

/* --- inhoud ------------------------------------------------------------- */

main { max-width: 780px; margin: 0 auto; padding: 12px 12px 0; }

h2 {
  font-family: var(--serif); font-weight: 400; font-size: 1.1rem;
  margin: 22px 0 8px;
}
h2:first-child { margin-top: 8px; }

.kaart {
  background: var(--wit); border: var(--rand); border-radius: var(--radius);
  padding: 14px; margin-bottom: 14px;
}

.regels { border: var(--rand); border-radius: var(--radius); overflow: hidden; background: var(--wit); }

.regel {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  gap: 4px 10px; align-items: baseline;
  padding: 10px 12px;
  border-bottom: 1px solid var(--lijn);
  cursor: pointer;
  background: none; width: 100%; text-align: left;
}
.regel:last-child { border-bottom: 0; }
.regel:nth-child(even) { background: var(--band); }
.regel:hover { background: #dbe8d7; }

.regel .datum { font-size: .8rem; color: var(--inkt-zacht); }
.regel .titel { font-weight: 500; }
.regel .sub { grid-column: 2; font-size: .8rem; color: var(--inkt-zacht); }
.regel .bedrag { grid-row: 1 / span 2; align-self: center; font-family: var(--serif); font-size: 1.05rem; }
.regel .merk { font-size: .7rem; color: var(--inkt-zacht); border: 1px solid var(--lijn); border-radius: 2px; padding: 0 4px; margin-left: 6px; }

.leeg {
  padding: 26px 16px; text-align: center; color: var(--inkt-zacht);
  background: var(--wit); border: 1px dashed var(--lijn); border-radius: var(--radius);
}
.leeg p { margin: 0 0 10px; }

.som {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 10px 12px; margin-top: -1px;
  border: var(--rand); border-top: 3px double var(--inkt);
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--wit); font-family: var(--serif);
}

/* --- knoppen ------------------------------------------------------------ */

.knop {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--inkt); color: var(--papier);
  border: 1px solid var(--inkt); border-radius: var(--radius);
  padding: 10px 16px; cursor: pointer; font-size: .95rem;
}
.knop:hover { background: #2a5443; }
.knop[disabled] { opacity: .45; cursor: not-allowed; }
.knop.stil { background: transparent; color: var(--inkt); border-color: var(--lijn); }
.knop.stil:hover { background: var(--band); }
.knop.rood { background: transparent; color: var(--stempel); border-color: var(--stempel); }
.knop.breed { width: 100%; }
.knoprij { display: flex; flex-wrap: wrap; gap: 8px; }

/* --- formulier ---------------------------------------------------------- */

label { display: block; font-size: .8rem; color: var(--inkt-zacht); margin-bottom: 3px; }

input[type=text], input[type=date], input[type=number], input[type=email],
select, textarea {
  width: 100%; padding: 10px; background: var(--wit);
  border: var(--rand); border-radius: var(--radius);
}
textarea { min-height: 96px; resize: vertical; font-size: .9rem; }

.velden { display: grid; gap: 12px; }
.velden.twee { grid-template-columns: 1fr 1fr; }

.schakel { display: flex; align-items: center; gap: 9px; }
.schakel input { width: 20px; height: 20px; accent-color: var(--inkt); }
.schakel label { margin: 0; font-size: .92rem; color: var(--inkt); }

/* --- onderbalk en camera ------------------------------------------------ */

.onderbalk {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--wit); border-top: var(--rand);
  padding-bottom: var(--veilig-onder);
}
.onderbalk button {
  background: none; border: 0; padding: 10px 4px 12px;
  color: var(--inkt-zacht); font-size: .72rem; cursor: pointer;
  display: grid; justify-items: center; gap: 3px;
}
.onderbalk button svg { width: 21px; height: 21px; }
.onderbalk button[aria-current="page"] { color: var(--inkt); font-weight: 600; }
.onderbalk button[aria-current="page"] svg { stroke-width: 2.1; }

.bon {
  position: fixed; right: 16px; z-index: 31;
  bottom: calc(78px + var(--veilig-onder));
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--stempel); color: var(--papier);
  border: 0; cursor: pointer; display: grid; place-items: center;
  box-shadow: 0 3px 10px rgba(31, 64, 51, .28);
}
.bon svg { width: 26px; height: 26px; }

/* --- lade (invoerscherm) ------------------------------------------------ */

.lade {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(31, 64, 51, .4);
  display: grid; align-items: end;
}
.lade[hidden] { display: none; }
.lade > div {
  background: var(--papier); border-radius: 10px 10px 0 0;
  padding: 16px 16px calc(20px + var(--veilig-onder));
  max-height: 92vh; overflow: auto;
  animation: omhoog .18s ease-out;
}
@keyframes omhoog { from { transform: translateY(14px); opacity: .6 } }

.lade h2 { margin-top: 0; }
.ladekop { display: flex; align-items: center; justify-content: space-between; }
.ladekop button { background: none; border: 0; font-size: 1.3rem; cursor: pointer; color: var(--inkt-zacht); }

.voorbeeld {
  width: 100%; max-height: 180px; object-fit: contain;
  background: var(--band); border: var(--rand); border-radius: var(--radius);
}

/* --- melding ------------------------------------------------------------ */

.melding {
  position: fixed; left: 12px; right: 12px; z-index: 50;
  bottom: calc(88px + var(--veilig-onder));
  background: var(--inkt); color: var(--papier);
  padding: 11px 14px; border-radius: var(--radius); font-size: .9rem;
}
.melding[hidden] { display: none; }
.melding[data-soort="fout"] { background: var(--stempel); }

/* --- sleutelscherm ------------------------------------------------------ */

.poort { max-width: 380px; margin: 14vh auto; padding: 0 20px; }
.poort h1 { font-family: var(--serif); font-weight: 400; font-size: 1.9rem; margin: 0 0 6px; }
.poort p { color: var(--inkt-zacht); margin-top: 0; }

/* --- klein scherm ------------------------------------------------------- */

@media (max-width: 420px) {
  .velden.twee { grid-template-columns: 1fr; }
  .maandbalk .totaal { font-size: 1.35rem; }
}

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