/* ==========================================================================
   CalDone — дневник питания
   A light, quiet interface built around one loud element: the bowl that
   fills up as the day is eaten. Everything else stays out of its way.
   ========================================================================== */

/* One variable file covers 400–900 and Cyrillic, so the app never depends
   on Google Fonts being reachable. */
@font-face {
  font-family: "Golos Text";
  /* Relative on purpose: resolved against the stylesheet URL, so it
     picks up whatever build id the page was served under. */
  src: url("fonts/golos.woff2") format("woff2-variations"),
       url("fonts/golos.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --ground:   #EEF1ED;
  --paper:    #FFFFFF;
  --paper-2:  #F6F9F5;
  --ink:      #16231C;
  --ink-2:    #5E6E66;
  --ink-3:    #94A29A;
  --line:     #E2E7E0;
  --line-2:   #EDF0EB;

  --leaf:     #2F7D52;
  --leaf-ink: #205A3A;
  --leaf-tint:#E4F0E8;

  --protein:  #C2553B;
  --fat:      #D99B27;
  --carbs:    #4E73B8;
  --water:    #2E9AC8;
  --over:     #C2402F;

  --r-card:   20px;
  --r-btn:    14px;
  --r-photo:  14px;
  --r-pill:   999px;

  --pad:      16px;
  --tabbar-h: 58px;

  --sans: "Golos Text", -apple-system, BlinkMacSystemFont, "SF Pro Text",
          "Segoe UI", Roboto, sans-serif;

  --shadow-sheet: 0 -2px 8px rgba(22, 35, 28, .04),
                  0 -24px 48px -24px rgba(22, 35, 28, .3);
  --shadow-pop:   0 2px 4px rgba(22, 35, 28, .05),
                  0 16px 32px -20px rgba(22, 35, 28, .35);

  /* Telegram 8.0+ publishes its own insets. When the client draws floating
     controls over the page, --tg-content-safe-area-inset-top is how much
     room they need; it is 0 in the ordinary windowed mode. Both are added
     so the app clears the notch and the client chrome alike. */
  --safe-b: calc(env(safe-area-inset-bottom, 0px)
                 + var(--tg-content-safe-area-inset-bottom, 0px));
  --safe-t: calc(env(safe-area-inset-top, 0px)
                 + var(--tg-content-safe-area-inset-top, 0px));
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior-y: none;
}

body {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  text-size-adjust: 100%;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

button { border: 0; background: none; cursor: pointer; }

h1, h2, h3, p, figure { margin: 0; }

ul { margin: 0; padding: 0; list-style: none; }

img { max-width: 100%; display: block; }

[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--leaf);
  outline-offset: 2px;
  border-radius: 6px;
}

.num { font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* --------------------------------------------------------------- shell --- */

.app {
  min-height: 100%;
  padding: calc(var(--safe-t) + 14px) var(--pad)
           calc(var(--tabbar-h) + var(--safe-b) + 28px);
  max-width: 560px;
  margin-inline: auto;
}

.app--plain { padding-bottom: calc(var(--safe-b) + 28px); }

/* Screens with the floating add button need room for it to rest over
   empty space rather than over the last row. */
.app--fab { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 100px); }

.boot {
  min-height: 70vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
}
.boot__mark {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--leaf);
  animation: spin .9s linear infinite;
}
.boot__text { color: var(--ink-2); font-size: 14px; }

@keyframes spin { to { transform: rotate(360deg); } }

/* -------------------------------------------------------------- tabbar --- */

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding-bottom: var(--safe-b);
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
}

.tab {
  height: var(--tabbar-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--ink-3);
  transition: color .15s ease;
}
.tab__icon {
  width: 23px; height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tab__label { font-size: 11px; font-weight: 500; letter-spacing: .01em; }
.tab[aria-selected="true"] { color: var(--leaf); }
.tab[aria-selected="true"] .tab__icon { stroke-width: 2.1; }

/* ------------------------------------------------------------ day strip --- */

.daystrip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 calc(var(--pad) * -1) 18px;
  padding: 2px var(--pad) 6px;
  scroll-snap-type: x proximity;
}
.daystrip::-webkit-scrollbar { display: none; }

