:root {
  /* Тёмная тема — глубокий графит (см. lib/theme/app_theme.dart _darkPalette) */
  --bg: #14171a;
  --surface: #1e2227;
  --surface-alt: #262b31;
  --card-border: #343a41; /* chip-border */
  --divider: #2b3036;
  --text: #f1f3f0;
  --text-secondary: #9aa098;
  --primary: #9cc98a;
  --primary-dark: #b2d8a2;
  --on-primary: #15251a;
  --green-soft: #2c3826;
  --on-green-soft: #cbe0bc;
  --ink: #ecefea;
  --on-ink: #14171a;
  --peach: #332a20;
  --peach-ink: #e7b57e;
  --star: #f3b255;
  --danger: #ef7a70;
  --danger-soft: #3a2321;
  --shadow: rgba(0, 0, 0, 0.45);
  --radius-sm: 12px;
  --radius-tile: 16px;
  --radius-card: 20px;
  --radius-banner: 24px;
  --radius-sheet: 28px;
  --radius-chip: 30px;
  --radius-pill: 100px;
  --max-width: 1180px;
}

:root[data-theme="light"] {
  /* Светлая тема — тёплый почти-белый фон, зелёный бренд (см. _lightPalette) */
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-alt: #f1efe8;
  --card-border: #e3e0d9;
  --divider: #ece9e2;
  --text: #1d2025;
  --text-secondary: #8a8f86;
  --primary: #4a6641;
  --primary-dark: #3c5436;
  --on-primary: #ffffff;
  --green-soft: #dce5ce;
  --on-green-soft: #33422a;
  --ink: #15181c;
  --on-ink: #ffffff;
  --peach: #fbeee4;
  --peach-ink: #b8702e;
  --star: #f2a33c;
  --danger: #e0584e;
  --danger-soft: #fbedec;
  --shadow: rgba(42, 42, 34, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
  /* Весь UI был рассчитан «на глаз» под 90% зум браузера — уменьшаем так же
     через zoom (не transform: scale, чтобы раскладка/скролл считались верно). */
  zoom: 90%;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 16px;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img { max-width: 100%; display: block; }

.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 264px;
  flex: none;
  background: var(--surface);
  box-shadow: 2px 0 16px var(--shadow);
  padding: 24px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  /* Высота экрана, а не страницы — иначе на коротких страницах (напр.
     AI-шеф) сайдбар растягивался вслед за высотой контента вместо того,
     чтобы оставаться прибитым к области просмотра. */
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 22px;
}
.sidebar-logo .icon {
  width: 92px; height: 92px; border-radius: var(--radius-card);
  background: var(--surface-alt); display: flex; align-items: center;
  justify-content: center; font-size: 20px; flex: none;
}
.sidebar-logo .title { font-weight: 800; font-size: 16px; }
.sidebar-logo .subtitle { font-size: 12px; color: var(--text-secondary); }

.sidebar-spacer { flex: 1; }
.sidebar-footer { font-size: 12px; color: var(--text-secondary); padding: 10px 8px 0; }

.promo-card {
  display: block; width: 100%; background: var(--green-soft); border-radius: var(--radius-card);
  padding: 18px; text-align: center; margin-top: 12px; border: none; font-family: inherit; cursor: pointer;
}
.promo-mascot { width: 72px; height: 72px; object-fit: contain; margin: 0 auto 10px; border-radius: var(--radius-tile); }
.promo-title { font-weight: 800; font-size: 15px; color: var(--on-green-soft); margin-bottom: 4px; }
.promo-text { font-size: 13px; color: var(--on-green-soft); opacity: .85; margin-bottom: 14px; line-height: 1.4; }
.promo-btn { min-height: 44px; padding: 10px; font-size: 14px; }

.nav-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: var(--radius-tile); cursor: pointer;
  font-weight: 600; font-size: 16.5px; color: var(--text);
  transition: background-color 180ms ease-out;
}
.nav-item.active { background: var(--green-soft); color: var(--on-green-soft); font-weight: 800; }
.nav-item:hover { background: var(--surface-alt); }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.max-body {
  max-width: var(--max-width); margin: 0 auto; padding: 24px 28px 70px; width: 100%;
  flex: 1; min-height: 0; display: flex; flex-direction: column;
}

