/* ==========================================================================
   Токены. Светлая тема по умолчанию, тёмная — по системе или вручную (data-theme)
   ========================================================================== */
:root {
  --bg: #F4F1EC;
  --panel: #FFFFFF;
  --panel2: #EEE9E1;
  --ink: #1E1A16;
  --mute: #6C645B;
  --line: #E0D9CE;
  --accent: #2F7A4F;
  --accent-ink: #FFFFFF;
  --accent-soft: #DCEFE2;
  --warm: #C8553D;
  --warm-soft: #F8E0D8;
  --warn: #A86A00;
  --warn-soft: #FBEFD5;
  --neg: #B23A2C;
  --neg-soft: #F7DCD7;
  --kcal: #D9822B;
  --protein: #3A7BD5;
  --fat: #C9A227;
  --carbs: #6BA368;
  --shadow: 0 1px 0 rgba(30, 26, 22, .04), 0 10px 28px -16px rgba(30, 26, 22, .28);
  --radius: 14px;
  --radius-sm: 9px;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Unbounded", "IBM Plex Sans", sans-serif;
  --nav-h: 62px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14120F;
    --panel: #1E1B17;
    --panel2: #29251F;
    --ink: #F1EBE2;
    --mute: #A39A8E;
    --line: #36302A;
    --accent: #6BCB8F;
    --accent-ink: #0C2416;
    --accent-soft: #1E3326;
    --warm: #F08A6B;
    --warm-soft: #3D231C;
    --warn: #E8B85A;
    --warn-soft: #3A2E15;
    --neg: #F08A7B;
    --neg-soft: #3B1F1B;
    --kcal: #F0A55A;
    --protein: #7EAEF0;
    --fat: #E5C65A;
    --carbs: #94CC90;
    --shadow: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #14120F;
  --panel: #1E1B17;
  --panel2: #29251F;
  --ink: #F1EBE2;
  --mute: #A39A8E;
  --line: #36302A;
  --accent: #6BCB8F;
  --accent-ink: #0C2416;
  --accent-soft: #1E3326;
  --warm: #F08A6B;
  --warm-soft: #3D231C;
  --warn: #E8B85A;
  --warn-soft: #3A2E15;
  --neg: #F08A7B;
  --neg-soft: #3B1F1B;
  --kcal: #F0A55A;
  --protein: #7EAEF0;
  --fat: #E5C65A;
  --carbs: #94CC90;
  --shadow: none;
  color-scheme: dark;
}

/* ==========================================================================
   База
   ========================================================================== */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; line-height: 1.2; margin: 0; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mute { color: var(--mute); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 6px; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ==========================================================================
   Каркас: шапка, навигация, контент
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.topbar-in {
  max-width: 1280px;
  margin: 0 auto;
  height: 56px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); font: 600 16px/1 var(--font-head); }
.brand:hover { text-decoration: none; }
.brand-logo { font-size: 22px; }
.topnav { display: none; gap: 4px; }
.topnav a {
  color: var(--mute);
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 14px;
}
.topnav a:hover { text-decoration: none; color: var(--ink); background: var(--panel2); }
.topnav a.active { color: var(--accent-ink); background: var(--accent); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.bottomnav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--panel);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}
.bottomnav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--mute);
  font-size: 11px;
  font-weight: 500;
}
.bottomnav a:hover { text-decoration: none; }
.bottomnav a .ico { font-size: 21px; line-height: 1; filter: grayscale(.9); opacity: .75; }
.bottomnav a.active { color: var(--accent); }
.bottomnav a.active .ico { filter: none; opacity: 1; }

main#view {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 16px 32px;
}
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { flex: 1; min-width: 0; }

@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .bottomnav { display: none; }
  .topnav { display: flex; }
  main#view { padding: 24px 24px 48px; }
  h1 { font-size: 26px; }
}

/* ==========================================================================
   Компоненты
   ========================================================================== */
.card {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 16px;
}
.card.flat { box-shadow: none; }
.card h2 { margin-bottom: 10px; }
.section + .section { margin-top: 16px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 10px;
  padding: 9px 14px;
  font-weight: 500;
  font-size: 14px;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { text-decoration: none; background: var(--panel2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--neg); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--panel2); }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.icon { padding: 7px; min-width: 36px; }
.btn.block { width: 100%; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--panel2);
  color: var(--mute);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.neg { background: var(--neg-soft); color: var(--neg); }
.chip.warm { background: var(--warm-soft); color: var(--warm); }

/* Переключатели-«таблетки» (фильтры, вкладки, сегменты) */
.pills { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.pills::-webkit-scrollbar { display: none; }
.pill {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.pill:hover { background: var(--panel2); }
.pill.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.segmented {
  display: inline-flex;
  background: var(--panel2);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.segmented button {
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--mute);
  cursor: pointer;
}
.segmented button.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }

/* Формы */
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--mute); }
.field > span { font-weight: 500; }
.input, .select, .textarea {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  color: var(--ink);
  font-size: 15px;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .form-grid.two { grid-template-columns: 1fr 1fr; }
  .form-grid.four { grid-template-columns: repeat(4, 1fr); }
}
.search {
  position: relative;
  flex: 1;
  min-width: 180px;
}
.search .input { padding-left: 34px; }
.search::before {
  content: "🔍";
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  opacity: .6;
}

