/* =========================================================================
   MEAL PLANNER — app shell, shared components, Today screen
   Layout is driven by .app--mobile / .app--desktop (two live instances).
   ========================================================================= */

/* ---------------------------------------------------------------- shell */
.app {
  position: relative;
  display: flex;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ff-body);
  overflow: hidden;
  height: 100%;
}
.app--mobile  { flex-direction: column; min-height: 0; }
.app--desktop { flex-direction: row; }

/* faint paper grain */
.app::before {
  content: "";
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    radial-gradient(circle at 18% 12%, rgba(47,125,79,0.035), transparent 42%),
    radial-gradient(circle at 86% 88%, rgba(207,98,56,0.03), transparent 46%);
}

/* ------------ MOBILE: top brand + bottom tabs ------------ */
.mtop {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: relative; z-index: 3; flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 9px; }
.brand__mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--brand); color: #fff;
  display: grid; place-items: center; flex-shrink: 0;
  box-shadow: var(--sh-1);
}
.brand__mark svg { width: 18px; height: 18px; }
.brand__name {
  font-family: var(--ff-display); font-weight: 800; font-size: var(--fs-18);
  letter-spacing: var(--tr-tight); line-height: 1;
}
.brand__name span { color: var(--brand); }
.brand__sub {
  font-size: var(--fs-11); color: var(--ink-3); font-weight: 600;
  letter-spacing: 0.02em; margin-top: 1px;
}

.mtop__date {
  text-align: right; line-height: 1.1;
}
.mtop__date b {
  font-family: var(--ff-display); font-weight: 700; font-size: var(--fs-15);
  display: block; text-transform: capitalize;
}
.mtop__date span { font-size: var(--fs-11); color: var(--ink-3); font-weight: 600; }

/* tab bar */
.tabs {
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--line);
  position: relative; z-index: 3; flex-shrink: 0;
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  gap: 2px;
}
.tab {
  appearance: none; border: 0; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 7px 2px 6px; border-radius: var(--r-2);
  color: var(--ink-3); font-family: var(--ff-body);
  font-size: 10px; font-weight: 700; letter-spacing: 0.01em;
  transition: color .15s, background .15s;
  min-height: 48px;
}
.tab svg { width: 22px; height: 22px; }
.tab[data-active="1"] { color: var(--brand); background: var(--brand-soft); }
.tab:active { transform: scale(.96); }

/* ------------ DESKTOP: sidebar ------------ */
.side {
  width: 248px; flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: relative; z-index: 3;
  padding: 22px 16px;
}
.side__brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 22px; }
.side__brand .brand__mark { width: 38px; height: 38px; border-radius: 11px; }
.side__brand .brand__mark svg { width: 22px; height: 22px; }
.side__brand .brand__name { font-size: var(--fs-20); }

.side__nav { display: flex; flex-direction: column; gap: 3px; }
.snav {
  appearance: none; border: 0; background: none; cursor: pointer;
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px; border-radius: var(--r-2);
  color: var(--ink-2); font-family: var(--ff-body);
  font-size: var(--fs-15); font-weight: 600; text-align: left; width: 100%;
  transition: background .14s, color .14s;
}
.snav svg { width: 21px; height: 21px; color: var(--ink-3); transition: color .14s; }
.snav:hover { background: var(--paper-2); color: var(--ink); }
.snav[data-active="1"] { background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; }
.snav[data-active="1"] svg { color: var(--brand); }
.snav__badge {
  margin-left: auto; font-size: var(--fs-12); font-weight: 700;
  background: var(--brand); color: #fff; border-radius: var(--r-pill);
  min-width: 20px; height: 20px; padding: 0 6px; display: grid; place-items: center;
}
.snav[data-active="1"] .snav__badge { background: var(--brand); }

.side__foot { margin-top: auto; }
.side__week {
  background: var(--paper-2); border: 1px solid var(--line);
  border-radius: var(--r-3); padding: 13px 14px; margin-top: 18px;
}
.side__week-eyebrow { font-size: var(--fs-11); font-weight: 700; letter-spacing: var(--tr-caps); text-transform: uppercase; color: var(--ink-3); }
.side__week-range { font-family: var(--ff-display); font-weight: 700; font-size: var(--fs-15); margin-top: 3px; text-transform: capitalize; }
.side__week-meta { font-size: var(--fs-12); color: var(--ink-3); margin-top: 6px; }

