/* The Jedlo screen (optional tab), the + Jedlo and ⋯ menus, and the food sheets (Podrobne, add, draft, item,
   Obľúbené). v4 (docs/v4/design.md): flat #212121 cards on the page grey, no card inside a card, calm numbers with
   thin flat bars (the macro colours stay as data colours), no tinted chips. Only --f-* tokens.
   Everything is scoped under .fd-* so app.css (still loaded) does not leak in and nothing leaks out. */

/* ====================================================================== screen */
.fd { display: grid; gap: var(--f-s3); color: var(--f-text); padding-bottom: 88px; }
.fd.is-empty { padding-bottom: var(--f-s4); }
.fd :where(h1, p) { margin: 0; }
/* the Forma type everywhere these screens draw, also while an older program theme is still loaded */
:is(.fd, .fd-menu-layer, .fd-details, .fd-favs, .fd-footer, .fd-item-tiles, .fd-amount, .fd-fold, .fd-meal-chips, .fd-label, .fd-info, .fd-fav-btn) {
  font-family: var(--f-font);
  letter-spacing: 0;
  text-transform: none;
}

/* top row: no screen title. The day switcher sits in the middle, ⋯ on the right (an empty cell on the left
   keeps the day centred). */
.fd-top { display: grid; grid-template-columns: var(--f-tap) minmax(0, 1fr) var(--f-tap); align-items: center; gap: var(--f-s2); padding-top: var(--f-s1); }
.fd-top::before { content: ""; }
.fd-top__more { background: transparent; color: var(--f-text-2); }
.fd-top__more svg { width: 22px; height: 22px; }

.fd-day { display: flex; align-items: center; justify-content: center; gap: var(--f-s1); min-width: 0; }
.fd-day__name { min-width: 0; text-align: center; font-size: var(--f-fs-body); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fd-day__name::first-letter { text-transform: uppercase; }
.fd-day .f-icon-btn { background: transparent; color: var(--f-text-2); }
.fd-day .f-icon-btn svg { width: 9px; height: 16px; }
.fd-day .f-icon-btn:disabled { opacity: 0.3; cursor: default; }

/* ====================================================================== hero: calories left, three macros, water */
.fd-hero { gap: var(--f-s5); padding: var(--f-s5) var(--f-card-pad) var(--f-s4); }
.fd-kcal { display: grid; gap: 4px; }
.fd-kcal__num { display: flex; align-items: baseline; gap: var(--f-s2); flex-wrap: wrap; }
.fd-kcal__num b { font: 500 var(--f-fs-hero) / 1 var(--f-font-num); letter-spacing: var(--f-track-display); font-variant-numeric: tabular-nums; }
.fd-kcal__num span { font-size: var(--f-fs-sub); color: var(--f-text-2); }
.fd-kcal__of { font-size: var(--f-fs-caption); color: var(--f-text-2); font-variant-numeric: tabular-nums; }
.fd-bar { display: block; height: 6px; margin-top: var(--f-s3); border-radius: 3px; background: var(--f-track); overflow: hidden; }
.fd-bar i { display: block; height: 100%; width: calc(var(--f-p, 0) * 100%); border-radius: inherit; background: var(--f-text); transition: width var(--f-dur-ring) var(--f-ease); }
.fd-kcal.is-over .fd-bar i { background: var(--f-worse); }
.fd-kcal.is-over .fd-kcal__num b { color: var(--f-worse); }

/* the macros: plain columns in the card (no tiles of their own) */
.fd-hero__tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--f-s4); }
.fd-hero .f-stat { background: none; border-radius: 0; padding: 0; }
.fd-hero .f-stat__value { font-size: 22px; }
.fd-hero .f-stat__value small { margin-left: 3px; }
@media (max-width: 360px) { .fd-hero__tiles { gap: var(--f-s3); } .fd-hero .f-stat__value { font-size: 19px; } .fd-hero .f-stat__value small { font-size: 12px; } }

