/* Calm, minimal and system-native: the iPhone's own font, hairlines instead of borders, one accent. */
:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --card: #ffffff;
  --soft: #f2f2f4;
  --line: rgba(60, 60, 67, 0.14);
  --track: #e8e8ed;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --accent: #0071e3;
  --on-ink: #ffffff;
  --good: #248a3d;
  --protein: #0071e3;
  --carbs: #5e5ce6;
  --fat: #c93400;
  --steps: #248a3d;
  --danger: #d70015;
  --danger-soft: rgba(215, 0, 21, 0.08);
  --gold: #a2845e;
  --chart: #0071e3;
  --tabs-h: 54px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 8px 24px rgba(0, 0, 0, 0.04);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #000000;
    --card: #1c1c1e;
    --soft: #2c2c2e;
    --line: rgba(235, 235, 245, 0.16);
    --track: #38383a;
    --ink: #f5f5f7;
    --muted: #a1a1a6;
    --accent: #2997ff;
    --on-ink: #000000;
    --good: #30d158;
    --protein: #2997ff;
    --carbs: #7d7aff;
    --fat: #ff9f0a;
    --steps: #30d158;
    --danger: #ff453a;
    --danger-soft: rgba(255, 69, 58, 0.16);
    --gold: #c9a97c;
    --chart: #2997ff;
    --shadow: none;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100dvh; color: var(--ink); background: var(--bg);
  font: 400 17px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  letter-spacing: -0.012em; -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
  overscroll-behavior-y: none;
}
body.sheet-open { overflow: hidden; }
button, input, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; touch-action: manipulation; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 34px; font-weight: 700; line-height: 1.1; letter-spacing: -0.025em; }
h2 { font-size: 20px; font-weight: 600; line-height: 1.2; letter-spacing: -0.02em; }
a { color: var(--accent); text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.ico { width: 1em; height: 1em; display: block; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 14px; letter-spacing: -0.006em; }

#screen { max-width: 560px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 16px) 16px calc(var(--tabs-h) + env(safe-area-inset-bottom) + 28px); display: flex; flex-direction: column; gap: 14px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 14px 4px -4px; }
.card { background: var(--card); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 4px 4px 2px; }
.page-head .eyebrow { display: block; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-bottom: 2px; }
.page-stats { display: flex; flex-direction: column; align-items: flex-end; font-size: 13px; color: var(--muted); line-height: 1.3; white-space: nowrap; }
.page-stats b { color: var(--ink); font-weight: 600; }

/* Buttons */
.btn { border: 0; border-radius: 14px; min-height: 50px; padding: 12px 18px; background: var(--soft); color: var(--ink); font-size: 16px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: opacity .12s, transform .12s; flex: none; }
.btn:active { opacity: .7; transform: scale(.985); }
.btn.primary, .btn.gold { background: var(--ink); color: var(--on-ink); }
.btn.danger { background: none; color: var(--danger); font-weight: 500; }
.btn.slim { min-height: 38px; padding: 7px 13px; font-size: 14px; border-radius: 10px; }
.btn.wide { display: flex; width: 100%; }
.btn[disabled] { opacity: .35; }
.btn .ico { font-size: 18px; }
.btn-row { display: flex; gap: 8px; flex: none; }
.btn-row .btn { flex: 1 1 0; min-width: 0; padding-inline: 8px; }
.icon-btn { border: 0; background: transparent; width: 40px; height: 44px; color: var(--muted); font-size: 22px; font-weight: 300; flex: none; display: grid; place-items: center; }
.icon-btn:active { opacity: .5; }
.text-btn { border: 0; background: none; padding: 8px 0; min-height: 40px; color: var(--accent); font-size: 15px; font-weight: 500; display: inline-flex; align-items: center; gap: 5px; }

/* Progress */
.bar { height: 6px; border-radius: 99px; background: var(--track); overflow: hidden; flex: none; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--c, var(--accent)); transition: width .45s cubic-bezier(.3,.8,.3,1); }

