/* Voeding: bovenop app.css (zelfde kleuren en typografie).
   Kleur: blauw = gegeten, lichtblauw = gepland (vaste dag), streep = doel. Groen/oranje/rood alleen voor het oordeel. */

body.food { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }

/* ---------- kop: merk + tabs, dan de dag ---------- */
.food .top { gap: 8px 12px; }
.food .top .daynav { flex: 1 1 100%; justify-content: space-between; }
.food .top .day { flex: 1; }
@media (min-width: 720px) { .food .top .daynav { flex: 0 0 auto; } }

.food main { max-width: 860px; gap: 30px; }
.food-top { gap: 12px; }

/* ---------- fase: kalibreren / voorstel / controle ---------- */
.phase { display: grid; gap: 10px; }
.phase .steps { display: flex; gap: 6px; }
.phase .steps i { flex: 1; height: 6px; border-radius: 3px; background: var(--sunk); }
.phase .steps i.on { background: var(--accent); }
.phase p { font-size: 14.5px; }
.proposal { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.proposal li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.proposal li:first-child { border-top: 0; }
.proposal .what span { display: block; font-size: 12.5px; color: var(--muted); }
.proposal .n { font-family: var(--f-mono); font-size: 12.5px; text-align: right; white-space: nowrap; }

/* ---------- budget (bovenste kaart) ---------- */
.budget { gap: 14px; }
.daytype { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.daytype select {
  appearance: none; -webkit-appearance: none; font: inherit; font-weight: 600; color: var(--ink);
  border: 1px solid var(--line); background: var(--sunk); border-radius: 999px; padding: 4px 30px 4px 12px; min-height: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%; background-size: 5px 5px; background-repeat: no-repeat;
}
.daytype .why { font-size: 13px; color: var(--muted); }

.room { display: grid; gap: 2px; }
.room .k { font-size: 13.5px; color: var(--muted); }
.room .v { font-family: var(--f-display); font-weight: 700; font-size: 46px; line-height: 1; letter-spacing: .01em; }
.room .v small { font-family: var(--f-body); font-size: 16px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.room .split { font-family: var(--f-mono); font-size: 13px; color: var(--muted); }
.room .split b { color: var(--ink); font-weight: 500; }
.room.over .v { color: var(--crit-text); }

.bars { display: grid; gap: 10px; }
.mbar { display: grid; gap: 4px; }
.mbar .lbl { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.mbar .lbl b { font-weight: 600; }
.mbar .lbl span { font-family: var(--f-mono); font-size: 12.5px; color: var(--muted); }
.mbar .lbl span b { color: var(--ink); font-weight: 500; }
.mtrack { position: relative; height: 10px; border-radius: 5px; background: var(--sunk); }
.mtrack .fill { position: absolute; top: 0; bottom: 0; left: 0; display: flex; gap: 2px; border-radius: 5px; overflow: hidden; max-width: 100%; }
.mtrack .fill i { display: block; height: 100%; }
.mtrack .fill i.eaten { background: var(--accent); }
.mtrack .fill i.planned { background: var(--accent-soft); }
.mtrack .fill i.over { background: var(--critical); }
.mtrack .goal { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); border-radius: 1px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 500; cursor: pointer; text-decoration: none; }
.btn.primary, button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 13.5px; border-radius: 8px; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--crit-text); }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- momenten en regels ---------- */
.slots { display: grid; gap: 12px; }
.slot { gap: 6px; padding: 12px 14px; }
.slot-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.slot-head h3 { font-size: 21px; }
.slot-head .sum { font-family: var(--f-mono); font-size: 12.5px; color: var(--muted); margin-left: auto; text-align: right; }
.slot-head .add { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 20px; line-height: 1; cursor: pointer; flex: none; }
.slot .empty { padding: 4px 0 2px; }
.rows { display: grid; margin: 0; padding: 0; list-style: none; }
.rows li { border-top: 1px solid var(--line); }
.rows li:first-child { border-top: 0; }
.entry { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; width: 100%;
  padding: 9px 0; border: 0; background: none; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.entry .thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--sunk); display: block; }
