/* Grind: licht of donker volgt de telefoon, lime als enige accent. */
:root {
  --achter: #000000; --kaart: #1c1c1e; --tekst: #ffffff; --stil: #8e8e93; --lijn: #2c2c2e; --veld: #2c2c2e;
  --accent: #a6ff00; --accent-zacht: #233300; --knop: #a6ff00; --knop-tekst: #000000;
  --rood: #fa114f; --geel: #ff9f0a; --cyaan: #00d7ff;
  --slaap: #00d7ff; --diep: #2f6bff; --rem: #8fe9ff;
  --schaduw: none;
  --rond: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--achter); color: var(--tekst);
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.verborgen { display: none !important; }
h1 { font-size: 2.1rem; font-weight: 800; margin: 0 0 1rem; letter-spacing: -.02em; }
h2 { font-size: 1.3rem; font-weight: 700; letter-spacing: -.01em; color: var(--tekst); margin: 0 0 .8rem; }
h3 { font-size: .95rem; margin: 1rem 0 .3rem; }
.stil { color: var(--stil); font-size: .88rem; }
.fout { color: var(--rood); font-size: .9rem; min-height: 1em; margin: .4rem 0 0; }
.fout:empty { min-height: 0; margin: 0; }
b, .cijfer b, .kcal, #kcaltotaal { font-variant-numeric: tabular-nums; }

/* Inloggen */
.kaart.smal { max-width: 360px; margin: 16vh auto 0; padding: 26px 22px; }
.merk { font-size: 2.4rem; font-weight: 900; letter-spacing: -.04em; text-transform: uppercase; margin: 0 0 1.4rem; line-height: 1; }
.merk::after { content: "."; color: var(--knop); }
.kaart.smal button[type="submit"], #faceid { width: 100%; }
#faceid { margin-bottom: 1rem; display: flex; align-items: center; justify-content: center; gap: 8px; }
#faceid svg { width: 20px; height: 20px; }