.daypill {
  flex: 0 0 auto;
  width: 46px;
  padding: 7px 0 8px;
  border-radius: var(--r-pill);
  display: grid;
  justify-items: center;
  gap: 5px;
  color: var(--ink-2);
  scroll-snap-align: center;
  transition: background .18s ease, color .18s ease;
}
.daypill__dow { font-size: 10px; font-weight: 500; text-transform: lowercase; }
.daypill__num { font-size: 16px; font-weight: 600; }
.daypill__dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--line);
}
.daypill__dot--some { background: var(--leaf); opacity: .45; }
.daypill__dot--done { background: var(--leaf); }
.daypill__dot--over { background: var(--over); }
.daypill[aria-selected="true"] {
  background: var(--ink);
  color: #fff;
}
.daypill[aria-selected="true"] .daypill__dot { background: rgba(255,255,255,.4); }
.daypill[aria-selected="true"] .daypill__dot--done,
.daypill[aria-selected="true"] .daypill__dot--some { background: #8FD9AE; }
.daypill[aria-selected="true"] .daypill__dot--over { background: #FF9C8A; }

/* ---------------------------------------------------------------- bowl --- */

.bowl {
  display: grid;
  justify-items: center;
  gap: 2px;
  margin: 6px 0 20px;
}

.bowl__figure { position: relative; width: 194px; height: 194px; }
.bowl__svg { width: 100%; height: 100%; display: block; }

.bowl__center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1px;
  pointer-events: none;
}
.bowl__value {
  font-size: 44px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.035em;
}
.bowl__unit { font-size: 13px; font-weight: 500; color: var(--ink-2); }
/* The waterline moves with the day and will cross the reading sooner or
   later. A halo in the fill's own tint keeps the digits clean without
   drawing a visible plate behind them. */
.bowl__value, .bowl__unit, .bowl__caption {
  text-shadow: 0 0 7px var(--paper), 0 0 12px var(--paper);
}
.bowl--over .bowl__value,
.bowl--over .bowl__unit,
.bowl--over .bowl__caption {
  text-shadow: 0 0 7px #FDF2EF, 0 0 12px #FDF2EF;
}
.bowl__caption { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.bowl--over .bowl__value { color: var(--over); }

.bowl__meta {
  margin-top: 10px;
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 13px;
  color: var(--ink-2);
}
.bowl__meta b { color: var(--ink); font-weight: 600; }

/* -------------------------------------------------------------- macros --- */

.macros {
  display: grid;
  gap: 13px;
  margin-bottom: 20px;
}

.macro { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 10px; }
.macro__key { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.macro__track {
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--line);
  overflow: hidden;
}
.macro__fill {
  height: 100%;
  border-radius: var(--r-pill);
  transform-origin: left center;
  transition: width .5s cubic-bezier(.22, 1, .36, 1);
}
.macro__val { font-size: 12.5px; color: var(--ink-2); }
.macro__val b { color: var(--ink); font-weight: 600; }
.macro--p .macro__fill { background: var(--protein); }
.macro--f .macro__fill { background: var(--fat); }
.macro--c .macro__fill { background: var(--carbs); }
/* Past the target the bar is full either way — colour is what tells the
   two apart. */
.macro--over .macro__fill { background: var(--over); }
.macro--over .macro__val b { color: var(--over); }

/* --------------------------------------------------------------- cards --- */

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 16px;
}
.card + .card { margin-top: 12px; }

.section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 26px 0 11px;
}
.section__title { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.section__aside { font-size: 12.5px; color: var(--ink-3); }

/* --------------------------------------------------------------- water --- */

.water {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 14px 16px 15px;
}
.water__head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 11px;
}
.water__glyph { font-size: 17px; }
.water__amount { font-size: 15px; font-weight: 600; }
.water__amount span { color: var(--ink-3); font-weight: 500; }
.water__undo {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--ink-3);
  padding: 4px 2px;
}
.water__track {
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--line);
  overflow: hidden;
  margin-bottom: 12px;
}
.water__fill {
  height: 100%;
  background: var(--water);
  border-radius: var(--r-pill);
  transition: width .45s cubic-bezier(.22, 1, .36, 1);
}
.water__row { display: flex; gap: 8px; }
.chip {
  flex: 1;
  padding: 9px 0;
  border-radius: var(--r-btn);
  background: var(--paper-2);
  border: 1px solid var(--line-2);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  transition: transform .12s ease, background .12s ease;
}
.chip:active { transform: scale(.96); background: var(--line-2); }

/* --------------------------------------------------------------- meals --- */

.meals { display: grid; gap: 8px; }

.meal {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 10px 12px 10px 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  transition: transform .12s ease;
}
.meal:active { transform: scale(.985); }