/* gebruikersregel onderaan sidebar */
.side__user {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; margin-top: 12px;
  border-top: 1px solid var(--line);
}
.side__user-av {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; flex-shrink: 0;
}
.side__user-name { font-weight: 700; font-size: var(--fs-13); flex: 1; }
.side__user-logout {
  appearance: none; background: none; border: 1.5px solid var(--line-2);
  border-radius: 8px; padding: 3px 9px; font-size: var(--fs-11);
  font-family: inherit; font-weight: 700; color: var(--ink-3);
  cursor: pointer; white-space: nowrap;
}
.side__user-logout:hover { border-color: var(--ink-3); color: var(--ink); }

/* ------------ main / screen container ------------ */
.main { flex: 1; min-width: 0; min-height: 0; position: relative; z-index: 1; display: flex; flex-direction: column; overflow: hidden; }
.screen { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; position: relative; }
.app--mobile  .screen { padding: 0 0 12px; }
.app--desktop .screen { padding: 0; }

/* desktop content gets a comfy max width + padding */
.wrap { width: 100%; }
.app--desktop .wrap { max-width: 1080px; margin: 0 auto; padding: 30px 40px 56px; }
.app--mobile  .wrap { padding: 0 16px 8px; }

/* screen header */
.shead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.app--mobile .shead { padding: 18px 0 14px; }
.app--desktop .shead { padding: 0 0 24px; }
.shead__title {
  font-family: var(--ff-display); font-weight: 800; letter-spacing: var(--tr-tight);
  line-height: 1; margin: 0;
}
.app--mobile .shead__title { font-size: var(--fs-28); }
.app--desktop .shead__title { font-size: var(--fs-42); }
.shead__sub { color: var(--ink-3); font-size: var(--fs-14); margin-top: 6px; font-weight: 500; }
.shead__sub b { color: var(--ink-2); font-weight: 700; }

/* ---------------------------------------------------------------- buttons */
.btn {
  appearance: none; cursor: pointer; font-family: var(--ff-body);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 700; font-size: var(--fs-14);
  padding: 11px 18px; border-radius: var(--r-2);
  background: var(--brand); color: #fff; border: 1px solid var(--brand);
  box-shadow: var(--sh-1); line-height: 1;
  transition: transform .08s, background .14s, box-shadow .14s, border-color .14s;
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { background: var(--brand-deep); border-color: var(--brand-deep); }
.btn:active { transform: translateY(1px); }
.btn--soft { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; box-shadow: none; }
.btn--soft:hover { background: #d8e8dc; }
.btn--ghost { background: var(--surface); color: var(--ink-2); border-color: var(--line-2); box-shadow: none; }
.btn--ghost:hover { background: var(--paper-2); color: var(--ink); border-color: var(--ink-4); }
.btn--danger { background: var(--surface); color: var(--danger); border-color: var(--line-2); box-shadow: none; }
.btn--danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn--sm { padding: 8px 13px; font-size: var(--fs-13); border-radius: var(--r-1); }
.btn--lg { padding: 14px 22px; font-size: var(--fs-16); border-radius: var(--r-3); }
.btn--block { width: 100%; }
.btn--icon { padding: 9px; border-radius: var(--r-2); }
.btn--icon svg { width: 19px; height: 19px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* chips & segmented */
.chip {
  appearance: none; cursor: pointer; font-family: var(--ff-body);
  font-weight: 600; font-size: var(--fs-13); white-space: nowrap;
  padding: 7px 13px; border-radius: var(--r-pill);
  background: var(--surface); color: var(--ink-2); border: 1px solid var(--line-2);
  transition: all .13s; line-height: 1; display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { border-color: var(--ink-4); color: var(--ink); }
.chip[data-active="1"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip[data-active="1"][data-c] { background: var(--c); border-color: var(--c); color: #fff; }
.chip__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--ink-3)); }

/* generic card */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-3); box-shadow: var(--sh-1);
}

/* pill / tag */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--fs-12); font-weight: 700; line-height: 1;
  padding: 5px 9px; border-radius: var(--r-pill);
  background: var(--paper-2); color: var(--ink-2);
}
.tag--c { background: var(--c-soft); color: var(--c-ink); }
.tag svg { width: 13px; height: 13px; }