/* Level */
.level-card { display: flex; flex-direction: column; gap: 10px; }
.level-line { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 7px; }
.level-line b { font-weight: 600; font-size: 17px; overflow-wrap: anywhere; }
.status-line { font-size: 15px; color: var(--muted); }

/* Summary */
.summary-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.big-number { font-size: 44px; font-weight: 700; line-height: 1; letter-spacing: -0.035em; }
.big-number small { font-size: 16px; font-weight: 500; color: var(--muted); letter-spacing: -0.01em; margin-left: 4px; }
.goal-line { padding: 13px 0; border-top: 0.5px solid var(--line); display: flex; flex-direction: column; gap: 7px; }
.goal-line-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.goal-line-top b { font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.goal-line-top b .ico { color: var(--good); font-size: 15px; }
.goal-line-top span { font-size: 15px; color: var(--muted); }
.goal-line-top span.over { color: var(--danger); }
.summary { display: flex; flex-direction: column; gap: 6px; }
.summary > .bar { margin: 8px 0 12px; }
.summary .btn { margin-top: 6px; }
.steps-card { display: flex; flex-direction: column; }
.steps-card .goal-line { border-top: 0; padding: 12px 0 6px; }

/* Week */
.week-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; margin-top: 12px; text-align: center; }
.week-day { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: 12px; font-weight: 500; color: var(--muted); }
.week-mark { width: min(32px, 100%); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 500; color: var(--muted); }
.week-day.today span { color: var(--ink); font-weight: 700; }
.week-day.today .week-mark { box-shadow: inset 0 0 0 1.5px var(--ink); color: var(--ink); }
.week-day.future .week-mark { opacity: .35; }
.week-day.perfect .week-mark { background: var(--ink); color: var(--on-ink); box-shadow: none; }
.week-day.perfect .week-mark .ico { font-size: 15px; }

/* Lists */
.meal-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.meal-kcal { font-size: 15px; color: var(--muted); }
.entry { display: flex; align-items: center; gap: 6px; padding: 10px 0; border-top: 0.5px solid var(--line); }
.card > .entry:first-child { border-top: 0; padding-top: 0; }
.entry-main { flex: 1; min-width: 0; display: block; }
.entry-main b { display: block; font-weight: 500; overflow-wrap: anywhere; line-height: 1.25; }
.entry-kcal { font-size: 15px; white-space: nowrap; text-align: right; }
.entry-kcal small { display: block; font-size: 11px; color: var(--muted); line-height: 1.1; }
.entry .icon-btn { margin-right: -10px; }
.entry-open { border: 0; background: none; padding: 0; text-align: left; min-height: 44px; }
.meal-actions { display: flex; justify-content: space-between; gap: 8px; border-top: 0.5px solid var(--line); margin-top: 6px; }
.empty { color: var(--muted); font-size: 15px; padding: 6px 0; }
.day-nav { display: flex; align-items: center; justify-content: space-between; margin: 0 -8px; }
.day-nav h1 { text-align: center; flex: 1; font-size: 22px; letter-spacing: -0.02em; font-weight: 600; }
.equation { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; text-align: center; gap: 4px; }
.equation b { display: block; font-size: 22px; font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; }
.equation span { font-size: 12px; color: var(--muted); }
.equation i { font-style: normal; font-size: 18px; color: var(--muted); }
.equation .left.over b { color: var(--danger); }
.macros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 16px; }
.macro b { display: flex; justify-content: space-between; align-items: center; font-weight: 500; font-size: 13px; margin-bottom: 6px; gap: 4px; }
.macro b .ico { font-size: 13px; color: var(--good); }
.macro small { display: block; font-size: 12px; color: var(--muted); margin-top: 5px; }