.meal__thumb {
  width: 52px; height: 52px;
  border-radius: var(--r-photo);
  object-fit: cover;
  background: var(--paper-2);
}
.meal__glyph {
  width: 52px; height: 52px;
  border-radius: var(--r-photo);
  background: var(--paper-2);
  display: grid;
  place-content: center;
  font-size: 23px;
}
.meal__body { min-width: 0; }
.meal__name {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.meal__sub {
  display: flex;
  gap: 9px;
  margin-top: 3px;
  font-size: 12px;
  color: var(--ink-3);
}
.meal__sub i { font-style: normal; }
.meal__sub .p { color: var(--protein); }
.meal__sub .f { color: var(--fat); }
.meal__sub .c { color: var(--carbs); }
.meal__kcal { font-size: 15px; font-weight: 600; white-space: nowrap; }
.meal__kcal small { font-size: 11px; font-weight: 500; color: var(--ink-3); margin-left: 2px; }

/* --------------------------------------------------------------- empty --- */

.empty {
  text-align: center;
  padding: 34px 20px 30px;
  background: var(--paper);
  border: 1px dashed var(--line);
  border-radius: var(--r-card);
}
.empty__glyph { font-size: 30px; margin-bottom: 10px; }
.empty__title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.empty__text { font-size: 13.5px; color: var(--ink-2); max-width: 30ch; margin-inline: auto; }

/* ------------------------------------------------------------- buttons --- */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 18px;
  border-radius: var(--r-btn);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.005em;
  transition: transform .12s ease, opacity .12s ease;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn--primary { background: var(--leaf); color: #fff; }
.btn--ghost { background: var(--paper); color: var(--ink); border: 1px solid var(--line); }
.btn--quiet { background: var(--paper-2); color: var(--ink-2); }
.btn--danger { background: var(--paper); color: var(--over); border: 1px solid var(--line); }
.btn--sm { padding: 10px 14px; font-size: 14px; }

.fab {
  position: fixed;
  right: max(var(--pad), calc((100vw - 560px) / 2 + var(--pad)));
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
  z-index: 35;
  width: 56px; height: 56px;
  border-radius: 20px;
  background: var(--ink);
  color: #fff;
  display: grid;
  place-content: center;
  box-shadow: var(--shadow-pop);
  transition: transform .14s cubic-bezier(.22, 1, .36, 1);
}
.fab:active { transform: scale(.92); }
.fab svg { width: 24px; height: 24px; }

/* --------------------------------------------------------------- lists --- */

.rows {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  overflow: hidden;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-2);
}
.row:last-child { border-bottom: 0; }
.row__label { font-size: 14.5px; }
.row__value { margin-left: auto; font-size: 14.5px; color: var(--ink-2); font-weight: 500; }
.row__chev { color: var(--ink-3); font-size: 17px; line-height: 1; margin-left: 2px; }
.row--tap:active { background: var(--paper-2); }
.row--danger .row__label { color: var(--over); }

/* -------------------------------------------------------------- toggle --- */

.toggle {
  margin-left: auto;
  width: 48px; height: 29px;
  border-radius: var(--r-pill);
  background: var(--line);
  padding: 2px;
  transition: background .2s ease;
  flex: 0 0 auto;
}
.toggle__knob {
  width: 25px; height: 25px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(22, 35, 28, .25);
  transition: transform .2s cubic-bezier(.22, 1, .36, 1);
}
.toggle[aria-checked="true"] { background: var(--leaf); }
.toggle[aria-checked="true"] .toggle__knob { transform: translateX(19px); }

/* --------------------------------------------------------------- stats --- */

.statgrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
}
.stat {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 14px 15px 13px;
}
.stat__label { font-size: 12px; color: var(--ink-3); margin-bottom: 5px; }
.stat__value { font-size: 21px; font-weight: 700; letter-spacing: -.02em; }
.stat__value small { font-size: 12px; font-weight: 500; color: var(--ink-3); margin-left: 3px; }

.segmented {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--line-2);
  border-radius: var(--r-btn);
}
.segmented button {
  flex: 1;
  padding: 8px 0;
  border-radius: 11px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-2);
  transition: background .18s ease, color .18s ease;
}
.segmented button[aria-selected="true"] {
  background: var(--paper);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(22, 35, 28, .07);
}

