/* Атрибут hidden должен побеждать любые display из наших правил: интерфейс
   скрывает блоки именно им, а собственное display: block у строки формы
   оставляло скрытое поле на экране. */
[hidden] { display: none !important; }

/* ---------- Тема ВитаБаланс ----------
   Палитра снята с логотипа: тёплый кремовый фон, оливковая зелень листьев,
   золото солнца и глубокий зелёный текста. */
:root {
  --bg:          #f4f2e6;
  --bg-soft:     #fbfaf3;
  --card:        #fffefa;
  --text:        #2d3d20;
  --muted:       #7d8a6e;
  --accent:      #55702f;
  --accent-soft: #8ca860;
  --accent-text: #fbfaf3;
  --gold:        #bf9f58;
  --gold-soft:   #e3d5ae;
  --line:        rgba(85, 112, 47, .18);
  --plate-1:     #ffffff;
  --plate-2:     #efecdd;
  --plate-edge:  rgba(85, 112, 47, .16);
  --radius: 18px;
  --shadow: 0 10px 28px rgba(60, 75, 40, .12);
  --bar-h: 88px;
  --serif: Georgia, 'Iowan Old Style', 'Palatino Linotype', 'Times New Roman', serif;
}

/* Тёмная тема: тот же бренд, но вечерний — глубокая зелень и приглушённое золото. */
html[data-theme="dark"] {
  --bg:          #151b11;
  --bg-soft:     #1d2417;
  --card:        #1f2719;
  --text:        #eceee0;
  --muted:       #95a086;
  --accent:      #7d9f45;
  --accent-soft: #9cbb6a;
  --accent-text: #141a10;
  --gold:        #d2b36d;
  --gold-soft:   #4a4128;
  --line:        rgba(236, 238, 224, .14);
  --plate-1:     #2b3522;
  --plate-2:     #1b2215;
  --plate-edge:  rgba(236, 238, 224, .14);
  --shadow: 0 12px 30px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  overscroll-behavior-y: none;
}

body {
  padding: 0 16px;
  /* мягкая зелёная дымка сверху — как размытая листва на логотипе */
  background-image:
    radial-gradient(120% 55% at 12% 0%, rgba(140, 168, 96, .20), transparent 62%),
    radial-gradient(90% 40% at 100% 4%, rgba(191, 159, 88, .14), transparent 60%);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

html[data-theme="dark"] body {
  background-image:
    radial-gradient(120% 55% at 12% 0%, rgba(140, 168, 96, .10), transparent 62%),
    radial-gradient(90% 40% at 100% 4%, rgba(191, 159, 88, .06), transparent 60%);
}

/* ---------- Экраны ---------- */
.screen { display: none; animation: fadeUp .35s ease both; }
.screen--active { display: block; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

.spacer { height: calc(var(--bar-h) + 16px); }
.spacer--lg { height: 40px; }

/* ---------- Шапка ---------- */
.head { position: relative; padding: 22px 2px 18px; text-align: center; }
.head--sub { padding-top: 26px; }

/* Кнопка календаря — фиксирована в углу и видна на всех рабочих экранах */
.diaryfab {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  right: 14px;
  z-index: 55;
  display: none;
  align-items: center;
  gap: 7px;
  padding: 9px 14px 9px 11px;
  border: 1.5px solid var(--accent);
  border-radius: 100px;
  background: var(--card);
  color: var(--accent);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(60, 75, 40, .18);
}
.diaryfab--on { display: inline-flex; }
.diaryfab:active { transform: scale(.95); }
.diaryfab__icon { font-size: 16px; line-height: 1; }
.diaryfab__kcal {
  padding: 2px 8px;
  border-radius: 100px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 700;
}
@media (max-width: 360px) {
  .diaryfab__text { display: none; }
}

/* Логотип обрезан по эмблеме: в исходнике под ней идёт надпись, в круге она не нужна. */
.head__logo {
  width: 84px;
  height: 84px;
  margin: 0 auto 10px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-soft);
  box-shadow: 0 6px 18px rgba(60, 75, 40, .16), 0 0 0 1px var(--line);
}
.head__logo img {
  display: block;
  width: 168px;
  height: 168px;
  margin: -20px 0 0 -42px;
  object-fit: cover;
}

.head__brand {
  margin: 0;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 700;
  letter-spacing: .005em;
  color: var(--accent);
}
.head__slogan {
  margin: 2px 0 20px;
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--muted);
}
.head__title {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.head__sub { margin: 0; color: var(--muted); font-size: 14px; }

/* ---------- Поиск ---------- */
.search {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 12px;
  margin-bottom: 14px;
}
.search__icon { opacity: .65; font-size: 15px; }
.search__input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  padding: 12px 8px;
  -webkit-appearance: none;
}
.search__input::-webkit-search-cancel-button { display: none; }
.search__clear {
  border: 0; background: transparent; color: var(--muted);
  font-size: 15px; padding: 6px; cursor: pointer; display: none;
}
.search--filled .search__clear { display: block; }