.entry .thumb.none { display: grid; place-items: center; color: var(--muted); font-size: 18px; }
.entry .what { min-width: 0; }
.entry .what b { font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry .what span { display: block; font-size: 12.5px; color: var(--muted); font-family: var(--f-mono); }
.entry .kc { font-family: var(--f-mono); font-size: 13px; text-align: right; white-space: nowrap; }
.entry .kc small { display: block; color: var(--muted); font-size: 11px; }

.planrow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 9px 0; cursor: pointer; }
.planrow input { width: 24px; height: 24px; margin: 0 10px; accent-color: var(--accent); cursor: pointer; }
.planrow .what b { font-weight: 500; }
.planrow .what span { display: block; font-size: 12.5px; color: var(--muted); font-family: var(--f-mono); }
.planrow .kc { font-family: var(--f-mono); font-size: 13px; color: var(--muted); }
.planrow.open .what b { color: var(--muted); }
.planrow.done .kc { color: var(--ink); }
.plan-tag { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }

.day-done { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; }
.day-done p { font-size: 13.5px; color: var(--muted); flex: 1 1 260px; }

/* ---------- week ---------- */
.wk { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.wk button { display: grid; justify-items: center; gap: 4px; padding: 6px 0 7px; border-radius: 8px; border: 0; background: var(--sunk); cursor: pointer; min-width: 0; color: var(--muted); font-size: 12px; }
.wk button b { color: var(--ink); font-weight: 600; font-size: 13px; }
.wk button .st { width: 16px; height: 16px; border-radius: 5px; box-shadow: inset 0 0 0 1.5px var(--axis); }
.wk button .st.goed { background: var(--good); box-shadow: none; }
.wk button .st.bijna { background: var(--warning); box-shadow: none; }
.wk button .st.mis { background: var(--critical); box-shadow: none; }
.wk button .st.part { background: var(--accent-soft); box-shadow: none; }
.wk button .kc { font-family: var(--f-mono); font-size: 10.5px; }
.wk button[aria-current="date"] { background: var(--surface); box-shadow: inset 0 0 0 2px var(--accent); }
.facts { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.facts li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px; }
.facts li:first-child { border-top: 0; }
.facts li span:last-child { font-family: var(--f-mono); font-size: 13px; text-align: right; }
.weight { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.weight input { width: 6.5em; }

/* ---------- formulieren ---------- */
input[type="text"], input[type="number"], input[type="search"], textarea, select.plain {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  min-height: 40px; padding: 6px 10px; width: 100%;
}
textarea { min-height: 76px; resize: vertical; }
input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
label.f { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.grid4 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 520px) { .grid4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: 13.5px; cursor: pointer; min-height: 34px; color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); font-weight: 600; }

/* ---------- onderblad (dialog) ---------- */
dialog.sheet { padding: 0; border: 0; background: transparent; color: var(--ink); max-width: none; max-height: none; width: 100%; height: 100%; margin: 0; }
dialog.sheet::backdrop { background: rgba(8, 11, 16, .45); }
.sheet-in { position: absolute; left: 0; right: 0; bottom: 0; max-height: 92dvh; overflow: auto; overscroll-behavior: contain;
  background: var(--bg); border-radius: 16px 16px 0 0; padding: 8px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  display: grid; gap: 14px; align-content: start; }
@media (min-width: 720px) {
  .sheet-in { left: 50%; right: auto; bottom: auto; top: 6vh; width: 620px; transform: translateX(-50%); border-radius: 16px; max-height: 88vh; padding: 16px 20px 20px; }
}
.grab { width: 40px; height: 4px; border-radius: 2px; background: var(--axis); justify-self: center; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: -8px; background: var(--bg); padding: 4px 0; z-index: 1; }
.sheet-head h2 { font-size: 26px; }
.close { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 18px; cursor: pointer; flex: none; }
.sheet .photo { width: 100%; max-height: 260px; object-fit: cover; border-radius: 12px; display: block; background: var(--sunk); }
.sheet .bottom { position: sticky; bottom: calc(-16px - env(safe-area-inset-bottom, 0px)); background: var(--bg); padding: 10px 0 0; display: grid; gap: 10px; border-top: 1px solid var(--line); }

.est { display: grid; gap: 8px; font-size: 14px; }
.est .desc { color: var(--muted); font-size: 13.5px; }
.est .q { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--warning); border-radius: 8px; padding: 10px 12px; display: grid; gap: 8px; }
.est .match { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px; padding: 10px 12px; display: grid; gap: 8px; }

