/* ───────── Theme ───────── */
:root {
  --bg: #000000;
  --bg-2: #0a0a0a;
  --card: #111111;
  --card-2: #1b1b1b;
  --line: #252525;
  --text: #f5f5f5;
  --muted: #a3a3a3;
  --faint: #6b6b6b;
  --accent: #22c873;
  --accent-2: #3563ff;
  --grad: linear-gradient(135deg, #10a35a 0%, #0e958f 50%, #2f5cf0 100%);
  --link: #6ee7b7;      /* mint: links and small highlights */
  --ok: #3ddc97;
  --warn: #ffc857;
  --bad: #ff6b81;
  --l1: #3ddc97;
  --l2: #5b9dff;
  --l3: #b06bff;
  --kcal: #f5f5f5;
  --p: #ff8a65;
  --c: #5bc8ff;
  --f: #ffd166;
  --r: 18px;
  --r-sm: 12px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
a { color: inherit; text-decoration: none; }
p a, .center a { color: var(--link); }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; line-height: 1.15; }
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 19px; font-weight: 700; }
p { margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: default; opacity: 0.45; }
ul, ol { margin: 0; padding: 0; list-style: none; }
.icon { flex: none; display: block; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.fine { color: var(--faint); font-size: 13px; margin-top: 10px; }
.center { text-align: center; }
.pad { padding: 24px 0; }
.text-left { text-align: left; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.eyebrow { color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px; }
.label { font-size: 13px; font-weight: 600; color: var(--muted); margin: 6px 0 2px; }
section { margin-top: 26px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-head a { color: var(--link); font-size: 14px; font-weight: 600; }
h2.sub { margin: 24px 0 10px; }

/* ───────── Shell ───────── */
.app { max-width: 560px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; position: relative; }
.screen { padding: calc(18px + var(--safe-t)) 16px 32px; }
.app.with-tabs .screen { padding-bottom: calc(96px + var(--safe-b)); }
.demo-bar ~ .screen { padding-top: 14px; }
.splash { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; align-content: center; gap: 24px; }

.demo-bar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: calc(6px + var(--safe-t)) 12px 6px; font-size: 13px; color: #ffe3a3;
  background: rgba(60, 46, 10, 0.92); backdrop-filter: blur(10px); border-bottom: 1px solid #5a4815;
}
.demo-bar button { padding: 3px 10px; border-radius: 99px; background: #ffc857; color: #1a1300; font-weight: 700; font-size: 12px; }

.tabbar {
  position: fixed; z-index: 40; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 560px; display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 6px calc(6px + var(--safe-b));
  background: rgba(0, 0, 0, 0.86); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; color: var(--faint); font-size: 11px; font-weight: 600; border-radius: 12px; }
.tabbar a.on { color: var(--text); }
.tabbar a.on .icon { color: var(--link); filter: drop-shadow(0 0 8px rgba(46, 211, 150, 0.55)); }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 18px; }
.topbar { display: flex; align-items: center; gap: 8px; margin: -4px 0 16px; }
.topbar-title { flex: 1; text-align: center; font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: var(--muted); flex: none; }
.icon-btn:hover:not(:disabled) { background: var(--card); color: var(--text); }
.icon-btn-spacer { width: 40px; flex: none; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--grad); font-weight: 800; font-size: 15px; color: #fff;
}
.avatar.big { width: 76px; height: 76px; font-size: 26px; }

/* ───────── Cards & buttons ───────── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.card + .card, .card + .btn, .btn + .card, .card + section { margin-top: 12px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px;
  border-radius: 14px; background: var(--card-2); border: 1px solid var(--line); font-weight: 700; font-size: 16px;
}
.btn.primary { background: var(--grad); border: 0; color: #fff; box-shadow: 0 6px 24px -8px rgba(16, 185, 105, 0.7); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 11px; }
.btn.block { display: flex; width: 100%; }
.btn.block + .btn.block { margin-top: 10px; }
.btn + .btn.block, .card + .btn.block { margin-top: 12px; }
.danger-text { color: var(--bad) !important; }
.link-btn { color: var(--link); font-weight: 600; font-size: inherit; }
.link-btn.danger { color: var(--bad); }
.notice { background: rgba(255, 200, 87, 0.1); border: 1px solid rgba(255, 200, 87, 0.3); color: #ffe3a3; padding: 12px 14px; border-radius: var(--r-sm); font-size: 14px; margin-top: 12px; }

.notice-card { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; color: var(--muted); font-size: 15px; }
.notice-card .icon:first-child { color: var(--link); }
.notice-card.static { margin-bottom: 12px; }
.link-card { display: block; }

/* ───────── Forms ───────── */
.form { display: flex; flex-direction: column; gap: 12px; }
.form h2 { margin-bottom: 4px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
label small { font-weight: 400; color: var(--faint); }
input, textarea, select {
  width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; outline: none;
}
textarea { resize: vertical; line-height: 1.4; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 52%, calc(100% - 15px) 52%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(16, 185, 105, 0.25); }
input::placeholder, textarea::placeholder { color: var(--faint); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.form-error { color: var(--bad); font-size: 14px; }
.inline-form { margin-top: 14px; }

.segmented { display: flex; gap: 4px; padding: 4px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 14px; }
.segmented > * { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; border-radius: 10px; font-size: 14px; font-weight: 700; color: var(--muted); }
.segmented > .on { background: var(--card-2); color: var(--text); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset; }
.segmented.small > * { min-height: 34px; font-size: 13px; }

.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 16px; padding: 0 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 8px 16px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); font-size: 14px; font-weight: 600; color: var(--muted); }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }

.switch { flex-direction: row; align-items: center; gap: 8px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch span { width: 44px; height: 26px; border-radius: 99px; background: var(--card-2); border: 1px solid var(--line); position: relative; transition: background 0.2s; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: transform 0.2s, background 0.2s; }
.switch input:checked + span { background: var(--ok); border-color: var(--ok); }
.switch input:checked + span::after { transform: translateX(18px); background: #fff; }
.switch em { font-style: normal; font-size: 12px; color: var(--faint); }

/* ───────── Welcome / auth ───────── */
.welcome, .auth { padding-top: 24px; }
.hero { text-align: center; margin-bottom: 28px; }
.logo-badge {
  display: block; width: 96px; height: 96px; margin: 0 auto 18px; border-radius: 26px; object-fit: cover;
  box-shadow: 0 12px 44px -10px rgba(20, 200, 140, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.15);
}
.hero h1 { font-size: 30px; }
.lead { color: var(--muted); font-size: 17px; margin-top: 8px; }
.feature-list { display: flex; flex-direction: column; gap: 10px; }
.feature-list li { display: flex; gap: 14px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.feature-list b { display: block; margin-bottom: 2px; }
.feature-list span { color: var(--muted); font-size: 14px; }
.feature-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(16, 185, 105, 0.14); color: var(--link); flex: none; }
.welcome-actions { margin-top: 22px; }
.demo-note { display: flex; gap: 8px; align-items: center; color: #ffe3a3; font-size: 14px; margin-bottom: 12px; }
.auth .card { margin-bottom: 16px; }
.auth > .center { margin-top: 4px; }
.card.center { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 28px 20px; }
.join-card .price { font-size: 30px; font-weight: 800; margin: 6px 0 16px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.checks { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.checks li { display: flex; gap: 10px; align-items: center; font-size: 15px; }
.checks .icon { color: var(--ok); }

/* ───────── Home ───────── */
.coach-cta, .chat-cta { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.coach-cta { background: linear-gradient(135deg, rgba(16, 185, 105, 0.16), rgba(47, 92, 240, 0.16)); border-color: rgba(46, 211, 150, 0.35); }
.coach-cta b, .chat-cta b { display: block; }
.coach-cta small, .chat-cta small { color: var(--muted); font-size: 13px; }
.coach-cta-icon { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--grad); color: #fff; flex: none; }
.install-hint { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.install-hint .grow > b { display: block; margin-bottom: 2px; }
.install-hint p { color: var(--muted); font-size: 14px; }
.install-hint p .icon { display: inline-block; vertical-align: -2px; }
.install-hint .btn { margin-top: 10px; }
.install-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--card-2); color: var(--link); flex: none; }
.h-scroll { display: flex; gap: 12px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.h-scroll::-webkit-scrollbar { display: none; }
.h-scroll > * { scroll-snap-align: start; }

/* ───────── Train ───────── */
.part-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.part-tile {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px;
  min-height: 118px; padding: 14px; border-radius: var(--r); border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--tile, var(--card));
}
.part-tile b { font-size: 18px; position: relative; }
.part-tile small { color: rgba(255, 255, 255, 0.72); font-size: 13px; position: relative; }
.part-letter { position: absolute; right: -6px; top: -18px; font-size: 104px; font-weight: 900; line-height: 1; color: rgba(255, 255, 255, 0.1); letter-spacing: -0.06em; }
.tint-violet { --tile: linear-gradient(140deg, #3a2370, #1a1430); }
.tint-blue { --tile: linear-gradient(140deg, #1d3a80, #121a33); }
.tint-teal { --tile: linear-gradient(140deg, #0f5a5a, #0f1f26); }
.tint-orange { --tile: linear-gradient(140deg, #7a3a16, #24150f); }
.tint-pink { --tile: linear-gradient(140deg, #6d1f52, #221021); }
.tint-green { --tile: linear-gradient(140deg, #1c5a35, #10201a); }
.tint-gold { --tile: linear-gradient(140deg, #6b5214, #211c0e); }
.tint-red { --tile: linear-gradient(140deg, #6e1d26, #221012); }

.guide { padding: 0; margin-bottom: 16px; overflow: hidden; }
.guide-head { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; text-align: left; }
.guide-head b { display: block; }
.guide-head small { color: var(--muted); font-size: 13px; }
.guide-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: rgba(61, 220, 151, 0.14); color: var(--ok); flex: none; }
.guide-body { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.guide-row { display: flex; gap: 12px; }
.guide-row p { color: var(--muted); font-size: 14px; }
.tips { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; background: var(--bg-2); border-radius: var(--r-sm); font-size: 14px; color: var(--muted); }
.tips b { color: var(--text); }
.lvl-chip { width: 34px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 12px; font-weight: 800; flex: none; color: #000; }
.lvl-chip.lvl-1 { background: var(--l1); }
.lvl-chip.lvl-2 { background: var(--l2); }
.lvl-chip.lvl-3 { background: var(--l3); }

.intro { margin: -4px 0 16px; text-align: center; }
.level-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; margin-bottom: 16px; overflow-x: auto; }
.level-tab {
  --lc: var(--l1); position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 10px 6px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--card); min-width: 92px;
}
.level-tab span { font-weight: 800; font-size: 15px; }
.level-tab small { font-size: 12px; color: var(--muted); }
.level-tab.lvl-2 { --lc: var(--l2); }
.level-tab.lvl-3 { --lc: var(--l3); }
.level-tab.active { border-color: var(--lc); background: color-mix(in srgb, var(--lc) 14%, var(--card)); box-shadow: 0 0 0 1px var(--lc) inset; }
.level-tab.active span { color: var(--lc); }
.mine-dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--lc); box-shadow: 0 0 8px var(--lc); }

.level-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.level-meta span { display: inline-flex; gap: 6px; align-items: center; }
.level-intro { margin-bottom: 14px; }
.mine-banner { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); font-size: 14px; font-weight: 700; min-height: 38px; }
.today-progress { display: flex; justify-content: space-between; font-size: 14px; font-weight: 700; margin: 18px 0 8px; }
.today-progress .count { color: var(--muted); }
.progress-bar { height: 8px; border-radius: 99px; background: var(--card-2); overflow: hidden; }
.progress-bar i { display: block; height: 100%; border-radius: 99px; background: var(--grad); transition: width 0.35s ease; }

.exercise-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.exercise { padding: 0; overflow: hidden; transition: border-color 0.2s; }
.exercise.done { border-color: rgba(61, 220, 151, 0.4); }
.exercise-row { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; }
.check { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; color: transparent; flex: none; transition: all 0.15s; }
.check.on { background: var(--ok); border-color: var(--ok); color: #06301f; }
.exercise-main { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: left; gap: 2px; }
.ex-name { font-weight: 700; }
.exercise.done .ex-name { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(255, 255, 255, 0.3); }
.ex-dose { font-size: 14px; color: var(--muted); }
.ex-video { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--faint); flex: none; cursor: pointer; }
.ex-video.has { background: var(--grad); color: #fff; padding-left: 2px; }
.exercise-body { padding: 0 14px 16px; }
.cue-title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 14px 0 8px; }
.cues { display: flex; flex-direction: column; gap: 6px; }
.cues li { position: relative; padding-left: 18px; font-size: 15px; }
.cues li::before { content: ""; position: absolute; left: 4px; top: 9px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.ready { display: flex; gap: 12px; margin-top: 16px; background: linear-gradient(135deg, rgba(61, 220, 151, 0.1), rgba(61, 220, 151, 0.03)); border-color: rgba(61, 220, 151, 0.3); }
.ready b { display: block; margin-bottom: 2px; color: var(--ok); }
.ready-icon { color: var(--ok); }

/* ───────── Video ───────── */
.video { position: relative; border-radius: 14px; overflow: hidden; background: #000; margin-bottom: 12px; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video.wide { aspect-ratio: 16 / 9; }
.video.vertical { aspect-ratio: 9 / 16; max-height: 72vh; margin-inline: auto; }
.video.file video { display: block; width: 100%; max-height: 72vh; background: #000; }
.video.ph { aspect-ratio: 16 / 9; display: grid; place-items: center; align-content: center; gap: 8px; color: var(--faint); font-size: 14px; background: var(--bg-2); border: 1px dashed var(--line); }

/* ───────── Meals ───────── */
.meal-list { display: flex; flex-direction: column; gap: 10px; }
.meal-card { display: flex; gap: 14px; align-items: center; padding: 10px; }
.meal-card + .meal-card { margin-top: 0; }
.meal-thumb {
  width: 88px; height: 88px; border-radius: 14px; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(140deg, #3a2a14, #171310); color: #ffd9a8; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
}
.meal-thumb.has-video .icon { width: 34px; height: 34px; padding: 9px 8px 9px 10px; border-radius: 50%; background: rgba(255, 255, 255, 0.16); color: #fff; }
.meal-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.meal-info small { color: var(--muted); font-size: 13px; display: inline-flex; gap: 4px; align-items: center; }
.meal-card.small { flex-direction: column; align-items: stretch; width: 172px; flex: none; padding: 8px; gap: 10px; }
.meal-card.small .meal-thumb { width: 100%; height: 92px; }
.meal-card.small b { font-size: 15px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.macro-pills { display: flex; flex-wrap: wrap; gap: 5px; }
.pill { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 99px; background: var(--card-2); white-space: nowrap; }
.pill.p { color: var(--p); }
.pill.c { color: var(--c); }
.pill.f { color: var(--f); }
.detail-title { margin: 6px 0 6px; }
.macro-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 18px 0 4px; }
.macro-grid > * { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 4px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.macro-grid b { font-size: 20px; font-weight: 800; }
.macro-grid span { font-size: 12px; color: var(--muted); font-weight: 600; }
.macro-grid .p b, .macro-grid .p input { color: var(--p); }
.macro-grid .c b, .macro-grid .c input { color: var(--c); }
.macro-grid .f b, .macro-grid .f input { color: var(--f); }
.macro-grid.editable input { text-align: center; font-size: 20px; font-weight: 800; padding: 4px; background: transparent; border-color: transparent; }
.macro-grid.editable input:focus { border-color: var(--accent); }
.macro-grid + .fine { margin-bottom: 16px; }
.ingredients li, .steps li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.ingredients li:last-child, .steps li:last-child { border-bottom: 0; }
.steps { counter-reset: s; }
.steps li { counter-increment: s; display: flex; gap: 12px; }
.steps li::before { content: counter(s); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--card-2); font-size: 13px; font-weight: 800; flex: none; }

/* ───────── Macros ───────── */
.macro-bars { display: flex; flex-direction: column; gap: 14px; }
.mbar-top { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; color: var(--muted); }
.mbar-top b { color: var(--text); }
.mbar small { display: block; margin-top: 4px; font-size: 12px; color: var(--faint); }
.mbar small.over { color: var(--warn); }
.mbar.p .progress-bar i { background: var(--p); }
.mbar.c .progress-bar i { background: var(--c); }
.mbar.f .progress-bar i { background: var(--f); }
.date-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.date-nav b { font-size: 17px; }
.food-list { display: flex; flex-direction: column; gap: 8px; }
.food { display: flex; align-items: center; gap: 8px; padding: 10px 6px 10px 14px; }
.food + .food { margin-top: 0; }
.food b { display: block; }
.food small { color: var(--muted); font-size: 13px; }
.add-food { margin-bottom: 12px; }
.pick-list { display: flex; flex-direction: column; max-height: 320px; overflow-y: auto; }
.pick-list button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.pick-list li:last-child button { border-bottom: 0; }
.pick-list b { display: block; font-size: 15px; }
.pick-list small { color: var(--muted); font-size: 13px; }
.pick-list .icon { color: var(--link); }
.result { margin-top: 12px; }

/* ───────── Chat ───────── */
.screen.chat-screen { padding: 0; }
.chat { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.demo-bar ~ .chat-screen .chat { height: calc(100dvh - 36px - var(--safe-t)); }
.chat-head { display: flex; align-items: center; gap: 12px; padding: calc(14px + var(--safe-t)) 16px 12px; border-bottom: 1px solid var(--line); background: var(--bg); }
.demo-bar ~ .chat-screen .chat-head { padding-top: 12px; }
.chat-head b { display: block; font-size: 17px; }
.chat-head small { color: var(--muted); font-size: 13px; }
.chat-avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: #fff; flex: none; }
.chat-list { flex: 1; overflow-y: auto; padding: 12px 14px 8px; display: flex; flex-direction: column; gap: 2px; -webkit-overflow-scrolling: touch; }
.day-sep { text-align: center; margin: 14px 0 8px; }
.day-sep span { font-size: 12px; color: var(--faint); background: var(--card); padding: 4px 10px; border-radius: 99px; }
.msg { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; max-width: 86%; }
.msg.grouped { margin-top: 2px; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: var(--card-2); color: var(--muted); flex: none; align-self: flex-start; margin-top: 18px; }
.msg.grouped .msg-avatar { background: transparent; margin-top: 0; }
.msg.coach .msg-avatar:not(:empty) { background: var(--grad); color: #fff; }
.msg-col { display: flex; flex-direction: column; min-width: 0; }
.msg.mine .msg-col { align-items: flex-end; }
.msg-author { font-size: 12px; font-weight: 700; color: var(--muted); margin: 0 0 3px 4px; display: flex; align-items: center; gap: 6px; }
.coach-badge { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 6px; border-radius: 6px; background: var(--grad); color: #fff; }
.bubble { text-align: left; padding: 9px 13px; border-radius: 18px; background: var(--card-2); white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; font-size: 15px; line-height: 1.4; }
.msg.coach .bubble { background: #0e241b; border: 1px solid rgba(46, 211, 150, 0.35); }
.msg.mine .bubble { background: var(--grad); color: #fff; border: 0; }
.msg-meta { font-size: 11px; color: var(--faint); margin: 3px 6px 0; }
.composer {
  position: fixed; z-index: 35; left: 50%; transform: translateX(-50%); width: 100%; max-width: 560px;
  bottom: calc(62px + var(--safe-b)); display: flex; gap: 8px; align-items: flex-end; padding: 8px 12px;
  background: rgba(0, 0, 0, 0.92); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
}
.chat { padding-bottom: calc(128px + var(--safe-b)); }
.composer textarea { flex: 1; resize: none; border-radius: 20px; padding: 10px 16px; max-height: 120px; line-height: 1.35; }
.send-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; flex: none; }

/* ───────── Account ───────── */
.account-head { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 18px; }
.account-head .avatar { margin-bottom: 8px; }
.account-head small { color: var(--muted); }
.kv { display: flex; justify-content: space-between; align-items: center; padding: 6px 0 12px; }
.kv span { color: var(--muted); }
.kv b.ok, .status.ok { color: var(--ok); }
.kv b.warn, .status.warn { color: var(--warn); }

/* ───────── Coach ───────── */
.coach-tabs a { text-decoration: none; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; text-align: center; }
.stat b { display: block; font-size: 24px; font-weight: 800; }
.stat span { font-size: 12px; color: var(--muted); }
.client-list, .edit-list { display: flex; flex-direction: column; gap: 8px; }
.edit-list { margin: 12px 0; }
.client { display: flex; align-items: center; gap: 12px; padding: 12px; }
.client + .client, .edit-row + .edit-row { margin-top: 0; }
.client b, .edit-row b { display: block; }
.client small, .edit-row small { display: block; color: var(--muted); font-size: 13px; }
.edit-row { display: flex; align-items: center; gap: 4px; padding: 8px 6px 8px 14px; }
.edit-row > a.grow, .edit-row > button.grow { padding: 4px 0; }
.ex-row { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 6px 4px 6px 10px; gap: 8px; }
.ex-row .icon-btn { width: 32px; height: 36px; }
.ex-badge { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--card-2); color: var(--faint); flex: none; }
.ex-badge.has { background: rgba(61, 220, 151, 0.16); color: var(--ok); }
.level-editor { padding: 0; overflow: hidden; }
.level-editor + .level-editor { margin-top: 10px; }
.level-editor-head { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; text-align: left; }
.level-editor-head b { display: block; }
.level-editor-head small { color: var(--muted); font-size: 13px; }
.level-editor-body { padding: 4px 16px 16px; border-top: 1px solid var(--line); }
.level-editor-body > .form { padding-top: 12px; }
.level-editor-body > .label { margin-top: 20px; }
.ex-form { background: var(--bg-2); margin: 8px 0; }
.video-field { display: flex; flex-direction: column; gap: 8px; }
.video-field .label { margin: 0; }
.uploaded { display: flex; align-items: center; gap: 8px; color: var(--ok); font-size: 14px; font-weight: 600; }
.file-btn { position: relative; overflow: hidden; flex-direction: row; color: var(--text); cursor: pointer; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-btn.disabled { opacity: 0.5; pointer-events: none; }

/* ───────── States ───────── */
.loading { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 0; color: var(--muted); font-size: 14px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 36px 16px; color: var(--muted); }
.empty b { color: var(--text); }
.empty p { font-size: 14px; max-width: 300px; }
.error-box { border-color: rgba(255, 107, 129, 0.4); display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.error-box p { color: #ffb3bf; }

.toast {
  position: fixed; z-index: 100; left: 50%; transform: translateX(-50%); bottom: calc(92px + var(--safe-b));
  max-width: min(92vw, 480px); padding: 12px 18px; border-radius: 14px; background: #1c1c1c; border: 1px solid var(--line);
  font-size: 14px; font-weight: 600; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); animation: toast-in 0.2s ease;
}
.toast.ok { border-color: rgba(61, 220, 151, 0.5); }
.toast.bad { border-color: rgba(255, 107, 129, 0.6); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

@media (min-width: 600px) {
  .app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ═════════ v2: programs, daily workouts, reminders, check-ins, Ask Coach ═════════ */
.small { font-size: 14px; }
.small-gap { margin: -6px 0 14px; font-size: 14px; }
.lead-sm { margin: 6px 0 16px; }
.pill { display: inline-block; }
.status.muted { color: var(--faint); }

/* Onboarding */
.onboarding { padding-top: 8px; }
.onboarding h1 { margin-bottom: 4px; }
.steps { display: flex; gap: 6px; margin-bottom: 22px; }
.steps i { flex: 1; height: 4px; border-radius: 99px; background: var(--card-2); }
.steps i.on { background: var(--grad); }
.logo-badge.small { width: 56px; height: 56px; border-radius: 18px; font-size: 18px; margin: 0 0 16px; }
.welcome-step { margin-bottom: 22px; }
.welcome-step h1 { margin: 6px 0 12px; }
.welcome-p { color: #d4d4d4; font-size: 16px; line-height: 1.55; margin-bottom: 12px; }
.program-pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 99px; background: rgba(16, 185, 105, 0.14); color: #a7f3d0; font-size: 14px; font-weight: 600; margin-bottom: 16px; }
.preview-card { margin-top: 12px; }

/* Reminders */
.reminders { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.reminders-head { display: flex; gap: 12px; align-items: center; }
.reminders-head b { display: block; }
.reminders-head small { color: var(--muted); font-size: 13px; }
.reminders .notice { margin-top: 0; }
.notif-preview { background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 16px; padding: 10px 14px 12px; backdrop-filter: blur(10px); }
.notif-app { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.notif-icon { width: 20px; height: 20px; border-radius: 6px; display: block; }
.notif-time { margin-left: auto; text-transform: none; }
.notif-preview b { display: block; font-size: 15px; }
.notif-preview p { font-size: 14px; color: #d4d4d4; }
.nudge-wrap { position: relative; }
.nudge-x { position: absolute; top: 14px; right: 16px; font-size: 13px; color: var(--faint); }

/* Home */
.today-card { display: block; margin-bottom: 12px; background: linear-gradient(150deg, rgba(16, 185, 105, 0.22), rgba(47, 92, 240, 0.12) 60%, var(--card)); border-color: rgba(46, 211, 150, 0.4); padding: 18px; }
.today-card h2 { font-size: 24px; margin: 2px 0 10px; display: flex; align-items: center; gap: 8px; }
.today-card.rest { background: var(--card); border-color: var(--line); }
.today-card.rest .muted { margin-bottom: 8px; }
.today-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.today-meta > span:first-child { display: inline-flex; gap: 6px; align-items: center; margin-right: 4px; }
.start-btn { pointer-events: none; }
.see-week { display: inline-flex; align-items: center; gap: 4px; color: var(--link); font-weight: 600; font-size: 14px; }
.coach-cta.alert { background: rgba(255, 200, 87, 0.1); border-color: rgba(255, 200, 87, 0.35); }
.coach-cta.alert .coach-cta-icon { background: #ffc857; color: #1a1300; }
.checkin-cta { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.checkin-cta b { display: block; }
.checkin-cta small { color: var(--muted); font-size: 13px; }
.checkin-cta .coach-cta-icon { background: linear-gradient(135deg, #ff8a65, #ff5c8a); }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.duo .card + .card { margin-top: 0; }
.mini-cta { display: flex; flex-direction: column; gap: 2px; }
.mini-cta .coach-cta-icon { margin-bottom: 8px; }
.mini-cta small { color: var(--muted); font-size: 13px; }

/* Today */
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 12px; }
.week-strip .day { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 9px 0 8px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-size: 12px; font-weight: 700; color: var(--muted); }
.week-strip .day i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.week-strip .day.rest i { background: var(--line); }
.week-strip .day.today { color: var(--text); border-color: rgba(46, 211, 150, 0.5); }
.week-strip .day.on { background: var(--grad); color: #fff; border-color: transparent; }
.week-strip .day.on i { background: #fff; }
.today-part { margin-top: 22px; }
.today-part .exercise-list { margin-top: 0; }
.lvl-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.done-card { display: flex; gap: 12px; align-items: center; margin-top: 14px; background: rgba(61, 220, 151, 0.1); border-color: rgba(61, 220, 151, 0.4); color: var(--ok); }
.done-card b { display: block; color: var(--text); }
.done-card p { color: var(--muted); font-size: 14px; }
.rest-card { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.rest-card > b { font-size: 20px; }
.rest-card .checks { margin: 4px 0 8px; }
.rest-card .btn { margin-top: 0 !important; }

/* Check-ins */
.photo-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.photo-slot { position: relative; aspect-ratio: 3 / 4; border-radius: 14px; border: 1.5px dashed var(--line); background: var(--bg-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); overflow: hidden; cursor: pointer; }
.photo-slot input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-slot.filled { border-style: solid; border-color: var(--ok); }
.photo-slot.filled span { position: absolute; bottom: 6px; padding: 2px 8px; border-radius: 99px; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 12px; }
.tip { margin-top: 0; }
.photo { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 10px; background: var(--card-2); cursor: zoom-in; }
.photo.ph { cursor: default; }
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.checkin-list { display: flex; flex-direction: column; gap: 10px; }
.checkin + .checkin { margin-top: 0; }
.checkin-head { display: flex; align-items: center; gap: 10px; }
.checkin-head small { color: var(--muted); font-size: 13px; flex: 1; }
.checkin-note { margin-top: 10px; color: #d4d4d4; font-size: 15px; }
.compare { margin-bottom: 4px; }
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.compare-grid small { display: block; text-align: center; color: var(--muted); font-size: 13px; margin-top: 6px; }
.change { font-weight: 800; }
.change.down { color: var(--ok); }
.change.up { color: var(--warn); }
.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, 0.92); display: grid; place-items: center; padding: 20px; }
.lightbox img { max-width: 100%; max-height: 90vh; border-radius: 12px; }
.lightbox .icon-btn { position: absolute; top: calc(12px + var(--safe-t)); right: 12px; color: #fff; }

/* Chat + Ask Coach */
.chat-head { flex-direction: column; align-items: stretch; gap: 8px; }
.chat-head .segmented, .ask-tabs .segmented { margin-bottom: 0; }
.chat-head small { font-size: 13px; padding-left: 4px; }
.ask-tabs { margin-bottom: 16px; }
.ask-box b { font-size: 17px; }
.ask-box .muted.small { margin-top: -8px; }
.qa-list { display: flex; flex-direction: column; gap: 10px; }
.qa + .qa { margin-top: 0; }
.qa .q { font-weight: 600; font-size: 16px; }
.qa .a { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--bg-2); border-left: 3px solid var(--accent-2); }
.qa .a .coach-badge { display: inline-block; margin-bottom: 4px; }
.qa .a p { font-size: 15px; color: #d4d4d4; white-space: pre-wrap; }
.qa .waiting { margin-top: 8px; display: inline-flex; gap: 6px; align-items: center; color: var(--warn); font-size: 13px; font-weight: 600; }
.qa .fine { display: block; margin-top: 8px; }
.qa .form { margin-top: 12px; }
.qa .link-btn { margin-top: 8px; font-size: 14px; }
.faq { padding: 0; }
.faq-q { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 14px 16px; font-weight: 600; }
.faq .a { margin: 0 16px 14px; }
.qa-meta { display: flex; align-items: center; gap: 8px; margin: -4px 0 6px; }
.qa-meta small { color: var(--faint); font-size: 12px; flex: 1; }
.check-row { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; font-size: 14px; color: var(--text); }
.check-row input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }

/* Coach */
.chips.coach-tabs a { display: inline-flex; align-items: center; gap: 6px; }
.chips.wrap { flex-wrap: wrap; margin: 0; padding: 0; overflow: visible; }
a.client { color: inherit; }
.client .status { font-size: 13px; font-weight: 700; white-space: nowrap; }
.client .icon { color: var(--faint); }
.client-list li + li { margin-top: 0; }
.quick-levels { font-size: 13px; color: var(--muted); margin: 10px 0 6px; }
.quick-levels .chip { padding: 5px 12px; font-size: 13px; }
.level-rows { display: flex; flex-direction: column; margin-bottom: 10px; }
.level-rows li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.level-rows li:last-child { border-bottom: 0; }
.segmented.mini { margin: 0; padding: 3px; gap: 3px; }
.segmented.mini > * { flex: none; width: 40px; min-height: 32px; }
.segmented.mini > .on.lvl-1 { background: var(--l1); color: #06301f; }
.segmented.mini > .on.lvl-2 { background: var(--l2); color: #071a3a; }
.segmented.mini > .on.lvl-3 { background: var(--l3); color: #1e0838; }
.schedule { display: flex; flex-direction: column; margin: 10px 0 12px; }
.schedule li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.schedule li:last-child { border-bottom: 0; }
.day-label { width: 34px; flex: none; font-weight: 800; font-size: 14px; padding-top: 5px; }
.sched-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip.tiny { padding: 4px 10px; font-size: 12px; }
.rest-tag { font-size: 12px; color: var(--faint); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; margin-left: 4px; }

/* ═════════ v3: food diary, barcode scanner, avatar ═════════ */
body.no-scroll { overflow: hidden; }
.icon-btn.small { width: 34px; height: 34px; }
.ok-text { color: var(--ok); }
.pad-s { padding: 6px 2px 10px; }

/* Diary */
.date-nav { gap: 6px; }
.date-pick { position: relative; flex: 1; align-items: center; gap: 0; color: var(--text); cursor: pointer; }
.date-pick b { font-size: 17px; }
.date-pick small { color: var(--muted); font-size: 12px; font-weight: 500; }
.date-pick input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; padding: 0; border: 0; }
.date-pick input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.today-jump { display: block; margin: -4px auto 12px; color: var(--link); font-size: 13px; font-weight: 700; }
.cal-summary { padding: 16px; }
.cal-top { display: flex; align-items: center; gap: 16px; }
.cal-ring { position: relative; width: 110px; height: 110px; flex: none; }
.cal-ring > div { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.cal-ring b { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.cal-ring small { font-size: 12px; color: var(--muted); font-weight: 600; }
.ring-bg { fill: none; stroke: var(--card-2); stroke-width: 10; }
.ring-fg { fill: none; stroke: var(--accent); stroke-width: 10; stroke-linecap: round; transition: stroke-dasharray 0.4s ease; }
.ring-fg.over { stroke: var(--warn); }
.cal-eq { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cal-eq > div { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; color: var(--muted); }
.cal-eq b { color: var(--text); font-size: 15px; }
.cal-eq .rem { border-top: 1px solid var(--line); padding-top: 6px; }
.cal-eq .rem b { font-size: 18px; color: var(--ok); }
.cal-eq .rem b.over { color: var(--warn); }
.streak { justify-content: flex-start !important; gap: 5px; color: #ffb36b !important; font-weight: 700; font-size: 13px !important; }
.mini-macros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.mm span { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.mm b { display: block; font-size: 15px; margin: 1px 0 6px; }
.mm b small { color: var(--faint); font-weight: 600; font-size: 12px; }
.mm .progress-bar { height: 6px; }
.mm.p .progress-bar i { background: var(--p); }
.mm.c .progress-bar i { background: var(--c); }
.mm.f .progress-bar i { background: var(--f); }
.meal-sec { margin-top: 12px; padding: 12px 14px; }
.meal-sec-head { display: flex; align-items: center; gap: 8px; min-height: 34px; }
.meal-sec-head b { font-size: 17px; flex: 1; }
.sec-kcal { font-weight: 800; font-size: 15px; }
.sec-menu { display: flex; flex-direction: column; margin: 6px -4px 4px; padding: 4px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.sec-menu > button, .sec-menu > label { display: flex; flex-direction: row; align-items: center; gap: 10px; padding: 11px 10px; border-radius: 8px; font-size: 15px; font-weight: 600; color: var(--text); text-align: left; }
.sec-menu > *:hover { background: var(--card); }
.sec-menu .icon { color: var(--link); }
.entries { margin-top: 4px; }
.entries li + li { border-top: 1px solid var(--line); }
.entry { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 0; }
.entry:disabled { opacity: 1; cursor: default; }
.entry b { display: block; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry small { display: block; color: var(--muted); font-size: 13px; }
.entry-kcal { font-weight: 700; font-size: 15px; }
.add-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 6px 0 2px; color: var(--link); font-weight: 700; font-size: 15px; }
.meal-photos { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; }
.meal-photo { position: relative; width: 92px; flex: none; }
.meal-photo .photo { aspect-ratio: 1; border-radius: 12px; }
.ph-x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, 0.65); color: #fff; }
.week-card { margin-top: 12px; }
.week-card .section-head { margin-bottom: 8px; }
.wb-area { position: relative; height: 96px; display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; }
.wb { height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.wb i { display: block; width: 100%; max-width: 30px; min-height: 3px; border-radius: 6px 6px 3px 3px; background: rgba(123, 116, 255, 0.55); }
.wb.on i { background: var(--grad); }
.wb.over i { background: rgba(255, 200, 87, 0.75); }
.goal-line { position: absolute; left: 0; right: 0; border-top: 1.5px dashed rgba(255, 255, 255, 0.3); pointer-events: none; }
.goal-line span { position: absolute; right: 0; top: -16px; font-style: normal; font-size: 10px; color: var(--faint); font-weight: 700; text-transform: uppercase; }
.wb-labels { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; text-align: center; font-size: 11px; color: var(--faint); font-weight: 700; margin-top: 6px; }
.wb-labels .on { color: var(--text); }
.week-avg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 14px; text-align: center; }
.week-avg b { display: block; font-size: 17px; }
.week-avg span { font-size: 11px; color: var(--muted); }
.week-avg .p b { color: var(--p); }
.week-avg .c b { color: var(--c); }
.week-avg .f b { color: var(--f); }

/* Add food */
.slot-chips { margin-bottom: 12px; }
.slot-chips .chip { padding: 7px 14px; }
.search-row { display: flex; gap: 8px; margin-bottom: 14px; }
.search-box { position: relative; flex: 1; flex-direction: row; align-items: center; gap: 0; color: var(--muted); }
.search-box > .icon { position: absolute; left: 14px; pointer-events: none; }
.search-box input { padding-left: 42px; padding-right: 40px; height: 50px; border-radius: 14px; }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-box .clear { position: absolute; right: 8px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--card-2); color: var(--muted); }
.scan-btn { width: 54px; height: 50px; flex: none; border-radius: 14px; display: grid; place-items: center; background: var(--grad); color: #fff; }
.quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.qa-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; font-size: 13px; }
.qa-btn + .qa-btn { margin-top: 0; }
.qa-btn .icon { color: var(--link); }
.res-h { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 16px 0 6px; display: flex; gap: 8px; align-items: baseline; }
.res-h small { text-transform: none; letter-spacing: 0; color: var(--faint); font-weight: 600; }
.results > .res-h:first-child { margin-top: 0; }
.food-results { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.food-row { display: flex; align-items: center; gap: 6px; padding: 0 8px 0 14px; }
.food-row + .food-row { border-top: 1px solid var(--line); }
.fr-main { text-align: left; padding: 11px 0; min-width: 0; }
.fr-main b { display: block; font-size: 15px; font-weight: 600; line-height: 1.3; }
.fr-main small { display: block; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fr-kcal { font-weight: 800; font-size: 15px; text-align: right; min-width: 44px; }
.fr-kcal small { display: block; font-size: 10px; color: var(--faint); font-weight: 600; margin-top: -2px; }
.fr-add { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: rgba(16, 185, 105, 0.16); color: var(--link); flex: none; }
.fr-add:active { background: var(--accent); color: #fff; }
.results > .btn.block { margin-top: 14px; }
.add-food-view .chips .chip { white-space: nowrap; }
.added-bar {
  position: fixed; z-index: 45; left: 50%; transform: translateX(-50%); bottom: calc(74px + var(--safe-b)); width: calc(100% - 24px); max-width: 536px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 8px 8px 16px; border-radius: 16px;
  background: #1f2a24; border: 1px solid rgba(61, 220, 151, 0.45); color: var(--ok); font-weight: 700; font-size: 14px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.added-bar span { display: flex; align-items: center; gap: 8px; }
.add-food-view { padding-bottom: 60px; }

/* Bottom sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 150; background: rgba(0, 0, 0, 0.6); display: flex; align-items: flex-end; justify-content: center; animation: fade-in 0.15s ease; }
.sheet { width: 100%; max-width: 560px; max-height: 92vh; max-height: 92dvh; overflow-y: auto; background: var(--bg-2); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 22px 22px 0 0; padding: 6px 16px calc(20px + var(--safe-b)); animation: sheet-up 0.22s ease; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin: 0 -6px 4px 0; min-height: 44px; }
.sheet-head b { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0.4; } }
@keyframes fade-in { from { opacity: 0; } }
.food-sheet h2 { font-size: 21px; margin-bottom: 4px; }
.food-numbers { display: flex; align-items: center; gap: 16px; margin: 16px 0; }
.macro-ring { position: relative; width: 84px; height: 84px; flex: none; }
.macro-ring > div { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.macro-ring b { font-size: 20px; font-weight: 800; line-height: 1; }
.macro-ring small { font-size: 11px; color: var(--muted); }
.macro-ring .ring-bg { stroke-width: 8; }
.seg { fill: none; stroke-width: 8; }
.seg.p { stroke: var(--p); } .seg.c { stroke: var(--c); } .seg.f { stroke: var(--f); }
.food-macros { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; text-align: center; }
.food-macros b { display: block; font-size: 18px; }
.food-macros span { display: block; font-size: 12px; color: var(--muted); }
.food-macros small { font-size: 11px; color: var(--faint); }
.food-macros .p b { color: var(--p); } .food-macros .c b { color: var(--c); } .food-macros .f b { color: var(--f); }
.grid-serving { display: grid; grid-template-columns: 1fr 110px; gap: 10px; margin-bottom: 14px; }
.food-sheet .slot-chips { margin-bottom: 14px; }

/* Barcode scanner */
.scanner { position: fixed; inset: 0; z-index: 160; background: #000; display: flex; flex-direction: column; }
.scanner-top { display: flex; align-items: center; justify-content: space-between; padding: calc(8px + var(--safe-t)) 8px 8px; color: #fff; }
.scanner-top .icon-btn { color: #fff; }
.scanner-view { position: relative; flex: 1; overflow: hidden; }
.scanner-view video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner-frame { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.scanner-frame i { width: min(78vw, 340px); height: min(42vw, 180px); border-radius: 18px; border: 3px solid rgba(255, 255, 255, 0.9); box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.45); }
.scanner-hint { position: absolute; left: 0; right: 0; bottom: 18px; text-align: center; color: #fff; font-weight: 600; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8); }
.scanner-nocam { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; color: var(--muted); }
.scanner-nocam .icon { color: var(--link); }
.scanner-actions { padding: 14px 16px calc(16px + var(--safe-b)); background: var(--bg-2); display: flex; flex-direction: column; gap: 10px; }
.scanner-type { display: flex; gap: 8px; }
.scanner-type input { flex: 1; }
.scanner-msg { color: #ffe3a3; font-size: 14px; text-align: center; }

/* Avatar */
.avatar-img svg { display: block; width: 100%; height: 100%; }
.avatar.has-img { background: radial-gradient(circle at 50% 30%, #17302a, #0b0b0b 70%); overflow: hidden; padding: 0; }
.avatar.has-img .avatar-img { width: 100%; height: 100%; }
.avatar-hero { position: relative; display: flex; flex-direction: column; align-items: center; padding: 8px 0 4px;
  background: radial-gradient(ellipse at 50% 55%, rgba(123, 116, 255, 0.22), transparent 65%); }
.avatar-hero > .avatar-img { width: 220px; height: 440px; }
.hero-cta { position: absolute; left: 0; right: 0; bottom: 40px; margin: 0 auto; max-width: 320px; text-align: center; padding: 14px; border-radius: 16px; background: rgba(16, 16, 24, 0.88); border: 1px solid var(--line); backdrop-filter: blur(8px); }
.hero-cta b { display: block; }
.hero-cta p { color: var(--muted); font-size: 14px; margin: 2px 0 10px; }
.body-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 10px; }
.body-stats > div { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 6px; text-align: center; }
.body-stats b { display: block; font-size: 22px; font-weight: 800; }
.body-stats span { font-size: 12px; color: var(--muted); }
.range-pill { display: inline-block; padding: 5px 12px; border-radius: 99px; background: rgba(61, 220, 151, 0.12); color: var(--ok); font-size: 13px; font-weight: 700; margin-bottom: 14px; }
.avatar-story { margin-top: 14px; }
.story-cols { display: grid; gap: 6px; }
.story-cols.n2 { grid-template-columns: repeat(2, 1fr); }
.story-cols.n3 { grid-template-columns: repeat(3, 1fr); }
.story-col { text-align: center; padding: 8px 2px 10px; border-radius: 14px; background: var(--bg-2); }
.story-col .avatar-img { height: 200px; }
.story-col b { display: block; margin-top: 4px; }
.story-col small { display: block; color: var(--muted); font-size: 12px; }
.story-col.goal { background: linear-gradient(180deg, rgba(16, 185, 105, 0.14), rgba(47, 92, 240, 0.1)); border: 1px solid rgba(46, 211, 150, 0.35); }
.story-col.goal .avatar-img { filter: drop-shadow(0 0 10px rgba(150, 130, 255, 0.55)); }
.avatar-story.compact .story-col .avatar-img { height: 170px; }
.scrub { margin-top: 16px; }
.scrub-view { display: flex; align-items: center; gap: 14px; }
.scrub-view .avatar-img { width: 110px; height: 220px; flex: none; }
.scrub-view b { display: block; font-size: 20px; }
.scrub-view small { color: var(--muted); }
.scrub input[type="range"] { padding: 0; height: 32px; background: transparent; border: 0; accent-color: var(--accent); box-shadow: none; }
.scrub-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--faint); }
.tip-card { margin-top: 14px; font-size: 14px; }
.avatar-editor { padding-bottom: 8px; }
.editor-preview { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; margin: 0 -16px 12px; padding: 8px 16px 10px;
  background: linear-gradient(180deg, var(--bg) 85%, rgba(0, 0, 0, 0)); }
.demo-bar ~ .screen .editor-preview { top: 36px; }
.editor-preview .avatar-img { width: 100px; height: 200px; flex: none; background: radial-gradient(ellipse at 50% 55%, rgba(123, 116, 255, 0.2), transparent 70%); }
.editor-stats b { display: block; font-size: 17px; }
.editor-stats small { color: var(--muted); font-size: 13px; }
.editor-tabs { margin-bottom: 12px; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 12px; }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.15); }
.swatch.on { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent); border-color: transparent; }
.style-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 6px; }
.style-tile { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px 8px; border-radius: 14px; background: var(--bg-2); border: 1.5px solid var(--line); font-size: 12px; font-weight: 600; color: var(--muted); }
.style-tile .avatar-img { width: 58px; height: 62px; }
.style-tile.on { border-color: var(--accent); color: var(--text); background: rgba(16, 185, 105, 0.12); }
.editor-save { margin-top: 14px; }
.avatar-card { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; padding: 12px 16px 12px 8px;
  background: linear-gradient(135deg, rgba(16, 185, 105, 0.12), rgba(47, 92, 240, 0.08) 60%, var(--card)); }
.avatar-card .avatar-img { width: 76px; height: 150px; flex: none; }
.avatar-card b { display: block; font-size: 16px; }
.avatar-card small { display: block; color: var(--muted); font-size: 13px; }
.avatar-card small.change.down { color: var(--ok); }
.avatar-card small.change.up { color: var(--warn); }
.avatar-card .see-week { margin-top: 8px; }
.avatar-compare { margin-top: 10px; }
.avatar-compare .avatar-img { height: 190px; background: var(--bg-2); border-radius: 10px; }

/* Coach: client food */
.food-days li + li { border-top: 1px solid var(--line); }
.food-days a { display: flex; align-items: center; gap: 10px; padding: 9px 0; font-size: 14px; }
.fd-day { width: 96px; flex: none; font-weight: 700; }
.fd-num { flex: 1; color: var(--text); }
.fd-num.p { color: var(--p); }
.fd-num em { font-style: normal; font-size: 12px; color: var(--faint); font-weight: 700; }
.fd-num em.ok { color: var(--ok); }
.fd-num em.over { color: var(--warn); }
.fd-none { flex: 2; color: var(--faint); }
.food-days .icon { color: var(--faint); }
.app:has(.added-bar) .toast { bottom: calc(146px + var(--safe-b)); }
.gear-chips { margin: 4px 0 12px !important; }
.avatar-hero { background: none; }
.avatar-hero > .avatar-img { width: 250px; height: 548px; }
.editor-preview .avatar-img { background: none; }
.editor-preview .avatar-img { width: 124px; height: 272px; }
.avatar-card .avatar-img { width: 84px; height: 184px; margin: -6px -4px; }
.story-col .avatar-img { height: 230px; }

/* v4: logo, add a client, client info */
.splash .logo-badge { margin-bottom: 22px; }
.btn.add-client { margin-bottom: 4px; }
.avatar.invite-dot { background: rgba(255, 196, 80, 0.14); color: var(--warn); }
.invite-text { font-size: 15px; line-height: 1.45; }
.note-text { display: flex; gap: 6px; align-items: flex-start; margin-top: 4px; }
.note-text .icon { flex: none; margin-top: 2px; }
.info-card .kv { gap: 10px; }
.info-card .kv b { text-align: right; }
.info-card .kv b small { color: var(--faint); font-weight: 500; margin-left: 4px; }
.kv b.contact { display: inline-flex; align-items: center; gap: 4px; min-width: 0; word-break: break-all; }
.icon-btn.small { width: 32px; height: 32px; min-width: 32px; color: var(--link); }
.pill .icon { vertical-align: -2px; }
.stats-fields { gap: 10px; }
.stats-fields .segmented { margin-bottom: 0; }
.section-head .pill { display: inline-flex; align-items: center; gap: 4px; }

/* v5: coach notifications */
.pick-people { display: flex; flex-direction: column; gap: 6px; }
.pick-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-radius: 12px; cursor: pointer; }
.pick-row input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.pick-row b { display: block; font-size: 15px; }
.pick-row small { display: block; font-size: 12px; color: var(--faint); }
.pick-row small.ok { color: var(--ok); }
.result-card small { color: var(--muted); }
.account-head .notify-one { margin-top: 8px; }
.notify .notif-preview { margin-top: 2px; }

/* v6: meals with photos + ingredient builder */
.meal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.meal-tile { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.meal-tile .mt-photo { position: relative; aspect-ratio: 1 / 1; background: var(--card-2); overflow: hidden; }
.meal-tile .mt-photo .meal-photo { position: absolute; inset: 0; width: 100%; height: 100%; }
.mt-play { position: absolute; right: 8px; bottom: 8px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, 0.6); color: #fff; padding-left: 2px; }
.mt-info { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; }
.mt-info b { font-size: 15px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mt-info small { color: var(--muted); font-size: 13px; }
.mt-info .p { color: var(--p); font-weight: 600; }
.meal-tile.small { width: 160px; flex: none; }
.meal-photo { display: block; width: 100%; height: 100%; object-fit: cover; }
.meal-photo.ph { display: grid; place-items: center; color: var(--faint); background: radial-gradient(circle at 50% 35%, #15291f, #0d0d0d 75%); }
.meal-photo.hero { width: calc(100% + 32px); margin: -4px -16px 14px; height: auto; aspect-ratio: 4 / 3; border-radius: 0; }
.meal-photo.hero.ph { aspect-ratio: 16 / 9; }
.meal-photo.mini { width: 46px; height: 46px; border-radius: 10px; flex: none; }
.meal-photo-field { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.mpf-preview { position: relative; width: 100%; border-radius: 14px; overflow: hidden; aspect-ratio: 4 / 3; background: var(--card-2); }
.mpf-preview .meal-photo { position: absolute; inset: 0; width: 100%; height: 100%; }
.mpf-remove { position: absolute; top: 8px; right: 8px; background: rgba(0, 0, 0, 0.6); color: #fff; }
.meal-form .chips.wrap { margin-bottom: 2px; }
.ing-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 4px; }
.ing-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ing-list b { display: block; font-size: 14px; line-height: 1.3; }
.ing-list small { color: var(--muted); font-size: 12px; }
.ing-cal { font-weight: 700; font-size: 15px; text-align: right; white-space: nowrap; }
.ing-cal small { display: block; font-size: 11px; color: var(--faint); font-weight: 500; }
.ing-total { font-size: 14px; color: var(--muted); margin: 6px 0 10px; line-height: 1.6; }
.ing-total b { color: var(--text); }
.ing-sheet { display: flex; flex-direction: column; gap: 10px; }
.ing-results { display: flex; flex-direction: column; }
.ing-hit { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.ing-hit b { display: block; font-size: 15px; font-weight: 600; line-height: 1.3; }
.ing-hit small { color: var(--muted); font-size: 12px; }
.ing-preview { font-size: 15px; color: var(--muted); margin: 4px 0 12px; }
.ing-preview b { color: var(--text); }
.ok-pill { color: var(--ok); display: inline-flex; align-items: center; gap: 4px; }

/* v7: bell button on the client home */
.head-actions { display: flex; align-items: center; gap: 8px; }
.bell-btn { position: relative; width: 42px; height: 42px; border-radius: 50%; background: var(--card); border: 1px solid var(--line); color: var(--text); }
.bell-dot { position: absolute; top: 8px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--bg), 0 0 10px rgba(34, 200, 115, 0.8); }
