:root {
  --bg: #f4f6f3;
  --card: #ffffff;
  --text: #1d2420;
  --muted: #66706a;
  --line: #e2e7e3;
  --accent: #2f9e5b;
  --accent-soft: #e3f4ea;
  --love: #d6336c;
  --love-soft: #fde8ef;
  --no: #8a8f8c;
  --warn: #c77700;
  --bad: #d03b3b;
  --freeze: #2b6cb0;
  --freeze-soft: #e5effa;
  --on-accent: #fff;
  --warn-bg: #fff4e0;
  --warn-text: #8a5300;
  --star: #f5a524;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-head: var(--font);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121614;
    --card: #1b211e;
    --text: #e7ece9;
    --muted: #9aa49e;
    --line: #2b332f;
    --accent: #4cc27c;
    --accent-soft: #1f3a2a;
    --love: #f06595;
    --love-soft: #3a1f2a;
    --no: #6f7672;
    --warn: #f0a33a;
    --bad: #f06b6b;
    --freeze: #6aa8ea;
    --freeze-soft: #1d2b3b;
    --warn-bg: #3a2c12;
    --warn-text: #f0c27a;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
}
header {
  position: sticky; top: 0; z-index: 5;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: calc(10px + env(safe-area-inset-top, 0px)) calc(16px + env(safe-area-inset-right, 0px)) 0 calc(16px + env(safe-area-inset-left, 0px));
}
.brand { font-size: 18px; }
.brand span { color: var(--muted); font-size: 13px; margin-left: 8px; }
.tbar { font-size: 13px; color: var(--muted); margin: 4px 0 6px; }
.tbar b { color: var(--text); }
.tbar span { margin-left: 8px; }
nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
nav::-webkit-scrollbar { display: none; }
.tab {
  border: 0; background: none; padding: 8px 10px; white-space: nowrap;
  color: var(--muted); border-bottom: 2px solid transparent; font: inherit; cursor: pointer;
}
.tab.active { color: var(--accent); border-color: var(--accent); font-weight: 600; }

