/* Indy — mobiel-first, nuchter/klinisch. Geen gamification (LP §13). */
:root {
  --bg: #f4f1e9;
  --surface: #ffffff;
  --surface-2: #faf8f2;
  --ink: #2b2822;
  --muted: #857f70;
  --line: #e6e1d4;
  --accent: #2f6f8f;
  --accent-ink: #ffffff;
  --gold: #ca9a34;
  --good: #3f9b52;
  --warn: #d98c1f;
  --bad: #c2412d;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(40, 35, 25, 0.08), 0 6px 18px rgba(40, 35, 25, 0.06);
  --safe-b: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); }
body { -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
button { font: inherit; cursor: pointer; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; font-weight: 700; }

#app { max-width: 560px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(150px + var(--safe-b)); }

/* Header */
.appbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 12px 16px calc(12px); display: flex; align-items: center; gap: 10px;
}
.appbar .logo { width: 30px; height: 30px; border-radius: 8px; }
.appbar h1 { font-size: 17px; }
.appbar .sub { font-size: 12px; color: var(--muted); }
.appbar .spacer { flex: 1; }
.appbar .datenav { display: flex; align-items: center; gap: 6px; }
.iconbtn {
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px;
  width: 34px; height: 34px; display: grid; place-items: center; font-size: 16px; color: var(--ink);
}

.screen { padding: 14px 16px 0; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 18px 2px 8px; }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px;
}
.card h2 { font-size: 15px; margin-bottom: 4px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }

