/* =========================================================
   Lensora — «спокойный премиум»
   Своя палитра для светлой и тёмной темы (тема Telegram решает только «светло/темно»)
   ========================================================= */
:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --hair: rgba(16, 24, 40, .07);
  --text: #0e1116;
  --text-2: #3b4250;
  --hint: #6b7380;
  --accent: #10b26b;
  --accent-2: #0ea59c;
  --accent-ink: #ffffff;
  --accent-soft: rgba(16, 178, 107, .11);
  --grad: linear-gradient(135deg, #18c37a 0%, #0ea59c 100%);
  --protein: #4f6dff;
  --fat: #f59e0b;
  --carbs: #9a6bff;
  --danger: #e5484d;
  --danger-soft: rgba(229, 72, 77, .1);
  --warn-soft: rgba(245, 158, 11, .14);
  --field: #eef0f3;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 10px 30px -12px rgba(16, 24, 40, .12);
  --shadow-lg: 0 18px 40px -16px rgba(16, 24, 40, .28);
  --glass: rgba(255, 255, 255, .78);
  --sheen: linear-gradient(180deg, rgba(255, 255, 255, .7), rgba(255, 255, 255, 0) 60%);

  --r: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --dock-h: 68px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  color-scheme: light;
}

:root.dark {
  --bg: #0a0c0f;
  --surface: #14171c;
  --surface-2: #1b1f26;
  --hair: rgba(255, 255, 255, .065);
  --text: #f2f4f7;
  --text-2: #c5cad3;
  --hint: #8a93a0;
  --accent: #2bd38c;
  --accent-2: #1ec0b0;
  --accent-ink: #04140c;
  --accent-soft: rgba(43, 211, 140, .12);
  --grad: linear-gradient(135deg, #34dc95 0%, #19b9aa 100%);
  --protein: #7590ff;
  --fat: #ffb547;
  --carbs: #b892ff;
  --danger: #ff5f6d;
  --danger-soft: rgba(255, 95, 109, .12);
  --warn-soft: rgba(255, 181, 71, .14);
  --field: #1f242c;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset;
  --shadow-lg: 0 20px 44px -18px rgba(0, 0, 0, .7);
  --glass: rgba(22, 25, 31, .72);
  --sheen: linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, 0) 55%);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-size: 16px; line-height: 1.4; min-height: 100vh; overscroll-behavior-y: none; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }
.num, .big, .kc, .totals b, .kpi b, .adapt b, .macro .top span, .stat b { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

#app { padding: 10px 16px calc(var(--dock-h) + 40px + var(--safe-b)); max-width: 560px; margin: 0 auto; }
body.no-tabbar #app { padding-bottom: calc(112px + var(--safe-b)); }

/* появление карточек */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
#app > * { animation: rise .42s var(--ease) both; }
#app > *:nth-child(2) { animation-delay: .04s; } #app > *:nth-child(3) { animation-delay: .08s; }
#app > *:nth-child(4) { animation-delay: .12s; } #app > *:nth-child(5) { animation-delay: .16s; }
#app > *:nth-child(n+6) { animation-delay: .2s; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- базовые блоки ---------- */
.card { position: relative; background: var(--sheen), var(--surface); border: 1px solid var(--hair); border-radius: var(--r); padding: 18px; margin-bottom: 12px; box-shadow: var(--shadow); }
.card.flat { padding: 0; overflow: hidden; }
.section-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--hint); margin: 22px 6px 10px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.section-title small { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 12.5px; }
.muted { color: var(--hint); }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 20px; border-radius: var(--r-md); font-weight: 600; font-size: 15.5px; background: var(--surface-2); border: 1px solid var(--hair); transition: transform .15s var(--ease), opacity .15s; }
.btn.primary { background: var(--grad); color: var(--accent-ink); border-color: transparent; box-shadow: 0 10px 24px -12px color-mix(in srgb, var(--accent) 80%, transparent), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn.block { width: 100%; }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn:active { transform: scale(.975); }
.btn[disabled] { opacity: .5; pointer-events: none; }

.field { display: block; width: 100%; height: 50px; padding: 0 16px; border-radius: var(--r-sm); border: 1px solid transparent; background: var(--field); outline: none; font-size: 16px; transition: border-color .15s, background .15s; }
.field:focus { border-color: var(--accent); background: var(--surface); }
label.lbl { display: block; font-size: 13px; font-weight: 500; color: var(--hint); margin: 14px 2px 7px; }

.seg { display: flex; background: var(--field); border-radius: 14px; padding: 4px; gap: 2px; }
.seg button { flex: 1; min-height: 38px; border-radius: 10px; font-size: 13.5px; font-weight: 600; color: var(--hint); transition: background .2s, color .2s; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 4px 10px -4px rgba(0, 0, 0, .12); }

.iconbtn { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--hair); color: var(--text-2); box-shadow: var(--shadow); transition: transform .15s var(--ease); }
.iconbtn:active { transform: scale(.94); }
.iconbtn[disabled] { opacity: .35; pointer-events: none; }
.iconbtn svg { width: 19px; height: 19px; }