main { max-width: 760px; margin: 0 auto; padding: 12px 16px calc(60px + env(safe-area-inset-bottom, 0px)); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 12px;
}
h2 { font-size: 19px; margin: 0 0 10px; }
h3 { font-size: 16px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.row.gap { justify-content: flex-start; }

button { font: inherit; color: inherit; cursor: pointer; }
.card > button, .row button {
  border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 9px 14px;
}
button.primary {
  display: block; width: 100%; margin-top: 12px; background: var(--accent); color: var(--on-accent);
  border: 0; border-radius: 12px; padding: 12px; font-weight: 600;
}

.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input[type=number], select {
  width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--text); font: inherit;
}
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.seg { display: flex; gap: 6px; margin-bottom: 8px; }
.seg.wrap { flex-wrap: wrap; }
.seg button {
  flex: 1; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 9px 6px;
}
.seg.wrap button { flex: 0 0 auto; min-width: 44px; }
.seg button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 8px; }
.kpis div { background: var(--bg); border-radius: 10px; padding: 10px 6px; text-align: center; }
.kpis b { display: block; font-size: 20px; }
.kpis span { font-size: 12px; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 6px 12px; font-size: 14px; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chip.love { background: var(--love-soft); border-color: var(--love); color: var(--love); }
.chip.no { color: var(--no); text-decoration: line-through; opacity: .75; }

.eq { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.eqbtn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  border: 1px solid var(--line); background: var(--bg); border-radius: 12px; padding: 10px 12px;
}
.eqbtn .ico { font-size: 22px; }
.eqbtn small { color: var(--muted); font-size: 11px; }
.eqbtn.on { background: var(--accent-soft); border-color: var(--accent); }

.dayhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.dayhead h3 { margin: 0; }
.badge { font-size: 12px; background: var(--accent-soft); color: var(--accent); padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.day.cookday { border-color: var(--accent); }

.meal { border-top: 1px solid var(--line); padding: 8px 0; }
.meal summary { display: flex; gap: 8px; align-items: baseline; cursor: pointer; list-style: none; }
.meal summary::-webkit-details-marker { display: none; }
.slot { font-size: 12px; color: var(--muted); width: 68px; flex: none; }
.mname { flex: 1; }
.mk { font-size: 13px; color: var(--muted); white-space: nowrap; }
.mbody { padding: 6px 0 0 0; font-size: 14px; }
.mbody ul { margin: 6px 0; padding-left: 18px; }
.meal.empty { color: var(--bad); font-size: 14px; }
ul.cols { columns: 2; column-gap: 24px; }
@media (max-width: 520px) { ul.cols { columns: 1; } .slot { width: 58px; } }

.total { display: flex; flex-wrap: wrap; gap: 6px 12px; border-top: 1px solid var(--line); padding-top: 8px; font-size: 13px; }
.ok { color: var(--accent); }
.warn { color: var(--warn); }
.bad { color: var(--bad); }

.portions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pill { font-size: 12px; padding: 3px 8px; border-radius: 8px; background: var(--bg); }
.pill.now { background: var(--accent-soft); color: var(--accent); }
.pill.freeze { background: var(--freeze-soft); color: var(--freeze); }
.tip { background: var(--freeze-soft); border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.warn-box { background: var(--warn-bg); color: var(--warn-text); border-radius: 10px; padding: 10px 12px; }

ul.shop { list-style: none; padding: 0; margin: 0; }
ul.shop li {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center;
  padding: 8px 0; border-top: 1px solid var(--line);
}
ul.shop label { display: flex; gap: 8px; align-items: center; }
ul.shop input:checked + span { text-decoration: line-through; color: var(--muted); }
.need { font-size: 13px; color: var(--muted); text-align: right; }
.stores { grid-column: 1 / -1; display: flex; gap: 10px; font-size: 12px; padding-left: 26px; }
.stores a { color: var(--accent); text-decoration: none; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(80px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px;
  transition: transform .25s; pointer-events: none;
}
#toast.show { transform: translateX(-50%) translateY(0); }

.install {
  display: flex; align-items: center; gap: 8px; margin: 6px 0;
  background: var(--accent-soft); border-radius: 10px; padding: 8px 10px; font-size: 13px;
}
.install span { flex: 1; }
.install button { border: 0; background: var(--accent); color: var(--on-accent); border-radius: 8px; padding: 6px 12px; font-weight: 600; }
.install button.x { background: none; color: var(--muted); padding: 4px 6px; }
.row.gap .badge { align-self: center; }

/* «Что есть дома» */
textarea {
  width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--text); font: inherit; resize: vertical; margin-bottom: 8px;
}
button.primary-inline { border: 0; background: var(--accent); color: var(--on-accent); border-radius: 10px; padding: 9px 14px; font-weight: 600; }
button.link { border: 0; background: none; color: var(--accent); padding: 0; text-decoration: underline; font: inherit; }
.chip .x { border: 0; background: none; color: inherit; padding: 0 0 0 4px; opacity: .6; }

/* Чек-лист по отделам */
.progress { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; margin: 6px 0 4px; }
.progress span { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.dept { margin-top: 10px; }
.dept h4 { margin: 0 0 2px; font-size: 14px; display: flex; justify-content: space-between; }
.dept h4 span { color: var(--muted); font-weight: 400; }
.dept.done h4 { color: var(--muted); }
ul.shop li.checked .need, ul.shop li.checked .stores { opacity: .45; }
ul.shop input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.need small { color: var(--accent); }

/* Голосовые колонки */
.voice .code { font-size: 34px; font-weight: 700; letter-spacing: 4px; text-align: center; margin: 8px 0; color: var(--accent); }

/* Оценки блюд */
.rate { display: flex; align-items: center; gap: 2px; font-size: 13px; color: var(--muted); padding: 0 0 6px 76px; }
.rate button { border: 0; background: none; font-size: 22px; line-height: 1; padding: 2px 3px; color: var(--line); }
.rate button.on { color: var(--star); }
@media (max-width: 520px) { .rate { padding-left: 66px; } }

/* Период, замена блюд */
.seg.period button { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.seg.period small { font-size: 11px; color: var(--muted); font-weight: 400; }
.card.next { border-color: var(--accent); }
.swap { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.swap .swapto { text-align: left; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.stars { color: var(--star); font-size: 12px; }

/* Вес */
.weigh input { width: 110px; }
svg.spark { width: 100%; height: 60px; color: var(--accent); margin: 6px 0; }

/* Таймлайн готовки */
details.tl { border-top: 1px dashed var(--line); padding: 8px 0; }
details.tl summary { cursor: pointer; }
ol.timeline { list-style: none; padding: 0; margin: 8px 0; }
ol.timeline li { display: grid; grid-template-columns: 44px 1fr auto; gap: 8px; align-items: start; padding: 6px 0; border-top: 1px solid var(--line); }
ol.timeline .t { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; padding-top: 1px; }
ol.timeline .what small { display: block; color: var(--muted); font-size: 12px; }
ol.timeline li.passive .what { color: var(--freeze); }
ol.timeline li.final .what { font-weight: 600; }
ol.timeline li.now { background: var(--accent-soft); border-radius: 8px; }
ol.timeline li.done { opacity: .45; }
ol.timeline .tick { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--accent); background: none; color: var(--accent); font-weight: 700; }
.card.cooking { border-color: var(--accent); border-width: 2px; }

/* Бытовая химия, дописанное */
ul.hh { list-style: none; padding: 0; margin: 10px 0 0; }
ul.hh li { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
ul.hh li small { color: var(--muted); }
ul.hh select { width: auto; padding: 6px; }
ul.hh .link { grid-column: 1 / -1; justify-self: start; font-size: 13px; }
b.warn { color: var(--warn); font-weight: 600; }
.add input[type=text] { flex: 1; min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; }
.need .from { color: var(--love); }

/* Семья */
.eater { border-top: 1px solid var(--line); padding: 10px 0; }
.eater .ename { flex: 1; min-width: 0; font-weight: 600; border: 0; border-bottom: 1px dashed var(--line); background: none; color: var(--text); font: inherit; font-weight: 600; padding: 4px 0; }
.egrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 6px; }
.egrid label span { display: block; font-size: 11px; color: var(--muted); }
.egrid input, .egrid select { padding: 6px; font-size: 14px; }
@media (max-width: 520px) { .egrid { grid-template-columns: repeat(3, 1fr); } }
.card.family { border-color: var(--love); }
.card.shared { border-color: var(--freeze); }
.code-inline { letter-spacing: 2px; color: var(--accent); }
label.switch { display: flex; align-items: center; gap: 6px; font-size: 14px; }
label.switch input { width: 18px; height: 18px; accent-color: var(--accent); }
input[type=text] { padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; width: 100%; }

/* Режим готовки: крупно — что делать сейчас */
.now-card { background: var(--accent-soft); border-radius: 14px; padding: 14px; margin: 10px 0; }
.now-card .label, .running .label { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.now-card .step { font-size: 20px; font-weight: 700; line-height: 1.3; margin: 4px 0; }
.now-card .then { margin-top: 10px; font-size: 14px; color: var(--muted); }
button.primary.big { font-size: 18px; padding: 14px; margin-top: 10px; }
.running { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.running .run { display: flex; justify-content: space-between; gap: 10px; text-align: left; border: 1px solid var(--freeze); background: var(--freeze-soft); color: var(--freeze); border-radius: 12px; padding: 10px 12px; }
.running .run b { white-space: nowrap; }
.running .run.ready { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .6; } }
details.ahead { margin: 8px 0; }
details.ahead summary { cursor: pointer; color: var(--muted); font-size: 14px; padding: 6px 0; }
ol.timeline li[role=button] { cursor: pointer; }
ol.timeline span.tick { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--accent); color: var(--accent); font-weight: 700; display: grid; place-items: center; }
.running .run { flex-wrap: wrap; align-items: center; }
.running .run > span { flex: 1 1 60%; }
.running .run.idle { border-style: dashed; background: var(--card); color: var(--text); }
.running .run.idle .primary-inline { width: 100%; padding: 11px; }
.running .run .bar { display: block; height: 4px; background: rgba(0,0,0,.08); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.running .run .bar i { display: block; height: 100%; background: currentColor; }
.running .run .primary-inline, .running .run .link { margin-left: auto; }

/* ===================== Темы оформления ===================== */
/* Подобраны навыком UI/UX Pro Max (design-system) под аудитории, контраст текста ≥ 4.5:1. */

/* «Свежий» (Flat Design, «fresh green + food amber») — по умолчанию; светлая/тёмная по системе. */
:root, :root[data-theme="fresh"] {
  --font: "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-head: "Rubik", var(--font);
}
:root:not([data-theme]), :root[data-theme="fresh"] {
  --bg: #ecfdf5; --card: #ffffff; --text: #0f172a; --muted: #475569; --line: #d5ece4;
  --accent: #047857; --accent-soft: #d1fae5; --on-accent: #ffffff;
  --cta: #d97706; --star: #d97706;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]), :root[data-theme="fresh"] {
    --bg: #0b1512; --card: #13201b; --text: #e6f4ee; --muted: #9db5aa; --line: #22362e;
    --accent: #34d399; --accent-soft: #123327; --on-accent: #062018; --star: #fbbf24;
  }
}

/* «Домашний» (мягкий, скруглённый; «warm terracotta + fresh green») — семьи, хозяйки. */
:root[data-theme="warm"] {
  --bg: #fffbeb; --card: #ffffff; --text: #2b1d16; --muted: #6b5548; --line: #f2e6e2;
  --accent: #9a3412; --accent-soft: #fbe7dc; --on-accent: #ffffff; --cta: #059669;
  --love: #be185d; --love-soft: #fce7f3; --no: #a8978c; --warn: #b45309; --bad: #b91c1c;
  --freeze: #1d4ed8; --freeze-soft: #e0e9fb; --warn-bg: #fdf0d5; --warn-text: #7c4a03; --star: #d97706;
  --radius: 22px;
  --font: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-head: "Nunito", var(--font);
}
:root[data-theme="warm"] h2, :root[data-theme="warm"] h3 { font-weight: 800; }
:root[data-theme="warm"] .card { border: 0; box-shadow: 0 6px 18px rgba(154, 52, 18, .08), 0 1px 0 rgba(154, 52, 18, .05); }
:root[data-theme="warm"] header { background: var(--bg); border-bottom: 0; }
:root[data-theme="warm"] .tab { border: 0; border-radius: 999px; padding: 8px 16px; margin-bottom: 8px; }
:root[data-theme="warm"] .tab.active { background: var(--accent); color: var(--on-accent); }
:root[data-theme="warm"] .seg button, :root[data-theme="warm"] .chip { border-radius: 999px; }
:root[data-theme="warm"] button.primary, :root[data-theme="warm"] .primary-inline { border-radius: 999px; }

/* «Спорт» (Vibrant & Block-based; «energy orange + success green») — зал, сушка, масса. */
:root[data-theme="sport"] {
  --bg: #111827; --card: #1f2937; --text: #f8fafc; --muted: #cbd5e1; --line: #374151;
  --accent: #f97316; --accent-soft: rgba(249, 115, 22, .16); --on-accent: #0f172a; --cta: #22c55e;
  --love: #fb7185; --love-soft: rgba(251, 113, 133, .16); --no: #6b7280; --warn: #fbbf24; --bad: #f87171;
  --freeze: #38bdf8; --freeze-soft: rgba(56, 189, 248, .14); --warn-bg: rgba(251, 191, 36, .14); --warn-text: #fde68a; --star: #fbbf24;
  --radius: 10px;
  --font: "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-head: "Rubik", var(--font);
  color-scheme: dark;
}
:root[data-theme="sport"] h2, :root[data-theme="sport"] h3 { text-transform: uppercase; letter-spacing: .3px; font-weight: 800; }
:root[data-theme="sport"] .kpis b, :root[data-theme="sport"] .now-card .step { font-weight: 800; }
:root[data-theme="sport"] .card { border-width: 0 0 0 4px; border-color: var(--line); }
:root[data-theme="sport"] .card.cooking, :root[data-theme="sport"] .day.cookday { border-left-color: var(--accent); }
:root[data-theme="sport"] .tab.active { color: var(--accent); border-color: var(--accent); }
:root[data-theme="sport"] .seg button.on, :root[data-theme="sport"] .chip.on { color: var(--accent); border-color: var(--accent); }
:root[data-theme="sport"] .ok { color: var(--cta); }

/* «Минимал» (Flat; «teal focus + action orange») — без карточек, тонкие линии, крупные заголовки. */
:root[data-theme="mono"] {
  --bg: #ffffff; --card: #ffffff; --text: #134e4a; --muted: #475569; --line: #e2e8f0;
  --accent: #0f766e; --accent-soft: #e6f6f4; --on-accent: #ffffff; --cta: #c2410c;
  --love: #be123c; --love-soft: #ffe4e6; --no: #94a3b8; --warn: #b45309; --bad: #b91c1c;
  --freeze: #1d4ed8; --freeze-soft: #eff4ff; --warn-bg: #fff7ed; --warn-text: #9a3412; --star: #c2410c;
  --radius: 8px;
  --font: "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-head: var(--font);
}
:root[data-theme="mono"] main { padding-top: 4px; }
:root[data-theme="mono"] .card { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 20px 2px; margin: 0; }
:root[data-theme="mono"] h2 { font-size: 24px; letter-spacing: -.3px; }
:root[data-theme="mono"] .now-card { border: 2px solid var(--accent); background: #fff; }

/* Общие правила UI/UX Pro Max: шрифт 16px, зоны нажатия ≥ 44px, видимый фокус, меньше анимации. */
body { font-size: 16px; }
h2, h3, .brand b { font-family: var(--font-head); }
.tab, .seg button, .chip, .card > button, .row button, button.primary-inline, .swap .swapto, .eqbtn { min-height: 44px; }
.chip { padding: 8px 14px; }
ol.timeline span.tick, ol.timeline .tick { min-width: 32px; min-height: 32px; }
button.link { min-height: 32px; }
ul.shop input[type=checkbox] { width: 24px; height: 24px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
button, [role=button], .chip, summary { cursor: pointer; }
button, .chip, .tab, .seg button { transition: background-color .15s ease, color .15s ease, border-color .15s ease; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Выбор темы */
.themes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.themes button { border: 2px solid var(--line); border-radius: 12px; padding: 0; overflow: hidden; background: none; text-align: left; }
.themes button.on { border-color: var(--accent); }
.themes .sw { display: flex; height: 34px; }
.themes .sw i { flex: 1; }
.themes span { display: block; padding: 5px 6px; font-size: 12px; }
@media (max-width: 420px) { .themes { grid-template-columns: repeat(2, 1fr); } }

/* ===================== Навигация, иконки, мастер ===================== */
svg.i { width: 18px; height: 18px; vertical-align: -3px; flex: none; }
svg.i.logo { width: 24px; height: 24px; color: var(--accent); vertical-align: -5px; }
button svg.i, summary svg.i, h2 svg.i, h3 svg.i { margin-right: 4px; }
h2 svg.i, h3 svg.i { width: 20px; height: 20px; color: var(--accent); }
.chip svg.i { width: 14px; height: 14px; margin-right: 4px; }
.chip.love svg.i { color: var(--love); }
.eqbtn .ico svg.i { width: 26px; height: 26px; color: var(--accent); }
.rate button svg.i { width: 24px; height: 24px; margin: 0; }
.rate button.on svg.i { fill: var(--star); stroke: var(--star); }
.stars svg.i { width: 13px; height: 13px; fill: var(--star); stroke: var(--star); vertical-align: -2px; }
.chip .x svg.i, .install .x svg.i, .link svg.i { width: 14px; height: 14px; margin: 0; }
ol.timeline .what svg.i { width: 15px; height: 15px; margin-right: 2px; color: var(--muted); }
ol.timeline .tick svg.i { width: 16px; height: 16px; margin: 0; }

/* Шапка: компактная, без вкладок — вкладки внизу */
header { padding-bottom: 8px; }
.brand span { display: none; }
@media (min-width: 560px) { .brand span { display: inline; } }

/* Нижнее меню (5 пунктов, зона нажатия ≥ 44px, безопасная зона снизу) */
nav#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--card); border-top: 1px solid var(--line);
  padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px));
}
nav#tabs:empty { display: none; }
nav#tabs .tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 52px; padding: 4px 2px; border: 0; border-radius: 10px; background: none;
  color: var(--muted); font-size: 11px; font-weight: 600;
}
nav#tabs .tab svg.i { width: 22px; height: 22px; margin: 0; }
nav#tabs .tab.active { color: var(--accent); background: var(--accent-soft); }
main { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
#toast { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
.seg.subtabs { margin-bottom: 12px; }

/* Мастер первого запуска */
body.wizard-mode header { display: none; }
.wizard-head { padding: 24px 2px 8px; }
.wizard-head h1 { font-family: var(--font-head); font-size: 28px; line-height: 1.15; margin: 6px 0; letter-spacing: -.3px; }
.wizard-head .steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.wizard-head .steps i { height: 4px; border-radius: 2px; background: var(--line); }
.wizard-head .steps i.on { background: var(--accent); }
.wizard-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: space-between; gap: 10px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--card); border-top: 1px solid var(--line);
}
.wizard-nav button { min-height: 48px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-weight: 600; }
.wizard-nav .primary-inline { flex: 1; max-width: 320px; margin-left: auto; border: 0; background: var(--accent); color: var(--on-accent); }
.wizard-body .card:first-child { margin-top: 4px; }
/* Минимал: акцентный фон у активного пункта меню — без заливки, только цвет и полоска */
:root[data-theme="mono"] nav#tabs .tab.active { background: none; box-shadow: inset 0 2px 0 var(--accent); border-radius: 0; }

/* Экран меню: компактная шапка */
.plan-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 2px 8px; }
.plan-head h2 { margin: 0; }
.plan-head p { margin: 2px 0 0; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--accent); flex: none; }
.icon-btn svg.i { margin: 0; width: 20px; height: 20px; }
details.pick, details.past { margin: 0 2px 10px; }
details.pick summary, details.past summary { color: var(--muted); font-size: 14px; padding: 8px 0; min-height: 44px; display: flex; align-items: center; gap: 4px; }
details.pick .seg { margin-top: 4px; }
.card.day.today { border-color: var(--accent); }
:root[data-theme="mono"] .card.day.today { border-bottom: 2px solid var(--accent); }
.badge svg.i { width: 13px; height: 13px; vertical-align: -2px; margin-right: 2px; }

/* Покупки: компактная сводка */
.shop-head h2 { margin: 0; }
.shop-head .sum { font-size: 22px; font-family: var(--font-head); }
.shop-head .actions { margin: 6px 0 8px; }
.shop-head .add { margin-top: 4px; flex-wrap: nowrap; }
.shop-head .add input { flex: 1; min-width: 0; }
