:root {
  --bg: #0a0b0d; --surface: #141619; --surface-2: #1d2025; --line: #272b32; --track: #262a31;
  --text: #f3f5f7; --muted: #8e97a5;
  --accent: #c6f432; --accent-ink: #0b0d05; --accent-text: #c6f432;
  --good: #34d399; --bad: #f87171; --warn: #fbbf24; --recovery: #fbbf24; --water: #38bdf8; --protein: #fb923c; --steps: #a78bfa;
  --radius: 18px;
  --safe-t: env(safe-area-inset-top); --safe-b: env(safe-area-inset-bottom);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f2f3f5; --surface: #ffffff; --surface-2: #f1f3f5; --line: #e3e6ea; --track: #e6e8ec;
    --text: #0b0d10; --muted: #677080; --accent: #b5e61d; --accent-text: #4b7a00;
    --good: #059669; --bad: #dc2626; --warn: #d97706; --recovery: #facc15; --water: #0284c7; --protein: #ea580c;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); line-height: 1.4;
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Noto Sans Arabic", Tahoma, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none;
}
[dir=rtl] * { letter-spacing: 0 !important; } /* letter-spacing breaks Arabic joining */
[dir=rtl] :is(b, small, .pr-val, .target, .set-chips span) { unicode-bidi: plaintext; } /* "2.5/3 L" stays in order */
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--accent-text); }
button { font: inherit; }
#app { max-width: 560px; margin: 0 auto; }
html.lock, html.lock body { overflow: hidden; }
.ic { width: 22px; height: 22px; flex: none; vertical-align: -5px; }
.btn .ic, .link .ic, .note .ic, .hint .ic, .machine .ic, .targets .ic, .callout .ic { width: 18px; height: 18px; }
[dir=rtl] .flip { transform: scaleX(-1); }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }
.good, .ok { color: var(--good); } .bad { color: var(--bad); } .warn { color: var(--warn); }

/* Layout */
.page { padding: calc(var(--safe-t) + 14px) 16px calc(100px + var(--safe-b)); }
.head { display: flex; align-items: center; gap: 12px; margin: 4px 0 16px; }
.head-t { min-width: 0; }
.head h1 { font-size: 28px; line-height: 1.15; letter-spacing: -.02em; }
.sub { color: var(--muted); margin-top: 4px; font-size: 14px; }
.tabbar {
  position: fixed; bottom: 0; inset-inline: 0; max-width: 560px; margin: 0 auto; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px 6px calc(6px + var(--safe-b));
  background: color-mix(in srgb, var(--bg) 84%, transparent); backdrop-filter: saturate(1.5) blur(18px); -webkit-backdrop-filter: saturate(1.5) blur(18px);
  border-top: 1px solid var(--line);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 50px; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; border-radius: 12px; }