/* water: one row with − and + (44 px each) */
.fd-water { grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: var(--f-s4); }
.fd-water__text { display: grid; gap: 2px; min-width: 0; }
.fd-water__btns { display: flex; gap: var(--f-s2); }
.fd-water__btns .f-icon-btn { background: var(--f-quiet); color: var(--f-text); }
.fd-water__btns .f-icon-btn svg { width: 14px; height: 14px; }
.fd-water__btns .f-icon-btn:disabled { opacity: 0.35; cursor: default; }

.fd-hero__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--f-s3); margin: calc(var(--f-s2) * -1) 0 calc(var(--f-s3) * -1); }
.fd-hint { font-size: var(--f-fs-sub); font-weight: 500; color: var(--f-text-2); min-width: 0; }
.fd-more { padding: 0 4px 0 12px; margin-right: -4px; font-size: var(--f-fs-sub); }
.fd-more svg { width: 8px; height: 14px; }

/* ====================================================================== meals */
.fd-meals { padding: var(--f-s1) 0; }
.fd-meal + .fd-meal { border-top: 1px solid var(--f-sep); }
.fd-meal__head { width: 100%; text-align: left; min-height: 64px; padding-inline: var(--f-s4); color: var(--f-text); }
.fd-meal__ico.f-row__thumb { width: 40px; height: 40px; border-radius: 50%; }
.fd-meal__ico svg { width: 22px; height: 22px; }
.fd-meal .f-row__chev svg { transition: transform var(--f-dur-2) var(--f-ease-out); }
.fd-meal.is-open .f-row__chev svg { transform: rotate(90deg); }
.fd-meal.is-open .fd-meal__ico { color: var(--f-text); }

.fd-panel { padding: 0 var(--f-s4) var(--f-s4); display: grid; gap: var(--f-s3); }
.fd-items { display: grid; }
.fd-item {
  width: 100%;
  min-height: 52px;
  padding: var(--f-s2) var(--f-s2) var(--f-s2) var(--f-s1);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--f-s3);
  text-align: left;
  border-radius: var(--f-r-sm);
  color: var(--f-text);
  transition: background-color var(--f-dur-2) var(--f-ease-out);
}
.fd-item:not(:has(.fd-tick)) { grid-template-columns: minmax(0, 1fr) auto; padding-left: 56px; }
.fd-item:active { background: var(--f-neutral-soft); }
.fd-item + .fd-item { box-shadow: 0 -1px 0 var(--f-sep); }
.fd-item__main { min-width: 0; display: grid; gap: 1px; }
.fd-item__name { font-size: var(--f-fs-sub); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fd-item__meta { font-size: var(--f-fs-caption); color: var(--f-text-2); font-variant-numeric: tabular-nums; }
.fd-item__kcal { font-family: var(--f-font-num); font-variant-numeric: tabular-nums; font-size: var(--f-fs-sub); font-weight: 500; color: var(--f-text-2); }
.fd-tick {
  width: 28px;
  height: 28px;
  margin-left: 6px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--f-text);
  color: var(--f-bg);
}
.fd-tick svg { width: 14px; height: 14px; }
.fd-item.is-off .fd-tick { background: transparent; box-shadow: inset 0 0 0 2px var(--f-stroke); }
.fd-item.is-off .fd-item__name { color: var(--f-text-3); text-decoration: line-through; }

/* supplements (hers): small toggles under the items */
.fd .supps, .fd-favs .supps { padding: 0; gap: var(--f-s2); }
.fd .supp {
  min-height: 32px;
  padding: 0 12px;
  border-radius: var(--f-r-pill);
  background: var(--f-surface-2);
  color: var(--f-text);
  box-shadow: none;
  font-size: var(--f-fs-caption);
}
.fd .supp svg { width: 12px; height: 12px; color: var(--f-better); }
.fd .supp.is-off { background: transparent; color: var(--f-text-3); box-shadow: inset 0 0 0 1px var(--f-stroke); }
.fd .supp.add { background: var(--f-quiet); color: var(--f-text); }
.fd .supp.add svg { color: inherit; }

