/* Токены — из DESIGN_SPEC.md (цвета, шрифт, радиусы, оттенки мест хранения).
   Структура экранов — наша (см. docs/product-analysis.md), спека диктует только визуальное. */
:root {
  --bg: #EEF0EE;
  --surface: #FFFFFF;
  --text: #1E2624;
  --text-2: #3F4A48;
  --text-3: #45504D;
  --accent: #2F5D62;
  --accent-hover: #1F4246;
  --on-accent: #FFFFFF;
  --warn-text: #7E4814;
  --tint-fridge: #E0EAEC;
  --tint-freezer: #E5E2EE;
  --tint-freezer-text: #423E50;
  --tint-pantry: #EDE6DA;
  --tint-pantry-text: #4D4436;
  --bar-track: rgba(30,38,36,0.12);
  --divider: #E0E3E1;
  --r-tile: 16px;
  --r-card: 20px;
  --r-filter: 14px;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { overscroll-behavior-y: none; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.4 var(--font); -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

#app { max-width: 520px; margin: 0 auto; padding: 0 16px calc(104px + env(safe-area-inset-bottom)); }
h1 { font-size: 30px; line-height: 38px; letter-spacing: -0.3px; font-weight: 700; margin: 0; }
h2 { font-size: 20px; line-height: 26px; font-weight: 700; margin: 0; }
p { margin: 0 0 12px; }
.muted { color: var(--text-3); font-size: 16px; line-height: 22px; }

/* шапка */
.header { padding: calc(14px + env(safe-area-inset-top)) 4px 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.header .who { color: var(--text-3); font-size: 16px; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.header .who b { color: var(--accent); }

/* фильтр домов (2 колонки, без горизонтальной прокрутки) */
.places { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.place { height: 56px; border-radius: var(--r-filter); background: var(--surface); font-size: 17px; font-weight: 600; padding: 0 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.2; }
.place small { font-size: 16px; font-weight: 400; color: var(--text-3); }
.place[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.place[aria-pressed="true"] small { color: var(--on-accent); opacity: .9; }

/* нижнее меню: фиксировано, 72px + safe area, подписи у всех пунктов, «добавить» приподнята */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; height: calc(72px + env(safe-area-inset-bottom)); padding: 0 8px env(safe-area-inset-bottom); background: rgba(255,255,255,.97); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-top: 1px solid var(--divider); display: grid; grid-template-columns: repeat(5, 1fr); max-width: 520px; margin: 0 auto; }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 72px; color: var(--text-2); font-size: 14px; font-weight: 600; line-height: 1.1; text-align: center; }
.tab svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.tab[aria-current="page"] { color: var(--accent); font-weight: 700; }
.tab--add { color: var(--accent); font-weight: 700; justify-content: flex-start; padding-top: 0; }
.tab-add-btn { width: 56px; height: 56px; border-radius: 999px; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; margin-top: -30px; box-shadow: 0 0 0 4px var(--bg); }
.tab-add-btn svg { stroke: var(--on-accent); stroke-width: 2.4; }
.tab--add:active .tab-add-btn { background: var(--accent-hover); }

/* полки */
.shelf { margin-top: 16px; }
.shelf .shelf-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 8px; min-height: 44px; }
.shelf .shelf-head .muted { font-weight: 600; }
.rows { display: flex; flex-direction: column; gap: 10px; }
.tile { border-radius: var(--r-tile); padding: 14px 16px; display: flex; align-items: center; gap: 12px; min-height: 72px; background: var(--surface); text-align: left; width: 100%; }
.shelf--fridge .tile { background: var(--tint-fridge); }
.shelf--freezer .tile { background: var(--tint-freezer); }
.shelf--freezer .tile .muted { color: var(--tint-freezer-text); }
.shelf--pantry .tile { background: var(--tint-pantry); }
.shelf--pantry .tile .muted { color: var(--tint-pantry-text); }
.tile .name { flex: 1; min-width: 0; text-align: left; }
.tile .name b { display: block; font-size: 18px; line-height: 24px; font-weight: 700; }
.tile .name .muted { display: block; }
.tile .warn { color: var(--warn-text); font-weight: 700; }
.bar { height: 8px; border-radius: 999px; background: var(--bar-track); margin-top: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.chev { color: var(--text-3); font-size: 26px; padding: 0 2px; }

/* степпер факта */
.stepper { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.stepper button { width: 48px; height: 48px; border-radius: 999px; background: var(--surface); font-size: 26px; font-weight: 700; color: var(--accent); }
.stepper button:active { background: var(--accent); color: var(--on-accent); }
.stepper .qty { min-width: 52px; text-align: center; font-size: 20px; font-weight: 700; line-height: 1.1; }
.stepper .qty small { display: block; font-size: 16px; font-weight: 400; color: var(--text-3); }

/* кнопки */
.btn { min-height: 48px; padding: 10px 18px; border-radius: 999px; background: var(--surface); font-size: 17px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:active { background: var(--accent-hover); }
.btn.outline { box-shadow: inset 0 0 0 2px var(--accent); color: var(--accent); min-height: 52px; }
.btn.warn { color: var(--warn-text); box-shadow: inset 0 0 0 2px var(--warn-text); }
.btn.big { width: 100%; min-height: 56px; font-size: 18px; }
.btn.link { background: none; color: var(--accent); min-height: 44px; padding: 8px 4px; }
.actions { display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }
.actions .btn { padding: 8px 14px; font-size: 16px; min-height: 44px; white-space: nowrap; }

/* карточки, пустые состояния, welcome */
.card { background: var(--surface); border-radius: var(--r-card); padding: 20px 18px; margin-top: 16px; }
.card h2 { margin-bottom: 10px; }
.empty { padding: 28px 16px; text-align: center; color: var(--text-3); font-size: 17px; }
.screen { padding: calc(32px + env(safe-area-inset-top)) 0 24px; }
.screen h1 { margin-bottom: 10px; }
.screen ul { padding-left: 22px; margin: 0 0 16px; }
.screen li { margin-bottom: 8px; }
.dots { display: flex; gap: 8px; margin: 0 0 18px; }
.dots i { width: 10px; height: 10px; border-radius: 999px; background: var(--bar-track); }
.dots i.on { background: var(--accent); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 16px; color: var(--text-3); font-weight: 600; }
.field input, .field select { min-height: 52px; padding: 10px 14px; font-size: 18px; border-radius: var(--r-filter); border: 2px solid var(--divider); background: var(--surface); width: 100%; }
.field input:focus, .field select:focus { border-color: var(--accent); outline: none; }
.inline { display: flex; gap: 8px; }
.inline .field { flex: 1; }
.check { display: flex; align-items: center; gap: 10px; font-size: 17px; margin: 4px 0 14px; min-height: 44px; }
.check input { width: 24px; height: 24px; accent-color: var(--accent); }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.choices button { min-height: 56px; border-radius: var(--r-filter); background: var(--surface); font-size: 20px; font-weight: 700; }
.buttons { display: flex; gap: 8px; margin-top: 8px; }
.buttons .btn { flex: 1; }
.err { color: var(--warn-text); font-weight: 600; margin-top: 8px; min-height: 1.4em; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.chips span, .chips .chip { background: var(--surface); border-radius: 999px; padding: 8px 14px; font-size: 16px; min-height: 44px; display: inline-flex; align-items: center; }
.card .chips .chip { background: var(--bg); font-weight: 600; }
.cab { margin-top: 6px; }
.cab + .cab { border-top: 1px solid var(--divider); padding-top: 14px; margin-top: 14px; }
.btn.link.danger { color: var(--warn-text); }
.header .who { background: none; border: 0; }

/* нижняя панель */
.sheet-bg { position: fixed; inset: 0; background: rgba(30,38,36,.45); z-index: 20; display: flex; align-items: flex-end; }
.sheet { background: var(--surface); width: 100%; max-width: 520px; margin: 0 auto; border-radius: var(--r-card) var(--r-card) 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); max-height: 92vh; overflow: auto; }
.sheet h2 { margin-bottom: 14px; }
.sheet .danger { color: var(--warn-text); }

.toast { position: fixed; top: calc(12px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 12px 18px; border-radius: 999px; font-size: 16px; font-weight: 600; z-index: 30; max-width: calc(100% - 32px); }
.offline { background: var(--surface); color: var(--warn-text); font-weight: 600; padding: 10px 12px; border-radius: var(--r-filter); margin-top: 10px; font-size: 16px; text-align: center; }
