:root {
  --bg: #f4f6f3;
  --card: #ffffff;
  --text: #17201a;
  --muted: #6b766e;
  --line: #e3e8e2;
  --soft: #eef2ed;
  --accent: #16a34a;
  --accent-ink: #ffffff;
  --accent-soft: #dcf5e4;
  --danger: #dc2626;
  --warn: #d97706;
  --p: #2f7dea;   /* белки */
  --f: #f0a020;   /* жиры */
  --c: #8b5cf6;   /* углеводы */
  --radius: 18px;
  --shadow: 0 1px 2px rgba(20, 40, 25, .05), 0 6px 24px rgba(20, 40, 25, .06);
  --nav-h: 64px;
  /* Отступы под вырезы экрана; в Telegram — его собственные. */
  --safe-b: max(env(safe-area-inset-bottom), var(--tg-safe-area-inset-bottom, 0px));
  --safe-t: max(env(safe-area-inset-top), var(--tg-content-safe-area-inset-top, 0px));
  color-scheme: light;
}
/* Тёмная тема: по системе, а в Telegram — по теме Telegram (data-theme на <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1411;
    --card: #171e19;
    --text: #e8eee9;
    --muted: #8f9b93;
    --line: #26302a;
    --soft: #1e2721;
    --accent: #22c55e;
    --accent-ink: #06260f;
    --accent-soft: #163322;
    --p: #5b9cf5;
    --f: #f5b343;
    --c: #a586fa;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1411;
  --card: #171e19;
  --text: #e8eee9;
  --muted: #8f9b93;
  --line: #26302a;
  --soft: #1e2721;
  --accent: #22c55e;
  --accent-ink: #06260f;
  --accent-soft: #163322;
  --p: #5b9cf5;
  --f: #f5b343;
  --c: #a586fa;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
h2 { font-size: 22px; margin: 0; }
h3 { font-size: 16px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.grow { flex: 1; }
.visually-hidden { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
svg { flex-shrink: 0; }

/* ---------- Кнопки и поля ---------- */
.btn {
  border: 0; border-radius: 12px; padding: 10px 16px; font-weight: 600; cursor: pointer;
  background: var(--soft); transition: transform .08s, opacity .15s, background .15s;
}
a.btn { text-decoration: none; color: inherit; display: inline-block; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--line); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.wide { width: 100%; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 6px 4px; font-weight: 600; }
.link.small { font-size: 13px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--soft); cursor: pointer;
  display: inline-grid; place-items: center; font-size: 22px; line-height: 1;
}
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.rec { background: var(--danger); color: #fff; animation: pulse 1.2s infinite; }@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(220, 38, 38, .15); } }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; min-width: 0; }
.field span { font-size: 12px; color: var(--muted); font-weight: 600; }
.field input, .field select, .cell-input {
  border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 9px 11px; width: 100%; min-width: 0;
}
.field input:focus, .field select:focus, textarea:focus, .cell-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.check { display: flex; gap: 8px; align-items: center; margin: 4px 0 12px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.error { color: var(--danger); margin: 0 0 12px; font-size: 14px; }

/* ---------- Карточки ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; border: 1px solid var(--line); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head h3 { margin: 0; }

/* ---------- Вход ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 20px 16px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card form { margin-top: 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; letter-spacing: -.01em; }
.brand img { width: 32px; height: 32px; }
.brand.big { font-size: 30px; }
.brand.big img { width: 48px; height: 48px; }

/* ---------- Каркас ---------- */
.app { min-height: 100dvh; }
.nav {
  position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: flex; background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.nav .brand { display: none; }
.nav-btn {
  flex: 1; border: 0; background: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 11px; font-weight: 600;
}
.nav-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.nav-btn.on { color: var(--accent); }
.main { padding: 0 16px calc(var(--nav-h) + var(--safe-b) + 20px); max-width: 1180px; margin: 0 auto; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px; justify-content: space-between;
  padding: calc(10px + var(--safe-t)) 0 10px; background: var(--bg);
}
.day-title { border: 0; background: none; font-size: 18px; font-weight: 700; cursor: pointer; padding: 6px 10px; border-radius: 10px; }
.day-title small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }

.diary-grid, .profile-grid { display: grid; gap: 0 18px; }
.col { min-width: 0; }

@media (min-width: 900px) {
  .app { display: grid; grid-template-columns: 220px 1fr; }
  .nav {
    position: sticky; top: 0; height: 100dvh; flex-direction: column; justify-content: flex-start; gap: 4px;
    padding: 20px 12px; border-top: 0; border-right: 1px solid var(--line); background: var(--card);
  }
  .nav .brand { display: flex; padding: 0 10px 18px; }
  .nav-btn { flex: 0; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 11px 12px; border-radius: 12px; font-size: 15px; }
  .nav-btn:hover { background: var(--soft); }
  .nav-btn.on { background: var(--accent-soft); }
  .main { padding: 0 28px 40px; width: 100%; }
  .topbar { padding-top: 18px; }
  .diary-grid { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
  .diary-grid .side { position: sticky; top: 76px; }
  .profile-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
}

/* ---------- Сводка дня ---------- */
.summary { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.ring { position: relative; width: 132px; height: 132px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 11; stroke-linecap: round; }
.ring .track { stroke: var(--soft); }
.ring .val { stroke: var(--accent); transition: stroke-dasharray .5s; }
.ring.over .val { stroke: var(--warn); }
.ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-center b { font-size: 26px; line-height: 1.1; letter-spacing: -.02em; }
.ring-center span { font-size: 12px; color: var(--muted); }
.macros { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.macro-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; gap: 6px; }
.macro-top b { font-weight: 700; }
.bar { height: 8px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; transition: width .5s; }
.bar.p i { background: var(--p); } .bar.f i { background: var(--f); } .bar.c i { background: var(--c); }
.left-note { grid-column: 1 / -1; margin: -4px 0 0; font-size: 13px; color: var(--muted); }

/* ---------- Ввод ---------- */
.composer textarea {
  width: 100%; border: 0; background: var(--soft); border-radius: 12px; padding: 12px; resize: none; min-height: 68px; max-height: 200px;
  scrollbar-width: thin;
}
.composer-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.composer.drag { outline: 2px dashed var(--accent); }
.composer-photo { position: relative; display: inline-block; margin-bottom: 10px; }
.composer-photo img { height: 96px; border-radius: 12px; display: block; }
.chip-x { position: absolute; top: -8px; right: -8px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--text); color: var(--card); cursor: pointer; font-size: 16px; line-height: 1; }
.hint { font-size: 13px; color: var(--muted); margin: 8px 2px 0; }

/* ---------- Черновик распознавания ---------- */
.draft { border: 2px solid var(--accent); }
.draft-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.draft-head img { width: 72px; height: 72px; object-fit: cover; border-radius: 12px; }
.draft-comment { font-size: 13px; color: var(--muted); background: var(--soft); padding: 8px 10px; border-radius: 10px; margin: 0 0 10px; }
.draft-items { display: flex; flex-direction: column; gap: 8px; }
.ditem { border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.ditem-top { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.ditem-top .cell-input { font-weight: 600; }
.ditem-nums { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.ditem-nums label { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--muted); font-weight: 600; min-width: 0; }
.ditem-nums .cell-input { padding: 7px 6px; text-align: center; }
.conf { font-size: 11px; padding: 2px 7px; border-radius: 99px; white-space: nowrap; font-weight: 600; }
.conf.low { background: #fde8e8; color: #b91c1c; } .conf.medium { background: #fef3c7; color: #92400e; } .conf.high { background: var(--accent-soft); color: var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .conf.low { background: #3a1717; color: #fca5a5; } :root:not([data-theme="light"]) .conf.medium { background: #3a2c10; color: #fcd34d; } }
:root[data-theme="dark"] .conf.low { background: #3a1717; color: #fca5a5; } :root[data-theme="dark"] .conf.medium { background: #3a2c10; color: #fcd34d; }
.draft-total { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; font-size: 14px; margin: 12px 0; }
.draft-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.draft-actions select, .draft-actions input { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 8px 10px; }

/* ---------- Приёмы пищи ---------- */
.meal { padding: 6px 0 4px; }
.meal-head { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 16px 6px; }
.meal-head h3 { margin: 0; }
.meal-head span { font-size: 13px; color: var(--muted); }
.entry { display: flex; gap: 12px; align-items: center; padding: 10px 16px; cursor: pointer; border-top: 1px solid var(--line); }
.entry:hover { background: var(--soft); }
.entry img { width: 42px; height: 42px; object-fit: cover; border-radius: 10px; }
.entry .ph { width: 42px; height: 42px; border-radius: 10px; background: var(--soft); display: grid; place-items: center; color: var(--muted); font-size: 18px; }
.entry-main { flex: 1; min-width: 0; }
.entry-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry-sub { font-size: 12px; color: var(--muted); }
.entry-sub b.p { color: var(--p); } .entry-sub b.f { color: var(--f); } .entry-sub b.c { color: var(--c); }
.entry-kcal { font-weight: 700; white-space: nowrap; }
.meal-add { display: block; width: 100%; border: 0; border-top: 1px dashed var(--line); background: none; color: var(--accent); font-weight: 600; font-size: 13px; text-align: left; padding: 10px 16px; cursor: pointer; }
.meal-add:hover { background: var(--soft); }

/* ---------- Добавка к записанному ---------- */
.addon h3 { margin: 0 0 6px; overflow-wrap: anywhere; }
.addon > p.muted { font-size: 13px; margin: 0 0 10px; }
.addon-input { display: flex; gap: 8px; align-items: flex-start; }
.addon-input textarea { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 12px; padding: 10px 12px; font: inherit; resize: vertical; }
.addon-tools { display: flex; gap: 10px; align-items: center; margin: 10px 0; }
.addon .draft-items { margin-bottom: 10px; }
.addon-mode { display: flex; margin-bottom: 10px; }
.addon-mode button { flex: 1; }
.addon-result { font-size: 14px; background: var(--soft); border-radius: 10px; padding: 8px 10px; margin: 0 0 10px; }
.addon-result .muted { font-size: 13px; }
.addon-open { width: 100%; margin-bottom: 12px; }
.empty { text-align: center; padding: 30px 16px; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }

/* ---------- Markdown ---------- */
.md { font-size: 14px; }
.md h3 { font-size: 14px; margin: 14px 0 6px; }
.md h3:first-child { margin-top: 0; }
.md p { margin: 0 0 8px; }
.md ul, .md ol { margin: 0 0 8px; padding-left: 20px; }
.md li { margin-bottom: 4px; }
.md .stamp { font-size: 12px; color: var(--muted); margin-top: 10px; }

/* ---------- Статистика ---------- */
.seg { display: inline-flex; background: var(--soft); border-radius: 12px; padding: 3px; }
.seg button { white-space: nowrap; border: 0; background: none; padding: 7px 12px; border-radius: 9px; font-weight: 600; font-size: 13px; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.stats-grid { display: grid; gap: 0 18px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .stats-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .stats-grid .full { grid-column: 1 / -1; } }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 600px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: var(--soft); border-radius: 14px; padding: 12px; }
.tile span { font-size: 12px; color: var(--muted); font-weight: 600; }
.tile b { display: block; font-size: 22px; letter-spacing: -.02em; }
.tile small { color: var(--muted); }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; }
.chart .grid { stroke: var(--line); }
.chart .goal { stroke: var(--text); stroke-dasharray: 4 4; opacity: .55; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: right; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { text-align: right; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
tr.clickable { cursor: pointer; } tr.clickable:hover td { background: var(--soft); }
.pct { font-weight: 700; } .pct.ok { color: var(--accent); } .pct.hi { color: var(--warn); } .pct.lo { color: var(--muted); }
.weight-row { display: flex; gap: 8px; margin-top: 10px; }
.weight-row input { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 8px 10px; }
.top-list { list-style: none; margin: 0; padding: 0; }
.top-list li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.top-list li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Профиль ---------- */
.qr { width: 180px; height: 180px; background: #fff; padding: 8px; border-radius: 12px; }
.qr svg { width: 100%; height: 100%; }
.url { font-family: ui-monospace, Consolas, monospace; font-size: 13px; word-break: break-all; background: var(--soft); padding: 8px 10px; border-radius: 10px; margin: 8px 0; }

/* ---------- Модалка и тост ---------- */
.modal { border: 0; border-radius: var(--radius); padding: 18px; width: min(460px, calc(100vw - 32px)); background: var(--card); color: var(--text); }
.modal::backdrop { background: rgba(0, 0, 0, .45); }
.modal-actions { display: flex; gap: 8px; justify-content: space-between; margin-top: 6px; flex-wrap: wrap; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--safe-b) + 14px); z-index: 50;
  background: var(--text); color: var(--card); padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: calc(100vw - 32px); box-shadow: var(--shadow);
}
.toast.err { background: var(--danger); color: #fff; }
@media (min-width: 900px) { .toast { bottom: 24px; } }

.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-card { display: flex; gap: 10px; align-items: center; color: var(--muted); }

/* ---------- Иконки в кнопках ---------- */
.ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; margin-right: 6px; }
.btn.small .ico { width: 14px; height: 14px; }
.topbar.wrap { flex-wrap: wrap; }
.small-note { font-size: 13px; margin: 0 0 10px; }

/* ---------- Выгрузка ---------- */
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.quick button { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer; }
.quick button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.export-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }

/* ---------- Админка ---------- */
.admin-grid { display: grid; gap: 0 18px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .admin-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } .admin-grid .full { grid-column: 1 / -1; } }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--accent-soft); color: var(--accent); }
.pill.warn { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.pill.bad { background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; margin: 0 0 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.limit { margin-bottom: 12px; }
.limit .macro-top span:last-child { color: var(--muted); }
.limit .bar { height: 10px; }
.limit .bar i { background: var(--accent); }
.limit .bar.mid i { background: var(--warn); }
.limit .bar.hi i { background: var(--danger); }
.note { font-size: 13px; color: var(--muted); background: var(--soft); border-radius: 10px; padding: 8px 10px; margin: 10px 0 0; }
.note.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.row-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-inline input { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 8px 10px; }
.row-inline input.num { flex: 0 0 90px; }
.switch { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.switch:last-of-type { border-bottom: 0; }
.switch small { display: block; color: var(--muted); font-size: 12px; }
.toggle { appearance: none; width: 44px; height: 26px; border-radius: 99px; background: var(--line); position: relative; cursor: pointer; flex-shrink: 0; transition: background .15s; margin: 0; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.toggle:checked { background: var(--accent); }
.toggle:checked::after { transform: translateX(18px); }
.users { list-style: none; margin: 0; padding: 0; }
.user-row { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 800; flex-shrink: 0; }
.user-main { flex: 1; min-width: 160px; }
.user-main b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-main small { color: var(--muted); font-size: 12px; display: block; }
.user-stats { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.user-stats b { display: block; font-size: 15px; color: var(--text); }
.user-actions { display: flex; gap: 6px; }
.tag { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: var(--soft); color: var(--muted); margin-left: 4px; vertical-align: 1px; }
.tag.admin { background: var(--accent-soft); color: var(--accent); }
.tag.plus { background: color-mix(in srgb, #f59e0b 18%, transparent); color: #b45309; }
.plus-card .plus-price { font-size: 13px; color: var(--muted); margin: 6px 0 12px; }
.plus-card ul { margin: 8px 0 0; padding-left: 18px; font-size: 14px; }
.pay-list { list-style: none; margin: 10px 0 0; padding: 0; font-size: 13px; }
.pay-list li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line, var(--soft)); }
.tag.blocked { background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger); }
.steps { margin: 0 0 12px; padding-left: 20px; font-size: 14px; }
.steps li { margin-bottom: 6px; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .92em; background: var(--soft); padding: 1px 5px; border-radius: 6px; }
.usage-chart { margin-top: 12px; }

/* ---------- Telegram-вход ---------- */
.tg-hello { text-align: center; margin: 18px 0; }
.tg-hello .btn { margin-top: 12px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 18px 0 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- Телефон ---------- */
@media (max-width: 599px) {
  .main { padding-left: 12px; padding-right: 12px; }
  .card { padding: 14px; border-radius: 16px; margin-bottom: 12px; }
  .summary { gap: 14px; }
  .ring { width: 116px; height: 116px; }
  .ring-center b { font-size: 23px; }
  .composer-row .icon-btn { width: 44px; height: 44px; }
  .composer-row .btn.primary { padding: 11px 18px; }
  .ditem-nums { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
  .ditem-nums .cell-input { padding: 8px 2px; font-size: 14px; }
  .draft-actions .btn { flex: 1; }
  .draft-actions .grow { display: none; }
  .draft-actions select, .draft-actions input { flex: 1; min-width: 0; }
  .modal { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 20px 20px 0 0; padding: 18px 16px calc(16px + var(--safe-b)); max-height: 92dvh; }
  .topbar h2 { font-size: 20px; }
  #range-seg { order: 3; width: 100%; }
  #range-seg button { flex: 1; }
  .tiles .tile b { font-size: 20px; }
  .row4 { grid-template-columns: repeat(2, 1fr); }
}

/* В Telegram выход из аккаунта не нужен — вход по Telegram. */
body.tg #logout { display: none; }

/* Вход в Claude в админке */
details.more { font-size: 14px; }
details.more summary { cursor: pointer; color: var(--accent); font-weight: 600; margin-bottom: 10px; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

/* Профиль: из чего сложилась норма */
.plan-note { font-size: 13px; line-height: 1.45; color: var(--muted); background: var(--soft); border-radius: 10px; padding: 8px 10px; margin: 0 0 12px; }
.plan-note b { color: var(--text); }
.plan-note:empty { display: none; }
.warn-text { color: var(--warn); }

/* Несколько фото в вводе и в черновике */
.composer-photos { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 4px 0 10px; }
.composer-photos .composer-photo { margin: 0; }
.composer-photos .composer-photo img { height: 84px; width: 84px; object-fit: cover; }
.photos-count { font-size: 13px; color: var(--muted); }
.draft-photos { display: flex; gap: 6px; flex-wrap: wrap; max-width: 50%; }
.draft-photos img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; }
.ditem-photo { width: 34px; height: 34px; object-fit: cover; border-radius: 8px; flex: none; }

/* Камера во весь экран */
.modal.camera-modal { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; padding: 0; background: #000; color: #fff; }
.cam { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; }
.cam video { flex: 1; min-height: 0; width: 100%; object-fit: contain; background: #000; }
.cam-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.cam-flash.on { animation: camflash .35s ease-out; }
@keyframes camflash { from { opacity: .8; } to { opacity: 0; } }
.cam-flip { position: absolute; top: calc(12px + var(--safe-t, 0px)); right: 12px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .45); color: #fff; font-size: 22px; cursor: pointer; }
.cam-thumbs { display: flex; gap: 6px; padding: 8px 12px 0; overflow-x: auto; min-height: 8px; }
.cam-thumbs img { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; border: 2px solid #fff; flex: none; }
.cam-hint { margin: 6px 12px 0; font-size: 12px; opacity: .7; text-align: center; }
.cam-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px calc(16px + var(--safe-b, 0px)); }
.cam-bar .btn { min-width: 96px; }
.cam-bar .btn.ghost { color: #fff; border-color: rgba(255, 255, 255, .4); background: transparent; }
.cam-shutter { width: 72px; height: 72px; border-radius: 50%; border: 5px solid #fff; background: rgba(255, 255, 255, .25); cursor: pointer; flex: none; }
.cam-shutter:active { background: #fff; transform: scale(.94); }
#manual-add { white-space: nowrap; }
@media (max-width: 400px) {
  .seg button { padding: 7px 8px; }
  .composer-row { gap: 6px; }
  .composer-row .icon-btn { width: 40px; height: 40px; }
  .composer-row .btn.primary { padding: 11px 14px; }
}

/* Админка: карточка участника */
.user-row .open { cursor: pointer; }
.user-row .user-main.open:hover b { color: var(--accent); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--muted); }
.dot.ok { background: var(--accent); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--danger); }
.au-head { display: flex; gap: 14px; align-items: center; margin: 10px 0 14px; flex-wrap: wrap; }
.avatar.big { width: 52px; height: 52px; font-size: 22px; }
.cal { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 5px; margin: 4px 0 10px; }
.cal-day { aspect-ratio: 1; border: 0; border-radius: 8px; cursor: pointer; font: 600 12px/1 inherit; color: var(--text); background: var(--soft); display: grid; place-items: center; padding: 0; }
.cal-day.ok, .cal-key.ok { background: color-mix(in srgb, var(--accent) 55%, transparent); }
.cal-day.lo, .cal-key.lo { background: color-mix(in srgb, var(--warn) 45%, transparent); }
.cal-day.hi, .cal-key.hi { background: color-mix(in srgb, var(--danger) 45%, transparent); }
.cal-day.none, .cal-key.none { background: var(--soft); color: var(--muted); }
.cal-day.sel { outline: 2px solid var(--text); outline-offset: 1px; }
.cal-key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.au-meal { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-bottom: 10px; }
.au-meal .entry { cursor: default; }
.au-meal .entry img { cursor: zoom-in; }

/* ---------- Приёмы пищи: выбор в черновике и разбивка в статистике ---------- */
.meal-pick { margin: 0 0 12px; }
.meal-pick .seg { display: flex; flex-wrap: wrap; width: 100%; }
.meal-pick .seg button { flex: 1; min-width: 70px; padding: 9px 8px; }
.meal-pick.ask { background: var(--soft); border: 1px solid var(--warn); border-radius: 12px; padding: 10px; }
.meal-pick.ask p { margin: 0 0 8px; font-size: 14px; }
.meal-pick.ask .seg { background: var(--card); }
.meal-pick.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.mrows { display: grid; gap: 12px; }
.mrow-head { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.mrow.none { opacity: .55; }
.mbar { height: 8px; background: var(--soft); border-radius: 99px; overflow: hidden; margin: 6px 0 4px; }
.mbar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.mrow small { font-size: 12px; }
.mlist { list-style: none; margin: 6px 0 0; padding: 0; }
.mlist li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.mlist li > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.invite { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 14px; margin: 12px 0; }
.qr.small { width: 120px; height: 120px; padding: 6px; }
.ai-chain { list-style: none; margin: 0 0 12px; padding: 0; }
.ai-chain li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.ai-chain li.off { opacity: .55; }
.ai-n { width: 24px; height: 24px; border-radius: 50%; background: var(--soft); color: var(--muted); font-size: 12px; font-weight: 700; display: grid; place-items: center; flex: none; }
.ai-main { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 3px; }
.ai-main b { font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ai-main small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.ai-main .ai-err { color: var(--danger); }
.ai-model { margin-top: 4px; flex-wrap: nowrap; }
.ai-model input { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 8px; padding: 5px 8px; font-size: 13px; }
.ai-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ai-actions .btn:disabled { opacity: .35; }

/* ---------- «Порция Плюс»: клетчатка, совет к приёму пищи, замок ---------- */
:root { --fb: #0d9488; --plus: #f59e0b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --fb: #2dd4bf; } }
:root[data-theme="dark"] { --fb: #2dd4bf; }
.bar.fb i { background: var(--fb); }
.ditem-nums.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.locked-row {
  border: 1px dashed var(--line); background: none; border-radius: 10px; padding: 6px 10px; font-size: 12px; font-weight: 600;
  color: var(--muted); cursor: pointer; text-align: left;
}
.locked-row:hover { border-color: var(--plus); color: var(--plus); }
.diet-note {
  grid-column: 1 / -1; justify-self: start; margin: -6px 0 0; border: 0; cursor: pointer; font-size: 13px; font-weight: 600;
  padding: 5px 12px; border-radius: 99px; color: var(--dc); background: color-mix(in srgb, var(--dc) 13%, transparent);
}

.advice {
  border-radius: 14px; padding: 12px; margin: 0 0 12px; background: color-mix(in srgb, var(--accent) 8%, var(--card));
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); animation: rise .45s ease both;
}
.advice.s1, .advice.s2 { background: color-mix(in srgb, var(--warn) 8%, var(--card)); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.advice-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.advice-head b { font-size: 14px; }
.advice-meter { display: flex; gap: 4px; }
.advice-meter i { width: 18px; height: 8px; border-radius: 99px; background: color-mix(in srgb, var(--text) 14%, transparent); }
.advice-meter i.on { background: var(--accent); animation: meter .35s ease both; animation-delay: calc(var(--i) * 90ms); }
.advice.s1 .advice-meter i.on, .advice.s2 .advice-meter i.on { background: var(--warn); }
.advice-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.advice-list li { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; animation: rise .4s ease both; animation-delay: calc(.2s + var(--i) * 90ms); }
.advice-plus { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; background: var(--accent); font-size: 14px; line-height: 1; }
.advice-ok { margin: 8px 0 0; font-size: 13px; }
.advice-diet { display: flex; gap: 8px; margin: 10px 0 0; font-size: 13px; padding-top: 8px; border-top: 1px solid var(--line); }
.advice-teaser {
  width: 100%; margin: 0 0 12px; border: 1px dashed color-mix(in srgb, var(--plus) 60%, transparent); background: color-mix(in srgb, var(--plus) 8%, transparent);
  border-radius: 12px; padding: 10px 12px; font-size: 13px; font-weight: 600; text-align: left; cursor: pointer; color: var(--text);
}

.locked { position: relative; overflow: hidden; }
.locked > :not(.lock) { filter: blur(5px); opacity: .7; pointer-events: none; user-select: none; }
.lock { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--card) 35%, transparent); }
.lock > div {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; background: var(--card); padding: 16px 20px;
  border-radius: 16px; box-shadow: 0 10px 40px rgba(0, 0, 0, .14); border: 1px solid var(--line); max-width: 300px;
}
.lock span { font-size: 13px; color: var(--muted); }
.lock .btn { margin-top: 4px; }

.upsell { text-align: center; }
.upsell-star { font-size: 44px; animation: starPop .7s cubic-bezier(.2, 1.6, .4, 1) both; }
.upsell h3 { margin: 4px 0 6px; font-size: 20px; }
.upsell .muted { margin: 0 0 10px; font-size: 14px; }
.upsell-list { list-style: none; padding: 0; margin: 0 0 16px; text-align: left; display: grid; gap: 8px; }
.upsell-list li { display: flex; gap: 10px; font-size: 14px; padding: 10px 12px; background: var(--soft); border-radius: 12px; animation: rise .4s ease both; animation-delay: calc(.15s + var(--i) * 70ms); }
.upsell-list li::before { content: "✓"; color: var(--accent); font-weight: 800; }

.fiber-bars { position: relative; display: flex; align-items: flex-end; gap: 3px; height: 90px; padding-top: 6px; }
.fiber-bars::after { content: ""; position: absolute; left: 0; right: 0; bottom: var(--goal); border-top: 2px dashed color-mix(in srgb, var(--fb) 60%, transparent); }
.fiber-bars i { flex: 1; border-radius: 4px 4px 2px 2px; background: var(--fb); transform-origin: bottom; animation: growUp .5s ease both; animation-delay: calc(var(--i) * 18ms); }
.fiber-bars i.mid { background: color-mix(in srgb, var(--fb) 60%, var(--warn)); }
.fiber-bars i.lo { background: var(--warn); }
.fiber-bars i.none { background: var(--soft); }

/* ---------- Диеты ---------- */
.diet-line { font-size: 13px; color: var(--muted); margin: -4px 0 12px; }
.diet-line b { color: var(--text); }
.diet-intro { text-align: center; padding: 22px 18px; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, var(--card)), var(--card)); }
.diet-intro h3 { font-size: 18px; margin: 8px 0 6px; }
.diet-intro p { margin: 0 auto; max-width: 560px; font-size: 14px; }
.diet-intro-art { display: flex; justify-content: center; gap: 10px; }
.diet-intro-art span {
  width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; font-size: 26px;
  background: color-mix(in srgb, var(--dc) 16%, var(--card)); animation: floaty 4s ease-in-out infinite;
}
.diet-intro-art span:nth-child(2) { animation-delay: -1.3s; transform: translateY(-6px); }
.diet-intro-art span:nth-child(3) { animation-delay: -2.6s; }

.diet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 14px; margin-bottom: 14px; }
.diet-card {
  display: flex; flex-direction: column; text-align: left; padding: 0; border-radius: var(--radius); overflow: hidden; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); color: inherit;
  transition: transform .2s, box-shadow .2s, border-color .2s; animation: rise .5s ease both; animation-delay: calc(var(--i) * 45ms);
}
.diet-card:hover { transform: translateY(-3px); box-shadow: 0 14px 34px color-mix(in srgb, var(--dc) 22%, transparent); border-color: color-mix(in srgb, var(--dc) 45%, var(--line)); }
.diet-card:active { transform: scale(.98); }
.diet-card.on { border: 2px solid var(--dc); }
.diet-art { background: linear-gradient(160deg, color-mix(in srgb, var(--dc) 18%, var(--card)), color-mix(in srgb, var(--dc) 5%, var(--card))); padding: 4px 18px 0; }
.diet-body { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 14px; }
.diet-body > b { font-size: 16px; }
.diet-body > .muted { font-size: 13px; line-height: 1.35; margin-bottom: 6px; }
.mstrip { display: flex; height: 8px; border-radius: 99px; overflow: hidden; gap: 2px; }
.mstrip i { animation: growX .7s ease both; transform-origin: left; }
.mstrip i.p { background: var(--p); } .mstrip i.f { background: var(--f); } .mstrip i.c { background: var(--c); }
.mstrip-legend { display: flex; gap: 12px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.mstrip-legend b.p { color: var(--p); } .mstrip-legend b.f { color: var(--f); } .mstrip-legend b.c { color: var(--c); }

.diet-current { display: flex; gap: 16px; align-items: center; border: 2px solid var(--dc); background: linear-gradient(135deg, color-mix(in srgb, var(--dc) 12%, var(--card)), var(--card)); }
.diet-current-art { width: 180px; flex: none; }
.diet-current h3 { margin: 2px 0 4px; font-size: 19px; }
.diet-current p { margin: 0 0 10px; font-size: 13px; }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--dc, var(--accent)); }

.back { display: inline-block; margin: 0 0 6px -4px; font-size: 15px; }
.diet-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 18px; align-items: center; overflow: hidden;
  background: linear-gradient(140deg, color-mix(in srgb, var(--dc) 20%, var(--card)) 0%, color-mix(in srgb, var(--dc) 4%, var(--card)) 70%); }
.diet-hero-art { max-width: 420px; }
.diet-hero h2 { font-size: 26px; letter-spacing: -.02em; }
.diet-hero-text p { margin: 6px 0 14px; color: var(--muted); }
.diet-hero .row-inline { margin-top: 14px; }
.diet-hero .btn.primary { background: var(--dc); color: #fff; box-shadow: 0 8px 22px color-mix(in srgb, var(--dc) 35%, transparent); }
.diet-cols { display: grid; gap: 0 14px; }
@media (min-width: 900px) { .diet-cols { grid-template-columns: 1fr 1fr; align-items: start; } }
.diet-about { margin: 0 0 12px; font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 13px; padding: 5px 10px; border-radius: 99px; background: var(--soft); }
.chip.good { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.diet-caution { font-size: 13px; margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--warn) 10%, transparent); }
.food-group + .food-group { margin-top: 12px; }
.food-group h4 { margin: 0 0 6px; font-size: 13px; }
.food-group.yes .chip { background: color-mix(in srgb, #16a34a 12%, transparent); }
.food-group.limit .chip { background: color-mix(in srgb, var(--warn) 13%, transparent); }
.food-group.no .chip { background: color-mix(in srgb, var(--danger) 11%, transparent); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.diet-rules { margin: 0; padding: 0; list-style: none; counter-reset: rule; display: grid; gap: 8px; }
.diet-rules li { counter-increment: rule; display: flex; gap: 10px; font-size: 14px; align-items: flex-start; animation: rise .4s ease both; animation-delay: calc(var(--i) * 50ms); }
.diet-rules li::before {
  content: counter(rule); flex: none; width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; color: #fff; background: var(--accent);
}
.plan-sub { margin: -4px 0 12px; font-size: 13px; }
.plan-meals { display: grid; gap: 10px; }
@media (min-width: 900px) { .plan-meals { grid-template-columns: 1fr 1fr; } }
.plan-meal { border: 1px solid var(--line); border-radius: 14px; padding: 12px; animation: rise .45s ease both; animation-delay: calc(var(--i) * 70ms); }
.plan-meal-head { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.plan-meal-head small { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
.plan-meal-head b { font-size: 14px; line-height: 1.3; }
.plan-ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: var(--soft); flex: none; }
.plan-kcal { font-size: 18px; font-weight: 800; text-align: right; line-height: 1; }
.plan-kcal small { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.plan-meal ul { list-style: none; margin: 0; padding: 0; }
.plan-meal li { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.plan-how { font-size: 13px; margin: 8px 0; color: var(--muted); }
.plan-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.plan-foot .btn.done { background: var(--accent-soft); color: var(--accent); }
.plan-total { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin-top: 12px; padding: 12px; border-radius: 12px; background: var(--soft); font-size: 14px; }
.plan-total span { color: var(--muted); }
.steps { display: grid; gap: 10px; }
.step { display: flex; gap: 12px; align-items: flex-start; animation: rise .45s ease both; animation-delay: calc(var(--i) * 90ms); }
.step span { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--accent-soft); color: var(--accent); }
.step p { margin: 4px 0 0; font-size: 14px; }

@media (max-width: 599px) {
  .diet-hero { grid-template-columns: 1fr; gap: 6px; }
  .diet-hero-art { max-width: 100%; margin: -6px -6px 0; }
  .diet-hero h2 { font-size: 22px; }
  .diet-current { flex-direction: column; align-items: stretch; text-align: left; }
  .diet-current-art { width: 100%; max-width: 260px; align-self: center; }
  .ditem-nums.six { gap: 3px; }
  .ditem-nums.six .cell-input { font-size: 13px; }
}

/* Иллюстрации диет (public/diet-art.js) */
.da { display: block; width: 100%; height: auto; overflow: visible; }
.da-it { animation: daPop .6s cubic-bezier(.2, 1.5, .4, 1) both; animation-delay: var(--d, 0s); transform-box: fill-box; transform-origin: center; }
.da-bob:not(.still) { animation: daBob 5s ease-in-out infinite; animation-delay: var(--b, 0s); }
.da-steam path { animation: daSteam 2.8s ease-in-out infinite; }
.da-spin { animation: daSpin 9s linear infinite; }
.da-spin.slow { animation-duration: 54s; }
.da-arc { animation: daArc 1.4s ease both .3s; }
.da-twinkle { animation: daTwinkle 2.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.da-beat { animation-name: daPop, daBeat; animation-duration: .6s, 1.5s; animation-iteration-count: 1, infinite; animation-delay: var(--d, 0s), .8s; }
.da-grow { animation-name: daPop, daGrow; animation-duration: .6s, 3.5s; animation-iteration-count: 1, infinite; animation-timing-function: ease, ease-in-out; transform-origin: center bottom; }
.da-lift { animation-name: daPop, daLift; animation-duration: .6s, 2.4s; animation-iteration-count: 1, infinite; animation-timing-function: ease, ease-in-out; }
@keyframes daPop { from { opacity: 0; transform: scale(.3); } }
@keyframes daBob { 50% { transform: translateY(-3.5px); } }
@keyframes daSteam { 0% { opacity: 0; transform: translateY(6px); } 40% { opacity: .9; } 100% { opacity: 0; transform: translateY(-10px); } }
@keyframes daSpin { to { transform: rotate(360deg); } }
@keyframes daArc { from { stroke-dasharray: 0 400; } }
@keyframes daTwinkle { 0%, 100% { opacity: .25; transform: scale(.6) rotate(0); } 50% { opacity: 1; transform: scale(1.1) rotate(45deg); } }
@keyframes daBeat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.14); } 30% { transform: scale(1); } 45% { transform: scale(1.08); } }
@keyframes daGrow { 0%, 100% { transform: scaleY(1) rotate(0); } 50% { transform: scaleY(1.06) rotate(-3deg); } }
@keyframes daLift { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-7px) rotate(-6deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes meter { from { transform: scaleX(0); } }
@keyframes growUp { from { transform: scaleY(0); } }
@keyframes growX { from { transform: scaleX(0); } }
@keyframes floaty { 50% { transform: translateY(-6px); } }
@keyframes starPop { from { opacity: 0; transform: scale(.2) rotate(-60deg); } }
@media (prefers-reduced-motion: reduce) {
  .da *, .diet-card, .advice, .advice *, .plan-meal, .step, .diet-rules li, .upsell *, .fiber-bars i, .mstrip i, .diet-intro-art span { animation: none !important; }
}

/* ---------- Готовые блюда ---------- */
.plan-tools { margin: -2px 0 10px; }
.plan-recipe { padding: 4px 0; margin: 6px 0; }
.recipe-tabs { display: flex; width: 100%; margin-bottom: 12px; }
.recipe-tabs button { flex: 1; padding: 8px 6px; }
.recipe-tabs small { font-weight: 700; color: var(--muted); margin-left: 2px; }
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 10px; }
.recipe-card {
  display: flex; flex-direction: column; text-align: left; padding: 0; border-radius: 14px; overflow: hidden; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); color: inherit; transition: transform .2s, box-shadow .2s, border-color .2s;
  animation: rise .45s ease both; animation-delay: calc(var(--i) * 45ms);
}
.recipe-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--dc) 45%, var(--line)); box-shadow: 0 12px 28px color-mix(in srgb, var(--dc) 18%, transparent); }
.recipe-card:active { transform: scale(.98); }
.recipe-card-art { background: linear-gradient(160deg, color-mix(in srgb, var(--dc) 14%, var(--card)), var(--card)); padding: 2px 10px 0; }
.recipe-card-body { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px 12px; }
.recipe-card-body > b { font-size: 14px; line-height: 1.3; }
.recipe-card-body small { font-size: 12px; }
.recipe-card-macros { color: var(--muted); }
.recipe-card-macros b.p { color: var(--p); } .recipe-card-macros b.f { color: var(--f); } .recipe-card-macros b.c { color: var(--c); }

.modal:has(.recipe) { width: min(520px, calc(100vw - 32px)); max-height: 92dvh; overflow-y: auto; }
.recipe-art { margin: -18px -18px 8px; padding: 6px 30px 0; background: linear-gradient(160deg, color-mix(in srgb, var(--dc) 20%, var(--card)), var(--card)); }
.recipe h3 { font-size: 20px; margin: 0 0 6px; letter-spacing: -.01em; }
.recipe h4 { font-size: 14px; margin: 16px 0 8px; }
.recipe h4 small { font-weight: 500; font-size: 12px; }
.recipe-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.recipe-diets { margin-bottom: 12px; }
.recipe-diets .chip { font-size: 12px; padding: 3px 9px; background: color-mix(in srgb, var(--dc) 14%, transparent); }
.recipe .seg { display: flex; width: 100%; }
.recipe .seg button { flex: 1; }
.recipe-note { font-size: 12px; margin: 6px 0 0; }
.recipe-ing { list-style: none; margin: 0; padding: 0; }
.recipe-ing li { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.recipe-steps { margin: 0; padding: 0; list-style: none; counter-reset: st; display: grid; gap: 8px; }
.recipe-steps li {
  counter-increment: st; display: flex; gap: 10px; align-items: flex-start; font-size: 14px; padding: 10px; border-radius: 12px;
  background: var(--soft); cursor: pointer; transition: opacity .2s, background .2s; animation: rise .4s ease both; animation-delay: calc(var(--i) * 60ms);
}
.recipe-steps li::before {
  content: counter(st); flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; color: #fff; background: var(--dc, var(--accent)); transition: background .2s;
}
.recipe-steps li.done { opacity: .55; text-decoration: line-through; }
.recipe-steps li.done::before { content: "✓"; background: var(--accent); }
.recipe-tip { font-size: 13px; margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--warn) 10%, transparent); }
.recipe-nums { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: 14px 0 6px; text-align: center; }
.recipe-nums div { background: var(--soft); border-radius: 12px; padding: 8px 2px; }
.recipe-nums b { display: block; font-size: 17px; }
.recipe-nums small { font-size: 11px; color: var(--muted); }
.recipe-nums b.p { color: var(--p); } .recipe-nums b.f { color: var(--f); } .recipe-nums b.c { color: var(--c); } .recipe-nums b.fb { color: var(--fb); }
@media (max-width: 599px) {
  .modal:has(.recipe) { width: 100vw; }
  .recipe-art { margin: -18px -16px 8px; padding: 6px 20px 0; }
  .recipe-tabs button { font-size: 12px; padding: 7px 2px; }
  .recipe-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .recipe-card-body { padding: 8px 10px 10px; }
  .recipe-card-body > b { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) { .recipe-card, .recipe-steps li { animation: none !important; } }

/* ---------- Каталог диет: поиск, разделы, список ---------- */
.diet-find { position: sticky; top: 0; z-index: 3; margin: 0 -4px 6px; padding: 8px 4px 6px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); }
.search { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 0 12px; box-shadow: var(--shadow); transition: border-color .2s, box-shadow .2s; }
.search:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent); }
.search svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; }
.search input { flex: 1; min-width: 0; border: 0; background: none; padding: 12px 0; font: inherit; font-size: 15px; color: var(--text); outline: none; }
.search input::-webkit-search-cancel-button { display: none; }
.search-x { border: 0; background: var(--soft); color: var(--muted); width: 26px; height: 26px; border-radius: 50%; cursor: pointer; font-size: 12px; flex: none; }
.search.small { margin: 0 0 12px; box-shadow: none; border-radius: 12px; }
.search.small input { padding: 9px 0; font-size: 14px; }
.diet-cats, .diet-conds, .menu-days { display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 10px 2px 2px; margin: 0 -2px; }
.diet-cats::-webkit-scrollbar, .diet-conds::-webkit-scrollbar, .menu-days::-webkit-scrollbar { display: none; }
.diet-conds { padding-top: 6px; }
.chip-btn { flex: none; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 99px; padding: 7px 13px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s, border-color .15s; }
.chip-btn small { color: var(--muted); font-weight: 700; margin-left: 2px; }
.chip-btn:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.chip-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip-btn.on small { color: rgba(255, 255, 255, .8); }
.chip-btn.small { padding: 5px 11px; font-size: 12px; }
.diet-sec { display: flex; align-items: baseline; gap: 8px; font-size: 17px; margin: 18px 2px 10px; }
.diet-sec small { font-size: 13px; color: var(--muted); font-weight: 700; }
.diet-list { display: grid; gap: 8px; margin-bottom: 8px; }
@media (min-width: 760px) { .diet-list { grid-template-columns: 1fr 1fr; } }
.diet-row {
  display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px; border-radius: 16px; cursor: pointer; color: inherit; font: inherit;
  background: var(--card); border: 1px solid var(--line); transition: transform .2s, box-shadow .2s, border-color .2s;
  animation: rise .4s ease both; animation-delay: calc(min(var(--i), 12) * 35ms);
}
.diet-row:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--dc) 45%, var(--line)); box-shadow: 0 10px 26px color-mix(in srgb, var(--dc) 16%, transparent); }
.diet-row:active { transform: scale(.98); }
.diet-row.on { border: 2px solid var(--dc); }
.diet-row-ico { width: 48px; height: 48px; flex: none; border-radius: 15px; display: grid; place-items: center; font-size: 25px; background: linear-gradient(150deg, color-mix(in srgb, var(--dc) 26%, var(--card)), color-mix(in srgb, var(--dc) 8%, var(--card))); }
.diet-row:hover .diet-row-ico { animation: floaty 1.6s ease-in-out infinite; }
.diet-row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.diet-row-body b { font-size: 15px; }
.diet-row-body small { font-size: 13px; color: var(--muted); line-height: 1.35; }
.diet-row-conds { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.diet-row-conds i { font-style: normal; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; color: color-mix(in srgb, var(--dc) 80%, var(--text)); background: color-mix(in srgb, var(--dc) 13%, transparent); }
.diet-row-go { font-size: 22px; color: var(--muted); flex: none; }
.diet-empty { padding: 26px 16px; }

/* ---------- Страница диеты: свёрнутые блоки ---------- */
.diet-med { font-size: 13px; margin: -4px 0 14px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--p) 10%, transparent); }
.diet-eat .food-groups { display: grid; gap: 12px; }
.diet-eat .food-group + .food-group { margin-top: 0; }
@media (min-width: 900px) { .diet-eat .food-groups { grid-template-columns: repeat(3, 1fr); } }
details.fold { padding: 0; }
details.fold > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 16px; cursor: pointer; user-select: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary h3 { margin: 0; }
.fold-hint { flex: 1; font-size: 13px; color: var(--muted); }
.fold-arrow { width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--soft); position: relative; transition: transform .25s, background .2s; }
.fold-arrow::before { content: ""; position: absolute; left: 50%; top: 45%; width: 8px; height: 8px; border-right: 2.2px solid var(--muted); border-bottom: 2.2px solid var(--muted); transform: translate(-50%, -50%) rotate(45deg); }
details.fold[open] .fold-arrow { transform: rotate(180deg); background: var(--accent-soft); }
details.fold > summary:hover .fold-arrow { background: var(--accent-soft); }
.fold-body { padding: 0 16px 16px; }
details.fold[open] .fold-body { animation: rise .3s ease both; }