/* ---------------------------------------------------------------- TODAY */
.today { display: flex; flex-direction: column; gap: 16px; }
.app--desktop .today { display: grid; grid-template-columns: 360px 1fr; gap: 28px; align-items: start; }

/* dashboard card (gauge + donut) */
.dash {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-4); box-shadow: var(--sh-2);
  padding: 22px; position: relative; overflow: hidden;
}
.app--desktop .today__rail { position: sticky; top: 8px; display: flex; flex-direction: column; gap: 16px; }
.dash__eyebrow { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.dash__gaugewrap { display: flex; flex-direction: column; align-items: center; padding: 6px 0 2px; }
.gauge { position: relative; }
.gauge__center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
}
.gauge__num {
  font-family: var(--ff-display); font-weight: 800; line-height: .92;
  letter-spacing: var(--tr-tight); font-variant-numeric: tabular-nums;
}
.gauge__unit { font-size: var(--fs-12); font-weight: 700; color: var(--ink-3); letter-spacing: var(--tr-caps); text-transform: uppercase; margin-top: 3px; }
.gauge__sub { font-size: var(--fs-13); color: var(--ink-2); font-weight: 600; margin-top: 2px; }
.gauge__sub b { font-family: var(--ff-display); }

/* status pill under gauge */
.statuspill {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 12px;
  font-size: var(--fs-13); font-weight: 700; padding: 7px 14px; border-radius: var(--r-pill);
}
.statuspill[data-z="ok"] { background: var(--ok-soft); color: var(--brand-ink); }
.statuspill[data-z="warn"] { background: var(--warn-soft); color: var(--honey-ink); }
.statuspill[data-z="over"] { background: var(--danger-soft); color: #8a2c1c; }
.statuspill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* macro section */
.macros { display: flex; align-items: center; gap: 18px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.macros__legend { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.mleg { display: grid; grid-template-columns: 12px 1fr auto; gap: 9px; align-items: center; }
.mleg__sw { width: 11px; height: 11px; border-radius: 3px; }
.mleg__name { font-size: var(--fs-13); font-weight: 600; color: var(--ink-2); }
.mleg__val { font-family: var(--ff-display); font-weight: 700; font-size: var(--fs-14); font-variant-numeric: tabular-nums; }
.mleg__val span { color: var(--ink-3); font-weight: 600; font-family: var(--ff-body); font-size: var(--fs-12); }

/* slots list */
.slots { display: flex; flex-direction: column; gap: 10px; }
.app--desktop .slots { gap: 11px; }
.slot {
  display: grid; grid-template-columns: 6px 1fr auto; align-items: stretch;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3);
  box-shadow: var(--sh-1); overflow: hidden; transition: box-shadow .14s, border-color .14s, transform .08s;
}
.slot:hover { box-shadow: var(--sh-2); border-color: var(--line-2); }
.slot__spine { background: var(--c); }
.slot__body { padding: 12px 14px; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 3px; cursor: pointer; }
.slot__meal { display: flex; align-items: center; gap: 8px; }
.slot__meal-name { font-size: var(--fs-11); font-weight: 800; letter-spacing: var(--tr-caps); text-transform: uppercase; color: var(--c-ink); }
.slot__time { font-size: var(--fs-11); color: var(--ink-4); font-weight: 600; }
.slot__title { font-family: var(--ff-display); font-weight: 700; font-size: var(--fs-18); letter-spacing: var(--tr-snug); line-height: 1.1; }
.slot__meta { font-size: var(--fs-12); color: var(--ink-3); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.slot__meta .dotsep { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-4); }
.slot__meta b { font-family: var(--ff-display); font-weight: 700; color: var(--ink-2); }
.slot__note { display: inline-flex; align-items: center; gap: 5px; font-style: italic; color: var(--ink-2); background: var(--paper-2); padding: 2px 8px; border-radius: var(--r-pill); }
.slot__note svg { width: 12px; height: 12px; color: var(--ink-3); }
.slot--alt .slot__title { font-size: var(--fs-16); color: var(--ink-2); }
.slot--empty .slot__body { color: var(--ink-3); }
.slot--empty { border-style: dashed; box-shadow: none; background: var(--surface-2); }
.slot__add { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink-3); }
.slot__add svg { width: 18px; height: 18px; }

/* right side of slot: eaten toggle */
.slot__right { display: flex; align-items: center; gap: 6px; padding: 0 12px 0 6px; }
.eatbtn {
  appearance: none; cursor: pointer; background: var(--surface);
  border: 1.5px solid var(--line-2); border-radius: 50%;
  width: 32px; height: 32px; display: grid; place-items: center;
  color: var(--ink-4); transition: all .14s;
}
.eatbtn:hover { border-color: var(--brand); color: var(--brand); }
.eatbtn[data-on="1"], .eatbtn--on { background: var(--brand); border-color: var(--brand); color: #fff; }
.eatbtn svg { width: 17px; height: 17px; }
.slot[data-eaten="1"] { background: var(--surface-2); }
.slot[data-eaten="1"] .slot__title { color: var(--ink-2); }
.kebab { appearance: none; cursor: pointer; background: none; border: 0; color: var(--ink-4); padding: 5px; border-radius: var(--r-1); }

/* portie-badge naast eatbtn: toont hoeveel porties gegeten */
.eaten-portions { display: flex; align-items: center; gap: 3px; }
.portions-badge {
  appearance: none; cursor: pointer;
  background: var(--brand-1, #e8f3ed); border: 1.5px solid var(--brand);
  border-radius: 10px; padding: 2px 7px;
  font-family: var(--ff-display); font-weight: 800; font-size: var(--fs-12);
  color: var(--brand); line-height: 1.4;
  transition: background .14s;
}
.portions-badge:hover { background: var(--brand); color: #fff; }
.kebab:hover { background: var(--paper-2); color: var(--ink-2); }

/* eaten/upcoming divider label */
.dividerlbl { display: flex; align-items: center; gap: 10px; margin: 4px 0 2px; }
.dividerlbl__t { font-size: var(--fs-11); font-weight: 800; letter-spacing: var(--tr-caps); text-transform: uppercase; color: var(--ink-3); white-space: nowrap; }
.dividerlbl__line { flex: 1; height: 1px; background: var(--line); }
.dividerlbl__count { font-family: var(--ff-display); font-weight: 700; font-size: var(--fs-12); color: var(--ink-3); }

/* mini weekstrip on today (mobile) */
.weekstrip { display: flex; gap: 7px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.weekstrip::-webkit-scrollbar { display: none; }
.wsday {
  flex-shrink: 0; appearance: none; border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--r-2); padding: 8px 11px; cursor: pointer; text-align: center; min-width: 50px;
  transition: all .13s;
}
.wsday b { font-family: var(--ff-display); font-weight: 700; font-size: var(--fs-16); display: block; }
.wsday span { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--ink-3); letter-spacing: .06em; }
.wsday[data-today="1"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.wsday[data-today="1"] span { color: var(--brand); }

/* sticky toast */
.toast {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 18px; z-index: 60;
  background: var(--ink); color: var(--paper);
  padding: 11px 18px; border-radius: var(--r-pill);
  font-weight: 600; font-size: var(--fs-13); box-shadow: var(--sh-3);
  display: flex; align-items: center; gap: 9px; white-space: nowrap;
  animation: toast-in .22s cubic-bezier(.2,.8,.2,1);
}
.toast svg { width: 17px; height: 17px; color: #8fd6a6; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 14px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* fade/slide screen transition (transform-only so content is never hidden) */
.screen-anim { animation: screen-in .28s cubic-bezier(.2,.7,.2,1) both; }
@keyframes screen-in { from { transform: translateY(9px); } to { transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .screen-anim { animation: none; } }