/* Kop met datum */
header { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 10px) 8px 10px; background: color-mix(in srgb, var(--achter) 88%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
#datumkop { position: relative; font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; }
#datumkies { position: absolute; inset: 0; opacity: 0; width: 100%; }
.pijl { background: var(--kaart); border: 0; color: var(--tekst); font-size: 1.5rem; width: 40px; height: 40px; padding: 0;
  border-radius: 50%; line-height: 1; cursor: pointer; box-shadow: var(--schaduw); }

main { padding: 6px 14px calc(env(safe-area-inset-bottom) + 96px); max-width: 640px; margin: 0 auto; }
.kaart { background: var(--kaart); border-radius: 16px; padding: 18px; margin-bottom: 14px; box-shadow: var(--schaduw); }
.kop { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.kop h2 { margin-bottom: .8rem; }

/* Velden en knoppen */
label { display: block; font-size: .82rem; font-weight: 500; color: var(--stil); margin-bottom: 10px; }
input, textarea, select { width: 100%; font: inherit; color: var(--tekst); background: var(--veld); border: 1.5px solid transparent;
  border-radius: 12px; padding: 11px 12px; margin-top: 4px; outline: none; transition: border-color .15s; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; }
button { font: inherit; border: 0; border-radius: 14px; padding: 12px 16px; background: var(--knop); color: var(--knop-tekst);
  font-weight: 700; cursor: pointer; transition: transform .08s, opacity .15s; }
button:active { transform: scale(.97); }
button:disabled { opacity: .45; }
button.tweede { background: var(--veld); color: var(--tekst); font-weight: 600; }
button.klein { padding: 5px 10px; font-size: .8rem; border-radius: 10px; }
button.weg { background: none; color: var(--stil); padding: 6px 8px; font-weight: 500; }
.rij { display: flex; gap: 8px; align-items: flex-end; }
.rij > * { flex: 1; }
.rij > button { flex: 0 0 auto; margin-bottom: 10px; }
.rij.vier label { min-width: 0; }

/* Onderbalk */
nav { position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: center; z-index: 5;
  background: color-mix(in srgb, var(--kaart) 90%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-top: 1px solid var(--lijn); padding: 6px 6px max(calc(env(safe-area-inset-bottom) - 10px), 6px); }
/* iPhone-app met doorzichtige statusbalk: op korte pagina's (Eten, Vraag) rekent iOS het scherm te kort
   en zweeft de onderbalk zo hoog als de statusbalk. Iets langer dan het scherm maken verhelpt dat. */
html { min-height: calc(100% + env(safe-area-inset-top)); }
/* Zwarte strook achter de statusbalk, zodat de klok nooit over de inhoud staat. */
body::before { content: ''; position: fixed; top: 0; left: 0; right: 0; height: env(safe-area-inset-top); background: var(--achter); z-index: 6; }
header.verborgen + main { padding-top: calc(env(safe-area-inset-top) + 10px); }
nav button { flex: 1; max-width: 120px; background: none; color: var(--stil); border-radius: 0; padding: 4px 0; font-size: .68rem;
  font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 3px; }
nav button span { display: grid; place-items: center; width: 54px; height: 30px; border-radius: 99px; transition: background .15s; }
nav button svg { width: 22px; height: 22px; }
nav button.actief { color: var(--tekst); }
nav button.actief span { background: var(--knop); color: var(--knop-tekst); }

/* Fitbit-kaart */
.cijfers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 10px; }
.cijfer b { display: block; font-family: var(--rond); font-size: 1.9rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.cijfer span { font-size: .74rem; color: var(--stil); font-weight: 500; }
.cijfer:first-child b { color: var(--accent); }
.fasebalk { display: flex; height: 12px; border-radius: 6px; overflow: hidden; margin: 16px 0 6px; background: var(--veld); gap: 2px; }
.fasebalk i { display: block; }

/* Dagboek */
.veld { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--lijn); }
.veld:first-child { border-top: 0; padding-top: 0; }
.veld > span { flex: 1; font-weight: 500; }
.knoppen { display: flex; gap: 4px; background: var(--veld); padding: 3px; border-radius: 12px; }
.knoppen button { background: none; color: var(--stil); padding: 6px 12px; font-weight: 600; border-radius: 9px; }
.knoppen button.aan { background: var(--knop); color: var(--knop-tekst); }
.veld input { width: 90px; margin: 0; text-align: right; }
.veld input.breed { width: 55%; text-align: left; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper input { width: 56px; text-align: center; }
.stepper button { width: 36px; height: 36px; padding: 0; border-radius: 50%; background: var(--veld); color: var(--tekst); }

/* Maaltijden */
.maaltijd { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--lijn); }
.maaltijd:first-child { border-top: 0; padding-top: 0; }
.maaltijd img { width: 52px; height: 52px; object-fit: cover; border-radius: 12px; }
.maaltijd .wat { flex: 1; min-width: 0; font-weight: 500; }
.maaltijd .wat small { color: var(--stil); display: block; font-weight: 400; }
.maaltijd .kcal { font-weight: 800; white-space: nowrap; cursor: pointer; }
#kcaltotaal { font-weight: 800; color: var(--tekst); font-size: .95rem; }
#tab-vandaag .kaart > button.tweede { width: 100%; margin-top: 10px; }
.fotoknop { display: block; background: var(--veld); border: 2px dashed var(--lijn); border-radius: 16px; padding: 26px 18px;
  text-align: center; cursor: pointer; color: var(--tekst); font-size: 1rem; font-weight: 600; margin-bottom: 14px; }
.fotoknop input { display: none; }
.fotoknop img { max-width: 100%; max-height: 260px; border-radius: 12px; display: block; margin: 0 auto; }

/* Vraag */
.snel { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip { background: var(--accent-zacht); color: var(--accent); font-weight: 600; font-size: .84rem; padding: 7px 12px; border-radius: 99px; }
#vraagknop { width: 100%; margin-top: 8px; }
.antwoord .tekst ul { padding-left: 1.2rem; margin: .3rem 0; }
.antwoord .tekst p { margin: .4rem 0; }
.antwoord .meta { display: flex; justify-content: space-between; align-items: center; }

/* Grafieken */
.grafiek { margin-bottom: 22px; }
.grafiek svg { width: 100%; height: 120px; display: block; }
.grafiek .kop { align-items: baseline; }
.grafiek .kop b { font-size: 1rem; }
.grafiek .kop span { font-size: .85rem; color: var(--stil); }

/* Instellingen */
.lijnveld { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--lijn); }
.lijnveld:first-child { border-top: 0; }
.lijnveld span { flex: 1; }
.lijnveld.uit span { color: var(--stil); }
.schakel { position: relative; flex: none; width: 51px; height: 31px; padding: 0; border-radius: 99px; background: #39393d; transition: background .2s; }
.schakel::after { content: ''; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; transition: transform .2s; }
.schakel.aan { background: var(--knop); }
.schakel.aan::after { transform: translateX(20px); }
.meter { height: 10px; background: var(--veld); border-radius: 5px; overflow: hidden; margin: 10px 0; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
.meter.zuinig i { background: var(--geel); }
.meter.goedkoop i, .meter.op i { background: var(--rood); }
#uitlog { width: 100%; margin-top: 14px; }

#melding { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 86px); transform: translateX(-50%); background: var(--tekst);
  color: var(--achter); padding: 10px 18px; border-radius: 99px; font-size: .9rem; font-weight: 600; z-index: 10; max-width: 90vw; }
.kop select { width: auto; margin: 0; padding: 6px 10px; font-size: 16px; }
p.klein { font-size: .85rem; color: var(--stil); margin: 0 0 .6rem; }
.pk-lijst { list-style: none; padding: 0; margin: 0 0 .6rem; }
.pk-lijst li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; font-size: .9rem; border-top: 1px solid var(--lijn); }
.pk-lijst li:first-child { border-top: 0; }

/* Ringen op doelen */
.ringen { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.ring { position: relative; display: flex; flex-direction: column; align-items: center; }
.ring svg { width: 100%; max-width: 76px; aspect-ratio: 1; }
.ring circle { fill: none; stroke-width: 10; stroke-linecap: round; transition: stroke-dasharray .5s; }
.ring .ring-achter { opacity: .22; }
.ring b { font-family: var(--rond); font-size: 1.05rem; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ring span { font-size: .72rem; color: var(--stil); font-weight: 500; }
.ring.gehaald b::after { content: " ✓"; color: var(--accent); }

/* Macro's in de etenkaart */
.macros { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.macro { background: var(--veld); border-radius: 12px; padding: 8px 10px; }
.macro span { display: block; font-size: .72rem; color: var(--stil); font-weight: 500; }
.macro b { font-size: .95rem; font-variant-numeric: tabular-nums; }
.macro .meter { height: 6px; margin: 6px 0 0; background: var(--kaart); }

/* Gewicht */
.gewichtrij { display: flex; align-items: center; gap: 10px; }
.gewichtrij input { width: 120px; margin: 0; font-size: 1.4rem; font-weight: 800; text-align: center; }
.gewichtrij span { color: var(--stil); font-weight: 600; }

/* Doelen */
.rij.twee label { min-width: 0; }

/* Weekvergelijking */
table.week { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
table.week th { font-size: .7rem; color: var(--stil); font-weight: 600; text-align: right; padding: 0 0 6px; }
table.week td { padding: 8px 0; border-top: 1px solid var(--lijn); text-align: right; white-space: nowrap; }
table.week td:first-child, table.week th:first-child { text-align: left; font-weight: 500; }
table.week i { font-style: normal; font-weight: 800; margin-left: 4px; color: var(--stil); }
table.week i.beter { color: var(--accent); }
table.week i.slechter { color: var(--rood); }

/* Buik */
#buikkaart.vraagt { box-shadow: 0 0 0 2px var(--knop); }
.buikrij { padding: 8px 0; border-top: 1px solid var(--lijn); }
.buikrij:first-child { border-top: 0; }
.buikrij > span { display: block; font-weight: 600; margin-bottom: 6px; }
.buikrij.nu > span::after { content: ' · nu'; color: var(--stil); font-weight: 400; }
.buikknoppen { width: 100%; }
.buikknoppen button { flex: 1; padding: 8px 4px; }
.buikknoppen button.aan.s0 { background: var(--knop); color: var(--knop-tekst); }
.buikknoppen button.aan.s1 { background: var(--geel); color: #161514; }
.buikknoppen button.aan.s2, .buikknoppen button.aan.s3 { background: var(--rood); color: #fff; }
.buikrij .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.buikrij .chip { opacity: .5; }
.buikrij .chip.aan { opacity: 1; }
#buikervoor .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
ul.ervoor, ul.verband { margin: 4px 0 10px; padding-left: 18px; font-size: .9rem; }
ul.ervoor small { color: var(--stil); }
ul.verband li.opvallend b { color: var(--rood); }

/* Schermtijd koppelen */
.sleutelvak { background: var(--veld); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; font-size: .88rem; }
.sleutelvak code { word-break: break-all; font-size: .8rem; }
ol.stappen { padding-left: 18px; margin: 8px 0; }
ol.stappen li { margin-bottom: 4px; }

/* Tijdens typen de onderbalk weg, anders schuift die op de iPhone mee omhoog boven het toetsenbord. */
body.typt nav { display: none; }
body.typt main { padding-bottom: 24px; }