/* ---------- шапка ---------- */
.dayhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 2px 14px; }
.dayhead h1 { font-size: 28px; line-height: 1.1; margin: 0; font-weight: 750; letter-spacing: -.025em; }
.dayhead .nav { display: flex; gap: 8px; align-items: center; }
.hello { font-size: 14px; color: var(--hint); margin-bottom: 3px; font-weight: 500; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: var(--accent-ink); font-weight: 700; font-size: 16px; flex: none; box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--accent) 80%, transparent); }

/* лента дней */
.week { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 14px; padding: 2px 16px 4px; scrollbar-width: none; }
.week::-webkit-scrollbar { display: none; }
.wd { flex: none; width: 46px; padding: 8px 0 9px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; gap: 5px; color: var(--hint); border: 1px solid transparent; transition: background .2s, color .2s; }
.wd .w { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.wd .d { font-size: 16px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.wd svg { width: 22px; height: 22px; transform: rotate(-90deg); }
.wd svg circle { fill: none; stroke-width: 3.2; }
.wd svg .tr { stroke: var(--field); }
.wd svg .pv { stroke: var(--accent); stroke-linecap: round; }
.wd svg .pv.over { stroke: var(--danger); }
.wd.on { background: var(--surface); box-shadow: var(--shadow); border-color: var(--hair); }
.wd.on .w { color: var(--accent); }

/* ---------- сводка дня: кольца ---------- */
.hero { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; }
.hero .lbl2 { font-size: 13px; font-weight: 600; color: var(--hint); text-transform: uppercase; letter-spacing: .06em; }
.hero .big { font-size: 46px; line-height: 1.02; font-weight: 750; letter-spacing: -.035em; margin: 6px 0 2px; }
.hero .big small { font-size: 17px; font-weight: 600; color: var(--hint); letter-spacing: 0; margin-left: 4px; }
.hero.over .big { color: var(--danger); }
.hero .sub { font-size: 13.5px; color: var(--hint); }
.hero .sub b { color: var(--text-2); font-weight: 600; }
.rings { width: 136px; height: 136px; position: relative; }
.rings svg { width: 136px; height: 136px; transform: rotate(-90deg); overflow: visible; }
.rings circle { fill: none; stroke-linecap: round; transition: stroke-dashoffset .9s var(--ease); }
.rings .tr { stroke: var(--field); stroke-linecap: butt; }
.rings .k { stroke: url(#ringGrad); }
.rings.over .k { stroke: var(--danger); }
.rings .p { stroke: var(--protein); } .rings .f { stroke: var(--fat); } .rings .c { stroke: var(--carbs); }
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.stat { background: var(--surface-2); border-radius: 14px; padding: 10px 12px; }
.stat .n { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--hint); font-weight: 600; }
.stat .n i { width: 8px; height: 8px; border-radius: 50%; }
.stat b { display: block; font-size: 18px; font-weight: 700; margin-top: 3px; letter-spacing: -.01em; }
.stat b small { font-size: 12.5px; color: var(--hint); font-weight: 500; }
.stat.p .n i { background: var(--protein); } .stat.f .n i { background: var(--fat); } .stat.c .n i { background: var(--carbs); }

/* полоски макросов (статистика) */
.macros { display: grid; gap: 14px; }
.macro .top { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 7px; }
.macro .top b { font-weight: 600; }
.macro .top span { color: var(--hint); }
.bar { height: 8px; border-radius: 5px; background: var(--field); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 5px; transition: width .7s var(--ease); }
.macro.p i { background: var(--protein); } .macro.f i { background: var(--fat); } .macro.c i { background: var(--carbs); }
/* клетчатка и сахара: полоска среднего + столбики по дням */
.macro.fb i { background: var(--accent); } .macro.sg i { background: #e8618c; }
.fs .macro small { display: block; font-size: 12px; margin-top: 6px; }
.fs-days { display: flex; align-items: flex-end; gap: 3px; height: 28px; margin-top: 8px; }
.fs-days i { flex: 1; border-radius: 3px 3px 1px 1px; opacity: .55; min-height: 0; }
.fs-note { font-size: 12.5px; margin: 0; }
.fs-src { font-size: 11px; color: var(--hint); opacity: .75; margin: -4px 0 0; }

/* ---------- быстрый повтор ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: flex; align-items: center; gap: 9px; padding: 6px 14px 6px 6px; border-radius: 999px; background: var(--surface); border: 1px solid var(--hair); box-shadow: var(--shadow); font-size: 14.5px; font-weight: 500; max-width: 240px; min-height: 44px; transition: transform .15s var(--ease); }
.chip:active { transform: scale(.97); }
.chip img, .chip .ph { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: none; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.chip .ph .ic { width: 16px; height: 16px; }
.chip .k { color: var(--hint); font-size: 13px; font-variant-numeric: tabular-nums; }

/* ---------- приёмы пищи ---------- */
.mgroup .mhead { display: flex; align-items: center; gap: 10px; padding: 14px 16px 6px; }
.mgroup .mhead .mi { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.mgroup .mhead .mi .ic { width: 17px; height: 17px; }
.mgroup .mhead b { font-size: 15.5px; font-weight: 650; }
.mgroup .mhead .sum { margin-left: auto; font-size: 13.5px; color: var(--hint); font-weight: 600; font-variant-numeric: tabular-nums; }
.meal { display: flex; gap: 12px; align-items: center; padding: 10px 16px; transition: background .15s; }
.meal:active { background: var(--surface-2); }
.meal:last-child { padding-bottom: 14px; }
.meal .thumb { width: 54px; height: 54px; border-radius: 15px; object-fit: cover; flex: none; background: var(--surface-2); display: grid; place-items: center; color: var(--accent); }
.meal .thumb .ic { width: 24px; height: 24px; stroke-width: 1.7; }
.meal .t { font-weight: 600; font-size: 15.5px; }
.meal .s { font-size: 13px; color: var(--hint); margin-top: 3px; font-variant-numeric: tabular-nums; }
.meal .kc { font-weight: 700; font-size: 17px; text-align: right; white-space: nowrap; }
.meal .kc small { display: block; font-weight: 500; color: var(--hint); font-size: 12px; }
.empty { text-align: center; padding: 34px 22px; color: var(--hint); font-size: 15px; }

/* ---------- плавающий док ---------- */
.tabbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + var(--safe-b)); z-index: 20; width: min(calc(100% - 32px), 420px); height: var(--dock-h);
  display: grid; grid-template-columns: 1fr 84px 1fr; align-items: center; padding: 0 10px; border-radius: 26px;
  background: var(--glass); -webkit-backdrop-filter: blur(22px) saturate(1.7); backdrop-filter: blur(22px) saturate(1.7);
  border: 1px solid var(--hair); box-shadow: var(--shadow-lg); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 52px; color: var(--hint); font-size: 11.5px; font-weight: 600; border-radius: 18px; transition: color .2s; }
.tabbar a.on { color: var(--text); }
.tabbar a.on svg { color: var(--accent); }
.tabbar svg { width: 23px; height: 23px; }
.fab { justify-self: center; width: 60px; height: 60px; border-radius: 22px; display: grid; place-items: center; background: var(--grad); color: var(--accent-ink);
  box-shadow: 0 12px 26px -10px color-mix(in srgb, var(--accent) 85%, transparent), inset 0 1px 0 rgba(255, 255, 255, .3); transform: translateY(-14px); transition: transform .18s var(--ease); }
.fab svg { width: 27px; height: 27px; stroke-width: 2; }
.fab:active { transform: translateY(-14px) scale(.94); }
body.no-tabbar .tabbar { display: none; }

/* ---------- анализ / редактор ---------- */
.photo { position: relative; border-radius: var(--r); overflow: hidden; margin-bottom: 12px; background: var(--surface-2); aspect-ratio: 4 / 3; box-shadow: var(--shadow-lg); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo.small { aspect-ratio: auto; height: 190px; }
.photo.small::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, .35)); }
.photo.thumb { width: 116px; height: 116px; aspect-ratio: 1; margin: 4px auto 14px; border-radius: 28px; }
/* фото блюда открывается на весь экран */
.photo img:not([src]) { visibility: hidden; }
.photo.zoom { cursor: zoom-in; }
.photo.zoom::before { content: ""; position: absolute; right: 12px; bottom: 12px; z-index: 1; width: 32px; height: 32px; border-radius: 10px;
  background: rgba(0, 0, 0, .45) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7'/%3E%3C/svg%3E") center / 16px no-repeat;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.viewer { position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, .94); display: grid; place-items: center;
  animation: fadein .2s var(--ease); }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer .vx { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: 12px; width: 40px; height: 40px;
  border-radius: 50%; display: grid; place-items: center; color: #fff; background: rgba(255, 255, 255, .14); }
.viewer .vx svg { width: 20px; height: 20px; }
@keyframes fadein { from { opacity: 0; } }
.scan { position: absolute; inset: 0; background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--accent) 38%, transparent) 50%, transparent); background-size: 100% 220%; animation: scan 1.6s ease-in-out infinite; }
@keyframes scan { 0% { background-position: 0 120%; } 100% { background-position: 0 -120%; } }
.scan-label { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); background: rgba(10, 12, 15, .62); color: #fff; padding: 9px 16px; border-radius: 999px; font-size: 14px; font-weight: 500; white-space: nowrap; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); display: flex; align-items: center; gap: 8px; }
.scan-label .ic { width: 18px; height: 18px; }