/* ---------- Персоны ---------- */
.persons {
  margin-bottom: 22px;
  padding: 12px 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
}
.persons__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.persons__label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}
.persons__manage {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 0;
}
.chip--add { border-style: dashed; color: var(--accent); font-weight: 600; }

/* ---------- Форма персоны ---------- */
.personform { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.personform__row { display: block; margin-bottom: 14px; }
.personform__row--split { display: flex; gap: 12px; }
.personform__row--split label { flex: 1; }
.personform input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 11px;
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
}
.personform input:focus-visible,
.norm__field input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.personform .norm__label { display: block; margin-bottom: 6px; }
.card__note--error { color: #b5462f; }

/* ---------- Блоки первого экрана ---------- */
.block { margin-bottom: 26px; }
.block__title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.block__num {
  flex: 0 0 auto;
  width: 23px; height: 23px;
  border-radius: 50%;
  background: var(--gold);
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.block__hint { margin: 0 0 10px 31px; font-size: 13px; color: var(--muted); }
.block__title + .chips { margin-top: 10px; }

/* ---------- Каталог продуктов ---------- */
.cat { margin-bottom: 20px; }
.cat__title {
  margin: 0 0 10px 2px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 100px;
  padding: 9px 14px 9px 11px;
  font-size: 14px;
  cursor: pointer;
  transition: transform .12s ease, background .18s ease, border-color .18s ease;
}
.chip__emoji { font-size: 17px; line-height: 1; }
.chip:active { transform: scale(.94); }
.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}
.chip[aria-pressed="true"] .chip__emoji { animation: pop .3s ease; }
@keyframes pop {
  0% { transform: scale(1); }
  45% { transform: scale(1.45) rotate(-12deg); }
  100% { transform: scale(1); }
}

.chips--static .chip { pointer-events: none; font-size: 12px; padding: 5px 11px; }

.empty { color: var(--muted); text-align: center; padding: 30px 0; }

/* ---------- Нижняя панель ---------- */
.bottombar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--bg-soft);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(60, 75, 40, .10);
  display: none;
  z-index: 40;
}
.bottombar--on { display: block; }
.bottombar__info {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px; font-size: 13px; color: var(--muted);
}
.bottombar__reset {
  border: 0; background: transparent; color: var(--muted);
  font-size: 13px; text-decoration: underline; cursor: pointer; padding: 2px 0;
}

/* ---------- Кнопки ---------- */
.btn {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 15px 18px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .12s ease, opacity .2s ease;
}
.btn:active { transform: scale(.98); }
.btn--primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: var(--accent-text);
  box-shadow: 0 8px 20px rgba(85, 112, 47, .28);
}
.btn--primary:disabled { opacity: .45; box-shadow: none; cursor: default; }
.btn--ghost { background: var(--bg-soft); color: var(--text); border: 1px solid var(--line); }
.btn__emoji { font-size: 17px; }

.actions { display: grid; gap: 10px; margin-top: 18px; }