/* ---------- Меню на день ---------- */
.menu-days { margin: -4px -2px 8px; padding-top: 0; }
.plan-meal { display: flex; flex-direction: column; }
.plan-meal ul { flex: 1; }
button.plan-meal-head { width: 100%; border: 0; background: none; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; border-radius: 12px; }
button.plan-meal-head:hover b { color: var(--dc, var(--accent)); text-decoration: underline; text-underline-offset: 3px; }
.plan-macros { display: block; margin: 8px 0 0; }
.plan-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.plan-actions .btn { flex: 1 1 auto; }
.plan-recipe-btn { background: color-mix(in srgb, var(--dc, var(--accent)) 14%, var(--card)); color: color-mix(in srgb, var(--dc, var(--accent)) 75%, var(--text)); border: 1px solid color-mix(in srgb, var(--dc, var(--accent)) 30%, transparent); font-weight: 700; }
.plan-actions .btn.done { background: var(--accent-soft); color: var(--accent); }
.plan-tools { margin: 12px 0 0; }
.recipe-more { display: flex; justify-content: center; margin-top: 12px; }
.recipe-more:empty { display: none; }
.recipe-none { margin: 4px 0 8px; font-size: 14px; }

/* ---------- Готовка по шагам ---------- */
.recipe-cook { width: 100%; margin: 14px 0 2px; background: var(--dc, var(--accent)); color: #fff; box-shadow: 0 8px 22px color-mix(in srgb, var(--dc, var(--accent)) 30%, transparent); }
.cook { display: flex; flex-direction: column; min-height: min(70dvh, 520px); }
.cook-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); font-weight: 700; }
.cook-bar { height: 6px; border-radius: 99px; background: var(--soft); overflow: hidden; margin: 10px 0 18px; }
.cook-bar i { display: block; height: 100%; background: var(--dc, var(--accent)); border-radius: 99px; transition: width .35s ease; }
.cook-title { margin: 0 0 6px; font-size: 14px; color: var(--muted); }
.cook-step { flex: 1; font-size: 22px; line-height: 1.45; font-weight: 600; margin: 0 0 18px; animation: rise .35s ease both; }
.cook-timer { align-self: flex-start; margin-bottom: 14px; font-weight: 700; }
.cook-timer.on { background: color-mix(in srgb, var(--warn) 14%, transparent); border-color: color-mix(in srgb, var(--warn) 40%, transparent); color: var(--warn); }
.cook-other { font-size: 13px; margin: 0 0 12px; }
@media (max-width: 599px) { .cook-step { font-size: 19px; } .plan-actions .btn { font-size: 12px; padding: 8px 8px; } }
@media (prefers-reduced-motion: reduce) { .diet-row, .cook-step, details.fold[open] .fold-body { animation: none !important; } }
.quiet .diet-row, .quiet .diet-card { animation: none; }