.alert { border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px; }
.alert.err { background: var(--neg-soft); color: var(--neg); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.ok { background: var(--accent-soft); color: var(--accent); }

.empty { text-align: center; color: var(--mute); padding: 40px 16px; }
.empty .big { font-size: 40px; margin-bottom: 8px; }

.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Таблицы */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--mute); font-weight: 500; font-size: 12px; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table td.r, .table th.r { text-align: right; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--panel2); }

/* Модальное окно: снизу «шторкой» на телефоне, по центру на десктопе */
.modal-back {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, .45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade .15s ease-out;
}
.modal {
  background: var(--panel);
  width: 100%;
  max-height: 92vh;
  border-radius: 18px 18px 0 0;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
  animation: rise .2s ease-out;
}
.modal-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.modal-head h2 { flex: 1; font-size: 16px; }
.modal-body { padding: 14px 16px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px 14px; border-top: 1px solid var(--line); }
@media (min-width: 640px) {
  .modal-back { align-items: center; padding: 24px; }
  .modal { max-width: 560px; border-radius: 18px; max-height: 86vh; }
  .modal.wide { max-width: 860px; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: .6; } }

.toasts {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom));
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 420px);
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: var(--bg);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
  animation: rise .2s ease-out;
}
.toast.err { background: var(--neg); color: #fff; }
@media (min-width: 900px) { .toasts { bottom: 24px; } }

/* Меню пользователя */
.menu { position: relative; }
.menu-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 200px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
  padding: 6px;
  z-index: 50;
}
.menu-pop a, .menu-pop button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border-radius: 8px;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
}
.menu-pop a:hover, .menu-pop button:hover { background: var(--panel2); text-decoration: none; }
.menu-pop hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.menu-pop .who { padding: 8px 10px; font-size: 12px; color: var(--mute); }

/* Экран входа */
.auth-wrap { max-width: 380px; margin: 6vh auto 0; }
.auth-wrap .card { padding: 24px 20px; }
.auth-wrap h1 { font-size: 20px; margin-bottom: 4px; }

/* ==========================================================================
   Рецепты и продукты
   ========================================================================== */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.filters { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }

.grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
}
.rcard {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--ink);
  box-shadow: var(--shadow);
  transition: transform .12s ease;
}
.rcard:hover { text-decoration: none; transform: translateY(-2px); }
.rcard-cover {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--panel2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  overflow: hidden;
}
.rcard-cover img { width: 100%; height: 100%; object-fit: cover; }
.rcard-badges { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; gap: 6px; justify-content: space-between; }
.rcard-badges .chip { background: rgba(0, 0, 0, .55); color: #fff; backdrop-filter: blur(4px); }
.rcard-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.rcard-title { font-weight: 600; font-size: 15px; line-height: 1.3; }
.rcard-sub { font-size: 12px; color: var(--mute); margin-top: -4px; }
.rcard-desc { font-size: 13px; color: var(--mute); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rcard-stats { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; margin-top: auto; padding-top: 4px; }
.rcard-stats b { font-weight: 600; }

.fav-btn {
  border: 0;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  border-radius: 999px;
  width: 30px;
  height: 30px;
  font-size: 15px;
  cursor: pointer;
  backdrop-filter: blur(4px);
}
.fav-btn.on { color: #FF6B81; }

/* Плитки КБЖУ */
.macros { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.macro { background: var(--panel2); border-radius: 12px; padding: 10px 6px; text-align: center; min-width: 0; }
.macro .v { font: 600 18px/1.1 var(--font-head); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.macro .l { font-size: 11px; color: var(--mute); margin-top: 4px; }
.macro.kcal .v { color: var(--kcal); }
.macro.protein .v { color: var(--protein); }
.macro.fat .v { color: var(--fat); }
.macro.carbs .v { color: var(--carbs); }
.macro.cost { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: center; gap: 8px; }
.macro.cost .l { margin-top: 0; }
@media (max-width: 420px) { .macro .v { font-size: 16px; } }

.recipe-hero {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel2);
  aspect-ratio: 16 / 8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 72px;
}
.recipe-hero img { width: 100%; height: 100%; object-fit: cover; }
.recipe-layout { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 1000px) {
  .recipe-layout { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
  .recipe-side { position: sticky; top: 72px; }
}
.ing-group { font-weight: 600; font-size: 13px; color: var(--mute); margin: 12px 0 4px; }
.ing-list { list-style: none; padding: 0; margin: 0; }
.ing-list li { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); align-items: baseline; }
.ing-list li:last-child { border-bottom: 0; }
.ing-list .amt { margin-left: auto; color: var(--mute); white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 14px; }
.ing-list li.optional { color: var(--mute); }
.md { line-height: 1.6; }
.md p { margin: 0 0 10px; }
.md ol, .md ul { margin: 0 0 10px; padding-left: 22px; }
.md li { margin-bottom: 6px; }
.md li::marker { color: var(--accent); font-weight: 600; }
.md :last-child { margin-bottom: 0; }

.stars { display: inline-flex; gap: 2px; }
.stars button { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--line); padding: 2px; }
.stars button.on { color: #F2B400; }

.servings { display: inline-flex; align-items: center; gap: 4px; background: var(--panel2); border-radius: 10px; padding: 3px; }
.servings button { border: 0; background: var(--panel); border-radius: 8px; width: 32px; height: 32px; cursor: pointer; font-size: 17px; }
.servings .v { min-width: 64px; text-align: center; font-weight: 600; font-size: 14px; }

.bar { height: 6px; border-radius: 3px; background: var(--panel2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--kcal); border-radius: 3px; }

/* ==========================================================================
   План и дневник
   ========================================================================== */
.week {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}
@media (min-width: 1100px) {
  .week { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
  .week .day { font-size: 13px; }
}
.day { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.day-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.day-head b { font-family: var(--font-head); font-size: 14px; }
.slot-name { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--mute); font-weight: 600; margin-top: 4px; }
.plan-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel2);
  border-radius: 10px;
  padding: 6px 8px;
  font-size: 13px;
}
.plan-item .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-item .t a { color: var(--ink); }
.plan-item.eaten { background: var(--accent-soft); }
.add-slot {
  border: 1px dashed var(--line);
  background: none;
  border-radius: 10px;
  padding: 5px 8px;
  font-size: 12px;
  color: var(--mute);
  cursor: pointer;
  text-align: left;
}
.add-slot:hover { border-color: var(--accent); color: var(--accent); }
.day-total { font-size: 12px; color: var(--mute); border-top: 1px solid var(--line); padding-top: 6px; margin-top: auto; }

.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.month .dow { font-size: 11px; color: var(--mute); text-align: center; padding: 4px 0; }
.mday {
  min-height: 64px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 5px 6px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}
.mday.out { opacity: .4; }
.mday.today { border-color: var(--accent); }
.mday .d { font-weight: 600; }
.mday .k { color: var(--kcal); font-variant-numeric: tabular-nums; }
.mday .dots { display: flex; gap: 2px; flex-wrap: wrap; }
.mday .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
@media (min-width: 900px) { .mday { min-height: 92px; padding: 8px; font-size: 13px; } }

.progress { display: flex; flex-direction: column; gap: 10px; }
.progress .p-row { display: grid; grid-template-columns: 70px 1fr auto; align-items: center; gap: 10px; font-size: 13px; }
.progress .bar { height: 8px; }
.progress .bar > i.protein { background: var(--protein); }
.progress .bar > i.fat { background: var(--fat); }
.progress .bar > i.carbs { background: var(--carbs); }
.progress .bar > i.water { background: #4AA8D8; }
.progress .bar > i.over { background: var(--neg); }

.entry { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.entry:last-child { border-bottom: 0; }
.entry .t { flex: 1; min-width: 0; }
.entry .t .n { font-weight: 500; }
.entry .k { text-align: right; font-size: 13px; white-space: nowrap; }
.entry.planned { opacity: .7; }

.two-col { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 1000px) { .two-col { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; } }

.chart-box { position: relative; height: 240px; }

/* Список покупок */
.shop-group { margin-top: 14px; }
.shop-group h3 { font-size: 13px; color: var(--mute); font-family: var(--font); font-weight: 600; margin-bottom: 4px; }
.shop-item { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.shop-item:last-child { border-bottom: 0; }
.shop-item input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--accent); flex: none; }
.shop-item .t { flex: 1; min-width: 0; }
.shop-item.done .t .n { text-decoration: line-through; color: var(--mute); }
.shop-item .from { font-size: 12px; color: var(--mute); }

/* Автодополнение */
.ac { position: relative; }
.ac-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
  max-height: 260px;
  overflow-y: auto;
  z-index: 60;
}
.ac-list button {
  display: flex;
  width: 100%;
  text-align: left;
  gap: 8px;
  border: 0;
  background: none;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 14px;
}
.ac-list button:hover, .ac-list button.hl { background: var(--panel2); }

/* Редактор ингредиентов */
.ing-edit { display: grid; gap: 6px; grid-template-columns: 1fr; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.ing-edit .r1 { display: grid; gap: 6px; grid-template-columns: 1fr; }
.ing-edit .r2 { display: grid; gap: 6px; grid-template-columns: 80px 80px 110px 1fr; }
@media (min-width: 760px) {
  .ing-edit .r1 { grid-template-columns: 2fr 1fr; }
}
@media (max-width: 480px) {
  .ing-edit .r2 { grid-template-columns: 1fr 1fr 1fr; }
  .ing-edit .r2 .note { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* На телефоне подпись периода в панели инструментов — отдельной строкой сверху */
@media (max-width: 640px) {
  .toolbar > b.grow { order: -1; flex-basis: 100%; }
  .page-head h1 { font-size: 20px; }
}
@media (max-width: 560px) { .wide-only { display: none; } }

/* Закреплённая панель «Сохранить» в длинных формах */
.save-bar {
  position: sticky;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 8px);
  z-index: 5;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}
@media (min-width: 900px) { .save-bar { bottom: 12px; } }