.fd-panel__actions { display: flex; flex-wrap: wrap; gap: var(--f-s2); }
.fd-panel__actions .f-btn { min-height: 40px; padding: 0 16px; }
.fd-panel__actions .f-btn svg { width: 16px; height: 16px; }

/* An empty day: one big button under the hero, no text block and no floating button. */
.fd-first { min-height: 60px; font-size: var(--f-fs-body); gap: var(--f-s2); }
.fd-first svg { width: 20px; height: 20px; }

/* + Jedlo: a wide accent pill above the tab bar, always in reach */
.fd-fab {
  z-index: 26;
  left: max(var(--f-gutter), env(safe-area-inset-left, 0px));
  right: max(var(--f-gutter), env(safe-area-inset-right, 0px));
  bottom: calc(var(--f-dock-h) + var(--f-dock-bottom) + 16px + env(safe-area-inset-bottom, 0px));
  max-width: 480px;
  margin-inline: auto;
  min-height: 56px;
  justify-content: center;
  font-size: 17px;
}

/* ====================================================================== menus */
.fd-menu-layer .f-scrim { z-index: var(--f-z-scrim); }
.fd-menu { color: var(--f-text); }
.fd-menu--add { right: max(var(--f-gutter), env(safe-area-inset-right, 0px)); bottom: calc(var(--f-dock-h) + var(--f-dock-bottom) + 84px + env(safe-area-inset-bottom, 0px)); }
.fd-menu--more { right: max(var(--f-gutter), env(safe-area-inset-right, 0px)); top: calc(env(safe-area-inset-top, 0px) + 56px); --f-menu-origin: top right; }

/* ====================================================================== shared sheet pieces */
.fd-label { display: flex; align-items: center; gap: var(--f-s2); font-size: var(--f-fs-sub); font-weight: 500; color: var(--f-text-2); margin: var(--f-s5) 4px var(--f-s2); }
.fd-label .f-info { margin: -10px -10px -10px auto; }
.fd-info { display: grid; gap: var(--f-s2); padding: var(--f-s3) var(--f-s4); margin-bottom: var(--f-s3); border-radius: var(--f-r-md); background: var(--f-surface-2); }
.fd-info p { margin: 0; font-size: var(--f-fs-caption); line-height: var(--f-lh-body); color: var(--f-text-2); }