/* ---------- Экран готовки ---------- */
.screen--cooking {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 60;
  padding: 0 16px;
}
.screen--cooking.screen--active { display: flex; align-items: center; justify-content: center; }

.cook { width: 100%; max-width: 420px; text-align: center; }
.cook__stage {
  font-size: 17px;
  font-weight: 700;
  min-height: 26px;
  margin-bottom: 26px;
  animation: stageIn .4s ease;
}
@keyframes stageIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.cook__arena {
  position: relative;
  width: 280px;
  height: 280px;
  margin: 0 auto 30px;
}

/* Тарелка */
.plate {
  position: absolute;
  inset: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, var(--plate-1), var(--plate-2) 72%);
  box-shadow:
    0 18px 40px rgba(60, 75, 40, .22),
    inset 0 0 0 1px var(--plate-edge);
  transform: scale(.85);
  opacity: 0;
  transition: transform .5s cubic-bezier(.2,.9,.25,1.2), opacity .4s ease;
}
.plate--on { transform: scale(1); opacity: 1; }
.plate--serve { animation: serve .7s cubic-bezier(.2,.9,.25,1.25); }
@keyframes serve {
  0%   { transform: scale(1) rotate(0); }
  35%  { transform: scale(1.09) rotate(3deg); }
  70%  { transform: scale(.97) rotate(-2deg); }
  100% { transform: scale(1) rotate(0); }
}
.plate--shake { animation: shake .45s ease infinite; }
@keyframes shake {
  0%, 100% { transform: scale(1) translate(0, 0); }
  25% { transform: scale(1) translate(-3px, 1px); }
  50% { transform: scale(1) translate(2px, -2px); }
  75% { transform: scale(1) translate(-1px, 2px); }
}

.plate__ring {
  position: absolute;
  inset: 16px;
  border-radius: 50%;
  border: 1px solid var(--plate-edge);
  box-shadow: inset 0 0 0 4px rgba(191, 159, 88, .12);
}
/* Секторы тарелки: ½ клетчатка, ¼ белки, ¼ сложные углеводы */
.plate__zones {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  pointer-events: none;
}
.zoneslice {
  opacity: 0;
  transform-origin: 50% 50%;
  transform: scale(.82);
  transition: opacity .5s ease, transform .6s cubic-bezier(.2,.9,.25,1.25);
}
.zoneslice--on { opacity: .30; transform: scale(1); }
.zoneslice__label {
  font-size: 9px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
  fill: var(--text);
  opacity: 0;
  transition: opacity .5s ease .15s;
}
text.zoneslice--on { opacity: .75; }

.plate__inner { position: absolute; inset: 0; }
.plate__dish {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 74px;
  opacity: 0;
  transform: scale(.4);
  transition: opacity .45s ease, transform .55s cubic-bezier(.2,.9,.25,1.4);
}
.plate__dish--on { opacity: 1; transform: scale(1); }

/* Летящие продукты */
.flyer {
  position: absolute;
  top: 50%;
  left: 50%;
  font-size: 30px;
  line-height: 1;
  will-change: transform, opacity;
  pointer-events: none;
}
.orbit {
  position: absolute;
  top: 50%;
  left: 50%;
  font-size: 26px;
  line-height: 1;
  transform-origin: center;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,.35));
}

/* Пар */
.steam {
  position: absolute;
  top: 6px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 16px;
  opacity: 0;
  transition: opacity .4s ease;
}
.steam--on { opacity: .55; }
.steam span {
  display: block;
  width: 7px; height: 46px;
  border-radius: 100px;
  background: linear-gradient(to top, var(--accent-soft), transparent);
  animation: rise 2.1s ease-in-out infinite;
}
.steam span:nth-child(2) { animation-delay: .5s; height: 60px; }
.steam span:nth-child(3) { animation-delay: 1s; }
@keyframes rise {
  0%   { transform: translateY(14px) scaleY(.5); opacity: 0; }
  40%  { opacity: .9; }
  100% { transform: translateY(-28px) scaleY(1.2); opacity: 0; }
}