/* Status blocks */
.status-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.status-block {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--surface);
  text-align: left; display: flex; flex-direction: column; gap: 4px; min-height: 84px;
}
.status-block .icon { font-size: 20px; }
.status-block .lbl { font-size: 13px; font-weight: 600; }
.status-block .val { font-size: 12px; color: var(--muted); }
.status-block .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-niet { background: #cfc9ba; }
.dot-niets { background: var(--good); }
.dot-data { background: var(--accent); }
.status-block.s-warn { border-color: #f0d9b8; background: #fdf6ea; }
.status-block.s-bad { border-color: #eecac0; background: #fcefeb; }

/* Buttons */
.btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 12px; padding: 11px 14px; font-size: 14px; font-weight: 600; display: inline-flex;
  align-items: center; justify-content: center; gap: 8px; width: 100%;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.gold { background: var(--gold); color: #2b2510; border-color: var(--gold); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); border-color: #eecac0; }
.btn.big { padding: 16px; font-size: 16px; }
.btn.sm { width: auto; padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: 0.5; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { width: auto; flex: 1; }

/* Coverage meter */
.coverage { display: flex; align-items: center; gap: 12px; }
.coverage .bar { flex: 1; height: 8px; border-radius: 6px; background: var(--line); overflow: hidden; }
.coverage .bar > span { display: block; height: 100%; background: var(--gold); }
.coverage .pct { font-weight: 700; font-size: 15px; }

/* 30-day strip */
.strip { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 10px; -webkit-overflow-scrolling: touch; }
.strip .day {
  flex: 0 0 auto; width: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 6px 4px;
  text-align: center; background: var(--surface); display: flex; flex-direction: column; gap: 3px; align-items: center;
}
.strip .day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.strip .day .dnum { font-size: 13px; font-weight: 700; }
.strip .day .dwd { font-size: 9px; color: var(--muted); text-transform: uppercase; }
.strip .day .marks { display: flex; gap: 2px; height: 8px; }
.strip .day .m { width: 7px; height: 7px; border-radius: 50%; }
.strip .day.empty { opacity: 0.55; border-style: dashed; }

/* Chips / toggles */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 13px;
  font-size: 13px; color: var(--ink); display: inline-flex; align-items: center; gap: 6px;
}
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip.on.good { background: var(--good); border-color: var(--good); }
.chip.on.warn { background: var(--warn); border-color: var(--warn); }
.chip.on.bad { background: var(--bad); border-color: var(--bad); }

/* Fecal card */
.fecal-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.fecal-card {
  border: 2px solid var(--line); border-radius: 12px; padding: 6px 4px 8px; background: var(--surface);
  display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center;
}
.fecal-card.on { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(47,111,143,0.2); }
.fecal-svg { width: 48px; height: 48px; }
.fecal-card .fs-num { font-size: 12px; font-weight: 700; }
.fecal-card .fs-lbl { font-size: 9px; color: var(--muted); line-height: 1.1; }
.band-dot { width: 8px; height: 8px; border-radius: 50%; }

/* Forms */
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], textarea, select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink); font-size: 15px;
}
textarea { min-height: 64px; resize: vertical; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.slider-val { font-weight: 700; font-size: 15px; min-width: 22px; text-align: center; }

/* Meal mix rows */
.mix-item { border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 8px; background: var(--surface-2); }
.mix-item .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mix-item .aandeel { display: flex; align-items: center; gap: 8px; margin-top: 8px; }

/* Bottom nav */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: var(--surface); border-top: 1px solid var(--line);
  display: flex; justify-content: space-around; padding: 6px 6px calc(6px + var(--safe-b));
  max-width: 560px; margin: 0 auto;
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 12px;
  color: var(--muted); text-decoration: none; font-size: 10px; border-radius: 10px;
}
.bottomnav a .ni { font-size: 20px; }
.bottomnav a.active { color: var(--accent); }

/* FAB */
.fab {
  position: fixed; z-index: 31; right: calc(50% - 280px + 18px); bottom: calc(74px + var(--safe-b));
  width: 62px; height: 62px; border-radius: 50%; background: var(--accent); color: #fff;
  border: none; font-size: 26px; box-shadow: 0 6px 18px rgba(47,111,143,0.45); display: grid; place-items: center;
}
@media (max-width: 596px) { .fab { right: 18px; } }

/* Sheet / modal */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(30, 26, 18, 0.42); z-index: 40;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: var(--bg); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  border-radius: 20px 20px 0 0; padding: 8px 16px calc(24px + var(--safe-b));
  animation: slideup 0.18s ease-out;
}
@keyframes slideup { from { transform: translateY(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.sheet .grab { width: 40px; height: 4px; background: var(--line); border-radius: 3px; margin: 8px auto 6px; }
.sheet h2 { font-size: 18px; margin: 6px 0 12px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 8px; position: sticky; bottom: 0; background: var(--bg); padding: 10px 0 0; }
.sheet-actions .btn { flex: 1; }

/* Incident big choice */
.incident-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 4px 0 8px; }
.incident-choice button {
  border: 1px solid var(--line); background: var(--surface); border-radius: 16px; padding: 22px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; color: var(--ink);
}
.incident-choice button .em { font-size: 40px; }

/* Toast */
#toast-root { position: fixed; bottom: calc(94px + var(--safe-b)); left: 0; right: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast { background: #2b2822; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow); max-width: 90%; }
.toast.warn { background: var(--warn); color: #241a06; }
.toast.err { background: var(--bad); }

/* Login */
.login-wrap { max-width: 380px; margin: 0 auto; padding: 40px 20px; }
.login-wrap .brand { text-align: center; margin-bottom: 20px; }
.login-wrap .brand img { width: 64px; height: 64px; border-radius: 16px; }
.login-wrap .brand h1 { font-size: 24px; margin-top: 10px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 16px; }
.seg button { flex: 1; padding: 10px; border: none; background: var(--surface); color: var(--muted); font-weight: 600; }
.seg button.on { background: var(--accent); color: #fff; }

/* Product / list rows */
.list-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: none; }
.list-row .grow { flex: 1; }
.badge { font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; padding: 3px 7px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.badge.aangenomen { background: #fbf1dc; border-color: #ecd9ad; color: #916c1c; }
.ingredient-tag { font-size: 11px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; color: var(--muted); }

/* Charts */
.chart-box { position: relative; height: 220px; margin-top: 8px; }
.legend-row { display: flex; flex-wrap: wrap; gap: 12px; font-size: 11px; color: var(--muted); margin-top: 6px; }
.legend-row span .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: middle; margin-right: 4px; }

.empty-hint { text-align: center; color: var(--muted); padding: 28px 10px; font-size: 13px; }
.warnbox { background: #fdf6ea; border: 1px solid #f0d9b8; color: #8a6314; border-radius: 10px; padding: 10px 12px; font-size: 12px; margin-bottom: 12px; }
.disclaimer { font-size: 11px; color: var(--muted); text-align: center; padding: 16px 20px 8px; line-height: 1.5; }
.hidden { display: none !important; }