@media (min-width: 900px) { .max-body { padding: 32px 48px 80px; } }

@media (max-width: 899px) {
  .sidebar { display: none; }
  .max-body { padding: 18px 18px 96px; }
  .bottom-nav { display: flex; }
}
.bottom-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface); box-shadow: 0 -2px 16px var(--shadow);
  padding: 9px 4px; justify-content: space-around; z-index: 20; }
.bottom-nav .nav-item { flex-direction: column; gap: 4px; font-size: 11.5px; padding: 6px 8px; }

svg.icon { flex: none; display: inline-block; vertical-align: middle; }
.icon-img { flex: none; display: inline-block; vertical-align: middle; object-fit: contain; }

/* Иконки в круглых/квадратных бейджах занимают почти всю площадь, но не
   вылезают за края контейнера. К превью карточек рецептов (фото блюд) это
   правило не относится — там не иконки, а обычные <img> без класса .icon. */
.row-icon .icon,
.sidebar-logo .icon .icon,
.banner-arrow .icon,
.fav-btn .icon,
.feed-fav .icon,
.chat-fab .icon,
.chat-icon-btn .icon,
.chat-send-btn .icon,
.mini-icon-btn .icon,
.icon-action-btn .icon,
.small-step .icon {
  width: 80% !important;
  height: 80% !important;
}
/* Иконки на главном экране / в AI-шефе — бейдж 30x30 (кроме бокового меню
   и карточек видов приёма пищи, у них свой размер), сама иконка внутри
   с отступом, а не впритык к краям бейджа. */
.icon-btn .icon,
.banner-icon .icon,
.assistant-icon .icon,
.highlight-icon .icon {
  width: 48px !important;
  height: 48px !important;
}
/* Заглушки без фото (нет картинки блюда) — иконка почти во весь контейнер. */
.feed-thumb--placeholder .icon,
.home-recipe-thumb--placeholder .icon {
  width: 80% !important;
  height: 80% !important;
}
/* Иконки категорий на главной — занимают почти весь бейдж. */
.category-icon .icon {
  width: 95% !important;
  height: 95% !important;
}
/* Иконки пунктов навигации в сайдбаре — вдвое крупнее (кроме нижней панели
   на мобильном, там места мало). */
.sidebar .nav-item .icon {
  width: 40px !important;
  height: 40px !important;
}

.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.icon-btn {
  width: 60px; height: 60px; padding: 0; border-radius: var(--radius-tile); border: none;
  background: var(--surface-alt); color: var(--text); display: flex; align-items: center;
  justify-content: center; cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--card-border); }

.banner-green {
  position: relative; display: flex; align-items: center; gap: 16px;
  background: var(--primary); color: var(--on-primary);
  border-radius: var(--radius-banner); padding: 20px; margin-bottom: 14px;
  overflow: hidden; min-height: 112px;
}
.banner-icon {
  width: 60px; height: 60px; border-radius: var(--radius-tile);
  background: rgba(0,0,0,.12); display: flex; align-items: center; justify-content: center; flex: none;
}
.banner-text { flex: 1; min-width: 0; }
.banner-title { font-weight: 800; font-size: 20px; margin-bottom: 5px; }
.banner-subtitle { font-size: 14px; opacity: .85; max-width: 230px; }
.banner-mascot { position: absolute; right: 58px; bottom: 0; width: 108px; height: auto; object-fit: contain; }
.banner-arrow {
  width: 46px; height: 46px; border-radius: 50%; background: var(--ink); color: var(--on-ink);
  display: flex; align-items: center; justify-content: center; flex: none; position: relative; z-index: 1;
}

.category-row { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; }
.category-item { display: flex; flex-direction: column; align-items: center; gap: 10px; flex: none; width: 108px; }
.category-icon {
  width: 90px; height: 90px; border-radius: var(--radius-card); background: var(--surface-alt);
  color: var(--primary); display: flex; align-items: center; justify-content: center;
}
.category-label { font-size: 14px; font-weight: 600; text-align: center; }