/* sticky footer inside the sheet's scroller: full width, flush with the bottom */
.fd-footer {
  margin: var(--f-s5) calc(max(16px, env(safe-area-inset-left, 0px)) * -1) calc(-28px - env(safe-area-inset-bottom, 0px));
  align-items: center;
  z-index: 2;
}
/* a short sheet still has its footer at the very bottom */
#sheet-scroll:has(> .fd-footer) { display: flex; flex-direction: column; }
#sheet-scroll:has(> .fd-footer) > .fd-footer { margin-top: auto; }
#sheet-scroll:has(> .fd-footer) > :not(.fd-footer) { flex: none; }
.draft-meal .field.wide { grid-template-columns: auto minmax(0, 1fr); }
.fd-footer__total { margin: 0; display: grid; gap: 1px; min-width: 0; color: var(--f-text); }
.fd-footer__total b { font-family: var(--f-font-num); font-variant-numeric: tabular-nums; font-size: var(--f-fs-title); font-weight: 500; line-height: 1.1; white-space: nowrap; }
.fd-footer__total span { font-size: var(--f-fs-caption); color: var(--f-text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.fd-footer .f-btn--primary { flex: 1; }
.fd-footer .f-btn svg { width: 18px; height: 18px; }
.fd-danger { color: var(--f-worse); }

/* "Pridať do…" in the add sheet: one row of chips that scrolls sideways */
.fd-meal-chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 calc(max(16px, env(safe-area-inset-left, 0px)) * -1) var(--f-s3); padding: 2px max(16px, env(safe-area-inset-left, 0px)) 6px; scrollbar-width: none; }
.fd-meal-chips::-webkit-scrollbar { display: none; }
.fd-meal-chips .f-chip { flex: none; }

/* quota message with the way out */
.cmp-status:has(.fd-manual) { display: grid; justify-items: start; gap: var(--f-s2); }
.fd-manual { min-height: 40px; padding: 0 16px; }
.fd-manual svg { width: 16px; height: 16px; }

/* ====================================================================== Podrobne */
.fd-details { display: grid; gap: var(--f-s4); color: var(--f-text); }
.fd-meters { display: grid; gap: var(--f-s4); padding: var(--f-card-pad); border-radius: var(--f-r-lg); background: var(--f-surface-1); }
.fd-meter { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; column-gap: var(--f-s3); row-gap: 6px; }
.fd-meter__name { font-size: var(--f-fs-sub); font-weight: 500; }
.fd-meter__val { font-size: var(--f-fs-caption); color: var(--f-text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.fd-meter__val b { font-family: var(--f-font-num); font-size: var(--f-fs-sub); color: var(--f-text); font-weight: 500; }
.fd-meter__bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--f-track); overflow: hidden; }
.fd-meter__bar i { display: block; height: 100%; border-radius: inherit; background: var(--fd-c, var(--f-text-2)); }
.fd-meter--kcal { --fd-c: var(--f-kcal); }
.fd-meter--protein { --fd-c: var(--f-protein); }
.fd-meter--carbs { --fd-c: var(--f-carbs); }
.fd-meter--fat { --fd-c: var(--f-fat); }
.fd-meter--water { --fd-c: var(--f-water); }
.fd-meter.is-over { --fd-c: var(--f-worse); }
.fd-meter.is-over .fd-meter__val b { color: var(--f-worse); }
.fd-wbtns { display: flex; gap: var(--f-s2); }
.fd-wbtns .f-icon-btn { width: 36px; height: 36px; color: var(--f-water); position: relative; }
.fd-wbtns .f-icon-btn::after { content: ""; position: absolute; inset: -4px; }
.fd-wbtns .f-icon-btn svg { width: 13px; height: 13px; }
.fd-wbtns .f-icon-btn:disabled { opacity: 0.35; cursor: default; }

.fd-splits { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--f-s3); }
.fd-split { margin: 0; padding: var(--f-s4); border-radius: var(--f-r-md); background: var(--f-surface-1); display: grid; gap: var(--f-s2); align-content: start; }
.fd-split--s { --fd-c: var(--f-carbs); }
.fd-split--f { --fd-c: var(--f-fat); }
.fd-split p { margin: 0; }
.fd-split__head { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--f-fs-sub); font-weight: 500; }
.fd-split__head b { font-family: var(--f-font-num); font-variant-numeric: tabular-nums; }
.fd-split__part { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--f-s2); font-size: var(--f-fs-caption); color: var(--f-text-2); }
.fd-split__part span { display: flex; align-items: center; gap: 6px; min-width: 0; }
.fd-split__part i { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--fd-c); }
.fd-split__part i.b { opacity: 0.45; }
.fd-split__part b { color: var(--f-text); font-variant-numeric: tabular-nums; }
.fd-split__part small { grid-column: 1 / -1; padding-left: 14px; color: var(--f-text-2); font-size: 12px; }
.fd-split.is-over .fd-split__part:nth-of-type(2) b { color: var(--f-worse); }

