/* Визуальный язык Replify v2: токены --v2-*, Golos 800 для заголовков и чисел, моно-капс для подписей */
:root {
  --v2-bg: #EEEEF2; --v2-bg1: #FFFFFF; --v2-card: #FFFFFF; --v2-card2: #F4F4F7; --v2-card3: #E8E8EC;
  --v2-line: rgba(11,11,13,.08); --v2-line2: rgba(11,11,13,.14);
  --v2-fg: #0B0B0D; --v2-fg-dim: rgba(11,11,13,.72); --v2-fg-muted: rgba(11,11,13,.58); --v2-fg-faint: rgba(11,11,13,.58);
  --primary: 221.2 83.2% 53.3%; /* акцент как в Replify: default, cobalt, emerald, terracotta */
  --v2-primary: hsl(var(--primary)); --v2-primary-dim: hsl(var(--primary) / .12);
  --v2-ok: #1A8A4D; --v2-warn: #B86E0B; --v2-err: #C53030;
  --v2-amber: #D48410; --v2-amber-dim: rgba(212,132,16,.14);
  --v2-violet: #7B5FE0; --v2-gold: #A8770C;
  --v2-shadow-card: 0 1px 2px rgba(11,11,13,.06), 0 4px 12px rgba(11,11,13,.08);
  --v2-shadow-fab: 0 8px 24px hsl(var(--primary) / .32);
  --d: var(--v2-primary); --d-dim: var(--v2-primary-dim);
  --o: var(--v2-amber); --o-dim: var(--v2-amber-dim);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Golos Text', 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  color-scheme: light;
}
/* Темная тема: по системе, либо принудительно через data-theme на <html> */
:root[data-theme="dark"] {
  --v2-bg: #0B0B0D; --v2-bg1: #121215; --v2-card: #17171B; --v2-card2: #1E1E23; --v2-card3: #26262C;
  --v2-line: rgba(255,255,255,.08); --v2-line2: rgba(255,255,255,.14);
  --v2-fg: #F4F4F6; --v2-fg-dim: rgba(244,244,246,.72); --v2-fg-muted: rgba(244,244,246,.55); --v2-fg-faint: rgba(244,244,246,.5);
  --primary: 217.2 91.2% 59.8%;
  --v2-primary-dim: hsl(var(--primary) / .18);
  --v2-ok: #6FE39A; --v2-warn: #F5C35A; --v2-err: #FF6B6B;
  --v2-amber: #F5A623; --v2-amber-dim: rgba(245,166,35,.18);
  --v2-violet: #B59BFF; --v2-gold: #F4C84B;
  --v2-shadow-card: 0 6px 20px rgba(0,0,0,.35);
  --v2-shadow-fab: 0 8px 24px hsl(var(--primary) / .40);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --v2-bg: #0B0B0D; --v2-bg1: #121215; --v2-card: #17171B; --v2-card2: #1E1E23; --v2-card3: #26262C;
    --v2-line: rgba(255,255,255,.08); --v2-line2: rgba(255,255,255,.14);
    --v2-fg: #F4F4F6; --v2-fg-dim: rgba(244,244,246,.72); --v2-fg-muted: rgba(244,244,246,.55); --v2-fg-faint: rgba(244,244,246,.5);
    --primary: 217.2 91.2% 59.8%;
    --v2-primary-dim: hsl(var(--primary) / .18);
    --v2-ok: #6FE39A; --v2-warn: #F5C35A; --v2-err: #FF6B6B;
    --v2-amber: #F5A623; --v2-amber-dim: rgba(245,166,35,.18);
    --v2-violet: #B59BFF; --v2-gold: #F4C84B;
    --v2-shadow-card: 0 6px 20px rgba(0,0,0,.35);
    --v2-shadow-fab: 0 8px 24px hsl(var(--primary) / .40);
    color-scheme: dark;
  }
}
/* Акцент, как в Replify: темные варианты светлее, чтобы держать контраст на темных карточках */
:root[data-accent="cobalt"] { --primary: 231 64% 48%; }
:root[data-accent="emerald"] { --primary: 165 79% 27%; }
:root[data-accent="terracotta"] { --primary: 20 85% 41%; }
:root[data-theme="dark"][data-accent="cobalt"] { --primary: 231 82% 68%; }
:root[data-theme="dark"][data-accent="emerald"] { --primary: 160 55% 56%; }
:root[data-theme="dark"][data-accent="terracotta"] { --primary: 21 88% 62%; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"])[data-accent="cobalt"] { --primary: 231 82% 68%; }
  :root:not([data-theme="light"])[data-accent="emerald"] { --primary: 160 55% 56%; }
  :root:not([data-theme="light"])[data-accent="terracotta"] { --primary: 21 88% 62%; }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--v2-bg); color: var(--v2-fg); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.hidden { display: none !important; }