/* Tiles */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; flex: none; }
.tiles.four { grid-template-columns: repeat(4, 1fr); }
.tiles b { display: block; font-size: 24px; font-weight: 600; line-height: 1.15; letter-spacing: -0.025em; }
.tiles.four b { font-size: 20px; }
.tiles span { font-size: 12px; color: var(--muted); line-height: 1.2; display: block; margin-top: 2px; }

/* Goals */
.goal { display: flex; flex-direction: column; gap: 7px; padding: 12px 0; border-top: 0.5px solid var(--line); }
.goal:first-child { border-top: 0; padding-top: 0; }
.goal:last-child { padding-bottom: 0; }
.goal-top { display: flex; align-items: center; gap: 6px; }
.goal-top b { flex: 1; font-weight: 500; overflow-wrap: anywhere; }
.goal-top .icon-btn { margin: -8px -10px -8px 0; }
.goal-card { display: flex; flex-direction: column; gap: 10px; }
.goal-sub::first-letter { text-transform: uppercase; }
.xp-row { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.quest-xp { display: flex; align-items: center; gap: 2px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.quest-xp .ico { font-size: 12px; }
.check-line { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-top: 0.5px solid var(--line); width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; }
.meal-head + .check-line { border-top: 0; padding-top: 8px; }
.check-line:last-child { padding-bottom: 0; }
.check-line b { flex: 1; font-weight: 400; overflow-wrap: anywhere; }
.check-line.off b, .check-line.off .small { opacity: .4; }
.check-dot { width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--line); display: grid; place-items: center; font-size: 13px; color: transparent; flex: none; }
.check-line.done .check-dot { background: var(--ink); box-shadow: none; color: var(--on-ink); }

/* Profile */
.hero-top { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px; }
.hero-top h1 { overflow-wrap: anywhere; font-size: 28px; margin-top: 6px; }
.rank { font-size: 15px; color: var(--muted); }
.badges { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.badge { padding: 14px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.badge .ico { font-size: 18px; color: var(--muted); margin-bottom: 4px; opacity: .5; }
.badge b { font-weight: 500; line-height: 1.2; color: var(--muted); font-size: 15px; }
.badge span { font-size: 13px; color: var(--muted); line-height: 1.25; }
.badge.got .ico { color: var(--gold); opacity: 1; }
.badge.got b { color: var(--ink); }

/* Forms */
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
/* 16px stops iPhone Safari zooming in when a field gets focus */
input[type="text"], input[type="number"], input[type="search"], input[type="password"], input[type="date"], select { width: 100%; min-width: 0; min-height: 46px; padding: 11px 13px; font-size: 16px; font-weight: 400; color: var(--ink); background: var(--soft); border: 0; border-radius: 11px; appearance: none; -webkit-appearance: none; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
input::placeholder { color: var(--muted); }
.form { display: flex; flex-direction: column; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.seg { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 2px; padding: 2px; background: var(--soft); border-radius: 10px; flex: none; }
.seg button { min-height: 36px; padding: 4px 2px; border: 0; border-radius: 8px; background: none; color: var(--ink); font-size: 13px; font-weight: 500; }
.seg button.on { background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.14); font-weight: 600; }
.subhead { font-size: 13px; font-weight: 600; color: var(--muted); margin-top: 16px; padding-bottom: 4px; }
.result { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; padding: 11px 0; min-height: 58px; border: 0; border-top: 0.5px solid var(--line); background: none; }
.result:active { opacity: .55; }
.result-main { flex: 1; min-width: 0; }
.result-main b { display: block; font-weight: 500; overflow-wrap: anywhere; line-height: 1.25; }
.brand-tag { color: var(--ink); opacity: .75; }
.amount { display: flex; align-items: center; gap: 10px; }
.amount input { flex: 1; font-size: 22px; font-weight: 600; min-height: 52px; }
.amount b { font-size: 16px; font-weight: 500; color: var(--muted); min-width: 26px; }
.trait { display: flex; flex-direction: column; gap: 8px; flex: none; }
.trait > b { font-weight: 600; }
.picks { display: flex; flex-wrap: wrap; gap: 6px; }
.pick { min-height: 38px; padding: 6px 13px; border: 0; border-radius: 99px; background: var(--soft); color: var(--ink); font-size: 14px; font-weight: 500; }
.pick.on { background: var(--ink); color: var(--on-ink); }
.notice { padding: 11px 13px; background: var(--soft); border-radius: 11px; font-size: 14px; flex: none; }
.notice.error { background: var(--danger-soft); color: var(--danger); }

/* Sheets: sized to the visible screen, so the keyboard can never cover them */
.sheet-back { position: fixed; left: 0; right: 0; top: var(--vv-top, 0); height: var(--vvh, 100dvh); z-index: 30; background: rgba(0,0,0,.35); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; max-height: calc(100% - env(safe-area-inset-top) - 12px); overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; background: var(--card); border-radius: 14px 14px 0 0; padding: 8px 16px calc(env(safe-area-inset-bottom) + 20px); display: flex; flex-direction: column; gap: 12px; animation: rise .26s cubic-bezier(.2,.8,.2,1); }
.sheet.full { height: calc(100% - env(safe-area-inset-top) - 12px); }
@keyframes rise { from { transform: translateY(36px); opacity: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; flex: none; }
.sheet-head .icon-btn { margin-right: -10px; }
.sheet-pin { position: sticky; top: -8px; z-index: 3; background: var(--card); margin: -8px -16px 0; padding: 8px 16px 10px; display: flex; flex-direction: column; gap: 10px; border-bottom: 0.5px solid var(--line); flex: none; }
.sheet-pin .sheet-head { min-height: 36px; }

/* Scan */
.scan-box { position: relative; overflow: hidden; border-radius: 14px; background: var(--soft); flex: none; }
.scan-box img { display: block; width: 100%; max-height: 240px; object-fit: cover; }
.scan-line { position: absolute; left: 0; right: 0; height: 2px; background: #fff; box-shadow: 0 0 14px 3px rgba(255,255,255,.8); animation: scan 1.6s ease-in-out infinite alternate; }
@keyframes scan { from { top: 4%; } to { top: 96%; } }
.scan-item { padding: 11px 0; border-top: 0.5px solid var(--line); display: flex; flex-direction: column; gap: 8px; flex: none; }
.scan-item .goal-top .icon-btn { margin: -8px -10px -8px 0; }
.conf { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--soft); color: var(--muted); text-transform: capitalize; }

/* Exercises */
.ex-art { width: 100%; height: auto; display: block; color: var(--ink); --ex-prop: var(--track); }
.ex-figure { stroke: var(--ink); fill: var(--ink); }
.ex-figure .head { stroke: none; }
.ex-figure.ghost { stroke: var(--track); fill: var(--track); }
.ex-kit.ghost { opacity: .25; }
.ex-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 4px; }
.ex-card { display: flex; flex-direction: column; gap: 2px; padding: 12px; text-align: left; border: 0; border-radius: 14px; background: var(--soft); min-width: 0; }
.ex-card b { font-weight: 500; line-height: 1.2; margin-top: 6px; font-size: 15px; }
.ex-card .ex-art { --ex-prop: var(--line); }
.ex-card .ex-figure.ghost { stroke: var(--line); fill: var(--line); }
.ex-hero { background: var(--soft); border-radius: 14px; padding: 10px 44px; flex: none; }
.chips-row { display: flex; gap: 6px; overflow-x: auto; flex: none; margin: 0 -16px; padding: 0 16px 2px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.chips-row .pick { flex: none; }
.set-table { display: flex; flex-direction: column; gap: 8px; flex: none; }
.set-row { display: grid; grid-template-columns: 22px 68px minmax(0, 1fr) minmax(0, 1fr) 30px; gap: 6px; align-items: center; }
.set-last { border: 0; background: var(--soft); color: var(--ink); border-radius: 8px; min-height: 40px; padding: 0 2px; font-size: 13px; font-variant-numeric: tabular-nums; text-align: center; }
.set-last.none { background: none; color: var(--muted); display: grid; place-items: center; }
.set-diff { grid-column: 3 / -1; font-size: 12px; font-weight: 500; color: var(--muted); }
.set-diff:empty { display: none; }
.set-row.head { font-size: 12px; font-weight: 500; color: var(--muted); }
.set-row > b { font-weight: 600; text-align: center; }
.set-row .icon-btn { width: 30px; }
.set-row .icon-btn[disabled] { opacity: .2; }

/* Gym sessions */
.session-live { display: flex; flex-direction: column; gap: 10px; }
.session-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.session-clock { font-size: 52px; font-weight: 700; line-height: 1.05; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.session-tally { text-align: right; }
.session-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding: 8px 0; border: 0; border-top: 0.5px solid var(--line); background: none; text-align: left; flex: none; }
.session-thumb { width: 56px; flex: none; }
.session-banner { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 46px; padding: 8px 14px; border: 0; border-radius: 14px; background: var(--ink); color: var(--on-ink); font-size: 15px; font-weight: 500; }
.session-banner .ico { font-size: 18px; }
.session-banner span { flex: 1; text-align: left; }
.session-banner b { font-weight: 600; }
.move-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 58px; padding: 10px 0; border: 0; border-top: 0.5px solid var(--line); background: none; text-align: left; }
.card > .move-row:first-child { border-top: 0; padding-top: 0; }
.spark { width: 72px; height: 26px; flex: none; }
.spark-empty { flex: none; }
.chev { font-size: 20px; color: var(--muted); font-weight: 300; }

/* Progress chart */
.chart { width: 100%; height: auto; display: block; flex: none; overflow: visible; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-axis { fill: var(--muted); font-size: 11px; }
.chart-line { fill: none; stroke: var(--chart); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { fill: var(--chart); stroke: var(--card); stroke-width: 2; }
.chart-hit { fill: transparent; cursor: pointer; }
.chart-readout { flex: none; display: flex; flex-direction: column; gap: 2px; }
.chart-value { font-size: 36px; font-weight: 700; line-height: 1.1; letter-spacing: -0.03em; }
.chart-value small { font-size: 16px; color: var(--muted); font-weight: 500; letter-spacing: 0; }

/* Tabs */
#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; background: color-mix(in srgb, var(--card) 78%, transparent); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-top: 0.5px solid var(--line); padding: 0 6px env(safe-area-inset-bottom); }
#tabs[hidden] { display: none; }
.tab { flex: 1; max-width: 100px; height: var(--tabs-h); border: 0; background: none; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10px; font-weight: 500; letter-spacing: 0; }
.tab .tile { display: grid; place-items: center; font-size: 25px; }
.tab.on { color: var(--ink); }

/* Toasts */
#toasts { position: fixed; left: 0; right: 0; top: calc(env(safe-area-inset-top) + 10px); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-radius: 99px; background: color-mix(in srgb, var(--card) 86%, transparent); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); color: var(--ink); font-size: 14px; font-weight: 500; box-shadow: 0 6px 24px rgba(0,0,0,.14); animation: pop .26s cubic-bezier(.2,.8,.2,1); }
.toast button { border: 0; background: none; color: var(--accent); font-weight: 600; min-height: 30px; padding: 0 2px; }
@keyframes pop { from { transform: translateY(-8px); opacity: 0; } }

/* Level up */
.levelup { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: grid; place-items: center; padding: 24px; text-align: center; overflow: hidden; }
.levelup-box { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; max-width: 340px; animation: pop .35s cubic-bezier(.2,.8,.2,1); }
.levelup h2 { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; }
.levelup .btn { margin-top: 18px; }

/* Setup */
.welcome-top { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.welcome-top h2 { font-size: 28px; font-weight: 700; letter-spacing: -0.025em; }
.setup-top { display: flex; align-items: center; gap: 6px; margin-left: -10px; min-height: 44px; }
.setup-bar { flex: 1; }
.brand { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
/* Product detail */
.sheet-pin.plain { border-bottom: 0; padding-bottom: 0; gap: 0; }
.sheet-pin.plain h2 { font-size: 22px; font-weight: 700; }
.detail-brand { padding-bottom: 8px; }
.detail-rows { display: flex; flex-direction: column; border-top: 0.5px solid var(--line); border-bottom: 0.5px solid var(--line); flex: none; }
.detail-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 54px; padding: 4px 0; border-top: 0.5px solid var(--line); }
.detail-row:first-child { border-top: 0; }
.detail-row > span { flex: none; }
.detail-row > b { font-weight: 500; text-align: right; }
.detail-row select, .detail-row input { width: auto; min-width: 0; max-width: 58%; min-height: 40px; padding: 7px 11px; text-align: right; text-align-last: right; color: var(--accent); font-weight: 500; }
.detail-row input { width: 92px; }
.macro-summary { display: grid; grid-template-columns: 88px repeat(3, minmax(0, 1fr)); gap: 8px; align-items: center; padding: 6px 0 10px; }
.macro-ring { position: relative; width: 88px; height: 88px; }
.macro-ring svg { width: 100%; height: 100%; display: block; }
.macro-ring-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05; }
.macro-ring-text b { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.macro-ring-text span { font-size: 11px; color: var(--muted); }
.macro-col { text-align: center; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.macro-col em { font-style: normal; font-size: 12px; color: var(--muted); }
.macro-col b { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; white-space: nowrap; }
.macro-col span { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.macro-col span i { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.detail-section { display: flex; flex-direction: column; gap: 9px; padding: 12px 0; border-top: 0.5px solid var(--line); }
.detail-section h3 { font-size: 16px; font-weight: 600; letter-spacing: -0.015em; }
.daily-goal { display: grid; grid-template-columns: 70px 1fr 42px; align-items: center; gap: 10px; font-size: 14px; }
.daily-goal b { font-weight: 500; text-align: right; }
.fact-row { display: flex; justify-content: space-between; gap: 10px; font-size: 15px; }
.fact-row span { color: var(--muted); }
.fact-row b { font-weight: 500; }
#portion-live { flex: none; }
.plan-note { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--muted); padding: 0 4px; margin-top: -6px; }
.text-btn.inline { min-height: 32px; padding: 4px 0 0; font-size: 14px; display: block; }
.session-row { align-items: center; gap: 4px; }
.session-open { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; border: 0; background: none; padding: 0; text-align: left; min-height: 44px; }
.tick { width: 44px; height: 44px; border: 0; background: none; display: grid; place-items: center; flex: none; padding: 0; color: transparent; font-size: 14px; position: relative; }
.tick::before { content: ""; position: absolute; width: 26px; height: 26px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--muted); }
.tick .ico { position: relative; }
.tick.done { color: var(--on-ink); }
.tick.done::before { background: var(--ink); box-shadow: none; }
.session-links { display: flex; justify-content: space-between; }
.danger-text { color: var(--danger); }
.text-btn[disabled] { opacity: .35; }
.routine-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 0.5px solid var(--line); }
.routine-row:first-child { border-top: 0; padding-top: 0; }
.routine-row:last-child { padding-bottom: 0; }
/* Food and exercise search */
body.search-open::before { content: ""; position: fixed; inset: 0; z-index: 29; background: var(--card); }
.sheet.search { height: 100%; max-height: 100%; border-radius: 0; overflow: hidden; gap: 0; padding: calc(env(safe-area-inset-top) + 6px) 0 0; animation: none; }
.search-top { flex: none; display: flex; flex-direction: column; gap: 7px; padding: 0 16px 8px; border-bottom: 0.5px solid var(--line); background: var(--card); transition: margin-top .22s ease, opacity .16s ease; }
.search-top.away { margin-top: calc(-1 * var(--bar-height, 90px) - 6px); opacity: 0; pointer-events: none; }
.search-row { display: flex; align-items: center; gap: 10px; }
.search-row input { flex: 1; min-height: 36px; padding: 6px 11px; border-radius: 10px; }
.search-row .text-btn { min-height: 36px; padding: 0; flex: none; }
.search-tools { display: flex; gap: 6px; }
.search-tools button { flex: 1 1 0; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 30px; padding: 3px 4px; border: 0; border-radius: 8px; background: var(--soft); font-size: 13px; font-weight: 500; }
.search-tools .ico { font-size: 14px; }
.search-top .chips-row .pick { min-height: 30px; padding: 3px 11px; font-size: 13px; }
.search-results { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 0 16px calc(env(safe-area-inset-bottom) + 16px); }
.search-results .subhead { font-size: 12px; margin-top: 10px; padding-bottom: 3px; }
.search-results .result { min-height: 44px; padding: 6px 0; gap: 10px; }
.search-results .result-main b { font-size: 15px; font-weight: 500; line-height: 1.2; }
.search-results .result-main .small { font-size: 12.5px; line-height: 1.25; display: block; }
.result-kcal { font-size: 14px; white-space: nowrap; flex: none; }
.result-kcal small { font-size: 11px; color: var(--muted); }
.search-results .ex-grid { margin-top: 10px; }
a.btn { text-decoration: none; }
/* Calendar */
.day-title { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 7px; border: 0; background: none; padding: 0; min-height: 44px; }
.day-title h1 { flex: none; }
.day-title .ico { font-size: 17px; color: var(--muted); }
.calendar-btn { color: var(--ink); font-size: 24px; margin-right: -8px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; flex: none; }
.cal-head b { font-weight: 600; }
.cal-head .icon-btn[disabled] { opacity: .2; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; flex: none; }
.cal-label { text-align: center; font-size: 12px; font-weight: 500; color: var(--muted); padding-bottom: 4px; }
.cal-day { position: relative; aspect-ratio: 1; max-height: 52px; width: 100%; border: 0; border-radius: 50%; background: none; font-size: 16px; display: grid; place-items: center; padding: 0; }
.cal-day i { position: absolute; bottom: 5px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--muted); }
.cal-day.today { color: var(--accent); font-weight: 700; }
.cal-day.on { background: var(--ink); color: var(--on-ink); font-weight: 600; }
.cal-day.on i { background: var(--on-ink); }
.cal-day[disabled] { opacity: .25; }
.goal-card p b { color: var(--ink); font-weight: 600; }
[hidden] { display: none !important; }

/* Diary summary and nutrition */
.summary-card { cursor: pointer; }
.summary-more { display: flex; justify-content: space-between; align-items: center; width: 100%; border: 0; border-top: 0.5px solid var(--line); background: none; margin-top: 14px; padding: 12px 0 0; font-size: 14px; color: var(--muted); }
.nutri-row { display: flex; flex-direction: column; gap: 5px; }
.nutri-top { display: flex; justify-content: space-between; gap: 10px; font-size: 15px; }
.nutri-top b { font-weight: 500; font-variant-numeric: tabular-nums; }
.nutri-row small { font-size: 12px; color: var(--muted); }
.more-nutrition summary { font-size: 14px; color: var(--muted); padding: 8px 0; cursor: pointer; }
.more-nutrition .grid-2 { margin-top: 6px; }
.session-open .entry-main .small { display: block; }

/* Home: days you can swipe through */
.home-title { justify-content: flex-start; min-height: 0; flex: none; gap: 6px; }
.title-caret { font-size: 15px; color: var(--muted); }
.week-strip { display: flex; position: relative; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none; flex: none; }
.week-strip::-webkit-scrollbar { display: none; }
.week-page { flex: 0 0 100%; scroll-snap-align: start; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.strip-day { display: flex; flex-direction: column; align-items: center; gap: 5px; border: 0; background: none; border-radius: 14px; padding: 7px 0 5px; font-size: 12px; font-weight: 500; color: var(--muted); min-width: 0; }
.strip-day.today > span:first-child { color: var(--accent); font-weight: 700; }
.strip-day.on { background: var(--card); box-shadow: 0 1px 3px rgb(0 0 0 / .08); }
.strip-day.on > span:first-child { color: var(--ink); font-weight: 700; }
.strip-day[disabled] { opacity: .3; }
.strip-mark { width: min(30px, 100%); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 500; color: var(--muted); box-shadow: inset 0 0 0 1.5px var(--track); }
.strip-mark.done { background: var(--ink); color: var(--on-ink); box-shadow: none; }
.strip-mark .ico { font-size: 14px; }
.strip-day i { width: 4px; height: 4px; border-radius: 50%; background: transparent; }
.strip-day i.on { background: var(--muted); }
.day-panel { display: flex; flex-direction: column; gap: inherit; touch-action: pan-y; }
.day-panel.from-right { animation: day-in-right .18s ease-out; }
.day-panel.from-left { animation: day-in-left .18s ease-out; }
@keyframes day-in-right { from { opacity: 0; transform: translateX(24px); } }
@keyframes day-in-left { from { opacity: 0; transform: translateX(-24px); } }
@media (prefers-reduced-motion: reduce) { .day-panel.from-right, .day-panel.from-left { animation: none; } }
.summary .summary-more { margin: 10px 0 6px; padding-bottom: 2px; }
.week-tiles { margin-top: 12px; }
.week-tiles b { font-size: 17px; }

/* Live session */
.session-bar { position: sticky; top: env(safe-area-inset-top); z-index: 5; display: grid; grid-template-columns: 1fr 1.25fr .6fr auto; align-items: center; gap: 8px; padding: 10px 12px 10px 14px; border-radius: 16px; background: var(--card); box-shadow: 0 2px 10px rgb(0 0 0 / .08); }
.session-bar span { display: block; font-size: 12px; color: var(--muted); }
.session-bar b { display: block; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.live-exercise { display: flex; flex-direction: column; gap: 6px; }
.live-head { display: flex; align-items: center; gap: 4px; }
.live-head .session-thumb { width: 48px; }
.live-head .entry-main .small { display: block; }
.live-row { display: grid; grid-template-columns: 24px 66px minmax(0, 1fr) minmax(0, 1fr) 40px; gap: 6px; align-items: center; border-radius: 10px; padding: 3px 4px; margin: 0 -4px; }
.live-row.head { font-size: 12px; font-weight: 500; color: var(--muted); padding-bottom: 0; }
.live-row.head span:nth-child(1) { text-align: center; }
.live-row input { width: 100%; min-width: 0; min-height: 40px; padding: 4px 6px; text-align: center; font-size: 16px; border-radius: 10px; }
.live-row input::placeholder { color: var(--muted); opacity: .55; }
.live-row.done { background: var(--soft); }
.live-row.done input { background: transparent; border-color: transparent; box-shadow: none; font-weight: 600; }
.live-num { display: grid; place-items: center; font-weight: 600; font-size: 15px; }
.live-num.best { color: var(--gold); font-size: 18px; }
.live-prev { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.live-tick { width: 40px; height: 40px; border: 0; border-radius: 10px; background: var(--soft); color: var(--muted); display: grid; place-items: center; padding: 0; font-size: 16px; }
.live-tick.on { background: var(--ink); color: var(--on-ink); }
.live-note { grid-column: 3 / -1; font-size: 12px; font-weight: 500; color: var(--muted); padding-bottom: 2px; }
.live-row.head span:nth-child(n+3) { text-align: center; }