/* ---------- Аллергии ---------- */
.allergy-chips { flex-wrap: wrap; gap: 6px; }
.allergy-chips .chip-btn.on { background: var(--danger); border-color: var(--danger); }
.allergy-warn { margin: 0 0 10px; padding: 10px 12px; border-radius: 12px; font-size: 13px; background: color-mix(in srgb, var(--danger) 10%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); }
.chip.allergic { text-decoration: line-through; opacity: .75; background: color-mix(in srgb, var(--danger) 10%, var(--card)); }
.diet-allergy { font-size: 13px; margin: -4px 0 14px; padding: 10px 12px; border-radius: 12px; background: var(--soft); }
.diet-allergy.bad { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.recipe-swap { font-size: 13px; margin: 0 0 10px; padding: 8px 12px; border-radius: 12px; background: var(--accent-soft); }
details.diet-unfit { margin: 18px 0 8px; }
details.diet-unfit > summary { cursor: pointer; font-weight: 700; font-size: 15px; color: var(--muted); padding: 6px 2px; list-style: none; }
details.diet-unfit > summary::-webkit-details-marker { display: none; }
details.diet-unfit > summary small { font-weight: 700; margin-left: 4px; }
details.diet-unfit .diet-row { opacity: .7; }

/* ---------- Админка: расход нейросетей ---------- */
.spend-h { margin: 18px 0 8px; font-size: 15px; }
.spend-h small { font-weight: 400; font-size: 12px; }
.spend-table td small { display: block; font-size: 11px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.spend-table td { vertical-align: top; }
.spend-table td b { font-weight: 700; }
.spend-table tr.clickable { cursor: pointer; }
.spend-table tr.clickable:hover td { background: var(--soft); }
.spend-table .bad-text { color: var(--danger); }
.spend-table .warn-text { color: var(--warn); }
.admin-note { font-size: 13px; margin: -4px 4px 4px; }
.ai-spend { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
details.ai-price { margin-top: 6px; font-size: 13px; }
details.ai-price > summary { cursor: pointer; color: var(--accent); font-weight: 600; width: fit-content; }
.ai-price-grid { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin: 8px 0 4px; }
.ai-price-grid label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); flex: 1 1 130px; }
.ai-price-grid input { font: inherit; font-size: 14px; padding: 7px 9px; border-radius: 9px; border: 1px solid var(--line); background: var(--card); color: var(--text); min-width: 0; }
.allergic-part { color: var(--danger); text-decoration-thickness: 1.5px; }

/* ---------- Админка: ровная сетка на ПК ---------- */
.tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tiles.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 700px) { .tiles.five { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .tiles.five { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.tile { min-width: 0; }
.tile small { display: block; font-size: 12px; overflow-wrap: anywhere; }
.tile b.up { color: var(--warn); }
.tile b.down { color: var(--accent); }
.admin-top { padding: 14px; }
.split { display: grid; gap: 4px 28px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.field input.num, .row-inline input.num { flex: none; }
.plan-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 10px 0 8px; align-items: end; }
.plan-fields .field { margin: 0; }
.plan-fields .field span { min-height: 2.4em; display: flex; align-items: flex-end; }
.plan-fields input { width: 100%; }
@media (min-width: 900px) {
  .user-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) 230px 250px; flex-wrap: nowrap; }
  .user-stats { justify-content: space-between; }
  .user-actions { justify-content: flex-end; }
}
.user-stats span { min-width: 64px; text-align: center; }
.user-actions { flex-wrap: wrap; }
.tag.key { background: color-mix(in srgb, var(--p) 14%, transparent); color: var(--p); }
.tag.ok-tag { background: var(--accent-soft); color: var(--accent); }
.model-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.model-chip { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--soft); border: 1px solid var(--line); white-space: nowrap; }
.model-chip i { font-style: normal; font-weight: 500; color: var(--muted); margin-left: 6px; }
.model-chip.ok { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.model-chip.warn { border-color: var(--warn); color: var(--warn); }
.model-chip.bad { border-color: var(--danger); color: var(--danger); }
.ai-main small .link { padding: 0 2px; font-size: 12px; }
.spend-chart { margin-top: 12px; }
.spend-bars { display: block; width: 100%; height: 120px; }
.spend-dates { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }
.server-row { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.bad-text { color: var(--danger); }
.card-head .seg { flex-wrap: wrap; }

/* ---------- Баланс приёма пищи ---------- */
.bal { border-top: 1px solid var(--line); padding: 10px 14px; font-size: 13px; }
.bal.ok { color: var(--accent); font-weight: 600; }
/* Советы к приёму: свёрнуты в одну строку, по нажатию — строки «нутриент → чипы». */
.bal-box > .bal-sum { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-weight: 600; font-size: 13px; line-height: 1.35; }
details.bal-box > summary { cursor: pointer; list-style: none; -webkit-tap-highlight-color: transparent; }
details.bal-box > summary::-webkit-details-marker { display: none; }
details.bal-box > summary i { font-style: normal; font-weight: 600; color: var(--accent); white-space: nowrap; font-size: 12px; }
details.bal-box > summary i::after { content: " ▾"; display: inline-block; transition: transform .2s; }
details.bal-box[open] > summary i::after { transform: rotate(180deg); }
.bal.bad > .bal-sum { color: var(--warn); }
.advice.bal-box { padding: 10px 12px; margin: 10px 0; }
.advice.s5 > .bal-sum { color: var(--accent); }
.advice.s2 > .bal-sum { color: var(--warn); }
.bal-body { margin-top: 6px; animation: rise .25s ease both; }
.bal-line { display: grid; grid-template-columns: 84px 1fr; gap: 8px; align-items: start; padding: 5px 0; border-top: 1px dashed var(--line); }
.bal-line:first-child { border-top: 0; }
.bal-k { display: flex; flex-direction: column; font-size: 12.5px; line-height: 1.25; color: var(--text); }
.bal-k small { color: var(--muted); font-size: 11.5px; font-weight: 400; }
.bal-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.bal-chip { font-size: 12px; font-weight: 400; line-height: 1.3; padding: 3px 8px; border-radius: 99px; color: var(--text); background: color-mix(in srgb, var(--card) 60%, var(--soft)); }
.bal-chip b { font-weight: 600; color: var(--muted); }
.bal-sub { margin: 8px 0 2px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--muted); }
.bal-body .advice-diet { margin: 6px 0 0; padding-top: 6px; font-size: 12.5px; }
.day-lacks .bal { border-top: 0; }

/* ---------- Вес ---------- */
.summary-chips { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; margin-top: -6px; }
.summary-chips .diet-note { margin: 0; }
.weight-chip { border: 0; cursor: pointer; font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 99px; background: var(--soft); color: var(--text); }
.weight-chip span { color: var(--accent); margin-left: 6px; }
.weight-big { display: flex; align-items: baseline; justify-content: center; gap: 8px; margin: 6px 0 14px; }
.weight-big input { width: 150px; font-size: 40px; font-weight: 800; text-align: center; border: 0; border-bottom: 2px solid var(--accent); background: none; color: var(--text); padding: 4px; }
.weight-big input:focus { outline: none; }
.weight-big span { font-size: 18px; color: var(--muted); }
.weight-log { list-style: none; margin: 6px 0 0; padding: 0; font-size: 13px; }
.weight-log li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); }
.weight-log li > span:first-child { flex: 1; }
.weight-log .icon-btn { width: 28px; height: 28px; font-size: 16px; }

/* ---------- Своя нейросеть и приглашения ---------- */
.own-keys { list-style: none; margin: 0 0 8px; padding: 0; }
.own-key { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.own-key.off { opacity: .6; }
.own-key small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.own-key .pill { margin-left: 4px; }
.own-key-actions { display: flex; gap: 6px; }
.check.small { font-size: 12px; margin: 6px 0 0; }
.check.consent { align-items: flex-start; font-size: 13px; background: var(--soft); border-radius: 10px; padding: 8px 10px; }
.check.consent input { margin-top: 2px; flex: none; }
.note.ok-note { color: var(--accent); background: var(--accent-soft); }
.tiles.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
svg.chart { max-width: 760px; margin-inline: auto; }