.row-card {
  display: flex; align-items: center; gap: 13px; background: var(--surface);
  border-radius: var(--radius-card); box-shadow: 0 6px 16px var(--shadow);
  padding: 14px 16px; margin-bottom: 10px;
}
.row-card--accent { background: var(--green-soft); box-shadow: none; color: var(--on-green-soft); }
.row-icon {
  width: 42px; height: 42px; border-radius: var(--radius-sm); background: var(--green-soft);
  color: var(--primary-dark); display: flex; align-items: center; justify-content: center; flex: none;
}
.row-icon--accent { background: rgba(0,0,0,.12); color: inherit; }
.row-text { flex: 1; min-width: 0; }
.row-title { font-weight: 800; font-size: 15.5px; }
.row-subtitle { font-size: 13.5px; color: var(--text-secondary); margin-top: 2px; }
.row-card--accent .row-subtitle { color: inherit; opacity: .75; }

/* Три карточки на главном экране: меню на неделю / список покупок / совет ИИ */
.highlight-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 14px; }
@media (max-width: 900px) { .highlight-row { grid-template-columns: 1fr; } }
.highlight-card {
  display: block; background: var(--surface); border-radius: var(--radius-card);
  box-shadow: 0 6px 16px var(--shadow); padding: 16px; color: var(--text);
}
.highlight-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.highlight-icon {
  width: 60px; height: 60px; border-radius: var(--radius-sm); background: var(--green-soft);
  color: var(--primary-dark); display: flex; align-items: center; justify-content: center; flex: none;
}
.highlight-title { font-weight: 800; font-size: 14.5px; flex: 1; min-width: 0; }
.highlight-chevron { color: var(--text-secondary); flex: none; }
.highlight-sub { font-size: 12.5px; color: var(--text-secondary); margin-bottom: 12px; }
.highlight-progress { height: 6px; border-radius: 6px; background: var(--surface-alt); overflow: hidden; margin-bottom: 10px; }
.highlight-progress-fill { height: 100%; background: var(--primary); border-radius: 6px; }
.highlight-days { display: flex; gap: 6px; }
.day-pill {
  flex: 1; text-align: center; padding: 6px 0; border-radius: var(--radius-sm);
  background: var(--surface-alt); color: var(--text-secondary); font-size: 11.5px; font-weight: 700;
}
.day-pill.active { background: var(--primary); color: var(--on-primary); }
.highlight-avatars { display: flex; gap: 8px; }
.avatar-badge {
  width: 32px; height: 32px; border-radius: 50%; background: var(--green-soft); color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; flex: none;
}
.avatar-badge--more { background: var(--surface-alt); color: var(--text-secondary); }

.section-header { display: flex; justify-content: space-between; align-items: center; margin: 16px 0 10px; }
.see-all { display: flex; align-items: center; gap: 2px; font-size: 14px; font-weight: 700; color: var(--primary); }

.home-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
@media (max-width: 1100px) { .home-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) { .home-grid { grid-template-columns: repeat(2, 1fr); } }
.home-recipe-card {
  display: block; background: var(--surface); border-radius: var(--radius-card);
  box-shadow: 0 6px 16px var(--shadow); overflow: hidden;
  transition: transform 180ms ease-out, box-shadow 180ms ease-out;
}
.home-recipe-card:hover { transform: translateY(-2px); box-shadow: 0 10px 22px var(--shadow); }
.home-recipe-thumb { width: 100%; height: 150px; object-fit: cover; background: var(--surface-alt); }
.home-recipe-thumb--placeholder { display: flex; align-items: center; justify-content: center; color: var(--text-secondary); }
.home-recipe-body { padding: 14px 16px 16px; }
.home-recipe-title { font-weight: 800; font-size: 15.5px; margin-bottom: 8px; line-height: 1.3; }
.home-recipe-meta { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-secondary); }
.home-recipe-meta span:nth-child(2) { margin-right: 10px; }