a { color: var(--v2-primary); }

/* типографика */
.display { font-family: var(--font-display); font-weight: 800; letter-spacing: -.02em; margin: 0; line-height: 1.05; }
.num { font-family: var(--font-display); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kicker { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .8px; color: var(--v2-fg-muted); margin: 0; font-weight: 500; }
.kicker.primary { color: var(--v2-primary); }
h2, h3 { margin: 0; }
.muted { color: var(--v2-fg-muted); }
.dim { color: var(--v2-fg-dim); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.err { color: var(--v2-err); }
.ok { color: var(--v2-ok); }
.warn { color: var(--v2-warn); }
.mono { font-family: var(--font-mono); font-size: 12px; }

/* каркас */
.app { max-width: 560px; margin: 0 auto; min-height: 100dvh; padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.hdr { position: sticky; top: 0; z-index: 20; background: var(--v2-bg); padding: calc(10px + env(safe-area-inset-top)) 16px 10px; }
.hdr-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.hdr-title { min-width: 0; }
.hdr-title .kicker { margin-bottom: 4px; }
.hdr h1 { font-size: 27px; }
.hdr-actions { display: flex; gap: 8px; flex-shrink: 0; }
.who-switch { display: inline-flex; gap: 2px; background: var(--v2-card2); border-radius: 999px; padding: 3px; }
.who-switch button { width: 38px; height: 38px; border-radius: 999px; border: 0; background: transparent; color: var(--v2-fg-muted); font-weight: 700; font-size: 15px; transition: background-color 150ms, color 150ms; }
.who-switch button.on { background: var(--pc, var(--v2-primary)); color: #fff; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 48px; height: 48px; flex-shrink: 0; color: var(--v2-fg); display: flex; }
.logo svg { width: 48px; height: 48px; fill: none; stroke: none; }
.logo .trk { stroke: currentColor; stroke-opacity: .14; stroke-width: 10; fill: none; }
.logo .arc { stroke: var(--v2-primary); stroke-width: 10; stroke-linecap: round; fill: none; }
.logo .glyph { fill: currentColor; stroke: none; font-family: 'Inter Tight', Inter, system-ui, sans-serif; font-weight: 600; font-size: 96px; letter-spacing: -3px; }
main { padding: 4px 16px 16px; }
.view { display: none; }
.view.on { display: block; animation: rise 180ms cubic-bezier(.2,.8,.2,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .view.on, .sheet, .rise { animation: none !important; } }

.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.sm { gap: 10px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* поверхности */
.card { background: var(--v2-card); border-radius: 16px; padding: 16px; box-shadow: var(--v2-shadow-card); }
.card.inset { background: var(--v2-card2); box-shadow: none; }
.hero { border-radius: 20px; padding: 16px; background: color-mix(in srgb, var(--v2-primary) 6%, var(--v2-card)); box-shadow: var(--v2-shadow-card); }
.note { background: var(--v2-card2); border-radius: 14px; padding: 12px 14px; font-size: 13px; color: var(--v2-fg-dim); }
.note b { color: var(--v2-fg); }
.divider { height: 1px; background: var(--v2-line); margin: 12px 0; }

/* кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 12px; border: 0; background: var(--v2-card2); color: var(--v2-fg); font-weight: 600; font-size: 14px; white-space: nowrap; transition: transform 120ms ease-out, background-color 150ms; }
.btn:active { transform: scale(.985); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.primary { background: var(--v2-primary); color: #fff; }
.btn.full { width: 100%; height: 48px; border-radius: 16px; font-size: 15px; }
.btn.ghost { background: transparent; color: var(--v2-fg-dim); }
.btn.danger { color: var(--v2-err); }
.btn.tint { background: var(--v2-primary-dim); color: var(--v2-primary); }
.btn:disabled { opacity: .45; }
.ib { width: 44px; height: 44px; border-radius: 999px; border: 0; background: var(--v2-card2); color: var(--v2-fg-dim); display: inline-flex; align-items: center; justify-content: center; transition: transform 120ms, color 150ms; }
.ib:active { transform: scale(.92); }
.ib svg { width: 18px; height: 18px; }
.ib.sm { width: 36px; height: 36px; }
.ib.xs { width: 30px; height: 30px; }
.ib.xs svg { width: 15px; height: 15px; }
.ib.plain { background: transparent; }

/* сегмент как в Replify */
.seg { display: inline-flex; background: var(--v2-card2); border: 1px solid var(--v2-line); border-radius: 999px; padding: 2px; }
.seg button { border: 0; background: transparent; height: 32px; padding: 0 16px; border-radius: 999px; font-size: 14px; color: var(--v2-fg-muted); font-weight: 500; }
.seg button.on { background: var(--v2-primary); color: #fff; font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.seg.xs button { height: 26px; padding: 0 10px; font-size: 12px; }

/* поля */
input, select, textarea { width: 100%; background: var(--v2-card2); border: 1px solid var(--v2-line); border-radius: 12px; padding: 10px 12px; outline: none; font-size: 15px; min-height: 42px; }
input:focus, select:focus, textarea:focus { border-color: var(--v2-primary); box-shadow: 0 0 0 3px var(--v2-primary-dim); }
textarea { min-height: 120px; resize: vertical; }
input[type=checkbox] { width: 20px; height: 20px; min-height: 0; accent-color: var(--v2-primary); }
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--v2-fg-muted); font-weight: 500; }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--v2-fg-muted); }
.search input { padding-left: 34px; height: 36px; min-height: 36px; border-radius: 999px; font-size: 14px; }

/* чипы */
.chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--v2-card2); color: var(--v2-fg-dim); font-size: 11px; font-weight: 600; white-space: nowrap; }
.chip.ok { background: color-mix(in srgb, var(--v2-ok) 14%, transparent); color: var(--v2-ok); }
.chip.warn { background: color-mix(in srgb, var(--v2-warn) 14%, transparent); color: var(--v2-warn); }
.chip.err { background: color-mix(in srgb, var(--v2-err) 14%, transparent); color: var(--v2-err); }
.chip.primary { background: var(--v2-primary-dim); color: var(--v2-primary); }
.who { display: inline-flex; width: 26px; height: 26px; border-radius: 999px; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.who { background: color-mix(in srgb, var(--pc, var(--v2-primary)) 15%, transparent); color: var(--pc, var(--v2-primary)); }

/* сегодня */
.daynav { display: flex; align-items: center; gap: 8px; }
.daylabel { flex: 1; height: 36px; border-radius: 999px; border: 0; background: transparent; font-weight: 600; font-size: 15px; display: flex; align-items: center; justify-content: center; color: var(--v2-fg); }
.daylabel.static { box-shadow: none; background: transparent; }
.rings { display: flex; gap: 14px; align-items: center; }
.ring { position: relative; flex-shrink: 0; }
.ringbox { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ring svg { width: auto; height: auto; transform: rotate(-90deg); display: block; }
.ring .c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ring .c .num { font-size: 20px; line-height: 1; }
.ring .c .kicker { font-size: 9px; margin-top: 3px; }
.hero-side { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.stat-line { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.stat-line .num { font-size: 17px; }
.bar { height: 6px; border-radius: 999px; background: var(--v2-line2); position: relative; overflow: hidden; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: var(--v2-primary); }
.bar i.plan { background: var(--v2-primary-dim); }
.hero-top { display: flex; align-items: center; gap: 18px; }
.hero-side { display: flex; flex-direction: column; gap: 6px; }
.macros3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 16px; }
.mc .v { margin: 4px 0 6px; font-size: 13px; }
.mc .v .num { font-size: 17px; }
.mc .bar { height: 5px; }
.mc.m-lo .bar i:not(.plan) { background: var(--v2-warn); }
.mc.m-lo .kicker { color: var(--v2-warn); }
.mc.m-hi .bar i:not(.plan), .mc.m-hi .bar i.plan { background: var(--v2-err); }
.mc.m-hi .kicker { color: var(--v2-err); }
.hero-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--v2-line); display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.hero .hint { margin: 0; font-size: 13px; line-height: 1.45; color: var(--v2-fg-dim); }
.hero .hint b { color: var(--v2-fg); }
#markPast { max-width: 100%; white-space: normal; height: auto; min-height: 34px; padding: 7px 12px; text-align: left; }
#shopping { margin-top: 2px; }
.hero .hint b { color: var(--v2-fg); }

.meal { background: var(--v2-card); border-radius: 16px; box-shadow: var(--v2-shadow-card); padding: 12px 12px 12px 14px; display: flex; gap: 10px; align-items: center; transition: transform 120ms ease-out, opacity 150ms; }
.meal:active { transform: scale(.992); }
.meal .body { flex: 1; min-width: 0; border: 0; background: none; padding: 0; text-align: left; }
.meal .top { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; min-height: 22px; }
.meal .items { font-weight: 600; font-size: 15px; line-height: 1.35; letter-spacing: -.005em; }
.meal .items .more { color: var(--v2-fg-muted); font-weight: 500; }
.meal .items.empty { color: var(--v2-fg-muted); font-weight: 500; }
.meal .nut { font-size: 13px; color: var(--v2-fg-muted); margin-top: 3px; }
.meal .nut .num { font-size: 13px; color: var(--v2-fg-dim); }
.meal.done { background: color-mix(in srgb, var(--v2-ok) 5%, var(--v2-card)); }
.meal.skip .items { text-decoration: line-through; color: var(--v2-fg-muted); }
.check { width: 40px; height: 40px; border-radius: 999px; border: 2px solid var(--v2-line2); background: transparent; color: transparent; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 150ms; }
.check svg { width: 20px; height: 20px; stroke-width: 3; }
.check.on { background: var(--v2-ok); border-color: var(--v2-ok); color: #fff; }
.check:disabled { opacity: .35; }
.addmeal { border: 1.5px dashed var(--v2-line2); background: transparent; border-radius: 16px; height: 48px; color: var(--v2-fg-muted); font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 6px; }

/* меню */
.weekstrip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.weekstrip button { border: 0; background: var(--v2-card); box-shadow: var(--v2-shadow-card); border-radius: 14px; padding: 8px 0 7px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--v2-fg-muted); font-family: var(--font-mono); text-transform: uppercase; }
.weekstrip button b { font-family: var(--font-display); font-weight: 800; font-size: 18px; color: var(--v2-fg); }
.weekstrip button.today b { color: var(--v2-primary); }
.weekstrip button.on { background: var(--v2-primary); color: rgba(255,255,255,.8); }
.weekstrip button.on b { color: #fff; }
.plan-slot { padding: 10px 0; border-top: 1px solid var(--v2-line); }
.plan-slot:first-of-type { border-top: 0; }
.plan-cell { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 6px 0; text-align: left; }
.plan-cell .t { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; line-height: 1.3; }
.plan-cell .t.empty { color: var(--v2-fg-muted); font-weight: 500; }
.plan-cell .k { font-size: 12px; color: var(--v2-fg-muted); white-space: nowrap; }
.list-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 0; border-top: 1px solid var(--v2-line); }
.cat + .list-item { border-top: 0; }
.list-item:first-child { border-top: 0; }
.list-item .t { font-weight: 600; }
.list-item .s { font-size: 12px; color: var(--v2-fg-muted); margin-top: 2px; }
button.list-item { width: 100%; border-left: 0; border-right: 0; border-bottom: 0; background: none; text-align: left; }

/* склад */
.cat { margin: 18px 0 4px; }
.cat:first-child { margin-top: 0; }
.inv { display: flex; align-items: center; gap: 12px; padding: 11px 0; border: 0; border-top: 1px solid var(--v2-line); width: 100%; background: none; text-align: left; }
.cat + .inv { border-top: 0; }
.amt { font-family: var(--font-display); font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.amt small { font-family: var(--font); font-weight: 500; font-size: 12px; color: var(--v2-fg-muted); }
.inv .nm { font-weight: 600; font-size: 15px; }
.inv .meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--v2-fg-muted); margin-top: 3px; }
.qty { display: flex; align-items: center; gap: 4px; }
.qty b { min-width: 58px; text-align: center; font-family: var(--font-display); font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; }

/* итоги */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.tile { background: var(--v2-card2); border-radius: 14px; padding: 12px; }
.tile .num { font-size: 26px; line-height: 1.1; margin-top: 6px; }
.tile .num small { font-size: 14px; color: var(--v2-fg-muted); }
.tile .s { font-size: 12px; color: var(--v2-fg-muted); margin-top: 2px; }
svg.chart { width: 100%; height: auto; display: block; margin-top: 12px; overflow: visible; stroke-width: 1; }
svg.chart text { fill: var(--v2-fg-muted); stroke: none; font: 10px var(--font-mono); }
svg.chart .grid { stroke: var(--v2-line2); }
svg.chart .ax { stroke: var(--v2-line2); }

/* лист снизу */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.45); display: none; align-items: flex-end; justify-content: center; }
.modal.on { display: flex; }
.sheet { background: var(--v2-bg1); width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; border-radius: 20px 20px 0 0; padding: 8px 16px calc(20px + env(safe-area-inset-bottom)); animation: up 220ms cubic-bezier(.2,.8,.2,1) both; overscroll-behavior: contain; }
.sheet::before { content: ''; display: block; width: 36px; height: 4px; border-radius: 999px; background: var(--v2-line2); margin: 0 auto 10px; }
@keyframes up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.sheet .head h2 { font-family: var(--font-display); font-weight: 800; letter-spacing: -.02em; font-size: 22px; line-height: 1.15; }
.sheet .head .kicker { margin-bottom: 4px; }
.sheet .foot { position: sticky; bottom: calc(-20px - env(safe-area-inset-bottom)); background: var(--v2-bg1); padding: 12px 0 calc(8px + env(safe-area-inset-bottom)); margin-top: 14px; border-top: 1px solid var(--v2-line); display: flex; flex-direction: column; gap: 8px; }