.titlefield { font-size: 22px; font-weight: 750; letter-spacing: -.02em; background: none; border: 0; outline: none; width: 100%; padding: 2px 0 4px; border-bottom: 2px solid transparent; transition: border-color .15s; }
.titlefield:focus { border-bottom-color: var(--accent); }

.totals { display: grid; grid-template-columns: 1.35fr 1fr 1fr 1fr; gap: 7px; text-align: center; }
.totals div { background: var(--surface-2); border-radius: 14px; padding: 10px 4px 9px; }
.totals b { display: block; font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.totals span { font-size: 11.5px; color: var(--hint); font-weight: 500; }
.totals .kcal { background: var(--accent-soft); }
.totals .kcal b { color: var(--accent); font-size: 20px; }

.item { padding: 14px 16px; }
.item + .item { border-top: 1px solid var(--hair); }
.item .head { display: flex; align-items: flex-start; gap: 8px; }
.item .name { flex: 1; text-align: left; font-weight: 600; font-size: 15.5px; display: flex; align-items: center; gap: 6px; min-width: 0; min-height: 28px; }
.item .name .txt { overflow: hidden; text-overflow: ellipsis; }
.item .name svg { width: 15px; height: 15px; color: var(--hint); flex: none; }
.item .x { color: var(--hint); width: 36px; height: 36px; display: grid; place-items: center; margin: -4px -8px 0 0; border-radius: 10px; }
.item .x svg { width: 18px; height: 18px; }
.tag { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 8px; background: var(--warn-soft); color: color-mix(in srgb, var(--fat) 75%, var(--text)); flex: none; margin-top: 3px; }
.item .body { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.stepper { display: flex; align-items: center; background: var(--surface-2); border: 1px solid var(--hair); border-radius: 14px; height: 44px; }
.stepper button { width: 44px; height: 44px; font-size: 21px; font-weight: 500; color: var(--accent); }
.stepper input { width: 58px; text-align: center; border: 0; background: none; outline: none; font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.stepper .u { color: var(--hint); font-size: 13px; padding-right: 2px; margin-left: -8px; }
.item .kc { margin-left: auto; text-align: right; }
.item .kc b { font-size: 17px; }
.item .kc small { display: block; font-size: 12px; color: var(--hint); margin-top: 2px; }
.addrow { display: flex; align-items: center; gap: 8px; padding: 16px; color: var(--accent); font-weight: 600; width: 100%; border-top: 1px solid var(--hair); min-height: 52px; }
.addrow svg { width: 20px; height: 20px; }

.conf { font-size: 13.5px; color: var(--hint); display: flex; align-items: center; gap: 8px; margin: 6px 2px 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dot.mid { background: var(--fat); box-shadow: 0 0 0 3px var(--warn-soft); } .dot.low { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

.actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; padding: 14px 16px calc(12px + var(--safe-b)); background: linear-gradient(transparent, var(--bg) 34%); display: flex; gap: 10px; max-width: 560px; margin: 0 auto; }
body.tg-main .actions .primary, body.tg-main .inline-save { display: none; }

/* ---------- вопросы модели ---------- */
.question { border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: linear-gradient(180deg, var(--accent-soft), transparent 70%), var(--surface); }
.qtext { display: flex; align-items: center; gap: 9px; font-weight: 650; margin-bottom: 12px; }
.qtext .ic { color: var(--accent); width: 20px; height: 20px; }
.qopts { display: flex; flex-wrap: wrap; gap: 8px; }
.qopt { min-height: 42px; padding: 0 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--hair); color: var(--text); font-weight: 600; font-size: 14.5px; box-shadow: var(--shadow); transition: transform .15s var(--ease); }
.qopt:active { transform: scale(.96); }

/* ---------- шторка ---------- */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(5, 7, 10, .45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); display: flex; align-items: flex-end; animation: fade .2s; }
.sheet[hidden] { display: none; }
.sheet .panel { width: 100%; max-width: 560px; margin: 0 auto; max-height: 88vh; background: var(--surface); border-radius: 28px 28px 0 0; padding: 10px 18px calc(16px + var(--safe-b)); display: flex; flex-direction: column; animation: up .3s var(--ease); border-top: 1px solid var(--hair); }
.sheet .grip { width: 40px; height: 5px; border-radius: 3px; background: var(--field); margin: 0 auto 14px; }
.sheet h3 { margin: 0 0 12px; font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.sheet .list { overflow-y: auto; margin: 8px -18px 0; min-height: 120px; }
.sheet .res { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 18px; width: 100%; text-align: left; min-height: 56px; }
.sheet .res:active { background: var(--surface-2); }
.sheet .res + .res { border-top: 1px solid var(--hair); }
.sheet .res small { color: var(--hint); display: block; font-size: 12.5px; margin-top: 2px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grid4 .field { padding: 0 8px; text-align: center; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(100%); } }

/* ---------- статистика ---------- */
.chart { width: 100%; height: 180px; display: block; }
.chart text { fill: var(--hint); font-size: 10px; font-weight: 500; }
.chart .goal { stroke: var(--hint); stroke-dasharray: 3 5; stroke-width: 1; opacity: .7; }
.chart .b { fill: url(#gb); }
.chart .b.over { fill: var(--danger); }
.chart .b.zero { fill: var(--field); }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.kpi { background: var(--sheen), var(--surface); border: 1px solid var(--hair); border-radius: 18px; padding: 14px 16px; box-shadow: var(--shadow); }
.kpi b { font-size: 24px; display: block; font-weight: 750; letter-spacing: -.02em; }
.kpi span { font-size: 13px; color: var(--hint); }

.report-text { font-size: 15px; line-height: 1.55; color: var(--text-2); }
.badge { display: inline-block; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: 3px 8px; border-radius: 7px; background: linear-gradient(135deg, #f7c86a, #e39b2d); color: #2b1a00; margin-left: 6px; vertical-align: 1px; }

/* вес */
.wchart { height: 120px; margin-top: 8px; }
.wdot { fill: var(--hint); opacity: .5; }
.wtrend { fill: none; stroke: var(--accent); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.rate { margin-left: auto; font-size: 13px; font-weight: 700; padding: 4px 9px; border-radius: 9px; background: var(--field); font-variant-numeric: tabular-nums; }
.rate.good { color: var(--accent); background: var(--accent-soft); }
.rate.bad { color: var(--danger); background: var(--danger-soft); }
.adapt { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; text-align: center; }
.adapt div { background: var(--surface-2); border-radius: 14px; padding: 12px 6px; }
.adapt b { display: block; font-size: 22px; font-weight: 750; }
.adapt span { font-size: 12px; color: var(--hint); }
.fc { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-top: 12px; }
.fc .ic { width: 18px; height: 18px; flex: none; }
.fc.good { color: var(--accent); } .fc.bad { color: var(--danger); }

/* переключатели */
.switch-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; min-height: 60px; }
.switch-row + .switch-row { border-top: 1px solid var(--hair); }
.switch-row b { font-weight: 600; }
.switch-row small { display: block; color: var(--hint); font-size: 12.5px; margin-top: 2px; }
.switch { appearance: none; -webkit-appearance: none; flex: none; width: 50px; height: 30px; border-radius: 15px; background: var(--field); position: relative; transition: background .2s; margin: 0; cursor: pointer; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); transition: transform .22s var(--ease); }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(20px); }

/* ---------- иконки и пустые состояния ---------- */
.ic { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.btn .ic { width: 19px; height: 19px; }
.ill { width: 68px; height: 68px; border-radius: 24px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.ill .ic { width: 32px; height: 32px; stroke-width: 1.7; }
.ill.bad { background: var(--danger-soft); color: var(--danger); }
.ill.warn { background: var(--warn-soft); color: var(--fat); }
.ic.star { width: 14px; height: 14px; color: var(--fat); fill: currentColor; margin-left: 4px; vertical-align: -1px; }
.withic { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.withic small { flex-basis: 100%; }

/* ---------- прочее ---------- */
.toast { position: fixed; left: 50%; top: calc(12px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); z-index: 60; background: rgba(14, 17, 22, .9); color: #fff; padding: 11px 16px; border-radius: 16px; font-size: 14.5px; font-weight: 500; max-width: calc(100% - 32px); animation: drop .3s var(--ease); display: flex; align-items: center; gap: 8px; box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .5); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.toast[hidden] { display: none; }
.toast .tick { width: 18px; height: 18px; color: #4ade80; stroke-width: 2.4; }
@keyframes drop { from { opacity: 0; transform: translate(-50%, -8px); } }
.skeleton { background: linear-gradient(90deg, var(--field), var(--surface-2), var(--field)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 14px; }
@keyframes sk { to { background-position: -200% 0; } }
.chart rect, .chart line { stroke-linecap: butt; }
.chart rect { stroke: none; }
.xlabels { display: grid; margin-top: 6px; text-align: center; font-size: 11px; font-weight: 600; color: var(--hint); text-transform: lowercase; }
.btn { white-space: nowrap; } .btn.block { min-width: 0; }

/* ---------- ярлык на главном экране ---------- */
.homebanner { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--dock-h) + 26px + var(--safe-b)); z-index: 21;
  width: min(calc(100% - 32px), 420px); display: flex; align-items: center; gap: 12px; padding: 12px 10px 12px 12px; border-radius: 22px;
  background: var(--glass); -webkit-backdrop-filter: blur(22px) saturate(1.7); backdrop-filter: blur(22px) saturate(1.7);
  border: 1px solid var(--hair); box-shadow: var(--shadow-lg); animation: bannerIn .45s var(--ease) both; }
@keyframes bannerIn { from { opacity: 0; transform: translate(-50%, 14px); } }
.homebanner b { display: block; font-size: 14.5px; font-weight: 650; }
.homebanner small { display: block; font-size: 12.5px; color: var(--hint); margin-top: 1px; }
.homebanner .btn.small { min-height: 36px; padding: 0 14px; }
.hb-ic { width: 40px; height: 40px; border-radius: 13px; flex: none; display: grid; place-items: center; background: var(--grad); color: var(--accent-ink); }
.hb-ic .ic { width: 21px; height: 21px; }
.hb-x { width: 32px; height: 32px; flex: none; display: grid; place-items: center; color: var(--hint); border-radius: 10px; }
.hb-x .ic { width: 17px; height: 17px; }
.homeitem { width: 100%; text-align: left; }
.homeitem[disabled] { cursor: default; }
.homeitem[disabled] .hb-ic { background: var(--accent-soft); color: var(--accent); }

/* знакомство при первом входе */
.wz-steps { display: flex; gap: 6px; margin: 4px 6px 18px; }
.wz-steps i { flex: 1; height: 4px; border-radius: 4px; background: var(--hair); transition: background .3s var(--ease); }
.wz-steps i.on { background: var(--grad); }
.wz-sub { margin: -6px 6px 16px; font-size: 14.5px; }
.wz-opts { display: grid; gap: 6px; }
.wz-opts button { min-height: 46px; padding: 0 14px; border-radius: 14px; text-align: left; font-size: 14.5px; font-weight: 600; background: var(--field); color: var(--hint); border: 1px solid transparent; transition: background .2s, color .2s, border-color .2s; }
.wz-opts button.on { background: var(--accent-soft); color: var(--text); border-color: var(--accent); }
.wz-kcal { display: flex; align-items: baseline; justify-content: center; gap: 8px; }
.wz-kcal input { width: 5.2ch; font-size: 44px; font-weight: 700; text-align: center; background: none; border: 0; border-bottom: 2px dashed var(--hair); color: var(--text); padding: 0; }
.wz-kcal span { color: var(--hint); font-weight: 500; }
.wz-skip { margin-top: 10px; background: none; border-color: transparent; color: var(--hint); font-weight: 500; font-size: 14px; }

/* единица г/мл и метка «Этикетка» */
.stepper button.u { width: auto; height: auto; padding: 4px 4px 4px 0; font-size: 13px; font-weight: 500; color: var(--hint); text-decoration: underline dotted; text-underline-offset: 3px; }
.tag.ok { background: var(--accent-soft); color: var(--accent); }

/* выбор цели: название + пояснение; объяснение нормы */
.wz-opts button { padding: 9px 14px; line-height: 1.25; }
.wz-opts button b { display: block; font-weight: 650; }
.wz-opts button small { display: block; font-size: 12.5px; font-weight: 500; color: var(--hint); margin-top: 2px; }
#goalbox .seg { margin-top: 0; }
.wz-explain { font-size: 13.5px; line-height: 1.45; margin: 12px 2px 0; }
.wz-explain b { color: var(--text); }
.disclaimer { display: block; font-size: 11.5px; line-height: 1.4; color: var(--hint); opacity: .8; margin: 8px 2px 0; }

/* серия дней, подсказка дня, ввод текстом */
.streak { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; padding: 2px 8px 2px 6px; border-radius: 10px; background: color-mix(in srgb, #ff8a3d 14%, transparent); color: #e2702a; font-size: 12.5px; font-weight: 650; vertical-align: 1px; }
.streak .ic { width: 14px; height: 14px; }
.streak.big { margin: 0 0 0 auto; font-size: 13.5px; padding: 4px 10px 4px 8px; }
.tip { display: flex; gap: 10px; align-items: flex-start; padding: 13px 15px; margin-bottom: 12px; border-radius: var(--r); background: var(--accent-soft); color: var(--text); font-size: 14.5px; line-height: 1.4; }
.tip .ic { color: var(--accent); width: 20px; height: 20px; margin-top: 1px; }
.quicktext { display: flex; align-items: center; gap: 10px; width: 100%; padding: 13px 15px; margin-bottom: 4px; border-radius: var(--r); background: var(--surface); border: 1px dashed var(--hair); color: var(--hint); font-size: 14.5px; text-align: left; }
.quicktext .ic { color: var(--accent); }
.textin { min-height: 88px; padding: 12px; resize: none; line-height: 1.4; font: inherit; }

/* медали */
.medal { width: 64px; height: 64px; flex: none; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .18)); }
.medal.big { width: 132px; height: 132px; display: block; margin: 4px auto 10px; }
.medal .m-rim { fill: none; stroke: rgba(255, 255, 255, .55); stroke-width: 1.6; }
.medal .m-core { fill: rgba(0, 0, 0, .16); }
.medal .m-ic { fill: none; stroke: #fff; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.medal .m-shine { fill: none; stroke: rgba(255, 255, 255, .45); stroke-width: 3; stroke-linecap: round; }
.medal.locked { opacity: .42; filter: grayscale(1); }
.medal.locked .m-shine { display: none; }
.awards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 6px; }
.award { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 14px 6px 12px; border-radius: 18px; background: var(--surface); border: 1px solid var(--hair); }
.award b { font-size: 13px; line-height: 1.2; }
.award small { font-size: 11.5px; color: var(--hint); }
.award.off b { color: var(--hint); }
.award-sum { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.award-sum > b { font-size: 34px; font-weight: 750; letter-spacing: -.02em; }
.award-sum .bar { flex-basis: 100%; }
.award-detail { text-align: center; }
.award-detail h3 { margin-bottom: 4px; }
.tier { display: inline-block; margin: 4px auto 0; padding: 4px 12px; border-radius: 10px; font-size: 13px; font-weight: 650; }
.tier.t1 { background: #c47c3e22; color: #a8622a; } .tier.t2 { background: #8c96a322; color: #6b7480; } .tier.t3 { background: #f0bd3f2b; color: #a5730a; }
.awards-row { display: block; color: inherit; text-decoration: none; }
.awards-row .medals { display: flex; gap: 6px; margin-top: 10px; }
.awards-row .medal { width: 52px; height: 52px; }

/* окно новой награды */
.awardpop { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px; background: rgba(5, 7, 10, .55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: fade .25s; }
.ap-card { position: relative; overflow: hidden; width: 100%; max-width: 340px; padding: 26px 22px 18px; border-radius: 28px; background: var(--surface); border: 1px solid var(--hair); text-align: center; animation: pop .45s var(--ease); }
.ap-card .medal.big { position: relative; animation: medal-in .7s var(--ease); }
.ap-rays { position: absolute; left: 50%; top: 92px; width: 320px; height: 320px; margin: -160px 0 0 -160px; border-radius: 50%; background: repeating-conic-gradient(from 0deg, var(--accent-soft) 0 10deg, transparent 10deg 20deg); animation: spin 14s linear infinite; mask: radial-gradient(circle, #000 30%, transparent 70%); -webkit-mask: radial-gradient(circle, #000 30%, transparent 70%); }
.ap-kicker { position: relative; font-size: 12.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--accent); }
.ap-card h2 { position: relative; margin: 6px 0 4px; font-size: 22px; }
.ap-card p { position: relative; margin: 0 0 16px; color: var(--hint); font-size: 14.5px; }
.ap-all { display: block; margin-top: 12px; font-size: 14px; color: var(--hint); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
@keyframes medal-in { 0% { transform: scale(.3) rotate(-25deg); opacity: 0; } 60% { transform: scale(1.12) rotate(6deg); opacity: 1; } 100% { transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ap-rays, .ap-card, .ap-card .medal.big { animation: none; } }

/* путь к цели */
.goalcard { display: block; color: inherit; text-decoration: none; }
.gc-path { display: flex; justify-content: space-between; align-items: baseline; margin: 14px 0 8px; font-size: 13.5px; color: var(--hint); }
.gc-path b { font-size: 22px; color: var(--text); }
.gc-bar { height: 10px; }

/* тренер: предложение нормы у клиента */
.proposal { border-color: color-mix(in srgb, var(--accent) 35%, var(--hair)); }
.pr-head { display: flex; gap: 12px; align-items: center; }
.pr-head small { display: block; font-size: 13px; color: var(--hint); margin-bottom: 2px; }
.pr-head b { font-size: 22px; font-weight: 750; letter-spacing: -.01em; }
.pr-diff { font-size: 13px; font-weight: 650; padding: 2px 7px; border-radius: 8px; vertical-align: 3px; margin-left: 4px; }
.pr-diff.up { background: var(--accent-soft); color: var(--accent); } .pr-diff.down { background: var(--warn-soft); color: var(--fat); }
.pr-macros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.pr-macros span { padding: 9px 10px; border-radius: 12px; background: var(--surface-2); font-size: 12.5px; color: var(--hint); }
.pr-macros b { display: block; font-size: 17px; color: var(--text); margin-top: 2px; }
.pr-macros s { font-size: 12px; margin-left: 4px; }
.pr-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* тренер: приглашение и список клиентов */
.invite { background: var(--sheen), linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, var(--surface)), var(--surface) 70%); }
.inv-top { display: flex; gap: 12px; align-items: flex-start; }
.inv-top b { display: block; font-size: 16.5px; margin-bottom: 3px; }
.inv-top small { display: block; font-size: 13.5px; color: var(--hint); line-height: 1.4; }
.inv-link { margin: 14px 0 12px; padding: 11px 13px; border-radius: 12px; background: var(--field); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; user-select: all; }
.inv-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kpis3 { grid-template-columns: repeat(3, 1fr); }
.kpis3 .kpi { padding: 12px 12px; }
.kpis3 .kpi b { font-size: 21px; }
.kpis3 .kpi b small { font-size: 14px; color: var(--hint); font-weight: 600; }
.kpis3 .kpi span { font-size: 12px; line-height: 1.25; display: block; }
.kpi-bad b { color: var(--danger); }
.client { display: flex; gap: 12px; align-items: center; padding: 12px 16px; color: inherit; text-decoration: none; transition: background .15s; }
.client + .client { border-top: 1px solid var(--hair); }
.client:active { background: var(--surface-2); }
.client .t { font-weight: 650; font-size: 15.5px; }
.client .s { font-size: 13px; color: var(--hint); margin-top: 2px; }
.client .s .ic { width: 13px; height: 13px; color: #e2702a; vertical-align: -2px; }
.pills { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.pill { font-size: 11.5px; font-weight: 650; padding: 3px 8px; border-radius: 8px; }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.pill.warn { background: var(--warn-soft); color: color-mix(in srgb, var(--fat) 75%, var(--text)); }
.mini-ring { width: 44px; height: 44px; flex: none; }
.mini-ring circle { fill: none; stroke-width: 3.4; transform: rotate(-90deg); transform-origin: 19px 19px; }
.mini-ring .tr { stroke: var(--field); } .mini-ring .pv { stroke: var(--accent); stroke-linecap: round; } .mini-ring .pv.over { stroke: var(--danger); }
.mini-ring text { font-size: 9.5px; font-weight: 700; fill: var(--text); text-anchor: middle; dominant-baseline: central; }

/* тренер: карточка клиента */
.client-head { display: flex; gap: 14px; align-items: center; margin: 6px 2px 16px; }
.client-head h1 { margin: 0 0 2px; font-size: 26px; }
.avatar.big { width: 56px; height: 56px; font-size: 22px; }
.cbars { display: grid; gap: 9px; margin-top: 14px; }
.cbar { display: grid; grid-template-columns: 74px 1fr 64px; align-items: center; gap: 10px; font-size: 13px; color: var(--hint); }
.cbar b { text-align: right; color: var(--text); font-size: 14px; } .cbar b small { color: var(--hint); font-weight: 500; }
.cbar .bar i { background: var(--accent); } .cbar.p .bar i { background: var(--protein, #6c8cff); } .cbar.f .bar i { background: var(--fat); } .cbar.c .bar i { background: var(--carbs, #b07cf0); }
.mini-ring text { stroke: none; font-size: 8.5px; font-weight: 650; letter-spacing: -.02em; }
.inv-actions .btn, .pr-actions .btn { min-width: 0; padding: 0 10px; }

/* обучение на исправлениях веса */
.pf-list { display: grid; gap: 8px; max-height: 45vh; overflow-y: auto; }
.pf-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); }
.pf-row b { display: block; font-size: 15px; }
.pf-row small { display: block; font-size: 13px; color: var(--hint); margin-top: 2px; }
.pf-row small b { display: inline; font-size: 13px; color: var(--text); }
/* КБЖУ продукта — заметная кнопка правки */
.item button.kc { padding: 6px 10px; margin-left: auto; border-radius: var(--r-sm); color: inherit; background: var(--surface-2);
  border: 1px solid var(--hair); transition: background .15s, transform .15s var(--ease); }
.item button.kc:active { background: var(--accent-soft); transform: scale(.97); }
.item button.kc .pen { width: 13px; height: 13px; margin-left: 5px; vertical-align: -1px; color: var(--accent);
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.item button.kc small { color: var(--text-2); }
.item button.kc small i { font-style: normal; font-weight: 700; margin-left: 4px; }
.item button.kc small i:first-child { margin-left: 0; }
.item button.kc small i.p { color: var(--protein); }
.item button.kc small i.f { color: var(--fat); }
.item button.kc small i.c { color: var(--carbs); }

/* быстрый старт: тихая перерисовка из свежих данных — без повторной анимации появления */
body.quiet #app > * { animation: none !important; }
.bootshell .dayhead { margin-bottom: 18px; }

/* окно «Что нового» */
.news-card { text-align: left; }
.news-card h2 { margin: 6px 0 18px; }
.news-list { display: grid; gap: 14px; margin-bottom: 20px; }
.news-item { display: flex; gap: 12px; align-items: flex-start; }
.news-item b { display: block; font-size: 15.5px; font-weight: 650; }
.news-item small { display: block; font-size: 13.5px; line-height: 1.4; color: var(--hint); margin-top: 2px; }
.news-ic { width: 40px; height: 40px; flex: none; border-radius: 13px; display: grid; place-items: center; }
.news-ic .ic { width: 21px; height: 21px; }
.news-ic.green { background: var(--accent-soft); color: var(--accent); }
.news-ic.blue { background: color-mix(in srgb, var(--protein) 14%, transparent); color: var(--protein); }
.news-ic.amber { background: var(--warn-soft); color: var(--fat); }