/* AI-шеф */
.assistant-hero { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; }
.assistant-hero-title { font-size: 14.5px; color: var(--text-secondary); max-width: 270px; }
.assistant-mascot { width: 80px; height: 80px; object-fit: contain; }
.assistant-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.assistant-card {
  display: block; width: 100%; background: var(--surface); border-radius: var(--radius-card);
  box-shadow: 0 6px 16px var(--shadow); padding: 18px 20px; border: none; text-align: left;
  font-family: inherit; cursor: pointer; color: var(--text);
}
.assistant-icon {
  display: inline-flex; width: 60px; height: 60px; border-radius: var(--radius-sm);
  background: var(--green-soft); color: var(--primary-dark); align-items: center; justify-content: center;
  margin-bottom: 13px;
}
.assistant-card-title { font-weight: 800; font-size: 15.5px; margin-bottom: 5px; display: flex; align-items: center; gap: 8px; }
.assistant-card-subtitle { font-size: 13.5px; color: var(--text-secondary); }
.beta-badge {
  background: var(--green-soft); color: var(--on-green-soft); font-size: 11px; font-weight: 800;
  padding: 2px 8px; border-radius: var(--radius-pill);
}
.ai-disclaimer {
  display: flex; align-items: flex-start; gap: 10px; margin-top: 20px;
  padding: 14px 16px; border-radius: var(--radius-tile); background: var(--surface-alt);
  color: var(--text-secondary); font-size: 12.5px; line-height: 1.5;
}
.ai-disclaimer .icon { flex: none; margin-top: 1px; color: var(--star); }
/* Растягивается на всю доступную высоту (родитель .max-body теперь flex-
   колонка на всю высоту экрана), чтобы плашка-дисклеймер (margin-top:auto
   внутри) прижималась к низу экрана, а не «висела» сразу под коротким
   контентом — без хрупких calc(100vh - N px). */
.assistant-page { display: flex; flex-direction: column; flex: 1; min-height: 0; }

h1, h2, h3 { margin: 0; }
.title-xl { font-size: 32px; font-weight: 800; }
.title-lg { font-size: 23px; font-weight: 800; }
.title-md { font-size: 18px; font-weight: 800; }
.text-secondary { color: var(--text-secondary); }

.card {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: 0 6px 16px var(--shadow);
  padding: 18px;
}

.search-row {
  display: flex; align-items: center; gap: 11px;
  background: var(--surface-alt); border: none;
  border-radius: var(--radius-tile); padding: 6px 10px 6px 16px; margin: 16px 0;
}
.search-row input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-size: 15px; padding: 13px 0;
}
.filter-row { display: flex; gap: 11px; flex-wrap: wrap; margin-bottom: 16px; }
.pill {
  padding: 11px 17px; border-radius: var(--radius-chip);
  border: 1px solid var(--card-border); background: var(--surface);
  font-size: 14px; font-weight: 700; cursor: pointer; color: var(--text);
}
.pill.active { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
select.pill { appearance: none; }

/* Фильтры — настоящий выпадающий список (оверлей поверх ленты, не раздвигает
   страницу): заголовок-кнопка показывает текущий выбор, под ним всплывает
   список вариантов (переиспользует .ing-autocomplete-list). */
.filter-dropdown { position: relative; flex: 1; min-width: 0; }
.filter-header {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 16px; border-radius: var(--radius-chip); border: 1px solid var(--card-border);
  background: var(--surface); font-size: 14.5px; font-weight: 700; color: var(--text);
  font-family: inherit; cursor: pointer;
}
.filter-header.active { background: var(--green-soft); border-color: var(--primary); color: var(--primary-dark); }
.filter-header span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-dropdown-menu { max-height: 320px; }
.filter-dropdown-menu .ing-autocomplete-item.active {
  background: var(--green-soft); color: var(--primary-dark); font-weight: 700;
}
/* Плитки-фильтры — используются на других страницах (режим закупок, приёмы
   пищи, подсказки продуктов, предпочтения), НЕ на странице поиска. */
.filter-tiles { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 16px; }
.filter-tile {
  padding: 9px 15px; border-radius: var(--radius-chip); border: 1px solid var(--card-border);
  background: var(--surface); font-size: 13px; font-weight: 700; color: var(--text);
  font-family: inherit; cursor: pointer;
}
.filter-tile.active { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }

.feed-card {
  position: relative; display: flex; background: var(--surface);
  border-radius: var(--radius-card); box-shadow: 0 6px 16px var(--shadow);
  overflow: hidden; margin-bottom: 16px; cursor: pointer;
  transition: transform 180ms ease-out, box-shadow 180ms ease-out;
}
.feed-card:hover { transform: translateY(-2px); box-shadow: 0 10px 22px var(--shadow); }
.feed-card-link { display: flex; gap: 0; flex: 1; min-width: 0; cursor: pointer; }
.feed-thumb { width: 136px; height: 160px; flex: none; object-fit: cover; background: var(--surface-alt); }
.feed-thumb--placeholder { display: flex; align-items: center; justify-content: center; color: var(--text-secondary); }
.feed-body {
  padding: 16px 18px; flex: 1; min-width: 0;
  /* Высота = высоте превью (--feed-thumb), чтобы карточка не растягивалась
     из-за длинного списка ингредиентов — лишнее обрезается ниже по месту. */
  height: 160px; display: flex; flex-direction: column; overflow: hidden;
}
.feed-body--fav { padding-right: 46px; }
.feed-fav {
  position: absolute; right: 13px; top: 13px; width: 38px; height: 38px; padding: 0; border-radius: 50%;
  border: none; background: var(--surface-alt); color: var(--text-secondary); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.feed-fav.active { color: var(--danger); }
.feed-title { font-weight: 800; font-size: 16px; margin-bottom: 7px; flex: none; }
.tag-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 7px; flex: none; }
.tag { background: var(--surface-alt); color: var(--text-secondary); font-size: 12.5px;
  padding: 4px 9px; border-radius: var(--radius-sm); }
.tag.green { background: var(--green-soft); color: var(--on-green-soft); }
.tag.peach { background: var(--peach); color: var(--peach-ink); }
/* Занимает весь оставшийся отступ до низа карточки — сколько строк влезет,
   столько ингредиентов и видно, остальное аккуратно обрезается многоточием. */
.feed-ingredients {
  font-size: 13.5px; color: var(--text-secondary); flex: 1; min-height: 0;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
}

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }

.skeleton { height: 128px; border-radius: var(--radius-card); background: var(--surface-alt);
  margin-bottom: 16px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .6; } 50% { opacity: 1; } }

.page-loading { display: flex; justify-content: center; padding: 80px 0; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--green-soft);
  border-top-color: var(--primary); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.page-error { padding: 40px; text-align: center; color: var(--text-secondary); }

/* Recipe detail */
.recipe-layout { display: grid; grid-template-columns: 1fr; gap: 22px; }
@media (min-width: 900px) { .recipe-layout { grid-template-columns: 1.4fr 1fr; align-items: start; } }
.recipe-image-wrap { position: relative; border-radius: var(--radius-card); overflow: hidden; height: 360px; background: var(--surface-alt); }
.recipe-image-wrap img { width: 100%; height: 100%; object-fit: cover; }
.badge-time { position: absolute; left: 15px; bottom: 15px; background: rgba(0,0,0,.55);
  color: #fff; padding: 8px 13px; border-radius: var(--radius-pill); font-size: 13.5px; font-weight: 700; }
.badge-18 { position: absolute; left: 15px; top: 15px; background: var(--danger);
  color: #fff; padding: 8px 13px; border-radius: var(--radius-pill); font-size: 14px; font-weight: 800; }
.fav-btn { position: absolute; right: 15px; top: 15px; width: 46px; height: 46px; padding: 0; border-radius: 50%;
  background: rgba(0,0,0,.5); border: none; color: #fff; font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; }
.fav-btn.active { color: var(--danger); }

.ingredient-row { display: flex; align-items: center; justify-content: space-between;
  padding: 9px 0; border-bottom: 1px solid var(--divider); font-size: 15.5px; }
.ingredient-row:last-child { border-bottom: none; }
.ingredient-row .measure { color: var(--text-secondary); font-size: 14px; }

.step-card { display: flex; gap: 13px; margin-bottom: 16px; }
.step-num { width: 32px; height: 32px; border-radius: 50%; background: var(--green-soft);
  color: var(--on-green-soft); display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; flex: none; }
.step-text { padding-top: 4px; line-height: 1.55; font-size: 15px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 22px; border-radius: var(--radius-tile); border: none; cursor: pointer;
  font-weight: 800; font-size: 15px; min-height: 52px;
  transition: filter 180ms ease-out;
}
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { filter: brightness(0.95); }
.btn-ink { background: var(--ink); color: var(--on-ink); }
.btn-outline { background: transparent; border: 1px solid var(--card-border); color: var(--text); }
.btn-outline.active { background: var(--green-soft); border-color: var(--primary); color: var(--primary-dark); }
.btn-danger-outline { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-block { width: 100%; }

.servings-row { display: flex; align-items: center; gap: 13px; padding: 11px 0; }

.nutrition-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.nutrition-item { display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 4px; border-radius: var(--radius-sm); background: var(--surface-alt); }
.nutrition-value { font-size: 17px; font-weight: 800; color: var(--text); }
.nutrition-label { font-size: 11.5px; color: var(--text-secondary); }
.step-btn { width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--green-soft);
  border: none; color: var(--primary-dark); font-size: 19px; cursor: pointer; }

.empty-state { text-align: center; padding: 44px 20px; color: var(--text-secondary); }

.auth-form { max-width: 400px; margin: 64px auto; display: flex; flex-direction: column; gap: 13px; }
.auth-form input { padding: 14px 15px; border-radius: var(--radius-tile); border: none;
  background: var(--surface-alt); color: var(--text); font-size: 15px; }
.auth-form input:focus { outline: 1.6px solid var(--primary); outline-offset: -1.6px; }
.error-text { color: var(--danger); font-size: 13.5px; }

/* Плавающий чат «AI-шеф» — на каждой странице (см. webapp/js/chat_widget.js) */
.chat-fab {
  position: fixed; right: 24px; bottom: 24px; width: 60px; height: 60px; padding: 0;
  border-radius: 50%; border: none; cursor: pointer; z-index: 60;
  background: var(--primary); color: var(--on-primary);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 24px var(--shadow);
}
@media (max-width: 899px) { .chat-fab { bottom: 88px; } }

.chat-panel {
  position: fixed; right: 24px; bottom: 96px; z-index: 61;
  width: 380px; max-width: calc(100vw - 32px);
  height: 500px; max-height: calc(100vh - 150px);
  background: var(--surface); border-radius: var(--radius-card);
  box-shadow: 0 16px 40px var(--shadow);
  display: flex; flex-direction: column; overflow: hidden;
}
@media (max-width: 899px) { .chat-panel { bottom: 160px; } }

.chat-panel-header {
  display: flex; align-items: center; gap: 10px; padding: 16px 18px;
  border-bottom: 1px solid var(--divider); font-weight: 800; font-size: 15px; flex: none;
}
.chat-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); flex: none; }
.chat-panel-title { flex: 1; }
.chat-icon-btn {
  width: 34px; height: 34px; padding: 0; border-radius: 50%; border: none;
  background: var(--surface-alt); color: var(--text-secondary); cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex: none;
}
.chat-log { flex: 1; overflow-y: auto; padding: 16px 18px; }
.chat-row { display: flex; margin-bottom: 12px; }
.chat-row--mine { justify-content: flex-end; }
.chat-bubble {
  max-width: 78%; padding: 11px 15px; border-radius: var(--radius-tile);
  background: var(--surface-alt); color: var(--text); font-size: 14px; line-height: 1.45;
}
.chat-bubble--mine { background: var(--primary); color: var(--on-primary); }
.chat-hint { color: var(--text-secondary); font-size: 13.5px; line-height: 1.5; }
.chat-input-row {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border-top: 1px solid var(--divider); flex: none;
}
.chat-input-row input {
  flex: 1; border: none; background: transparent; outline: none;
  color: var(--text); font-size: 14px; padding: 11px 6px;
}
.chat-send-btn {
  width: 38px; height: 38px; padding: 0; border-radius: 50%; border: none;
  background: var(--primary); color: var(--on-primary); cursor: pointer; flex: none;
  display: flex; align-items: center; justify-content: center;
}
.chat-send-btn:disabled { opacity: .6; cursor: default; }

/* Плавающее окно калькулятора калорий — открывается с кнопки в дневнике
   питания (см. webapp/js/calorie_calculator_panel.js), по образцу .chat-panel,
   но не привязано к отдельной FAB-кнопке — открывает/закрывает сама страница. */
.calc-panel {
  position: fixed; right: 24px; bottom: 24px; z-index: 61;
  width: 420px; max-width: calc(100vw - 32px);
  height: 620px; max-height: calc(100vh - 100px);
  background: var(--surface); border-radius: var(--radius-card);
  box-shadow: 0 16px 40px var(--shadow);
  display: flex; flex-direction: column; overflow: hidden;
}
@media (max-width: 899px) { .calc-panel { bottom: 88px; } }
.calc-panel-body { flex: 1; overflow-y: auto; padding: 16px 18px; }

/* Меню на неделю */
.menu-head-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; }
.card-title-row { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.card-title-row .title-md { font-size: 16px; }
.card-hint { font-size: 12.5px; color: var(--text-secondary); margin-bottom: 12px; }

.pantry-chip {
  display: inline-flex; align-items: center; gap: 7px; background: var(--green-soft);
  color: var(--on-green-soft); padding: 9px 13px; border-radius: var(--radius-chip);
  font-size: 13.5px; font-weight: 600; cursor: pointer; border: 1px solid var(--primary);
}
.pantry-add-row { display: flex; gap: 8px; margin-top: 12px; }
.pantry-add-row input {
  flex: 1; padding: 12px 14px; border-radius: var(--radius-tile); border: none;
  background: var(--surface-alt); color: var(--text); font-size: 14px;
}
.pantry-details { margin-top: 12px; }
.pantry-details summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--text-secondary); user-select: none;
}
.pantry-details summary::-webkit-details-marker { display: none; }
.pantry-details summary::before {
  content: '›'; display: inline-block; font-size: 16px; font-weight: 700;
  transition: transform 0.15s ease; transform: rotate(0deg);
}
.pantry-details[open] summary::before { transform: rotate(90deg); }
.pantry-details .filter-tiles { margin-top: 10px; margin-bottom: 0; }