/* ====================================================================== one item */
.fd-amount { padding: var(--f-s3); border-radius: var(--f-r-lg); background: var(--f-surface-1); }
.fd-amount .amt-grams { margin: var(--f-s2) 0 0; text-align: center; font-size: var(--f-fs-caption); color: var(--f-text-2); }
.fd-item-tiles { display: grid; gap: var(--f-s3); margin-top: var(--f-s4); color: var(--f-text); }
.fd-item-kcal { margin: 0; display: flex; align-items: baseline; justify-content: center; gap: 6px; }
.fd-item-kcal b { font-family: var(--f-font-num); font-variant-numeric: tabular-nums; font-size: var(--f-fs-num); font-weight: 500; letter-spacing: var(--f-track-display); line-height: 1; }
.fd-item-kcal span { font-size: var(--f-fs-sub); color: var(--f-text-2); font-weight: 400; }
.fd-item-tiles .f-stat__value { font-size: 20px; }
.fd-fold { margin-top: var(--f-s4); color: var(--f-text); }
.fd-facts { display: grid; }
.fd-fact { display: flex; justify-content: space-between; gap: var(--f-s3); padding: 10px 0; font-size: var(--f-fs-sub); color: var(--f-text-2); }
.fd-fact + .fd-fact { border-top: 1px solid var(--f-sep); }
.fd-fact b { color: var(--f-text); font-variant-numeric: tabular-nums; font-weight: 500; }
.fd-note { margin: var(--f-s3) 0 0; font-size: var(--f-fs-caption); line-height: var(--f-lh-body); color: var(--f-text-2); }
.fd-fav-btn { justify-self: start; align-self: flex-start; margin-top: var(--f-s3); padding-left: 4px; }
.fd-fav-btn:disabled { color: var(--f-text-2); cursor: default; }
.fd-fav-btn svg { width: 18px; height: 18px; }

/* ====================================================================== Obľúbené */
.fd-favs { display: grid; gap: var(--f-s3); color: var(--f-text); }
.fd-favs .fd-label { margin: var(--f-s3) 4px 0; }
.fd-fav { padding-inline: var(--f-s4); min-height: 68px; }
.fd-fav + .fd-fav::before { content: ""; position: absolute; top: 0; left: 72px; right: 0; height: 1px; background: var(--f-sep); }
.fd-fav__ico.f-row__thumb { width: 40px; height: 40px; border-radius: 50%; color: var(--f-carbs); }
.fd-fav__ico svg { width: 20px; height: 20px; }
.fd-fav__main { text-align: left; min-height: var(--f-tap); align-content: center; }
.fd-fav__del { color: var(--f-worse); }
.fd-fav__del svg { width: 18px; height: 18px; }
.fd-routine { padding: var(--f-s1) var(--f-s3); border-radius: var(--f-r-lg); background: var(--f-surface-1); }
.fd-fav-edit { justify-self: center; }
.fd-panel__actions .fd-fav-icon { color: var(--f-text-2); margin-left: auto; }
.fd-panel__actions .fd-fav-icon:disabled { opacity: 1; }

/* ====================================================================== v4 quieting of the food sheets */
/* the day / meal under a food sheet's title: plain secondary text, not a tinted pill */
.sheet:has(.fd-details, .fd-amount, .fd-favs, .draft-meal, .fd-composer) .sheet-top .chip { background: none; padding: 0; color: var(--f-text-2); font-size: var(--f-fs-sub); font-weight: 400; }
.fd-meter--kcal { --fd-c: var(--f-text); }
/* the amount stepper: quiet round buttons, the input and unit on the sheet's #212121 */
.fd-amount .q-btn { width: 44px; height: 44px; background: var(--f-quiet); color: var(--f-text); }
.fd-amount input, .fd-amount select { background: var(--f-surface-2); color: var(--f-text); font-family: var(--f-font-num); font-weight: 500; }
/* the AI composer's suggestions: light chips, not accent ones; the quick questions quiet */
.fd-composer .cmp-suggest .chip { background: var(--f-text); color: #141414; font-weight: 500; }
.fd-composer .cmp-chips .chip { box-shadow: inset 0 0 0 1px var(--f-stroke); color: var(--f-text-2); }
/* the composer and the add list: quiet camera and + buttons, the send / voice button light (the sheet's one action) */
.sheet .cmp-cam { background: var(--f-quiet); color: var(--f-text); }
.sheet .cmp-send:not(.is-rec) { background: var(--f-text); color: #141414; }
.sheet .q-btn.add { background: var(--f-quiet); color: var(--f-text); }
.sheet .food-row .tick.is-item { background: var(--f-quiet); color: var(--f-text); }
.sheet .ai-row .tick { background: var(--f-quiet); color: var(--f-text); }