.chart { width: 100%; display: block; overflow: visible; }
.chart__grid { stroke: var(--line); stroke-width: 1; }
.chart__target { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 4; }
.chart__bar { fill: var(--leaf); }
.chart__bar--over { fill: var(--over); }
.chart__bar--empty { fill: var(--line); }
.chart__label { font-size: 10px; fill: var(--ink-3); }
.chart__line { fill: none; stroke: var(--leaf); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart__area { fill: var(--leaf-tint); }
.chart__dot { fill: var(--leaf); }
.chart__goal { stroke: var(--protein); stroke-width: 1; stroke-dasharray: 3 4; }

/* -------------------------------------------------------------- sheets --- */

.sheet-root {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.scrim {
  position: absolute;
  inset: 0;
  background: rgba(16, 26, 20, .38);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: fade .2s ease;
}
.sheet {
  position: relative;
  background: var(--ground);
  border-radius: 24px 24px 0 0;
  box-shadow: var(--shadow-sheet);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  animation: rise .3s cubic-bezier(.22, 1, .36, 1);
}
.sheet--tall { height: 92vh; }

.sheet__grip {
  width: 36px; height: 4px;
  border-radius: 2px;
  background: var(--line);
  margin: 9px auto 0;
  flex: 0 0 auto;
}
.sheet__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px var(--pad) 8px;
  flex: 0 0 auto;
}
.sheet__title { font-size: 17px; font-weight: 600; letter-spacing: -.015em; }
.sheet__close {
  margin-left: auto;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--line-2);
  color: var(--ink-2);
  display: grid;
  place-content: center;
  font-size: 15px;
}
.sheet__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px var(--pad) calc(var(--safe-b) + 20px);
}
.sheet__foot {
  flex: 0 0 auto;
  padding: 12px var(--pad) calc(var(--safe-b) + 14px);
  border-top: 1px solid var(--line);
  background: var(--ground);
  display: grid;
  gap: 8px;
}
.sheet__foot--split { grid-template-columns: 1fr 1fr; }

@keyframes rise { from { transform: translateY(14%); opacity: .6; } }
@keyframes fade { from { opacity: 0; } }

/* --------------------------------------------------------------- forms --- */