.mini-icon-btn {
  width: 38px; height: 38px; border-radius: var(--radius-sm); background: var(--green-soft);
  color: var(--primary-dark); border: none; display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex: none;
}
.small-step {
  width: 28px; height: 28px; border-radius: 8px; background: var(--green-soft);
  color: var(--primary-dark); border: none; display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex: none;
}

.calorie-chip-row { display: flex; gap: 8px; margin-top: 10px; }

/* Переключатель темы (солнце/луна) в списке профиля — вместо отдельной
   страницы. Кружок-бегунок сдвигается вправо в тёмной теме. */
.theme-switch {
  width: 78px; height: 42px; border-radius: 999px; border: 2px solid var(--card-border);
  background: var(--surface-alt); position: relative; cursor: pointer; padding: 0; flex: none;
}
.theme-switch-knob {
  position: absolute; top: 3px; left: 3px; width: 33px; height: 33px; border-radius: 50%;
  background: var(--primary); color: var(--on-primary); display: flex; align-items: center;
  justify-content: center; transition: left 180ms ease;
}
.theme-switch-knob svg { width: 21px; height: 21px; }
.theme-switch[data-theme="dark"] .theme-switch-knob { left: 39px; }
.theme-switch[data-on="1"] .theme-switch-knob { left: 39px; background: var(--primary); }
.theme-switch[data-on="0"] .theme-switch-knob { background: var(--card-border); color: var(--text-secondary); }