.tabbar a.on { color: var(--text); }
.tabbar a.on .ic { color: var(--accent-text); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 12px; }
.card h2 { font-size: 18px; margin-bottom: 10px; }
.card h3 { font-size: 16px; margin: 16px 0 8px; display: flex; align-items: center; gap: 8px; }
.card h3:first-child, .card .row h3 { margin-top: 0; }
.card .row h2, .card .row h3 { margin-bottom: 0; }
.card > .row.between:first-child { margin-bottom: 10px; }
.card > a.row { color: inherit; text-decoration: none; }
.card.hero { background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 13%, var(--surface)) 0%, var(--surface) 60%); }
.card.list { padding: 2px 0; }
.card.soft { background: var(--surface-2); }
.card.warn-card { border-color: color-mix(in srgb, var(--warn) 50%, var(--line)); }
.card.danger-card { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.card.danger-card h4 { margin: 12px 0 4px; font-size: 14px; }
.card.danger-card ul { margin: 0; padding-inline-start: 18px; font-size: 14px; line-height: 1.5; }
.card ul:not(.plist):not(.ticks):not(.x):not(.ing) { margin: 6px 0 0; padding-inline-start: 18px; line-height: 1.5; font-size: 15px; }
.eyebrow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.eyebrow.ok { color: var(--good); } .eyebrow.warn { color: var(--warn); }
.eyebrow .ic { width: 16px; height: 16px; }
.xl { font-size: 27px; letter-spacing: -.02em; margin-bottom: 4px; }
.card h2.xl { margin-bottom: 4px; }
.big { font-size: 28px; font-weight: 800; margin: 4px 0; font-variant-numeric: tabular-nums; }
.sec { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 24px 4px 8px; }
.tag { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 99px; background: var(--surface-2); text-transform: none; letter-spacing: 0; }
.tag.warn { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.tag.bad { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }

/* Buttons */
.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 11px 16px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font-weight: 650; font-size: 15px; text-decoration: none; cursor: pointer;
  transition: transform .08s ease, background .15s;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.danger:not(.ghost) { background: color-mix(in srgb, var(--bad) 14%, var(--surface)); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn.block { display: flex; width: 100%; margin-top: 10px; }
.btn.lg { min-height: 56px; font-size: 17px; border-radius: 16px; }
.btn.sm { min-height: 38px; padding: 7px 12px; font-size: 14px; }
.btn:disabled { opacity: .4; }
.btn.grow { flex: 1; }
.link { background: none; border: 0; padding: 6px 0; min-height: 36px; color: var(--accent-text); font-weight: 650; font-size: 14px; text-decoration: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.icon-btn { flex: none; width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); cursor: pointer; }
.icon-btn.sm { width: 34px; height: 34px; background: transparent; border: 0; color: var(--muted); }
.icon-btn.sm .ic { width: 18px; height: 18px; }
.icon-btn:disabled { opacity: .3; }
.mini { flex: none; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); border-radius: 10px; font-size: 13px; font-weight: 700; padding: 5px 10px; min-height: 30px; cursor: pointer; }
.row { display: flex; align-items: center; }
.between { justify-content: space-between; gap: 10px; }
.gap { gap: 8px; margin-top: 8px; }
.wrap { flex-wrap: wrap; }
.plain { background: none; border: 0; color: inherit; width: 100%; padding: 0; cursor: pointer; text-align: start; }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.btn-grid.col { grid-template-columns: 1fr; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }

/* Stats */
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.card.stats3 { padding: 10px; }
.stats3 > div, .stats-grid > div { background: var(--surface-2); border-radius: 14px; padding: 10px 12px; min-width: 0; }
.stats3 b, .stats-grid b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats3 small, .stats-grid small { color: var(--muted); font-size: 12px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.hint { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: 14px; margin: 10px 0; line-height: 1.4; }
.hint .ic { color: var(--protein); margin-top: 1px; }
.mot { display: flex; gap: 8px; margin-top: 8px; font-size: 14px; }
.mot::before { content: '•'; color: var(--accent-text); font-weight: 900; }

/* Daily progress */
.daily { display: flex; gap: 16px; align-items: center; margin: 6px 0 4px; }
.score { position: relative; flex: none; width: 96px; height: 96px; }
.score-t { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.score-t b { font-size: 22px; font-variant-numeric: tabular-nums; }
.score-t small { font-size: 10px; color: var(--muted); max-width: 64px; line-height: 1.15; margin-inline: auto; }
.metrics { flex: 1; display: grid; gap: 10px; min-width: 0; }
.m-top { display: flex; align-items: center; gap: 6px; font-size: 13px; margin-bottom: 5px; }
.m-top .ic { width: 16px; height: 16px; }
.m-top span { color: var(--muted); }
.m-top b { margin-inline-start: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }
.m-top .mini { padding: 3px 8px; min-height: 26px; font-size: 12px; }
.metric.water .ic { color: var(--water); } .metric.water .bar i { background: var(--water); }
.metric.protein .ic { color: var(--protein); } .metric.protein .bar i { background: var(--protein); }
.metric.steps .ic { color: var(--steps); } .metric.steps .bar i { background: var(--steps); }
.bar { height: 6px; background: var(--track); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .4s; }
.bar.thick { height: 10px; margin: 12px 0 6px; }
.bar.over i { background: var(--warn); }
.kv-row { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; margin-top: 12px; }
.kv-row b { color: var(--text); margin-inline-start: 4px; }
.ring .r-track { fill: none; stroke: var(--track); }
.ring .r-val { fill: none; stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .6s; }

/* Journey */
.journey { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; text-align: center; margin: 6px 0; }
.journey.sm { grid-template-columns: repeat(4, 1fr); }
.journey small { display: block; color: var(--muted); font-size: 12px; }
.journey b { font-size: 20px; font-variant-numeric: tabular-nums; }
.journey .cur b { font-size: 26px; color: var(--accent-text); }
.trend { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 4px; }
.trend > div { background: var(--surface-2); border-radius: 12px; padding: 8px 12px; }
.trend small { display: block; color: var(--muted); font-size: 12px; }
.trend b { font-size: 17px; font-variant-numeric: tabular-nums; }

/* Charts */
.chart { width: 100%; height: auto; display: block; margin-top: 8px; overflow: visible; direction: ltr; }
.c-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.c-area { fill: var(--accent); opacity: .12; }
.c-dot { fill: var(--accent); }
.c-goal { stroke: var(--muted); stroke-dasharray: 4 4; stroke-width: 1; }
.c-lbl { font-size: 10px; font-weight: 700; fill: var(--text); font-family: inherit; }
.c-lbl.muted { fill: var(--muted); font-weight: 500; }
.c-bar { fill: var(--accent); }
.chart-empty { color: var(--muted); font-size: 14px; text-align: center; padding: 20px 8px; }

/* Segmented control & chips */
.seg { display: flex; gap: 4px; padding: 4px; margin-bottom: 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar, .chips::-webkit-scrollbar, .s-nav::-webkit-scrollbar { display: none; }
.seg a, .seg button { flex: 1; padding: 9px 10px; border-radius: 10px; border: 0; background: none; color: var(--muted); font-weight: 650; font-size: 14px; text-align: center; text-decoration: none; white-space: nowrap; cursor: pointer; }
.seg .on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.seg.sm { margin: 0; padding: 3px; }
.seg.sm button { padding: 6px 10px; font-size: 13px; }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 10px; scrollbar-width: none; }
.card .chips { margin: 10px 0 0; padding: 0; flex-wrap: wrap; }
.chip { flex: none; min-height: 38px; padding: 8px 14px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); color: var(--text); font-size: 14px; font-weight: 550; cursor: pointer; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }

/* Lists */
.list-row, .ex-row, .p-row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 10px 16px;
  background: none; border: 0; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; text-align: start; cursor: pointer;
}
.card:not(.list) .list-row, .card:not(.list) .ex-row, .list .list .ex-row { padding-inline: 0; }
.list > :last-child, .card > .list-row:last-child, .card > .ex-row:last-child { border-bottom: 0; }
.list-row > div, .ex-row > div { flex: 1; min-width: 0; }
.list-row b, .ex-row b { font-weight: 650; }
.list-row small, .ex-row small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.list-row > .ic, .ex-row > .ic { color: var(--muted); width: 18px; }
.link-row { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; margin: 6px 0; }
.link-row > div { flex: 1; min-width: 0; }
.link-row h2 { margin: 0 0 2px; }
.link-row small { display: block; }
.card.link-row { padding: 14px 16px; margin: 0 0 12px; }
.pr-val { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.p-row span { flex: none; max-width: 48%; }
.p-row b { flex: 1; text-align: end; font-weight: 500; font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-row .ic { color: var(--muted); width: 18px; }
.plist { margin: 0; padding-inline-start: 18px; }
.plist li { margin: 0 0 6px; line-height: 1.45; font-size: 15px; }
.thumb { position: relative; flex: none; width: 52px; height: 52px; border-radius: 12px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; }
.thumb::before { content: attr(data-e); font-size: 24px; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #fff; }
.lvl { display: flex; gap: 2px; flex: none; }
.lvl i { width: 4px; height: 12px; border-radius: 2px; background: var(--track); }
.lvl.l1 i:first-child, .lvl.l2 i:nth-child(-n+2), .lvl.l3 i { background: var(--accent-text); }
.group { margin-bottom: 16px; }
.group-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 0 4px 6px; font-size: 14px; }
.group-h span { color: var(--muted); font-size: 13px; text-align: end; }
.group > .list-row { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 6px; padding: 12px 14px; }
.empty { color: var(--muted); text-align: center; padding: 18px 8px; font-size: 14px; }

/* Exercise */
.media { position: relative; aspect-ratio: 4 / 3; background: #fff; border-radius: var(--radius); overflow: hidden; margin: 0 0 12px; border: 1px solid var(--line); }
.media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.media .f2 { animation: flip 2.8s ease-in-out infinite; }
@keyframes flip { 0%, 38% { opacity: 0; } 50%, 88% { opacity: 1; } 100% { opacity: 0; } }
.media.ph { display: grid; place-items: center; aspect-ratio: 16 / 7; background: linear-gradient(145deg, var(--surface-2), var(--surface)); }
.media.ph::before { content: attr(data-e); font-size: 56px; }
.media.ph img { display: none; }
@media (prefers-reduced-motion: reduce) { .media .f2 { animation: none; opacity: 0; } }
.machine, .targets { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; color: var(--muted); margin: 6px 0 10px; }
.how h4 { font-size: 13px; font-weight: 700; color: var(--muted); margin: 14px 0 4px; text-transform: uppercase; letter-spacing: .04em; }
.how p, .how li { font-size: 15px; line-height: 1.5; }
.how ol, .how ul { margin: 0; padding-inline-start: 20px; }
.how li { margin-bottom: 4px; }
ul.x li::marker { content: '✕  '; color: var(--bad); }
ul.ticks { margin: 0; padding-inline-start: 22px; line-height: 1.6; }
ul.ticks li::marker { content: '✓  '; color: var(--good); }
.callout { background: var(--surface-2); border-radius: 14px; padding: 12px 14px; margin: 0 0 12px; font-size: 14px; line-height: 1.45; }
.callout p + p { margin-top: 6px; }
.callout .ic { margin-inline-end: 6px; vertical-align: -4px; }
.callout.knee { background: color-mix(in srgb, var(--warn) 11%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
.callout.knee .ic { color: var(--warn); }
.callout.bad { background: color-mix(in srgb, var(--bad) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); }
.callout.small { font-size: 13px; padding: 10px 12px; }
.note { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-radius: 12px; padding: 10px 12px; margin: 8px 0; font-size: 14px; }
.note .ic { color: var(--accent-text); margin-inline-end: 4px; }
.disclaimer { font-size: 13px; color: var(--muted); line-height: 1.45; margin: 10px 0 12px; }
.disclaimer .ic { width: 16px; height: 16px; vertical-align: -3px; }
.credit { font-size: 11px; color: var(--muted); text-align: center; margin: 12px 0; }
.tbl-wrap { overflow-x: auto; margin: 8px 0; }
.tbl { border-collapse: collapse; width: 100%; font-size: 13px; }
.tbl th, .tbl td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 650; white-space: nowrap; }

/* Plan */
.start-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile { display: grid; align-content: start; gap: 4px; min-height: 78px; padding: 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); text-align: start; cursor: pointer; }
.tile b { font-size: 15px; }
.tile small { color: var(--muted); font-size: 12px; line-height: 1.3; }
.tile:disabled { opacity: .45; }
.week { display: grid; gap: 2px; }
.week-row { display: grid; grid-template-columns: 1fr 1.2fr 64px; align-items: center; gap: 8px; min-height: 48px; padding: 8px 10px; border-radius: 12px; background: none; border: 0; color: inherit; text-align: start; cursor: pointer; }
.week-row.today { background: var(--surface-2); }
.wd { font-weight: 650; }
.wd small { color: var(--muted); font-weight: 400; margin-inline-start: 4px; }
.wk { font-size: 14px; color: var(--muted); }
.wk.k-gym { color: var(--text); font-weight: 650; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
.st-gym.dot { background: var(--good); } .st-cardio.dot { background: var(--water); } .st-recovery.dot { background: var(--recovery); }
.st-rest.dot { background: var(--surface-2); border: 1px solid var(--muted); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 10px; }
.cal-h { font-size: 11px; color: var(--muted); text-align: center; padding: 4px 0; overflow: hidden; }
.cal-d { aspect-ratio: 1; border: 0; border-radius: 10px; background: var(--surface-2); color: var(--text); font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; cursor: pointer; padding: 0; }
.cal-d.st-gym { background: var(--good); color: #032416; }
.cal-d.st-cardio { background: var(--water); color: #03202f; }
.cal-d.st-recovery { background: var(--recovery); color: #2b1d00; }
.cal-d.st-future { background: transparent; border: 1px dashed var(--line); color: var(--muted); }
.cal-d.out { opacity: .35; }
.cal-d.today { outline: 2px solid var(--accent-text); outline-offset: 1px; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend .dot { width: 10px; height: 10px; }

/* Workout mode */
.session { padding: 0 16px calc(120px + var(--safe-b)); }
.s-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; margin: 0 -16px; padding: calc(var(--safe-t) + 8px) 16px 8px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.s-title { flex: 1; text-align: center; }
.s-title b { display: block; }
.s-title small { color: var(--muted); font-variant-numeric: tabular-nums; }
.s-nav { display: flex; gap: 6px; overflow-x: auto; padding: 6px 2px 12px; scrollbar-width: none; }
.s-dot { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 700; font-size: 14px; cursor: pointer; }
.s-dot.on { border-color: var(--accent-text); color: var(--text); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent); }
.s-dot.done { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.s-dot .ic { width: 16px; height: 16px; stroke-width: 3; }
.s-name { font-size: 27px; letter-spacing: -.02em; margin-bottom: 2px; }
.target { display: inline-block; background: var(--surface-2); border-radius: 10px; padding: 6px 10px; font-size: 14px; margin: 4px 0 12px; }
.suggest { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin: 0 0 12px; font-size: 14px; line-height: 1.45; }
.suggest small { display: block; color: var(--muted); margin-top: 4px; }
.suggest .ic { color: var(--water); margin-top: 1px; }
.suggest.up { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.suggest.up .ic { color: var(--accent-text); }
.suggest.knee .ic { color: var(--warn); }
.sets-log { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 8px 12px 4px; margin-bottom: 12px; }
.sl-h, .sl-row { display: grid; grid-template-columns: 30px 1fr 1fr 50px; gap: 10px; align-items: center; }
.no-w .sl-h, .no-w .sl-row { grid-template-columns: 30px 1fr 50px; }
.sl-h { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 4px 0; }
.sl-h span:not(:first-child) { text-align: center; }
.sl-row { padding: 5px 0; }
.sl-n { font-weight: 800; color: var(--muted); text-align: center; }
.sl-row input { width: 100%; min-width: 0; height: 50px; padding: 0 4px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font-size: 21px; font-weight: 750; text-align: center; font-variant-numeric: tabular-nums; }
.sl-row.done input { background: color-mix(in srgb, var(--accent) 10%, var(--surface-2)); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.done-btn { flex: none; width: 50px; height: 50px; display: grid; place-items: center; border-radius: 14px; border: 2px solid var(--line); background: var(--surface-2); color: var(--muted); cursor: pointer; }
.done-btn.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.done-btn .ic { width: 22px; height: 22px; stroke-width: 3; }
.meal-row .done-btn { width: 44px; height: 44px; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }
.s-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.s-actions .btn { font-size: 14px; }
.s-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 10px; }
.checklist { display: grid; margin-top: 6px; }
.check { display: flex; gap: 12px; align-items: center; padding: 8px 0; font-size: 15px; cursor: pointer; min-height: 40px; }
.check input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--accent); }
.field.inline { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; }
.field.inline > span { flex: 1; }
.field.inline input { width: 96px; flex: none; text-align: center; }
.rest { position: fixed; inset-inline: 0; bottom: 0; z-index: 30; max-width: 560px; margin: 0 auto; padding: 10px 16px calc(12px + var(--safe-b)); background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -10px 30px rgba(0, 0, 0, .35); animation: up .2s ease-out; }
.rest-bar { height: 4px; background: var(--track); border-radius: 99px; overflow: hidden; margin-bottom: 8px; }
.rest-bar i { display: block; height: 100%; background: var(--accent); transition: width .25s linear; }
.rest-row { display: flex; align-items: center; gap: 10px; }
.rest-row span { color: var(--muted); }
.rest-t { flex: 1; font-size: 30px; font-variant-numeric: tabular-nums; }
.rest.done { background: var(--accent); color: var(--accent-ink); }
.rest.done b { font-size: 18px; }

/* Log detail */
.set-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.set-chips span { background: var(--surface-2); border-radius: 10px; padding: 6px 10px; font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
.set-chips small { color: var(--muted); font-weight: 500; margin-inline-end: 6px; }
.celebrate { text-align: center; padding: 6px 0; }
.big-check { width: 64px; height: 64px; margin: 0 auto 10px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--accent-ink); animation: pop .5s cubic-bezier(.2, 1.6, .4, 1); }
.big-check .ic { width: 34px; height: 34px; stroke-width: 3; }
.pr-badge { display: flex; gap: 10px; align-items: center; padding: 12px 14px; margin: 0 0 10px; border-radius: 14px; font-size: 14px; background: linear-gradient(135deg, color-mix(in srgb, var(--protein) 22%, var(--surface)), var(--surface)); border: 1px solid color-mix(in srgb, var(--protein) 45%, var(--line)); }
.pr-badge .ic { color: var(--protein); }
.pr-badge.pop { animation: pop .6s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }

/* Food */
.macro { margin: 12px 0; }
.macro span { font-size: 14px; }
.macro b { font-size: 15px; font-variant-numeric: tabular-nums; }
.macro b small { color: var(--muted); font-weight: 500; }
.macro .bar { margin: 6px 0 4px; }
.macro > small { display: block; font-size: 12px; }
.meal-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.meal-row a { flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.meal-row a b { font-weight: 650; }
.meal-row small { display: block; color: var(--muted); font-size: 13px; }
.plan-gym { display: flex; gap: 8px; align-items: center; padding: 10px 0; color: var(--accent-text); font-weight: 650; font-size: 14px; border-bottom: 1px dashed var(--line); }
.meal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.meal-card { display: flex; flex-direction: column; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; color: inherit; text-decoration: none; }
.mc-body { display: grid; gap: 6px; padding: 10px 12px 12px; }
.mc-body b { font-size: 14px; line-height: 1.3; }
.mc-body small .ic { width: 14px; height: 14px; vertical-align: -2px; }
.macros-mini { display: flex; flex-wrap: wrap; gap: 3px 8px; font-size: 12px; color: var(--muted); }
.macros-mini span:first-child { color: var(--text); font-weight: 650; }
.photo { position: relative; aspect-ratio: 16 / 10; overflow: hidden; display: grid; place-items: center; background: linear-gradient(145deg, color-mix(in srgb, var(--protein) 24%, var(--surface-2)), var(--surface-2)); }
.photo::before { content: attr(data-e); font-size: 44px; }
.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo.big { border-radius: var(--radius); margin-bottom: 12px; }
.photo.big::before { font-size: 64px; }
.macro-row { display: grid; grid-template-columns: repeat(5, 1fr); text-align: center; padding: 12px 6px; }
.macro-row b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.macro-row small { color: var(--muted); font-size: 11px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 14px; }
.kv span { color: var(--muted); flex: none; }
.kv b { text-align: end; font-weight: 600; }
.ing { list-style: none; padding: 0; margin: 0; }
.ing li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.ing li:last-child { border: 0; }
.ing b { color: var(--muted); font-weight: 500; white-space: nowrap; }
ol.steps, .recs { margin: 0; padding-inline-start: 22px; }
ol.steps li, .recs li { margin: 0 0 10px; line-height: 1.5; }
ol.steps li::marker, .recs li::marker { color: var(--accent-text); font-weight: 800; }
.swap { display: flex; gap: 14px; }
.sw-icon { flex: none; font-size: 30px; line-height: 1; }
.sw-from { margin: 2px 0 8px; color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--bad) 70%, transparent); }
.sw-to { margin: 2px 0 6px; font-weight: 600; line-height: 1.45; }
.g-item { display: flex; align-items: center; gap: 8px; padding: 2px 16px; border-bottom: 1px solid var(--line); }
.card:not(.list) .g-item { padding-inline: 0; }
.list > .g-item:last-child, .checklist > .g-item:last-child { border-bottom: 0; }
.g-item .check { flex: 1; min-width: 0; }
.g-item small { white-space: nowrap; }
.g-item.done .check span { text-decoration: line-through; color: var(--muted); }

/* Forms */
.field { display: grid; gap: 6px; margin: 14px 0; }
.field > span { font-size: 14px; font-weight: 650; color: var(--muted); }
.field > span small { font-weight: 400; }
:where(input:not([type=checkbox], [type=radio], [type=range]), select, textarea) {
  width: 100%; min-height: 48px; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 16px;
}
textarea { resize: vertical; min-height: 64px; line-height: 1.4; }
.card .row select { width: auto; max-width: 58%; min-height: 38px; padding: 6px 10px; font-size: 14px; }
.stepper { display: grid; grid-template-columns: 48px 1fr auto 48px; gap: 8px; align-items: center; }
.stepper button { height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font-size: 22px; font-weight: 600; cursor: pointer; }
.stepper input { text-align: center; font-size: 20px; font-weight: 750; }
.unit { color: var(--muted); font-size: 14px; min-width: 18px; }
.radios { display: flex; flex-wrap: wrap; gap: 6px; }
.radios label { flex: 1 0 auto; min-width: 44px; position: relative; }
.radios input { position: absolute; opacity: 0; pointer-events: none; }
.radios span { display: block; padding: 11px 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 650; font-size: 15px; text-align: center; cursor: pointer; }
.radios input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.radios input:focus-visible + span { outline: 2px solid var(--accent-text); outline-offset: 2px; }
details summary { cursor: pointer; padding: 10px 0; color: var(--accent-text); font-weight: 650; font-size: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.grid2 .field { margin: 8px 0; }
.add-row { display: flex; gap: 8px; margin: 12px 0; }
.add-row input { flex: 1; min-width: 0; }
.add-row select { width: auto; max-width: 42%; flex: none; }
.add-row .btn { flex: none; }
.search input { border-radius: 14px; margin-bottom: 10px; }
.switch { appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 50px; height: 30px; margin-inline-start: auto; border-radius: 99px; background: var(--track); cursor: pointer; transition: background .2s; }
.switch::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch:checked { background: var(--good); }
.switch:checked::after { transform: translateX(20px); }
[dir=rtl] .switch:checked::after { transform: translateX(-20px); }

/* Sheets, toast */
.sheet-bg { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .55); animation: fade .2s; }
.sheet {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 41; max-width: 560px; margin: 0 auto;
  max-height: 90vh; max-height: 90dvh; overflow-y: auto; overscroll-behavior: contain;
  padding: 20px 16px calc(20px + var(--safe-b)); border-radius: 22px 22px 0 0; background: var(--surface);
  animation: up .28s cubic-bezier(.2, .8, .2, 1);
}
.sheet > h2, .sheet form > h2 { font-size: 21px; margin: 0 0 6px; padding-inline-end: 48px; }
.sheet h3 { margin: 16px 0 6px; font-size: 16px; }
.sheet > p, .sheet form > p { margin-bottom: 8px; }
.sheet-x { position: absolute; top: 14px; inset-inline-end: 14px; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
#toast { position: fixed; left: 50%; top: calc(var(--safe-t) + 12px); z-index: 60; max-width: calc(100% - 32px); padding: 10px 18px; border-radius: 99px; background: var(--text); color: var(--bg); font-weight: 650; font-size: 14px; text-align: center; pointer-events: none; transform: translate(-50%, -160%); transition: transform .25s; }
#toast.on { transform: translate(-50%, 0); }

/* Profile, photos, review, welcome */
.profile-top { display: flex; gap: 14px; align-items: center; }
.profile-top p { margin-top: 4px; font-size: 14px; }
.avatar { flex: none; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 24px; font-weight: 800; }
.file-btn { cursor: pointer; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.photo-grid figure { margin: 0; }
.photo-grid img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 12px; background: var(--surface-2); }
.photo-grid figcaption { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--muted); }
.compare { position: relative; aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden; background: var(--surface-2); touch-action: pan-y; }
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.compare-top { position: absolute; inset: 0; clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.compare-line { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; background: #fff; box-shadow: 0 0 6px rgba(0, 0, 0, .5); pointer-events: none; }
.compare input[type=range] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.week-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.week-nav .center b, .week-nav .center small { display: block; }
.welcome { min-height: 100vh; min-height: 100dvh; display: grid; align-content: center; justify-items: center; gap: 10px; padding: calc(var(--safe-t) + 24px) 24px calc(var(--safe-b) + 24px); text-align: center; }
.w-logo { border-radius: 22px; box-shadow: 0 12px 40px color-mix(in srgb, var(--accent) 25%, transparent); }
.welcome h1 { font-size: 34px; letter-spacing: -.02em; margin-top: 6px; }
.w-form { width: 100%; max-width: 360px; text-align: start; margin-top: 8px; }
.err { color: var(--bad); font-size: 14px; }