.field { margin-bottom: 14px; }
.field__label {
  display: block;
  font-size: 12.5px;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.input, .textarea {
  width: 100%;
  padding: 13px 14px;
  border-radius: var(--r-btn);
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 16px; /* 16px keeps iOS from zooming on focus */
  color: var(--ink);
  transition: border-color .15s ease;
}
.input:focus, .textarea:focus { outline: none; border-color: var(--leaf); }
.textarea { resize: none; min-height: 88px; line-height: 1.45; }
.input--num { font-variant-numeric: tabular-nums; }

.hint { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.error { font-size: 12.5px; color: var(--over); margin-top: 6px; }

.pickers { display: grid; gap: 8px; }
.picker {
  width: 100%;
  text-align: left;
  padding: 13px 15px;
  border-radius: var(--r-btn);
  background: var(--paper);
  border: 1px solid var(--line);
  transition: border-color .15s ease, background .15s ease;
}
.picker__label { font-size: 14.5px; font-weight: 600; }
.picker__desc { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; line-height: 1.4; }
.picker[aria-selected="true"] {
  border-color: var(--leaf);
  background: var(--leaf-tint);
}

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* --------------------------------------------------- numeric stepper ---- */

.stepper {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  padding: 6px;
}
.stepper button {
  height: 38px;
  border-radius: 10px;
  background: var(--paper-2);
  font-size: 19px;
  font-weight: 500;
  color: var(--ink-2);
}
.stepper button:active { background: var(--line-2); }
.stepper input {
  border: 0;
  background: none;
  text-align: center;
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  min-width: 0;
}
.stepper input:focus { outline: none; }

/* -------------------------------------------------------------- upload --- */

.uploader {
  position: relative;
  display: grid;
  place-items: center;
  gap: 8px;
  aspect-ratio: 16 / 10;
  max-height: 30vh;
  border-radius: var(--r-card);
  border: 1px dashed var(--line);
  background: var(--paper);
  color: var(--ink-2);
  overflow: hidden;
  width: 100%;
}
.uploader input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.uploader__glyph { font-size: 30px; }
.uploader__text { font-size: 13.5px; }
.uploader__preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.uploader__clear {
  position: absolute;
  top: 10px; right: 10px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(16, 26, 20, .58);
  color: #fff;
  display: grid;
  place-content: center;
  font-size: 15px;
  backdrop-filter: blur(6px);
}

.analysing {
  display: grid;
  place-items: center;
  gap: 14px;
  padding: 46px 20px;
  text-align: center;
}
.analysing__ring {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--leaf);
  animation: spin .9s linear infinite;
}
.analysing__text { font-size: 14px; color: var(--ink-2); }

/* ---------------------------------------------------------- meal sheet --- */

.detail__photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--r-card);
  margin-bottom: 14px;
}
.detail__score {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px 5px 8px;
  border-radius: var(--r-pill);
  background: var(--leaf-tint);
  color: var(--leaf-ink);
  font-size: 12.5px;
  font-weight: 600;
}
.detail__score--mid { background: #FBF0DC; color: #8A6314; }
.detail__score--low { background: #FBE7E2; color: #96341F; }
.guess {
  margin-top: 4px;
  padding: 10px 12px;
  border-radius: var(--r-btn);
  background: #FBF3E0;
  color: #7A5A12;
  font-size: 12.5px;
  line-height: 1.45;
}
.guess b { font-weight: 600; }

.detail__comment {
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.5;
  margin-top: 10px;
}

.kv {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line-2);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  overflow: hidden;
  margin: 14px 0;
}
.kv > div {
  background: var(--paper);
  padding: 12px 8px;
  text-align: center;
}
.kv__label { font-size: 11px; color: var(--ink-3); }
.kv__value { font-size: 16px; font-weight: 700; margin-top: 3px; letter-spacing: -.02em; }
.kv__value--p { color: var(--protein); }
.kv__value--f { color: var(--fat); }
.kv__value--c { color: var(--carbs); }

/* ---------------------------------------------------------- onboarding --- */

.onb {
  display: grid;
  gap: 0;
  min-height: calc(100dvh - var(--safe-t) - var(--safe-b) - 40px);
  grid-template-rows: auto 1fr auto;
}
.onb__bar {
  height: 3px;
  background: var(--line);
  border-radius: var(--r-pill);
  overflow: hidden;
  margin: 8px 0 26px;
}
.onb__bar span {
  display: block;
  height: 100%;
  background: var(--leaf);
  border-radius: var(--r-pill);
  transition: width .32s cubic-bezier(.22, 1, .36, 1);
}
.onb__step { font-size: 12px; color: var(--ink-3); margin-bottom: 8px; }
.onb__q {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.2;
  margin-bottom: 8px;
}
.onb__note { font-size: 14px; color: var(--ink-2); margin-bottom: 22px; line-height: 1.5; }
.onb__foot { padding-top: 18px; display: grid; gap: 8px; }

/* Full-height screens (welcome, result): content on top, action at the
   bottom, slack in between rather than trailing empty space. */
.screen {
  min-height: calc(100dvh - var(--safe-t) - var(--safe-b) - 40px);
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.hero {
  text-align: center;
  padding: 22px 0 8px;
}
.hero__glyph { font-size: 44px; margin-bottom: 14px; }
.hero__title {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -.033em;
  line-height: 1.15;
  margin-bottom: 10px;
}
.hero__text { font-size: 14.5px; color: var(--ink-2); line-height: 1.5; max-width: 32ch; margin-inline: auto; }

.facts { display: grid; gap: 10px; margin: 26px 0 6px; text-align: left; }
.fact { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; }
.fact__glyph { font-size: 20px; line-height: 1.2; }
.fact__title { font-size: 14.5px; font-weight: 600; }
.fact__text { font-size: 13px; color: var(--ink-2); line-height: 1.45; margin-top: 2px; }

/* -------------------------------------------------------------- toasts --- */

.toast-root {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 18px);
  z-index: 80;
  display: grid;
  justify-items: center;
  gap: 8px;
  pointer-events: none;
  padding: 0 var(--pad);
}
.toast {
  max-width: 420px;
  padding: 11px 16px;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-pop);
  animation: toast-in .24s cubic-bezier(.22, 1, .36, 1);
}
.toast--bad { background: var(--over); }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } }

/* ------------------------------------------------------------ skeleton --- */

.skeleton {
  border-radius: var(--r-card);
  background: linear-gradient(100deg, var(--line-2) 30%, var(--paper) 50%, var(--line-2) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer { to { background-position: -120% 0; } }

/* ------------------------------------------------------------- profile --- */

.who {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}
.who__avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--leaf-tint);
}
.who__initial {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--leaf-tint);
  color: var(--leaf-ink);
  display: grid;
  place-content: center;
  font-size: 22px;
  font-weight: 700;
}
.who__name { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.who__sub { font-size: 13px; color: var(--ink-3); margin-top: 1px; }

.tip {
  background: var(--leaf-tint);
  border-radius: var(--r-card);
  padding: 15px 16px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--leaf-ink);
}
.tip__head { font-weight: 600; margin-bottom: 4px; display: flex; gap: 7px; align-items: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
