:root {
  --bg: #0d1110;
  --surface: #161c1a;
  --surface-2: #1e2623;
  --surface-3: #27312d;
  --line: #2a3430;
  --text: #eef3ef;
  --muted: #8fa097;
  --accent: #b8f25a;
  --accent-ink: #14200a;
  --accent-soft: rgba(184, 242, 90, 0.14);
  --warn: #ffb454;
  --danger: #ff6b6b;
  --ok: #5ee0a0;
  --protein: #7cc8ff;
  --fat: #ffb454;
  --carbs: #c49bff;
  --radius: 18px;
  --tabs-h: 60px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
a { color: inherit; text-decoration: none; }

h1 { font-size: 30px; line-height: 1.15; margin: 4px 0 14px; letter-spacing: -0.025em; font-weight: 800; }
h2 { font-size: 13px; margin: 26px 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }
h3 { font-size: 17px; margin: 0; letter-spacing: -0.01em; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.cap::first-letter { text-transform: uppercase; }
.center { text-align: center; }
.num { font-variant-numeric: tabular-nums; }
.error { color: var(--danger); min-height: 1.4em; margin: 6px 0; font-size: 14px; }
.warn-text { color: var(--warn); }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

main {
  max-width: 600px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 14px) 16px calc(var(--tabs-h) + env(safe-area-inset-bottom) + 28px);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.card.link { display: flex; align-items: center; gap: 14px; }
.card.link:active, .program-card:active, .ex-row:active, .menu-row:active { transform: scale(0.99); }

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

/* ---------- Поля и кнопки ---------- */
input, textarea, select {
  width: 100%;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font: inherit;
  font-size: 16px;
}
textarea { resize: vertical; min-height: 72px; }
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
.form > label:first-child, .field:first-child { margin-top: 0; }
.field { display: block; margin: 0 0 10px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }

.btn {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 14px;
  padding: 11px 18px;
  font: inherit; font-weight: 650;
  cursor: pointer;
  min-height: 46px;
  text-align: center;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 36px; padding: 6px 13px; font-size: 14px; border-radius: 11px; }
.btn.block { display: flex; width: 100%; }
.btn.big-btn { min-height: 56px; font-size: 17px; border-radius: 16px; }
.btn:disabled { opacity: 0.45; }
.icon-btn { background: none; border: 0; color: var(--muted); font-size: 22px; line-height: 1; padding: 8px 10px; cursor: pointer; border-radius: 10px; min-width: 40px; min-height: 40px; }
.icon-btn:disabled { opacity: 0.25; }
.icon-btn.plus { color: var(--accent-ink); background: var(--accent); width: 36px; height: 36px; min-width: 36px; min-height: 36px; border-radius: 50%; padding: 0; font-size: 22px; font-weight: 700; }
.chev { color: var(--muted); font-size: 22px; }
.back { display: inline-block; color: var(--muted); padding: 4px 0; margin-bottom: 4px; font-size: 15px; }

.segmented { display: flex; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 3px; margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.segmented button { flex: 1; min-width: max-content; background: none; border: 0; color: var(--muted); font: inherit; font-size: 14px; font-weight: 600; padding: 9px 10px; border-radius: 9px; cursor: pointer; }
.segmented button.on { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); }
.segmented.small button { padding: 7px 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.chips.col { flex-direction: column; align-items: stretch; }
.chip { background: var(--surface-2); border: 1px solid var(--line); color: var(--text); border-radius: 99px; padding: 8px 14px; font: inherit; font-size: 14px; cursor: pointer; text-align: left; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.filters .chips { flex-wrap: nowrap; overflow-x: auto; margin-right: -16px; padding-right: 16px; scrollbar-width: none; }
.filters .chips::-webkit-scrollbar, .segmented::-webkit-scrollbar { display: none; }
.chip { flex: none; }

.tag { display: inline-flex; align-items: center; font-size: 12px; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); margin-left: 6px; vertical-align: middle; white-space: nowrap; font-weight: 600; }
.tags .tag:first-child, .row > .tag:first-child, .hero-card .tag:first-child { margin-left: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tags .tag { margin: 0; }
.tag.warn { color: var(--warn); border-color: rgba(255, 180, 84, 0.5); }
.tag.ok { color: var(--ok); border-color: rgba(94, 224, 160, 0.45); }
.tag.accent { color: var(--accent); border-color: rgba(184, 242, 90, 0.5); background: var(--accent-soft); }

.stepper { display: flex; align-items: stretch; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.stepper input { border: 0; border-radius: 0; text-align: center; font-size: 22px; font-weight: 700; background: transparent; padding: 8px 4px; min-width: 0; }
.stepper button { background: var(--surface-3); border: 0; color: var(--text); font-size: 24px; width: 52px; flex: none; cursor: pointer; }
.stepper button:active { background: var(--line); }

.warning { border-left: 3px solid var(--warn); padding: 10px 12px; background: rgba(255, 180, 84, 0.08); border-radius: 0 12px 12px 0; font-size: 14px; margin: 10px 0; }
.warning p:last-child { margin-bottom: 0; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty .btn { margin-top: 8px; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 14px); transform: translate(-50%, 20px); opacity: 0;
  background: var(--surface-3); color: var(--text); border: 1px solid var(--line); padding: 11px 16px; border-radius: 14px; z-index: 60;
  transition: 0.25s; max-width: calc(100% - 32px); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); font-size: 15px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: var(--danger); }

/* ---------- Шторка ---------- */
.sheet-wrap { position: fixed; inset: 0; background: rgba(0, 0, 0, 0); z-index: 50; display: flex; align-items: flex-end; justify-content: center; transition: background 0.25s; }
.sheet-wrap.open { background: rgba(0, 0, 0, 0.55); }
.sheet { width: 100%; max-width: 600px; max-height: 92dvh; display: flex; flex-direction: column; background: var(--surface); border-radius: 22px 22px 0 0;
  border: 1px solid var(--line); border-bottom: 0; transform: translateY(100%); transition: transform 0.28s cubic-bezier(.2, .8, .2, 1); }
.sheet-wrap.open .sheet { transform: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 6px 18px; }
.sheet-title { margin: 0; font-size: 19px; color: var(--text); text-transform: none; letter-spacing: -0.01em; }
.sheet-body { overflow-y: auto; padding: 4px 16px calc(env(safe-area-inset-bottom) + 20px); -webkit-overflow-scrolling: touch; }
.sheet-body > div > textarea, .sheet-body > div > div > textarea { margin-bottom: 10px; }
.menu .btn { margin-bottom: 10px; }

/* ---------- Вход ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.login .card { width: 100%; max-width: 340px; }
.login .btn { width: 100%; }

/* ---------- Нижние вкладки ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center;
  background: rgba(13, 17, 16, 0.92);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a { flex: 1; max-width: 120px; height: var(--tabs-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); font-size: 11px; font-weight: 600; }
.tabs .ti { font-size: 20px; line-height: 1; }
.tabs a.active { color: var(--accent); }
body[data-route="session"] .tabs { display: none; }
body[data-route="session"] main { padding-bottom: calc(env(safe-area-inset-bottom) + 28px); }

/* ---------- Анимации упражнений ---------- */
.anim { display: block; width: 100%; height: 100%; }
.a-ground { stroke: var(--line); stroke-width: 1.5; stroke-linecap: round; }
.a-torso { stroke: var(--text); stroke-width: 9.5; stroke-linecap: round; }
.a-limb { fill: none; stroke: var(--text); stroke-width: 6.5; stroke-linecap: round; stroke-linejoin: round; }
.a-limb.far { stroke: #6f8279; }
.a-head { fill: var(--text); }
.a-prop { fill: var(--surface-3); stroke: #3a4742; stroke-width: 1; }
.a-prop.soft { fill: #1d2522; stroke: none; }
.a-line { stroke: #4a5953; stroke-linecap: round; }
.a-line.soft { stroke: #34403b; }
.a-wheel { fill: none; stroke: #4a5953; stroke-width: 3; }
.a-cable { stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 2 2; }
.a-pad { fill: #4a5953; }
.a-weight { fill: var(--accent); stroke: var(--accent-ink); stroke-width: 1.4; }
.a-weight.far { fill: #7fa63f; }
.a-handle { fill: none; stroke: var(--accent); stroke-width: 1.8; }
.a-plate { fill: var(--accent); stroke: var(--accent-ink); stroke-width: 1.6; }
.a-plate-c { fill: var(--accent-ink); }
.a-band { stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; }
.a-rope { fill: none; stroke: var(--accent); stroke-width: 1.6; }

.thumb { width: 72px; height: 54px; flex: none; border-radius: 10px; background: var(--surface-2); overflow: hidden; }
.thumb.sm { width: 56px; height: 42px; }
.thumbs { display: flex; gap: 6px; margin: 12px 0 8px; overflow: hidden; }
.stage { aspect-ratio: 4 / 3; background: radial-gradient(ellipse at 50% 40%, #1f2925, var(--surface) 70%); border: 1px solid var(--line); border-radius: var(--radius); margin: 8px 0 12px; overflow: hidden; }
.stage.big { aspect-ratio: 4 / 3; margin-top: 4px; }

/* ---------- Списки ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .grams { width: 84px; flex: none; padding: 8px; text-align: right; }
.link-row { display: flex; flex-direction: column; }
.list-title { font-size: 13px; color: var(--muted); margin: 16px 0 8px; font-weight: 600; }

.ex-list { display: flex; flex-direction: column; gap: 8px; }
.ex-row { display: flex; align-items: center; gap: 12px; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px 8px 8px; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.ex-row b { display: block; font-weight: 650; }
.ex-row .grow > span { display: block; }
.ex-row.excluded { opacity: 0.6; border-style: dashed; }
.ex-row.done { opacity: 0.65; }
.ex-list.compact { margin-top: 10px; }
.ex-list.compact .ex-row { background: var(--surface-2); border-color: transparent; }
.filters { position: sticky; top: 0; z-index: 3; background: var(--bg); padding: 6px 0 2px; margin-bottom: 6px; }
.sheet .filters { background: var(--surface); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; margin-top: 10px; }

/* ---------- Сегодня ---------- */
.hero-card { display: block; background: linear-gradient(160deg, #1f2b1a 0%, var(--surface) 60%); border: 1px solid #344229; border-radius: 22px; padding: 18px; margin-bottom: 14px; }
.hero-card h2 { color: var(--text); font-size: 26px; text-transform: none; letter-spacing: -0.02em; margin: 10px 0 0; font-weight: 800; }
.hero-card.live { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.stats-grid:has(> :nth-child(4)) { grid-template-columns: repeat(2, 1fr); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px; color: inherit; font: inherit; text-align: left; cursor: default; }
button.stat { cursor: pointer; }
.stat b { display: block; font-size: 24px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat span { display: block; font-size: 12px; color: var(--muted); line-height: 1.25; margin-top: 2px; }
.coach-card .ico, .action .ico, .menu-row .ico { width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 18px; }
.banner { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--accent); color: var(--accent-ink); border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; }

/* ---------- Тренировки ---------- */
.program-card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 10px; }
.program-card h3 { font-size: 20px; margin: 10px 0 6px; }
.program-card.active { background: linear-gradient(160deg, #1f2b1a 0%, var(--surface) 70%); border-color: #3a4a2d; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 4px; }
.action { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.action .ico { margin-bottom: 6px; }
.action span:last-child { font-size: 12px; color: var(--muted); }
.card.day.next { border-color: #3a4a2d; }
.card.day h3 { display: inline; margin-right: 6px; }
.day-name { font-weight: 700; font-size: 17px; }
.edit-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.edit-row .col .icon-btn { min-height: 30px; padding: 4px 8px; font-size: 18px; }
.mini-fields { display: grid; grid-template-columns: 1fr 1.3fr 1.2fr; gap: 6px; margin-top: 6px; }
.mini-fields label { margin: 0; font-size: 11px; }
.mini-fields input { padding: 7px 8px; margin-top: 3px; font-size: 15px; }
.sticky-actions { position: sticky; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 8px); margin-top: 16px; }
.progress-line { height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; margin: 10px 0 4px; }
.progress-line > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.3s; }

/* ---------- Экран тренировки ---------- */
.session-head { display: flex; align-items: center; gap: 8px; }
.session-head h1 { font-size: 24px; }
.ex-nav { display: flex; align-items: center; gap: 4px; margin-top: 10px; }
.ex-title { color: var(--text); font-size: 21px; text-transform: none; letter-spacing: -0.01em; margin: 2px 0 0; }
.dots { display: flex; gap: 5px; }
.dots span { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-3); border: 1px solid var(--line); }
.dots span.on { background: var(--accent); border-color: var(--accent); }
.set-input { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.set-input .field { margin: 0; }
.set-input .rpe { grid-column: 1 / -1; }
.set-input:not(:has(.field:nth-child(3))) .field:first-child:last-child { grid-column: 1 / -1; }
.rpe-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.rpe-row button { background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); border-radius: 10px; padding: 9px 0; font: inherit; font-weight: 700; cursor: pointer; }
.rpe-row button.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.ok-note { color: var(--ok); font-weight: 600; }
.sets { margin: 4px 0 8px; padding: 0 4px; list-style: none; }
.sets li { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; color: var(--muted); }
.sets li b { color: var(--text); }
details.tech summary { cursor: pointer; font-weight: 600; }
details.tech p { margin: 10px 0 0; color: var(--muted); }
.rest-big { text-align: center; }
.ring-box { position: relative; width: 180px; height: 180px; margin: 4px auto 10px; }
.ring-box svg { width: 100%; height: 100%; }
.ring-center { position: absolute; inset: 0; display: grid; place-content: center; }
.rest-big .time { font-size: 44px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.rest-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  padding: calc(env(safe-area-inset-top) + 8px) 16px 10px;
  background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; gap: 10px;
}
.rest-bar .time { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 80px; }
.rest-bar .btn { background: rgba(0, 0, 0, 0.14); border-color: transparent; color: var(--accent-ink); }
.rest-bar.done { background: var(--warn); }
body.resting main { padding-top: calc(env(safe-area-inset-top) + 74px); }
body.resting[data-route="session"] .rest-bar { display: none; }
body.resting[data-route="session"] main { padding-top: calc(env(safe-area-inset-top) + 14px); }
.done-hero { text-align: center; padding: 18px 0 6px; }
.big-emoji { font-size: 48px; }
.records h3 { margin-bottom: 6px; }

/* ---------- Графики ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.c-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; }
.c-line { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.c-area { fill: var(--accent-soft); }
.c-dot { fill: var(--bg); stroke: var(--accent); stroke-width: 2; }
.c-val { fill: var(--text); font-size: 12px; font-weight: 700; }
.c-label { fill: var(--muted); font-size: 10px; }
.c-bar { fill: var(--surface-3); }
.c-bar.last { fill: var(--accent); }
.c-bar.over { fill: var(--warn); }
.c-target { stroke: var(--muted); stroke-dasharray: 4 4; }
.ring-bg { fill: none; stroke: var(--surface-3); }
.ring-fg { fill: none; stroke: var(--accent); stroke-linecap: round; transition: stroke-dasharray 0.4s; }
.ring-fg.over { stroke: var(--warn); }
.ring-val { fill: var(--text); font-size: 22px; font-weight: 800; }
.ring-sub { fill: var(--muted); font-size: 10.5px; }
.ring { flex: none; }

/* ---------- Карта мышц ---------- */
.mm-figures { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mm-figures figure { margin: 0; text-align: center; }
.mm-figures figure span { font-size: 12px; color: var(--muted); }
.mm { width: 100%; max-height: 260px; }
.mm-body * { fill: var(--surface-2); }
.mm-off { fill: var(--surface-3); }
.mm-on { fill: var(--accent); }

/* ---------- Питание ---------- */
.kcal-card { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; align-items: center; }
.kcal-card.link { display: flex; }
.kcal-card .macros-col { grid-column: 1 / -1; display: grid; gap: 10px; margin-top: 10px; }
.big-num { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.burned { color: var(--warn); margin-top: 4px; }
.bar { height: 10px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.bar.thin { height: 6px; margin-top: 5px; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width 0.3s; }
.bar.p > span { background: var(--protein); }
.bar.f > span { background: var(--fat); }
.bar.c > span { background: var(--carbs); }
.bar.over > span { background: var(--danger); }
.meal h3 { font-size: 17px; }
.meal .list { margin-top: 6px; }
.food-results { margin: 10px 0; }
.food-row { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line); color: inherit; font: inherit; text-align: left; padding: 11px 2px; cursor: pointer; }
.food-row b { display: block; font-weight: 600; }
.food-row .muted { display: block; }
.food-row .plus { color: var(--accent); font-size: 24px; font-weight: 600; }
.sheet .segmented + .segmented { margin-top: -4px; }

/* ---------- Прогресс ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo { position: relative; padding: 0; border: 0; border-radius: 12px; overflow: hidden; aspect-ratio: 3 / 4; background: var(--surface-2); cursor: pointer; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo span { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 6px 5px; font-size: 11px; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, 0.7)); text-align: left; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.compare figure, .sheet-body figure { margin: 0 0 12px; }
.sheet-body figure img { width: 100%; border-radius: 12px; display: block; }
.sheet-body figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; text-align: center; }
.file { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-btn { position: relative; margin: 0 0 6px; color: var(--accent-ink); font-size: 16px; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }

/* ---------- Чат ---------- */
.chat-log { display: flex; flex-direction: column; gap: 10px; padding-bottom: 90px; }
.msg { display: flex; flex-direction: column; max-width: 88%; }
.msg.user { align-self: flex-end; }
.msg .bubble { padding: 10px 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); white-space: normal; overflow-wrap: anywhere; }
.msg.user .bubble { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); border-bottom-right-radius: 6px; }
.msg.assistant .bubble { border-bottom-left-radius: 6px; }
.msg-program { margin-top: 6px; background: var(--surface-2); border: 1px solid #3a4a2d; border-radius: 14px; padding: 10px 12px; }
.msg-program .row { margin-top: 8px; }
.chat-intro { color: var(--muted); }
.chat-intro .chip { color: var(--text); }
.chat-input { position: fixed; left: 0; right: 0; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom)); display: flex; gap: 8px; align-items: flex-end;
  padding: 10px 16px; background: rgba(13, 17, 16, 0.94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); max-width: 600px; margin: 0 auto; }
.chat-input textarea { min-height: 46px; max-height: 140px; resize: none; border-radius: 16px; }
.chat-input .btn { width: 46px; padding: 0; font-size: 20px; border-radius: 50%; flex: none; }
.typing { display: flex; gap: 4px; padding: 14px 16px !important; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

/* ---------- Ещё ---------- */
.menu-card { padding: 4px 14px; }
.menu-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.menu-row:last-child { border-bottom: 0; }
.menu-row .grow > * { display: block; }
.media-own { width: 100%; border-radius: 12px; display: block; }

/* ---------- Напоминания ---------- */
.days { display: flex; gap: 5px; flex-wrap: wrap; }
.days label { margin: 0; }
.days input { position: absolute; opacity: 0; width: 0; height: 0; }
.days span { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.days input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.days input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }

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

/* ---------- План под цель ---------- */
.plan-weights { font-size: 30px; letter-spacing: -0.02em; margin: 8px 0 6px; }
.plan-weights b { font-weight: 800; }
.plan-card { display: flex; align-items: center; gap: 12px; }
.plan-card .ico { width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 18px; }
.plan-card .progress-line { margin-top: 6px; }
.hero-card .chart { margin-top: 10px; }
.c-plan { fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-dasharray: 5 4; }
.c-target { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 2 3; opacity: 0.6; }
.legend { display: flex; align-items: center; gap: 6px; margin: 4px 0 0; }
.legend span { display: inline-block; width: 18px; height: 0; border-top: 2px dashed var(--muted); }
.legend .lg-fact { border-top: 2px solid var(--accent); margin-left: 10px; }
.insights { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.insight { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.4; }
.insight .ico { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--surface-2); color: var(--muted); }
.insight.ok .ico { background: rgba(94, 224, 160, 0.16); color: var(--ok); }
.insight.warn .ico { background: rgba(255, 180, 84, 0.16); color: var(--warn); }
.suggestion { border-color: rgba(184, 242, 90, 0.5); }
.tips { margin: 10px 0 14px; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; line-height: 1.4; color: var(--muted); }
.token { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; word-break: break-all; background: var(--surface-2); border-radius: 10px; padding: 10px; user-select: all; }
.user-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.user-row:last-child { border-bottom: 0; }
.segmented.wrap { display: grid; grid-template-columns: 1fr 1fr; overflow: visible; }

/* ---------- Питание: разбор БЖУ, календарь, фото, совет ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button.macro { display: block; width: 100%; background: none; border: 0; padding: 4px 0; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: 8px; }
button.macro:active { background: var(--surface-2); }
.ring-btn { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; }
.day-title { background: none; border: 0; padding: 4px 6px; color: inherit; font: inherit; cursor: pointer; border-radius: 10px; }
.day-title .cal-ico { font-size: 18px; color: var(--muted); }
.breakdown li { align-items: stretch; }
.breakdown .bar { margin: 6px 0 4px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 12px 0 8px; }
.cal-head { text-align: center; font-size: 12px; color: var(--muted); padding-bottom: 4px; }
.cal-day { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 48px; padding: 4px 0; border-radius: 10px; border: 1px solid transparent; background: var(--surface-2); color: inherit; font: inherit; cursor: pointer; }
.cal-day b { font-size: 15px; }
.cal-day small { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; min-height: 12px; }
.cal-day:disabled { opacity: 0.35; cursor: default; }
.cal-day.ok { background: rgba(94, 224, 160, 0.14); }
.cal-day.over { background: rgba(255, 180, 84, 0.18); }
.cal-day.low { background: var(--surface-3); }
.cal-day.today { border-color: var(--muted); }
.cal-day.sel { border-color: var(--accent); }
.cal-w { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.cal-day .cal-w { position: absolute; top: 5px; right: 6px; }
.cal-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.dot.ok { background: rgba(94, 224, 160, 0.5); }
.dot.over { background: rgba(255, 180, 84, 0.6); }
.dot.low { background: var(--surface-3); }
.food-photo { width: 100%; max-height: 220px; object-fit: cover; border-radius: 14px; margin: 10px 0; }
.suggest-card { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; color: inherit; font: inherit; cursor: pointer; }
.suggest-card .ico { width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 18px; }
.burn-goal { margin: 4px 0 10px; }