/* редактор приема */
.it { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--v2-line); }
.it:first-child { border-top: 0; }
.it .nm { font-weight: 600; font-size: 14px; line-height: 1.3; }
.it .sub { font-size: 12px; color: var(--v2-fg-muted); margin-top: 2px; }
.stepper { display: flex; align-items: center; background: var(--v2-card2); border-radius: 999px; height: 32px; flex-shrink: 0; }
.stepper button { width: 30px; height: 32px; border: 0; background: none; color: var(--v2-fg-dim); display: flex; align-items: center; justify-content: center; }
.stepper button svg { width: 15px; height: 15px; }
.stepper.big { height: 40px; }
.stepper.big button { width: 40px; height: 40px; }
.stepper.big input { width: 64px; height: 40px; font-size: 17px; }
.stepper input { width: 48px; min-height: 0; height: 32px; padding: 0; border: 0; background: none; text-align: center; font-family: var(--font-display); font-weight: 800; font-size: 14px; box-shadow: none; }
.stepper .u { font-size: 11px; color: var(--v2-fg-muted); padding-right: 4px; margin-left: -4px; }
.cin { width: 64px; min-height: 0; height: 32px; padding: 0 8px; font-size: 13px; text-align: right; border-radius: 10px; }
.total { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 12px; background: var(--v2-primary-dim); border-radius: 12px; margin-top: 8px; }
.total .num { font-size: 18px; color: var(--v2-primary); }
.filters { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 10px 0 4px; }
.filters::-webkit-scrollbar { display: none; }
.filters button { border: 1px solid var(--v2-line2); background: transparent; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 13px; color: var(--v2-fg-dim); white-space: nowrap; font-weight: 500; }
.filters button.on { background: var(--v2-fg); border-color: var(--v2-fg); color: var(--v2-bg1); }
.res { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--v2-line); width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; }
.res .nm { font-weight: 600; font-size: 14px; }
.res .sub { font-size: 12px; color: var(--v2-fg-muted); }
.res .add { width: 32px; height: 32px; border-radius: 999px; background: var(--v2-primary-dim); color: var(--v2-primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.res .add svg { width: 16px; height: 16px; stroke-width: 2.4; }
.res.picked .add { background: var(--v2-ok); color: #fff; }
.results { max-height: 320px; overflow-y: auto; }

/* рецепт */
.kbju { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kbju > div { background: var(--v2-card2); border-radius: 14px; padding: 12px; }
.kbju .num { font-size: 22px; margin: 4px 0 2px; }
table.ing { width: 100%; border-collapse: collapse; font-size: 14px; }
table.ing th { text-align: left; font: 500 10px var(--font-mono); text-transform: uppercase; letter-spacing: .8px; color: var(--v2-fg-muted); padding: 0 0 6px; }
table.ing td { padding: 8px 0; border-top: 1px solid var(--v2-line); vertical-align: top; }
table.ing .n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; padding-left: 8px; }
.steps { white-space: pre-wrap; font-size: 14px; color: var(--v2-fg-dim); background: var(--v2-card2); border-radius: 14px; padding: 12px 14px; }
.tablewrap { overflow-x: auto; }
table.review { width: 100%; border-collapse: collapse; font-size: 13px; }
table.review th { text-align: left; font: 500 10px var(--font-mono); text-transform: uppercase; letter-spacing: .8px; color: var(--v2-fg-muted); padding: 0 4px 6px; }
table.review td { padding: 6px 4px; border-top: 1px solid var(--v2-line); vertical-align: middle; }
table.review td.q input { width: 76px; }
table.review select, table.review input { min-height: 36px; padding: 6px 8px; font-size: 13px; }

/* журнал */
.jr { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--v2-line); }
.jr:first-child { border-top: 0; }
.jr .t { font-size: 14px; font-weight: 600; line-height: 1.3; }
.jr.undone .t { text-decoration: line-through; color: var(--v2-fg-muted); }

/* нижняя навигация как в Replify: иконки, активная в подложке акцента */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-around; align-items: center; background: var(--v2-bg1); border-top: 1px solid var(--v2-line); padding: 8px 8px max(10px, env(safe-area-inset-bottom)); }
.tabs button { border: 0; background: transparent; color: var(--v2-fg-muted); min-width: 64px; min-height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; transition: color 150ms, background-color 150ms, transform 150ms; }
.tabs button:active { transform: scale(.9); }
.tabs button span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.tabs button.on { color: var(--v2-primary); background: var(--v2-primary-dim); }

/* тост с отменой */
.toast { position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); z-index: 60; background: var(--v2-fg); color: var(--v2-bg1); border-radius: 14px; padding: 10px 10px 10px 16px; font-size: 14px; display: flex; align-items: center; gap: 12px; max-width: calc(100% - 32px); width: max-content; opacity: 0; pointer-events: none; transition: opacity 180ms, transform 180ms; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { border: 0; background: color-mix(in srgb, var(--v2-bg1) 18%, transparent); color: var(--v2-bg1); font-weight: 700; height: 32px; padding: 0 12px; border-radius: 10px; white-space: nowrap; }
.toast #toastMsg { flex: 1; }

/* вход */
.login { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login .card { width: 100%; max-width: 360px; }
.login .card.onboard { max-width: 460px; }
.login .btn.full { display: flex; justify-content: center; }
.modal.on ~ .toast { bottom: auto; top: calc(12px + env(safe-area-inset-top)); transform: translate(-50%, -20px); }
.modal.on ~ .toast.on { transform: translate(-50%, 0); }

/* выбор акцента */
.swatches { display: flex; gap: 12px; }
.swatches button { width: 36px; height: 36px; border-radius: 999px; border: 0; display: flex; align-items: center; justify-content: center; color: #fff; transition: transform 120ms; }
.swatches button:active { transform: scale(.95); }
.swatches button svg { width: 16px; height: 16px; stroke-width: 2.6; }
.swatches button.on { box-shadow: 0 0 0 2px var(--v2-card2), 0 0 0 4px var(--sw); }


/* нижняя навигация на широком экране: по центру, как в Replify */
@media (min-width: 600px) { .tabs { justify-content: center; gap: 8px; } .tabs button { min-width: 88px; } }

/* склад */
.seg.full { display: flex; width: 100%; }
.seg.full button { flex: 1; }
.cta { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; border-radius: 16px; padding: 14px; background: color-mix(in srgb, var(--v2-primary) 8%, var(--v2-card)); box-shadow: var(--v2-shadow-card); color: var(--v2-fg); }
.cta b { display: block; font-weight: 700; font-size: 15px; }
.cta > svg { color: var(--v2-fg-muted); }
.cta-ic { width: 40px; height: 40px; border-radius: 12px; background: var(--v2-primary); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stock-sum { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--v2-fg-dim); padding: 0 4px; }
.stock-sum .num { font-size: 14px; color: var(--v2-fg); }
.stock-sum .warn .num { color: var(--v2-warn); }
.linkish { border: 0; background: none; padding: 0; color: var(--v2-err); font-size: 13px; }
.linkish .num { color: var(--v2-err); }
.amt.ok { color: var(--v2-ok); }
.kicker.warn { color: var(--v2-warn); }
.idea details summary { cursor: pointer; }

/* итоги: плитки-переключатели, график без обводки, разбор рациона */
svg.chart rect { stroke: none; }
.tiles.t4 { grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 460px) { .tiles.t4 { grid-template-columns: repeat(2, 1fr); } }
button.tile { border: 0; text-align: left; color: inherit; box-shadow: inset 0 0 0 1.5px transparent; transition: box-shadow 150ms; }
button.tile.sel { box-shadow: inset 0 0 0 1.5px var(--v2-primary); background: var(--v2-primary-dim); }
.tile .num.ok { color: var(--v2-ok); } .tile .num.warn { color: var(--v2-warn); } .tile .num.err { color: var(--v2-err); }
.facts { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--v2-line); font-size: 13px; color: var(--v2-fg-dim); }
.facts b { color: var(--v2-fg); font-family: var(--font-display); font-weight: 800; }
.stackrow { display: grid; grid-template-columns: 44px 1fr 104px; gap: 10px; align-items: center; margin-bottom: 8px; }
.stackrow .mono { text-align: right; }
.stack-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--v2-line2); }
.stack-bar i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; margin-top: 4px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 999px; margin-right: 6px; vertical-align: 0; }
.hbar { display: grid; grid-template-columns: 110px 1fr 86px; gap: 10px; align-items: center; padding: 6px 0; }
.hbar .mono { text-align: right; }