/* Окно выбора блюда (случайное из категории / поиск) — оверлей поверх экрана */
.dish-picker-backdrop {
  position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.dish-picker-sheet {
  width: 100%; max-width: 520px; max-height: min(80vh, 640px);
  background: var(--surface); border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  box-shadow: 0 -16px 40px var(--shadow); display: flex; flex-direction: column; overflow: hidden;
}
@media (min-width: 640px) {
  .dish-picker-backdrop { align-items: center; }
  .dish-picker-sheet { border-radius: var(--radius-card); max-height: min(80vh, 640px); }
}
.dish-picker-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--card-border); margin: 10px auto 0; flex: none; }
.dish-picker-header { display: flex; align-items: center; gap: 10px; padding: 12px 20px 6px; flex: none; }
.dish-picker-header .title-md { flex: 1; }
.dish-picker-search-row { padding: 4px 20px 10px; flex: none; }
.dish-picker-input {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-tile);
  border: 1px solid var(--card-border); background: var(--surface-alt); color: var(--text); font-size: 14px;
}
.dish-picker-list { flex: 1; overflow-y: auto; padding: 4px 12px 16px; }
.dish-picker-item {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px;
  border: none; border-top: 1px solid var(--divider); background: transparent; color: var(--text);
  cursor: pointer; text-align: left; font-size: 14px;
}
.dish-picker-item:first-child { border-top: none; }
.dish-picker-item .dish-thumb { width: 48px; height: 48px; border-radius: 10px; flex: none; object-fit: cover; }