.items { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.item { display: grid; gap: 4px; padding: 12px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; padding-top: 4px; }
.item-top { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.item-top b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.item-top .g { display: inline-flex; align-items: center; gap: 4px; font-family: var(--f-mono); font-size: 14px; }
.item-top .g input { width: 4.6em; min-height: 32px; padding: 2px 6px; text-align: right; font-family: var(--f-mono); }
.item-top .x { width: 30px; height: 30px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); font-size: 16px; cursor: pointer; }
.item .meta { display: flex; justify-content: space-between; gap: 8px; font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.item .portie { font-family: var(--f-body); font-size: 12.5px; color: var(--muted); }
.chips.portions { gap: 5px; }
.chips.portions .chip { min-height: 30px; padding: 3px 10px; font-size: 12.5px; }

/* slider: dikke duim (goed te pakken op de telefoon), band = onder- tot bovengrens van de schatting */
.slide { position: relative; height: 34px; }
.slide .band { position: absolute; top: 13px; height: 8px; border-radius: 4px; background: var(--accent-wash); box-shadow: inset 0 0 0 1px var(--accent-soft); pointer-events: none; }
input[type="range"] { -webkit-appearance: none; appearance: none; position: absolute; inset: 0; width: 100%; height: 34px; margin: 0; background: transparent; cursor: pointer; touch-action: pan-y; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--line); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -11px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,.25); }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--accent-wash), 0 0 0 5px var(--accent); }

.portion { display: grid; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.portion .lbl { display: flex; justify-content: space-between; font-size: 13.5px; }
.portion .lbl b { font-family: var(--f-mono); font-weight: 500; }

.tot { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 14px; align-items: end; }
.tot .kcal { font-family: var(--f-display); font-weight: 700; font-size: 38px; line-height: 1; }
.tot .kcal small { font-family: var(--f-body); font-size: 14px; color: var(--muted); font-weight: 500; }
.tot .mac { font-family: var(--f-mono); font-size: 13px; color: var(--muted); }
.tot .mac b { color: var(--ink); font-weight: 500; }
.tot .fit { grid-column: 1 / -1; font-size: 13px; }
.fit.good { color: var(--good-text); } .fit.warn { color: var(--warn-text); } .fit.crit { color: var(--crit-text); }

.results { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; max-height: 46vh; overflow: auto; }
.results li { border-top: 1px solid var(--line); }
.results li:first-child { border-top: 0; }
.results button { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; width: 100%; padding: 9px 2px; border: 0; background: none; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.results button span { display: block; font-size: 12.5px; color: var(--muted); }
.results button .n { font-family: var(--f-mono); font-size: 12.5px; text-align: right; white-space: nowrap; color: var(--ink); }
.results .src { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }

/* laden: zachte glans; uit bij 'minder beweging' */
.skel { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--sunk) 0%, var(--line) 50%, var(--sunk) 100%); background-size: 200% 100%; animation: shine 1.2s linear infinite; }
.skel.tall { height: 54px; }
@keyframes shine { to { background-position: -200% 0; } }
.thinking { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.thinking i { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; transform: scale(.7); } }

/* ---------- vaste knop onderin ---------- */
.fab { position: fixed; z-index: 15; left: 0; right: 0; bottom: 0; display: flex; gap: 8px; justify-content: center;
  padding: 10px max(16px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
.fab button { min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 16px; padding: 0 18px; cursor: pointer; }
.fab button.primary { flex: 1; max-width: 420px; font-size: 16.5px; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.fab #fabAdd { width: 52px; padding: 0; font-size: 24px; }

.toast { position: fixed; z-index: 30; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--ink); color: var(--surface); border-radius: 10px; padding: 9px 14px; font-size: 14px; display: flex; gap: 12px; align-items: center; max-width: calc(100% - 32px); }
.toast[hidden] { display: none; }
.toast button { border: 0; background: none; color: var(--accent-soft); font-weight: 600; cursor: pointer; padding: 0; }

@media (prefers-reduced-motion: reduce) { .skel, .thinking i { animation: none; } }