/* Искры/конфетти при подаче */
.sparks { position: absolute; inset: 0; pointer-events: none; }
.spark {
  position: absolute;
  top: 50%; left: 50%;
  width: 7px; height: 7px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0;
}

.cook__progress {
  height: 4px;
  border-radius: 100px;
  background: var(--line);
  overflow: hidden;
  max-width: 220px;
  margin: 0 auto 18px;
}
.cook__progress i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 100px;
  background: var(--accent);
  transition: width .4s linear;
}
.cook__skip {
  border: 0; background: transparent; color: var(--muted);
  font-size: 13px; cursor: pointer; padding: 8px 14px;
}

/* ---------- Результат ---------- */
.dish { padding: 58px 0 6px; } /* сверху оставлено место под кнопку календаря */
.dish__plate {
  position: relative;
  width: 210px; height: 210px;
  margin: 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, var(--plate-1), var(--plate-2) 72%);
  box-shadow: 0 18px 40px rgba(60, 75, 40, .2), inset 0 0 0 1px var(--plate-edge);
}
.dish__plate .plate__dish { font-size: 60px; opacity: 1; transform: none; }
.dish__plate .orbit { font-size: 21px; }

/* ---------- Карточки ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px 18px;
  margin-top: 12px;
  animation: fadeUp .4s ease both;
}
.card--hero { text-align: center; padding-top: 18px; }
.card--tip { background: transparent; border-style: dashed; }
.card__kicker {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
}
.card__title {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.card__h3 { margin: 0 0 12px; font-family: var(--serif); font-size: 18px; font-weight: 700; }
.card__hint { color: var(--muted); font-weight: 400; font-size: 13px; }
.card__note { margin: 0; color: var(--muted); font-size: 14px; }

.card--hero .chips { justify-content: center; }

.meta { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; margin-bottom: 12px; }
.meta__item { text-align: center; }
.meta__val { display: block; font-size: 17px; font-weight: 700; }
.meta__key { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

/* Бейджи прибора и приёма пищи */
.badges { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--gold-soft);
  background: rgba(191, 159, 88, .1);
  border-radius: 100px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 600;
}

/* КБЖУ */
.nutri {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 0 12px;
  margin-bottom: 4px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}
.nutri__item b { color: var(--text); font-size: 14px; }

.card--note { background: transparent; border-style: dashed; }

.card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card__head .card__h3 { margin: 0; }
.card__total { margin: 14px 0 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.card__total b { color: var(--text); }

/* Порции */
.portions { display: flex; align-items: center; gap: 4px; }
.portion {
  min-width: 30px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 9px;
  padding: 5px 0;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}
.portion--on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.portions__label { font-size: 12px; color: var(--muted); margin-left: 4px; }

/* Ингредиенты */
.ings { list-style: none; margin: 0; padding: 0; }
.ings li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.ings li:last-child { border-bottom: 0; }
.ings__name { flex: 1; }
.ings__note { color: var(--muted); font-style: normal; font-size: 13px; }
.ings__amount { flex: 0 0 auto; font-size: 13px; font-weight: 600; color: var(--accent); white-space: nowrap; }
.ings--extra { margin-top: 6px; }
.ings--extra li { border-bottom: 0; padding: 4px 0; color: var(--muted); font-size: 14px; }

/* ---------- Карточка «Метод тарелки» ---------- */
.zonebar {
  position: relative;
  display: flex;
  height: 14px;
  border-radius: 100px;
  overflow: hidden;
  background: var(--line);
  margin-bottom: 14px;
}
.zonebar__part { display: block; height: 100%; transition: width .5s ease; }
.zonebar__mark {
  position: absolute;
  top: -3px; bottom: -3px;
  width: 2px;
  background: var(--text);
  opacity: .45;
}

.zonelist { list-style: none; margin: 0 0 12px; padding: 0; }
.zonelist li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.zonelist li:last-child { border-bottom: 0; }
.zonelist__dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.zonelist__name { flex: 1; }
.zonelist__val { text-align: right; font-size: 13px; }
.zonelist__val i { display: block; font-style: normal; font-size: 11px; color: var(--muted); }
.zonelist__ok { color: var(--accent) !important; }
.zonelist__off { color: var(--gold) !important; }

.nutri__item--accent { color: var(--gold); font-weight: 600; }

/* ---------- Календарь калорий ---------- */
.calnav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.calnav__title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  text-transform: capitalize;
}
.calnav__btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}
.calnav__btn:active { transform: scale(.92); }