.day-card { margin-bottom: 14px; }
.dish-row { display: flex; gap: 12px; padding: 9px 0; align-items: flex-start; border-top: 1px solid var(--divider); }
.dish-row:first-of-type { border-top: none; }
.dish-thumb { width: 56px; height: 56px; border-radius: var(--radius-sm); object-fit: cover; background: var(--surface-alt); flex: none; }
.dish-thumb--placeholder { display: flex; align-items: center; justify-content: center; color: var(--text-secondary); }
.dish-info { flex: 1; min-width: 0; padding-top: 2px; }
.dish-name-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dish-name { font-weight: 700; font-size: 14.5px; }
.ai-badge { background: var(--green-soft); color: var(--primary-dark); font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 6px; }
.dish-meta { font-size: 12.5px; color: var(--primary-dark); margin-top: 2px; }
.dish-actions { display: flex; gap: 2px; flex: none; }
.icon-action-btn {
  width: 36px; height: 36px; border-radius: 50%; border: none; background: transparent;
  color: var(--text-secondary); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.icon-action-btn:hover { background: var(--surface-alt); }
.icon-action-btn.active { color: var(--primary); }
.icon-action-btn:disabled { opacity: .35; cursor: default; }
.servings-mini-row { display: flex; align-items: center; gap: 8px; margin-left: 68px; margin-top: 2px; font-size: 12.5px; color: var(--text-secondary); }
.servings-mini-row .num { font-weight: 800; color: var(--text); font-size: 13.5px; }

.add-dish-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--divider); flex-wrap: wrap; }
.add-dish-label { font-size: 13.5px; font-weight: 700; }

.shopping-row { display: flex; align-items: flex-start; gap: 11px; padding: 8px 0; cursor: pointer; border: none; background: none; width: 100%; text-align: left; font-family: inherit; }
.shopping-row .icon { color: var(--text-secondary); flex: none; margin-top: 1px; }
.shopping-row.bought .icon { color: var(--primary); }
.shopping-name { font-size: 14.5px; color: var(--text); }
.shopping-row.bought .shopping-name { text-decoration: line-through; color: var(--text-secondary); }
.shopping-measure { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }

.week-summary-line { font-weight: 700; font-size: 15.5px; margin-top: 4px; }
.notes-textarea {
  width: 100%; min-height: 80px; padding: 13px 14px; border-radius: var(--radius-tile); border: none;
  background: var(--surface-alt); color: var(--text); font-size: 14px; font-family: inherit; resize: vertical;
}

/* Свои поля ввода — без стандартного вида браузера (стрелочки number,
   иконка календаря у date и т.п.), чтобы всё выглядело одним стилем. */
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}
input, textarea, select { -webkit-appearance: none; appearance: none; }

/* Автодополнение продуктов — выпадает ПОД полем, закрытый прокручиваемый
   блок (не растягивает страницу, не перекрывает то, что выше). */
.ing-autocomplete-list {
  position: absolute; top: 100%; left: 0; right: 0; margin-top: 4px; z-index: 30;
  background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--radius-tile);
  box-shadow: 0 10px 24px var(--shadow); max-height: 220px; overflow-y: auto;
}
.ing-autocomplete-item {
  display: block; width: 100%; text-align: left; padding: 10px 14px; border: none; background: none;
  color: var(--text); font-size: 14px; font-family: inherit; cursor: pointer; border-bottom: 1px solid var(--divider);
}
.ing-autocomplete-item:last-child { border-bottom: none; }
.ing-autocomplete-item:hover { background: var(--surface-alt); }