.calweek {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.calgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }

.calday {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  overflow: hidden;
}
.calday--empty { pointer-events: none; }
.calday--has { color: var(--text); background: rgba(140, 168, 96, .12); font-weight: 600; }
.calday--today { border-color: var(--gold); }
.calday--on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.calday__num { line-height: 1; }
.calday__bar {
  width: 60%;
  height: 3px;
  border-radius: 100px;
  background: var(--accent);
  transform-origin: left center;
}
.calday--on .calday__bar { background: var(--accent-text); }

/* Полоска дневной нормы */
.goalbar {
  height: 8px;
  border-radius: 100px;
  background: var(--line);
  overflow: hidden;
  margin: 4px 0 10px;
}
.goalbar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  transition: width .4s ease;
}
.goalbar i.goalbar--over { background: linear-gradient(90deg, var(--gold), #d98b4a); }

/* Список съеденного */
.diary { list-style: none; margin: 12px 0 0; padding: 0; }
.diary__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.diary__item:last-child { border-bottom: 0; padding-bottom: 0; }
.diary__emoji { font-size: 22px; line-height: 1; }
.diary__text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.diary__text b { font-size: 15px; font-weight: 600; }
.diary__text i { font-style: normal; font-size: 12px; color: var(--muted); }
.diary__actions { display: flex; align-items: center; gap: 6px; }
.diary__btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--accent);
  border-radius: 9px;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.diary__btn:active { transform: scale(.94); }
.diary__btn--del { color: var(--muted); padding: 6px 9px; }

/* Расчёт персональной нормы */
.norm { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.norm__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.norm__label {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}
.norm__row .norm__label { margin: 0; }
.norm__field {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 11px;
  padding: 7px 11px;
}
.norm__field input {
  width: 58px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  text-align: right;
  -moz-appearance: textfield;
}
.norm__field input::-webkit-outer-spin-button,
.norm__field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.norm__field i { font-style: normal; font-size: 13px; color: var(--muted); }

.norm .chips { margin: 0 0 14px; }
.chip--sm { font-size: 13px; padding: 7px 12px 7px 10px; }

.norm__result {
  background: rgba(140, 168, 96, .10);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 13px;
  font-size: 14px;
  line-height: 1.5;
}
.norm__macros { color: var(--muted); font-size: 13px; }
.norm__apply { margin-top: 10px; }
.norm__apply:disabled { opacity: .55; cursor: default; }

.goalset { display: flex; align-items: center; gap: 8px; }
.goalset__value { font-size: 16px; font-weight: 700; min-width: 48px; text-align: center; }

/* Подборка других блюд */
.suggest { list-style: none; margin: 0; padding: 0; }
.suggest__item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: transform .12s ease;
}
.suggest__item:last-child { border-bottom: 0; padding-bottom: 0; }
.suggest__item:active { transform: scale(.985); }
.suggest__emoji { font-size: 24px; line-height: 1; }
.suggest__text { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.suggest__text b { font-size: 15px; font-weight: 600; }
.suggest__text i { font-style: normal; font-size: 12px; color: var(--muted); }
.suggest__go { color: var(--accent); font-size: 18px; font-weight: 700; }

/* Заметки про другие приборы */
.notes { list-style: none; margin: 0; padding: 0; }
.notes li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.notes li:last-child { border-bottom: 0; padding-bottom: 0; }

/* Шаги */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li {
  counter-increment: step;
  position: relative;
  padding: 0 0 20px 40px;
  font-size: 15px;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: -2px;
  width: 27px; height: 27px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.steps li::after {
  content: '';
  position: absolute;
  left: 13px; top: 29px; bottom: 6px;
  width: 1px;
  background: var(--line);
}
.steps li:last-child { padding-bottom: 0; }
.steps li:last-child::after { display: none; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Этап B: план и факт, ручная еда ---------- */

.daysec {
  margin: 16px 0 2px;
  font-family: var(--font-head, inherit);
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .02em;
}
.daysec:first-child { margin-top: 4px; }

.chips--small { gap: 6px; }
.chip--small { font-size: 13px; padding: 6px 11px; }
.chip--on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

.syncnote {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.diary--plan .diary__item { align-items: stretch; flex-direction: column; gap: 8px; }
.diary__head { display: flex; align-items: center; gap: 10px; }
.diary__item--plan { opacity: .96; }

.pstatus {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 0 0 32px;
  font-size: 13px;
}
.pstatus b { font-weight: 600; }
.pstatus i { font-style: normal; color: var(--muted); }
.pstatus__actions { display: flex; gap: 6px; margin-left: auto; }

.pask { display: flex; gap: 6px; align-items: center; width: 100%; padding-left: 32px; }
.pask input {
  width: 84px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.ptotals { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.ptotal { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; }
.ptotal__name { font-weight: 600; min-width: 84px; }
.ptotal__val { color: var(--muted); flex: 1; min-width: 0; }
.ptotal__val b { color: var(--text); }
.ptotal__val i { font-style: normal; }
.ptotal__note { margin: 4px 0 0; font-size: 12px; color: var(--muted); }

.dayadd { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.btn--small { padding: 10px 14px; font-size: 14px; }
.actions--row { display: flex; flex-wrap: wrap; gap: 10px; }
.actions--row .btn { flex: 1; min-width: 140px; }

.pform__row { display: block; margin-bottom: 14px; }
.pform__label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--muted); }
.pform__input,
.pform input[type="number"],
.pform input[type="text"],
.pform select {
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}
.pform input:disabled { opacity: .6; }
.pform__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.pform__grid span { display: block; margin-bottom: 4px; font-size: 12px; color: var(--muted); }
.pform__more { margin-bottom: 14px; }
.pform__more summary { font-size: 13px; color: var(--muted); cursor: pointer; margin-bottom: 8px; }
.pform__check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; margin-bottom: 12px; }
.pform__check input { margin-top: 2px; }
.pform__hint { margin: 0 0 10px; font-size: 12px; color: var(--muted); }
.pform__total { margin: 0 0 10px; font-size: 13px; }
.pform__error { margin: 0 0 10px; font-size: 13px; color: #b5462f; }

.foods { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.foods__list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.foods__list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.foods__list i { font-style: normal; font-size: 12px; color: var(--muted); }

.dishing { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.dishing__row { display: grid; grid-template-columns: 1fr 72px 92px auto; gap: 6px; align-items: center; }
.dishing__row input { width: 100%; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: inherit; font-size: 14px; }

/* ---------- Этап D: план на период и покупки ---------- */

.planday { margin-bottom: 18px; }
.planday:last-child { margin-bottom: 0; }
.planslots { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 8px; }

.planslot {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-soft);
}
.planslot--pinned { border-color: var(--accent); }
.planslot--empty { color: var(--muted); font-size: 13px; justify-content: center; }
.planslot__meal {
  min-width: 62px;
  font-size: 12px;
  color: var(--muted);
  text-transform: lowercase;
}
.planslot__text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 120px; }
.planslot__text b { font-size: 15px; font-weight: 600; }
.planslot__text i { font-style: normal; font-size: 12px; color: var(--muted); }
.planslot__actions { display: flex; gap: 6px; flex-wrap: wrap; }

.shopping { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.shopitem {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.shopitem:last-of-type { border-bottom: 0; }
.shopitem label { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; cursor: pointer; }
.shopitem b { font-size: 15px; font-weight: 600; }
.shopitem i { font-style: normal; font-size: 12px; color: var(--muted); }
.shopitem .pask { width: 100%; padding-left: 0; }
.shopitem .pask i { font-size: 12px; }
