/* ============ Tokens ============ */
:root {
  color-scheme: dark;
  /* Golden Fitness brand: logo yellow #FCEB22 on near-black */
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-2: #1c1c1b;
  --surface-3: #282826;
  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .14);
  --text: #f6f6f2;
  --text-2: #b9b8b0;
  --muted: #8a8980;
  --accent: #fceb22;
  --accent-ink: #0a0a0a;
  --accent-fg: #fceb22;
  --accent-soft: rgba(252, 235, 34, .12);
  --amber: #f5a623;
  /* data identities (validated: dataviz palette, dark steps) */
  --c-workout: #d95926;
  --c-food: #199e70;
  --c-water: #3987e5;
  --c-protein: #9085e9;
  --c-carbs: #c98500;
  --c-fat: #d55181;
  /* status (fixed) */
  --good: #0ca30c;
  --warn: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --delta-good: #0ca30c;
  --delta-bad: #e66767;
  --grid: #232321;
  --axis: #3c3c38;
  --hero-grad: radial-gradient(120% 140% at 100% 0%, rgba(252, 235, 34, .22) 0%, rgba(252, 235, 34, 0) 55%), linear-gradient(160deg, #1d1d1b, #101010);
  --shadow: 0 12px 32px rgba(0, 0, 0, .45);
  --radius: 20px;
  --radius-sm: 14px;
  --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f4f2ec; --surface: #ffffff; --surface-2: #f6f4ef; --surface-3: #e9e6dd;
    --line: rgba(12, 14, 18, .08); --line-2: rgba(12, 14, 18, .15);
    --text: #15120c; --text-2: #575043; --muted: #7d7668;
    --accent-fg: #6b5e00; --accent-soft: rgba(252, 235, 34, .22);
    --c-workout: #eb6834; --c-food: #1baf7a; --c-water: #2a78d6;
    --c-protein: #4a3aa7; --c-carbs: #eda100; --c-fat: #e87ba4;
    --delta-good: #006300; --delta-bad: #c62f2f;
    --grid: #ebe8e0; --axis: #cfcabd;
    --hero-grad: radial-gradient(120% 140% at 100% 0%, rgba(252, 235, 34, .5) 0%, rgba(252, 235, 34, 0) 55%), linear-gradient(160deg, #ffffff, #fbf9e8);
    --shadow: 0 12px 32px rgba(40, 30, 10, .12);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f2ec; --surface: #ffffff; --surface-2: #f6f4ef; --surface-3: #e9e6dd;
  --line: rgba(12, 14, 18, .08); --line-2: rgba(12, 14, 18, .15);
  --text: #15120c; --text-2: #575043; --muted: #7d7668;
  --accent-fg: #6b5e00; --accent-soft: rgba(252, 235, 34, .22);
  --c-workout: #eb6834; --c-food: #1baf7a; --c-water: #2a78d6;
  --c-protein: #4a3aa7; --c-carbs: #eda100; --c-fat: #e87ba4;
  --delta-good: #006300; --delta-bad: #c62f2f;
  --grid: #ebe8e0; --axis: #cfcabd;
  --hero-grad: radial-gradient(120% 140% at 100% 0%, rgba(252, 235, 34, .5) 0%, rgba(252, 235, 34, 0) 55%), linear-gradient(160deg, #ffffff, #fbf9e8);
  --shadow: 0 12px 32px rgba(40, 30, 10, .12);
}

/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
h1, h2, h3, h4, p { margin: 0; }
img, svg { display: block; }
:focus-visible { outline: 2px solid var(--accent-fg); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.shell { max-width: 480px; margin: 0 auto; min-height: 100dvh; position: relative; }
@media (min-width: 560px) {
  body { background: color-mix(in srgb, var(--bg) 70%, #000); }
  .shell { background: var(--bg); box-shadow: 0 0 0 1px var(--line), var(--shadow); }
}
.view { padding: calc(var(--safe-t) + 14px) 16px calc(var(--tab-h) + var(--safe-b) + 28px); animation: page-in .28s ease both; }
.view.no-tabs { padding-bottom: calc(var(--safe-b) + 28px); }
.view.refreshing > * { opacity: .6; transition: opacity .15s; pointer-events: none; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } }

/* ============ Icons ============ */
.i { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.i.fill { fill: currentColor; stroke: none; }

/* ============ Type & layout helpers ============ */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; min-height: 44px; }
.topbar h1 { font-size: 27px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.stack { display: grid; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 26px 4px 10px; }
.section-title h2 { font-size: 17px; font-weight: 750; letter-spacing: -.01em; }
.section-title a, .section-title button { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 650; color: var(--accent-fg); }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.center { text-align: center; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mb-12 { margin-bottom: 12px; }

/* ============ Cards ============ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; position: relative; }
:where(a, button).card { display: block; width: 100%; text-align: start; transition: transform .12s ease, background .12s; }
:where(a, button).card:active { transform: scale(.985); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h3 { font-size: 16px; font-weight: 750; }
.card.flush { padding: 0; overflow: hidden; }
.card.tint { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent-fg) 25%, transparent); }

/* ============ Buttons ============ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 18px; border-radius: var(--radius-sm);
  font-weight: 700; font-size: 15px; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); transition: transform .1s, background .15s, opacity .15s; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn-dark { background: var(--text); color: var(--bg); border-color: transparent; }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--delta-bad); }
.btn-block { width: 100%; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 14px; border-radius: 11px; }
.btn-lg { height: 56px; font-size: 16px; border-radius: 16px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: inline-grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); }
.icon-btn:disabled { opacity: .35; pointer-events: none; }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 10px; }
.icon-btn.plain { background: transparent; border: 0; }
.link-btn { color: var(--accent-fg); font-weight: 650; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; padding: 6px 0; }
.btn-row { display: flex; gap: 10px; }
.btn-row > * { flex: 1; }

/* ============ Avatar ============ */
.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 15px;
  background: var(--surface-3); color: var(--text); box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); flex: none; }
.avatar.lg { width: 76px; height: 76px; font-size: 26px; }
.avatar.md { width: 48px; height: 48px; font-size: 16px; box-shadow: none; }

/* ============ Pills, chips, badges ============ */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 650;
  background: var(--surface-2); color: var(--text); white-space: nowrap; line-height: 1.3; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--muted)); flex: none; }
.pill .i { width: 14px; height: 14px; color: var(--c, currentColor); }
.pill[data-s="good"] { --c: var(--good); background: color-mix(in srgb, var(--good) 15%, transparent); }
.pill[data-s="warn"] { --c: var(--warn); background: color-mix(in srgb, var(--warn) 18%, transparent); }
.pill[data-s="serious"] { --c: var(--serious); background: color-mix(in srgb, var(--serious) 18%, transparent); }
.pill[data-s="critical"] { --c: var(--critical); background: color-mix(in srgb, var(--critical) 16%, transparent); }
.pill[data-s="accent"] { background: var(--accent); color: var(--accent-ink); }
.pill[data-s="accent"] .i { color: var(--accent-ink); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 36px; padding: 0 14px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; font-weight: 600; color: var(--text-2);
  display: inline-flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"], .chip.on { background: var(--text); color: var(--bg); border-color: transparent; }

/* ============ Segmented control ============ */
.seg { display: flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 13px; padding: 3px; gap: 2px; }
.seg > * { flex: 1; height: 36px; border-radius: 10px; font-size: 14px; font-weight: 650; color: var(--text-2); display: grid; place-items: center; transition: background .15s, color .15s; }
.seg > [aria-current="page"], .seg > [aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .18); }
.seg.sm > * { height: 30px; font-size: 13px; }
:root[data-theme="dark"] .seg > [aria-current="page"], :root[data-theme="dark"] .seg > [aria-pressed="true"] { background: var(--surface-3); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg > [aria-current="page"], :root:not([data-theme="light"]) .seg > [aria-pressed="true"] { background: var(--surface-3); } }

/* ============ Meters ============ */
.meter { height: 8px; border-radius: 99px; background: color-mix(in srgb, var(--c, var(--accent-fg)) 20%, transparent); overflow: hidden; }
.meter > i { animation: grow .8s cubic-bezier(.2, .8, .2, 1) both; display: block; height: 100%; border-radius: 99px; background: var(--c, var(--accent-fg)); width: 0; transition: width .6s cubic-bezier(.2, .8, .2, 1); }
@keyframes grow { from { width: 0; } }
.meter.thin { height: 6px; }
.meter.thick { height: 10px; }
.macro { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: baseline; }
.macro .meter { grid-column: 1 / -1; }
.macro-label { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.macro-label .key { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.macro-val { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.macro-val b { color: var(--text); font-weight: 700; }

/* ============ Stat tiles ============ */
.stat { display: flex; flex-direction: column; gap: 2px; min-height: 104px; }
.stat-label { font-size: 13px; color: var(--text-2); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.stat-label .i { width: 16px; height: 16px; color: var(--muted); }
.stat-value { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin-top: 4px; }
.stat-value small { font-size: 14px; font-weight: 650; color: var(--text-2); margin-inline-start: 3px; letter-spacing: 0; }
.stat .foot { margin-top: auto; padding-top: 6px; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 13px; font-weight: 650; color: var(--text-2); }
.delta .i { width: 14px; height: 14px; }
.delta.good { color: var(--delta-good); }
.delta.bad { color: var(--delta-bad); }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mini-stat { background: var(--surface-2); border-radius: 14px; padding: 10px 12px; }
.mini-stat .v { font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.mini-stat .l { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ============ Lists ============ */
.list { display: flex; flex-direction: column; }
.list > .li { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); min-height: 52px; }
.list > .li:last-child { border-bottom: 0; }
.card > .list:first-child > .li:first-child { padding-top: 2px; }
.card > .list:last-child > .li:last-child { padding-bottom: 2px; }
.li .l { color: var(--text-2); font-size: 14px; flex: 1; min-width: 0; }
.li .v { font-weight: 650; text-align: end; font-size: 14px; max-width: 62%; overflow-wrap: anywhere; }
.li .ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex: none; }
.li .ico .i { width: 19px; height: 19px; }
.li .t { font-weight: 650; font-size: 15px; }
.li .s { font-size: 13px; color: var(--muted); }

/* ============ Forms ============ */
.field { display: grid; gap: 6px; }
.field > span, .field > label { font-size: 13px; font-weight: 650; color: var(--text-2); }
.input, .select, .textarea { width: 100%; height: 50px; padding: 0 14px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--line-2);
  font-size: 16px; color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s; appearance: none; -webkit-appearance: none; }
.textarea { height: 88px; padding: 12px 14px; resize: none; }
.select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 22px, calc(100% - 15px) 22px; background-size: 5px 5px; background-repeat: no-repeat; padding-inline-end: 36px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent-fg); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--muted); opacity: .8; }
input[type="date"].input { min-width: 0; }
.form { display: grid; gap: 14px; }
.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.input-wrap { position: relative; }
.input-wrap .suffix { position: absolute; inset-inline-end: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 14px; pointer-events: none; }
.input-wrap .input { padding-inline-end: 48px; }
.input-wrap .toggle { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); }
.form-error { color: var(--delta-bad); font-size: 14px; font-weight: 600; min-height: 0; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper .icon-btn { width: 44px; height: 44px; }
.stepper output { min-width: 64px; text-align: center; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.option-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.option { border: 1px solid var(--line-2); background: var(--surface-2); border-radius: 13px; padding: 10px 6px; font-size: 13px; font-weight: 650;
  display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text-2); }
.option .i { width: 22px; height: 22px; }
.option[aria-pressed="true"] { border-color: var(--accent-fg); background: var(--accent-soft); color: var(--text); }

/* ============ Tab bar ============ */
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: min(480px, 100%); z-index: 40;
  height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b); display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(160%) blur(18px); -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-top: 1px solid var(--line); }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 650; color: var(--muted); position: relative; }
.tab .i { width: 24px; height: 24px; stroke-width: 1.9; }
.tab[aria-current="page"] { color: var(--text); }
.tab[aria-current="page"]::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent-fg); }
.tab-center { justify-content: flex-start; }
.tab-center .fab { width: 58px; height: 58px; border-radius: 20px; margin-top: -20px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 8px 22px rgba(243, 192, 68, .30), 0 0 0 5px var(--bg); transition: transform .15s; }
.tab-center .fab .i { width: 26px; height: 26px; stroke-width: 2.2; }
.tab-center:active .fab { transform: scale(.94); }
.tab-center[aria-current="page"]::before { display: none; }
.tab-center .fab.live::after { content: ""; position: absolute; top: -16px; inset-inline-end: calc(50% - 32px); width: 12px; height: 12px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--bg); }

/* ============ Sheet ============ */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); opacity: 0; transition: opacity .25s; }
.sheet { position: absolute; left: 50%; bottom: 0; width: min(480px, 100%); max-height: 92dvh; background: var(--surface); border-radius: 26px 26px 0 0;
  transform: translate(-50%, 100%); transition: transform .32s cubic-bezier(.2, .85, .25, 1); display: flex; flex-direction: column; box-shadow: var(--shadow);
  border: 1px solid var(--line); border-bottom: 0; }
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: translate(-50%, 0); }
.sheet-grip { padding: 10px 0 6px; display: grid; place-items: center; touch-action: none; cursor: grab; }
.sheet-grip::before { content: ""; width: 40px; height: 5px; border-radius: 99px; background: var(--line-2); }
.sheet-body { overflow-y: auto; padding: 4px 18px calc(var(--safe-b) + 20px); overscroll-behavior: contain; }
.sheet-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 16px; }
.sheet-title h2 { font-size: 21px; font-weight: 800; letter-spacing: -.01em; }
.sheet-foot { position: sticky; bottom: calc(-1 * (var(--safe-b) + 20px)); background: var(--surface); padding: 12px 0 calc(var(--safe-b) + 20px);
  margin-bottom: calc(-1 * (var(--safe-b) + 20px)); border-top: 1px solid var(--line); margin-top: 16px; }

/* ============ Toast & tooltip ============ */
#toast-root { position: fixed; top: calc(var(--safe-t) + 12px); left: 50%; transform: translateX(-50%); z-index: 80; width: min(448px, calc(100% - 32px)); display: grid; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 16px; background: var(--text); color: var(--bg); font-weight: 650; font-size: 14px;
  box-shadow: var(--shadow); animation: toast-in .3s cubic-bezier(.2, .9, .3, 1.2) both; pointer-events: auto; }
.toast .i { width: 20px; height: 20px; }
.toast.error { background: #3a1414; color: #ffd9d9; }
.toast.pr { background: var(--accent); color: var(--accent-ink); }
.toast.out { animation: toast-out .25s ease both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-14px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px); } }
.chart-tip { position: fixed; z-index: 70; pointer-events: none; background: var(--surface-3); border: 1px solid var(--line-2); border-radius: 12px; padding: 8px 10px;
  box-shadow: var(--shadow); min-width: 90px; max-width: 220px; transform: translate(-50%, calc(-100% - 12px)); }
.chart-tip .tv { font-size: 16px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.chart-tip .tl { font-size: 12px; color: var(--text-2); font-weight: 600; }
.chart-tip .tr { display: flex; align-items: center; gap: 6px; }
.chart-tip .tk { width: 12px; height: 2px; border-radius: 2px; background: var(--c); }

/* ============ Charts ============ */
.chart { position: relative; width: 100%; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.chart svg { overflow: visible; }
.chart text { font-family: var(--font); fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .lbl-strong { fill: var(--text); font-weight: 700; font-size: 12px; }
.chart .lbl-sub { fill: var(--text-2); font-size: 11px; }
.chart .halo { paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; font-weight: 650; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .target { stroke: var(--text-2); stroke-width: 1; opacity: .7; shape-rendering: crispEdges; }
.chart .hit { fill: transparent; cursor: pointer; outline: none; }
.chart .bg:hover .bar, .chart .bg:focus-within .bar { filter: brightness(1.2); }
.chart .hit:focus-visible { outline: none; }
.chart .xhair { stroke: var(--text-2); stroke-width: 1; shape-rendering: crispEdges; }
.chart:focus-visible { outline: 2px solid var(--accent-fg); outline-offset: 4px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--text-2); font-weight: 600; margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); display: inline-block; }
.legend i.line { height: 2px; width: 14px; border-radius: 2px; }
details.tv { margin-top: 10px; }
details.tv summary { font-size: 13px; color: var(--accent-fg); font-weight: 650; cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
details.tv summary::-webkit-details-marker { display: none; }
.dtable { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px; font-variant-numeric: tabular-nums; }
.dtable th { text-align: start; color: var(--muted); font-weight: 650; font-size: 12px; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.dtable td { padding: 8px 4px; border-bottom: 1px solid var(--line); }
.dtable td:not(:first-child), .dtable th:not(:first-child) { text-align: end; }
.dtable tr:last-child td { border-bottom: 0; }

/* Rings */
.rings svg circle.arc { animation: ring-in 1s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes ring-in { from { stroke-dasharray: 0 var(--circ); } }

/* ============ Skeleton ============ */
.sk { background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: sk 1.2s linear infinite;
  border-radius: var(--radius); border: 1px solid var(--line); }
@keyframes sk { to { background-position: -200% 0; } }

/* ============ Empty states ============ */
.empty { text-align: center; padding: 22px 12px; color: var(--text-2); display: grid; justify-items: center; gap: 8px; }
.empty .ico { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.empty .ico .i { width: 26px; height: 26px; }
.empty h3 { color: var(--text); font-size: 16px; }

/* ============ Banner ============ */
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.banner .i { width: 20px; height: 20px; margin-top: 1px; color: var(--c, var(--text-2)); }
.banner[data-s="warn"] { --c: var(--warn); background: color-mix(in srgb, var(--warn) 10%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.banner[data-s="serious"] { --c: var(--serious); background: color-mix(in srgb, var(--serious) 10%, var(--surface)); border-color: color-mix(in srgb, var(--serious) 30%, transparent); }
.banner[data-s="critical"] { --c: var(--critical); background: color-mix(in srgb, var(--critical) 10%, var(--surface)); border-color: color-mix(in srgb, var(--critical) 35%, transparent); }
.banner[data-s="info"] { --c: var(--c-water); }
.banner b { display: block; font-size: 14px; }
.banner p { font-size: 13px; color: var(--text-2); margin-top: 2px; }

/* ============ Home ============ */
.hero-card { background: var(--hero-grad); border: 1px solid var(--line-2); overflow: hidden; }
.hero-top { display: flex; justify-content: space-between; align-items: center; }
.brand { font-weight: 900; letter-spacing: .18em; font-size: 13px; display: inline-flex; align-items: center; gap: 8px; }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.brand-mark .i { width: 16px; height: 16px; stroke-width: 2.6; }
.hero-plan { margin-top: 18px; font-size: 14px; color: var(--text-2); font-weight: 650; }
.hero-days { display: flex; align-items: baseline; gap: 8px; margin: 2px 0 14px; }
.hero-days .big { font-size: 52px; font-weight: 850; letter-spacing: -.04em; line-height: 1; }
.hero-days span:last-child { font-size: 16px; font-weight: 650; color: var(--text-2); }
.hero-dates { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--muted); font-weight: 600; }

.checkin-strip { display: flex; align-items: center; gap: 12px; }
.checkin-strip .ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-2); flex: none; }
.checkin-strip .ico .i { width: 22px; height: 22px; }
.live { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 rgba(12, 163, 12, .6); animation: live 1.8s infinite; }
@keyframes live { 70% { box-shadow: 0 0 0 9px rgba(12, 163, 12, 0); } 100% { box-shadow: 0 0 0 0 rgba(12, 163, 12, 0); } }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; }

.today-card { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.ring-legend { display: grid; gap: 12px; }
.lg-row { display: flex; gap: 10px; align-items: center; }
.lg-row .key { width: 4px; align-self: stretch; border-radius: 4px; background: var(--c); }
.lg-label { font-size: 12px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; }
.lg-val { font-size: 19px; font-weight: 800; letter-spacing: -.01em; line-height: 1.2; }
.lg-val small { font-size: 13px; color: var(--text-2); font-weight: 600; letter-spacing: 0; }

.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.wd { display: grid; justify-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
.wd .c { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); font-size: 13px; }
.wd .c .i { width: 18px; height: 18px; stroke-width: 2.8; }
.wd.hit .c { background: var(--accent); color: var(--accent-ink); }
.wd.today .c { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text-2); }
.wd.future .c { opacity: .5; }

.workout-card .wc-title { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; }
.workout-card .wc-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--text-2); font-size: 13px; font-weight: 600; margin: 8px 0 14px; }
.workout-card .wc-meta span { display: inline-flex; align-items: center; gap: 5px; }
.workout-card .wc-meta .i { width: 15px; height: 15px; }
.tip-card p { margin-top: 8px; font-size: 15px; line-height: 1.5; color: var(--text); }
.tip-card .coach { display: flex; align-items: center; gap: 10px; }

/* ============ Train ============ */
.days-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day-btn { display: grid; justify-items: center; gap: 2px; padding: 8px 0 7px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.day-btn .dn { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.day-btn .dd { font-size: 17px; font-weight: 800; }
.day-btn .dt { font-size: 10px; font-weight: 650; color: var(--muted); max-width: 44px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-btn[aria-pressed="true"] { background: var(--text); border-color: transparent; }
.day-btn[aria-pressed="true"] .dn, .day-btn[aria-pressed="true"] .dd, .day-btn[aria-pressed="true"] .dt { color: var(--bg); }
.day-btn.is-today .dn { color: var(--accent-fg); }
.day-btn[aria-pressed="true"].is-today .dn { color: var(--bg); }

.ex { padding: 14px 14px 10px; }
.ex-head { display: flex; gap: 12px; align-items: flex-start; }
.ex-idx { width: 32px; height: 32px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; }
.ex.complete .ex-idx { background: var(--accent); color: var(--accent-ink); }
.ex-head h3 { font-size: 16px; font-weight: 750; line-height: 1.25; }
.ex-head .muted { font-size: 13px; margin-top: 2px; }
.ex-count { margin-inline-start: auto; font-size: 13px; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; padding-top: 6px; }
.sets { margin-top: 12px; display: grid; gap: 6px; }
.set-row, .set-head { display: grid; grid-template-columns: 30px 1fr 72px 64px 44px; gap: 8px; align-items: center; }
.set-row.no-w, .set-head.no-w { grid-template-columns: 30px 1fr 88px 44px; }
.set-head { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 0 2px; }
.set-head span:nth-child(n+3) { text-align: center; }
.set-no { font-weight: 800; text-align: center; color: var(--text-2); font-size: 14px; }
.set-prev { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.set-in { height: 40px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); text-align: center; font-weight: 700; font-size: 16px; width: 100%;
  font-variant-numeric: tabular-nums; outline: none; padding: 0 4px; color: var(--text); }
.set-in:focus { border-color: var(--accent-fg); }
.set-in::placeholder { color: var(--muted); font-weight: 600; }
.tick { width: 44px; height: 40px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); border: 1px solid var(--line); }
.tick .i { width: 20px; height: 20px; stroke-width: 2.8; }
.set-row.done .tick { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.set-row.done .set-in { background: var(--accent-soft); border-color: transparent; }
.set-row.done .set-no { color: var(--accent-fg); }
.set-row.pr .set-no::after { content: "PR"; display: block; font-size: 9px; color: var(--accent-fg); }
.set-row[aria-disabled="true"] { opacity: .55; pointer-events: none; }
.ex-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }

.rest-pill { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + var(--safe-b) + 32px); z-index: 45; display: flex; align-items: center; gap: 10px;
  background: var(--text); color: var(--bg); border-radius: 18px; padding: 8px 8px 8px 16px; box-shadow: var(--shadow); animation: toast-in .3s both; width: max-content; max-width: calc(100% - 32px); }
.rest-pill .timer { font-size: 22px; min-width: 58px; }
.rest-pill .lbl { font-size: 12px; font-weight: 700; opacity: .7; text-transform: uppercase; letter-spacing: .06em; }
.rest-pill button { height: 38px; padding: 0 12px; border-radius: 12px; background: color-mix(in srgb, var(--bg) 12%, transparent); font-weight: 700; font-size: 14px; color: var(--bg); }
.rest-pill .rp-bar { position: absolute; left: 14px; right: 14px; bottom: 4px; height: 3px; border-radius: 3px; background: color-mix(in srgb, var(--bg) 18%, transparent); overflow: hidden; }
.rest-pill .rp-bar i { display: block; height: 100%; background: var(--accent-fg); }

.class-card { display: grid; grid-template-columns: 58px 1fr; gap: 14px; }
.class-time { text-align: center; padding-top: 2px; }
.class-time .t { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.class-time .d { font-size: 12px; color: var(--muted); font-weight: 600; }
.class-card h3 { font-size: 16px; font-weight: 750; }
.class-meta { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.class-foot { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.class-foot .meter { flex: 1; }
.act-ico { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: color-mix(in srgb, var(--c, var(--accent-fg)) 16%, var(--surface-2)); color: var(--c, var(--accent-fg)); flex: none; }
.act-ico .i { width: 20px; height: 20px; }
.day-group { font-size: 13px; font-weight: 700; color: var(--muted); margin: 18px 4px 8px; text-transform: uppercase; letter-spacing: .05em; }
.pr-card { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.pr-card h3 { font-size: 15px; font-weight: 750; }
.pr-card .big { font-size: 24px; font-weight: 850; letter-spacing: -.02em; text-align: end; }
.pr-card .big small { font-size: 13px; color: var(--text-2); font-weight: 650; }
.spark { height: 34px; grid-column: 1 / -1; margin-top: 6px; }

/* ============ Check-in ============ */
.pass { border-radius: 24px; padding: 20px; color: #f5f6f7; background: radial-gradient(130% 120% at 0% 0%, rgba(243, 192, 68, .32), rgba(243, 192, 68, 0) 50%), linear-gradient(150deg, #24201a 0%, #0e0d0b 100%);
  border: 1px solid rgba(255, 255, 255, .1); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.pass::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(115deg, rgba(255, 255, 255, .025) 0 2px, transparent 2px 12px); pointer-events: none; }
.pass { --text: #f7f4ec; --text-2: #bdb5a4; --surface-2: #1f1c17; color-scheme: dark; }
.pass .brand-mark { background: #f3c044; color: #1a1400; }
.pass-top { display: flex; justify-content: space-between; align-items: center; }
.pass-body { display: grid; grid-template-columns: 1fr auto; gap: 16px; margin-top: 18px; align-items: end; }
.pass-name { font-size: 22px; font-weight: 800; letter-spacing: -.01em; line-height: 1.2; }
.pass-code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 14px; color: #f3c044; margin-top: 4px; letter-spacing: .04em; }
.pass-meta { font-size: 12px; color: #aab0b8; margin-top: 12px; line-height: 1.6; }
.pass-meta b { color: #f5f6f7; }
.qr { width: 124px; height: 124px; background: #fff; border-radius: 14px; padding: 8px; position: relative; z-index: 1; }
.qr svg { width: 100%; height: 100%; }
.big-timer { font-size: 44px; font-weight: 850; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-head h3 { font-size: 16px; font-weight: 750; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal .dow { font-size: 11px; font-weight: 700; color: var(--muted); text-align: center; padding-bottom: 4px; }
.cal .cell { aspect-ratio: 1; border-radius: 10px; display: grid; place-items: center; font-size: 13px; font-weight: 650; color: var(--text-2); background: var(--surface-2); position: relative; }
.cal .cell.pad { background: transparent; }
.cal .cell.future { opacity: .4; }
.cal .cell[data-lvl="1"] { background: color-mix(in srgb, var(--accent-fg) 30%, var(--surface-2)); color: var(--text); }
.cal .cell[data-lvl="2"] { background: color-mix(in srgb, var(--accent-fg) 62%, var(--surface-2)); color: var(--text); }
.cal .cell[data-lvl="3"] { background: var(--accent-fg); color: var(--bg); }
:root:not([data-theme="light"]) .cal .cell[data-lvl="3"] { color: var(--accent-ink); }
.cal .cell.today { box-shadow: inset 0 0 0 2px var(--text); }
.cal .cell.frozen::after { content: ""; position: absolute; bottom: 4px; width: 4px; height: 4px; border-radius: 50%; background: var(--c-water); }
.cal-legend { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); font-weight: 600; margin-top: 12px; justify-content: flex-end; }
.cal-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* ============ Diet ============ */
.date-nav { display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 3px; }
.date-nav .icon-btn { width: 34px; height: 34px; background: transparent; border: 0; }
.date-nav span { font-size: 14px; font-weight: 700; min-width: 78px; text-align: center; }
.kcal-card { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.ring-center { position: relative; }
.ring-center .rc { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-center .rc b { font-size: 26px; font-weight: 850; letter-spacing: -.02em; line-height: 1.1; }
.ring-center .rc span { font-size: 12px; color: var(--text-2); font-weight: 650; }
.kv { display: grid; gap: 8px; }
.kv .r { display: flex; justify-content: space-between; font-size: 14px; }
.kv .r span { color: var(--text-2); }
.kv .r b { font-variant-numeric: tabular-nums; }
.glasses { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.glass { width: 28px; height: 36px; border-radius: 4px 4px 9px 9px; border: 2px solid color-mix(in srgb, var(--c-water) 45%, transparent); position: relative; overflow: hidden; }
.glass::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: var(--c-water); transition: height .3s; }
.glass.full::after { height: 100%; }
.glass.full { border-color: var(--c-water); }
.meal-card .card-head { margin-bottom: 6px; }
.meal-ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.meal-ico .i { width: 19px; height: 19px; }
.food-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.food-row .t { font-weight: 650; font-size: 14px; }
.food-row .s { font-size: 12px; color: var(--muted); }
.food-row .k { font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.suggest { margin-top: 10px; padding: 12px; border-radius: 14px; background: var(--surface-2); border: 1px dashed var(--line-2); }
.suggest .eyebrow { display: flex; align-items: center; gap: 6px; }
.suggest ul { margin: 8px 0 10px; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 14px; }
.suggest li { display: flex; justify-content: space-between; gap: 10px; color: var(--text-2); }
.suggest li b { color: var(--text); font-weight: 600; }
.food-pick { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); width: 100%; text-align: start; }
.food-pick .t { font-weight: 650; font-size: 15px; }
.food-pick[aria-pressed="true"] .t { color: var(--accent-fg); }
.food-pick[aria-pressed="true"] { box-shadow: inset 3px 0 0 var(--accent-fg); padding-inline-start: 10px; }
.food-pick .s { font-size: 12px; color: var(--muted); margin-top: 1px; }
.food-pick .k { margin-inline-start: auto; font-weight: 700; font-variant-numeric: tabular-nums; text-align: end; font-size: 14px; }
.food-pick .k small { display: block; color: var(--muted); font-weight: 600; font-size: 11px; }
.search { position: relative; }
.search .i { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; }
.search .input { padding-inline-start: 42px; }

/* ============ Progress ============ */
.hero-num { font-size: 56px; font-weight: 850; letter-spacing: -.04em; line-height: 1; }
.hero-num small { font-size: 20px; color: var(--text-2); font-weight: 700; letter-spacing: 0; margin-inline-start: 4px; }
.goal-track { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); font-weight: 650; margin-top: 8px; }
.bmi-gauge { position: relative; margin: 22px 0 6px; }
.bmi-bar { display: flex; gap: 2px; height: 10px; }
.bmi-bar i { border-radius: 3px; background: var(--c); opacity: .85; }
.bmi-bar i:first-child { border-radius: 99px 3px 3px 99px; }
.bmi-bar i:last-child { border-radius: 3px 99px 99px 3px; }
.bmi-marker { position: absolute; top: -9px; width: 4px; height: 28px; border-radius: 4px; background: var(--text); transform: translateX(-50%); box-shadow: 0 0 0 2px var(--surface); }
.bmi-scale { display: flex; margin-top: 8px; font-size: 11px; font-weight: 650; color: var(--text-2); }
.bmi-scale span { text-align: center; }
.measure-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.measure { background: var(--surface-2); border-radius: 14px; padding: 10px 12px; }
.measure .l { font-size: 12px; color: var(--muted); font-weight: 650; }
.measure .v { font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.measure .v small { font-size: 12px; color: var(--text-2); font-weight: 600; }

/* ============ Profile ============ */
.profile-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 8px 0 4px; }
.profile-hero h2 { font-size: 23px; font-weight: 800; letter-spacing: -.01em; }
.plan-opt { display: grid; gap: 6px; padding: 14px; border-radius: 16px; border: 1.5px solid var(--line-2); background: var(--surface-2); text-align: start; width: 100%; position: relative; }
.plan-opt[aria-pressed="true"] { border-color: var(--accent-fg); background: var(--accent-soft); }
.plan-opt .pn { font-weight: 800; font-size: 16px; }
.plan-opt .pp { font-weight: 850; font-size: 20px; }
.plan-opt .pp small { font-size: 13px; color: var(--text-2); font-weight: 600; }
.plan-opt ul { margin: 4px 0 0; padding: 0 0 0 18px; font-size: 13px; color: var(--text-2); }
.plan-opt .pill { position: absolute; top: 12px; inset-inline-end: 12px; }
.trainer { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; }

/* ============ Auth ============ */
.auth { min-height: 100dvh; display: flex; flex-direction: column; padding: calc(var(--safe-t) + 28px) 20px calc(var(--safe-b) + 24px); }
.auth-hero { padding: 26px 4px 26px; }
.auth-hero .logo { width: 64px; height: 64px; border-radius: 20px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; margin-bottom: 22px;
  box-shadow: 0 12px 30px rgba(243, 192, 68, .28); }
.auth-hero .logo .i { width: 34px; height: 34px; stroke-width: 2.4; }
.auth-hero h1 { font-size: 34px; font-weight: 850; letter-spacing: -.03em; line-height: 1.08; }
.auth-hero h1 em { font-style: normal; color: var(--accent-fg); }
.auth-hero p { color: var(--text-2); margin-top: 10px; font-size: 16px; }
.auth-foot { margin-top: auto; padding-top: 24px; text-align: center; font-size: 14px; color: var(--text-2); }
.auth-foot a { color: var(--accent-fg); font-weight: 700; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; font-weight: 650; margin: 4px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.steps { display: flex; gap: 6px; margin: 6px 0 20px; }
.steps i { flex: 1; height: 4px; border-radius: 4px; background: var(--surface-3); }
.steps i.on { background: var(--accent-fg); }
.preview { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

@media (max-width: 360px) {
  .topbar h1 { font-size: 24px; }
  .set-row, .set-head { grid-template-columns: 26px 1fr 64px 56px 40px; gap: 6px; }
  .today-card { grid-template-columns: 1fr; justify-items: center; }
  .today-card .ring-legend { grid-template-columns: repeat(3, 1fr); width: 100%; gap: 8px; }
  .today-card .lg-val { font-size: 16px; }
  .hero-days .big { font-size: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ============ Page layout helpers ============ */
.cols > .col + .col { margin-top: 12px; }
.cols > .col > :first-child.section-title { margin-top: 8px; }
.cards-grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.cards-grid > * { min-width: 0; }
.side-brand, .side-only { display: none; }

/* ============ Desktop & tablet ============ */
@media (min-width: 720px) {
  .sheet-wrap .sheet { top: 50%; bottom: auto; width: min(560px, 92vw); max-height: 86vh; border-radius: 24px; border-bottom: 1px solid var(--line);
    transform: translate(-50%, -46%) scale(.98); opacity: 0; transition: transform .25s cubic-bezier(.2, .85, .25, 1), opacity .2s; }
  .sheet-wrap.open .sheet { transform: translate(-50%, -50%); opacity: 1; }
  .sheet-grip { display: none; }
  .sheet-body { padding: 22px 24px 24px; }
  .sheet-foot { bottom: -24px; margin-bottom: -24px; padding-bottom: 24px; }
  #toast-root { left: auto; inset-inline-end: 24px; transform: none; width: 380px; }
}

@media (min-width: 960px) {
  body { background: var(--bg); }
  .shell { max-width: none; box-shadow: none; background: transparent; }
  .tabbar {
    inset-inline-start: 0; top: 0; bottom: 0; transform: none; width: 248px; height: 100vh; padding: 22px 14px; border-top: 0; border-inline-end: 1px solid var(--line);
    display: flex; flex-direction: column; gap: 4px; background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .side-brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 22px; order: -2; }
  .side-brand .brand-mark { width: 38px; height: 38px; border-radius: 12px; }
  .side-brand .brand-mark .i { width: 22px; height: 22px; }
  .side-brand b { display: block; font-size: 16px; font-weight: 800; letter-spacing: -.01em; }
  .side-brand span { font-size: 12px; color: var(--muted); font-weight: 600; }
  .tab, .tab-center, .side-only { display: flex; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 14px; height: 46px; border-radius: 12px;
    font-size: 15px; font-weight: 650; color: var(--text-2); }
  .tab:hover { background: var(--surface-2); color: var(--text); }
  .tab .i { width: 21px; height: 21px; }
  .tab[aria-current="page"] { background: var(--accent-soft); color: var(--text); }
  .tab[aria-current="page"] .i { color: var(--accent-fg); }
  .tab[aria-current="page"]::before { top: 11px; bottom: 11px; inset-inline-start: 0; width: 3px; height: auto; border-start-start-radius: 0; border-end-start-radius: 0; border-start-end-radius: 3px; border-end-end-radius: 3px; }
  .tab-center { order: -1; margin-bottom: 10px; background: var(--accent); color: var(--accent-ink); }
  .tab-center:hover { background: var(--accent); color: var(--accent-ink); filter: brightness(1.05); }
  .tab-center .fab { width: auto; height: auto; margin: 0; background: none; box-shadow: none; color: inherit; border-radius: 0; }
  .tab-center .fab .i { width: 21px; height: 21px; }
  .tab-center[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
  .tab-center[aria-current="page"] .i { color: var(--accent-ink); }
  .tab-center .fab.live::after { top: 6px; inset-inline-end: 10px; }
  .side-only { margin-top: auto; }
  .side-only[aria-current="page"] { background: var(--accent-soft); color: var(--text); }
  .view { margin-inline-start: 248px; padding: 34px 40px 48px; max-width: calc(248px + 1240px); }
  .view > * { max-width: 760px; }
  .view > .cols, .view > .cards-grid, .view > .wide, .view > .topbar { max-width: none; }
  .view.no-tabs { margin-inline-start: 0; max-width: none; }
  .topbar h1 { font-size: 32px; }
  .rest-pill { bottom: 28px; left: calc(50% + 124px); }
  .cards-grid { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
  .auth { max-width: 460px; margin: 0 auto; justify-content: center; }
  .auth-foot { margin-top: 24px; }
}

@media (min-width: 1180px) {
  .cols { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 24px; align-items: start; }
  .cols > .col + .col { margin-top: 0; }
  .cols > .col > :first-child.section-title { margin-top: 0; }
  .view > * { max-width: 1240px; }
}

/* ============ Exercise library & custom workouts ============ */
.seg.five > * { font-size: 13px; padding: 0 2px; }
.thumb { width: 48px; height: 48px; border-radius: 12px; object-fit: cover; background: #fff; flex: none; display: block; }
.thumb-ph { display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.thumb-ph .i { width: 22px; height: 22px; }
.ex-thumb { position: relative; flex: none; }
.ex-thumb .thumb { width: 54px; height: 54px; border-radius: 14px; }
.ex-thumb .ex-idx { position: absolute; inset-inline-start: -6px; top: -6px; width: 22px; height: 22px; border-radius: 8px; font-size: 12px;
  background: var(--surface-3); box-shadow: 0 0 0 2px var(--surface); }
.ex-thumb .ex-idx .i { width: 13px; height: 13px; stroke-width: 3; }
.ex-name { font-weight: 750; font-size: 16px; text-align: start; line-height: 1.25; }
.ex-name:hover { color: var(--accent-fg); }
.ex .ex-count { padding-top: 4px; }
.dot-custom { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--accent-fg); margin-inline-end: 3px; vertical-align: middle; }
.day-btn[aria-pressed="true"] .dot-custom { background: var(--bg); }
.list > button.li { width: 100%; text-align: start; }
.list > button.li:hover .t { color: var(--accent-fg); }
.list > .li > .i:last-child { color: var(--muted); width: 18px; height: 18px; }

.howto-imgs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.howto-imgs.single { grid-template-columns: 1fr; }
.howto-imgs figure { margin: 0; position: relative; }
.howto-imgs img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 14px; background: #fff; display: block; }
.howto-imgs figcaption { position: absolute; inset-inline-start: 8px; bottom: 8px; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 700;
  background: rgba(0, 0, 0, .62); color: #fff; letter-spacing: .03em; }
.howto-h { font-size: 15px; font-weight: 750; margin: 18px 0 8px; }
.steps-list { margin: 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 10px; }
.steps-list li { counter-increment: s; display: grid; grid-template-columns: 26px 1fr; gap: 10px; font-size: 14px; line-height: 1.5; color: var(--text); }
.steps-list li::before { content: counter(s); width: 26px; height: 26px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-fg);
  font-weight: 800; font-size: 13px; display: grid; place-items: center; }
.tips-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.tips-list li { display: flex; gap: 10px; font-size: 14px; color: var(--text-2); line-height: 1.45; }
.tips-list .i { width: 18px; height: 18px; color: var(--good); margin-top: 1px; }

.tpl-cover img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 16px; background: #fff; display: block; }
.tpl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tpl-card { padding: 0; overflow: hidden; }
.tpl-img { aspect-ratio: 16 / 10; background: #fff; display: grid; place-items: stretch; }
.tpl-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tpl-img .thumb-ph { width: 100%; height: 100%; }
.tpl-body { padding: 10px 12px 12px; }
.tpl-body .eyebrow { font-size: 10px; }
.tpl-body .t { font-weight: 750; font-size: 15px; margin-top: 2px; }
.tpl-body .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tpl-scroll { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px 4px; scroll-snap-type: x mandatory; scroll-padding-inline: 16px; }
.tpl-scroll::-webkit-scrollbar { display: none; }
.tpl-scroll .tpl-card { flex: none; width: 200px; scroll-snap-align: start; }

.lib-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lib-card { padding: 0; overflow: hidden; }
.lib-img { aspect-ratio: 3 / 2; background: #fff; position: relative; display: grid; }
.lib-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-img .thumb-ph { width: 100%; height: 100%; }
.lib-badge { position: absolute; top: 8px; inset-inline-start: 8px; font-size: 11px; padding: 3px 8px; }
.lib-body { padding: 10px 12px 12px; }
.lib-body .t { font-weight: 700; font-size: 14px; line-height: 1.3; }
.lib-body .s { font-size: 12px; color: var(--muted); margin-top: 2px; }

.pick-row { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.pick-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 10px 0; text-align: start; }
.pick-main .t { font-weight: 650; font-size: 15px; }
.pick-main .s { font-size: 12px; color: var(--muted); }
.pick-toggle { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line-2); display: grid; place-items: center; color: var(--text-2); flex: none; }
.pick-toggle[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.pick-toggle .i { width: 20px; height: 20px; stroke-width: 2.6; }

@media (min-width: 960px) {
  .lib-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
  .tpl-scroll { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin: 0; padding: 0; overflow: visible; }
  .tpl-scroll .tpl-card { width: auto; }
  .tpl-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ============ Week planner ============ */
.week-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.week-nav .grow { display: grid; line-height: 1.2; }
.week-nav .grow b { font-size: 15px; font-weight: 750; }
.week-nav .grow span { font-size: 12px; color: var(--muted); font-weight: 600; }
.plan-day.is-today { border-color: color-mix(in srgb, var(--accent-fg) 55%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-fg) 30%, transparent); }
.plan-day h3 { font-size: 17px; font-weight: 800; margin-top: 2px; }
.plan-items { display: grid; gap: 2px; margin-top: 12px; }
.plan-item { display: flex; align-items: center; gap: 10px; padding: 6px; margin: 0 -6px; border-radius: 12px; text-align: start; width: calc(100% + 12px); }
.plan-item:hover { background: var(--surface-2); }
.plan-item .thumb { width: 40px; height: 40px; border-radius: 10px; }
.plan-item .t { font-weight: 650; font-size: 14px; }
.plan-item .s { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.plan-item .pill { padding: 2px 8px; font-size: 11px; }

/* ============ Brand, access and protection (approval, PT, watermark) ============ */
.brand-logo { width: 40px; height: 40px; border-radius: 50%; flex: none; }
.auth-logo { width: 112px; height: 112px; border-radius: 50%; margin: 0 auto 14px; filter: drop-shadow(0 10px 28px rgba(252, 235, 34, .18)); }
.side-brand .brand-logo { width: 38px; height: 38px; }
.pill.pt-pill { background: var(--accent); color: var(--accent-ink); font-weight: 850; letter-spacing: .04em; }
.pt-hero { border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); background: var(--hero-grad); }
.pt-hero h2 { font-size: 22px; font-weight: 850; letter-spacing: -.01em; margin: 6px 0 4px; }
.pt-hero-top { display: flex; align-items: center; gap: 8px; }
.perks { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 12px; }
.perks li { display: flex; gap: 12px; align-items: flex-start; }
.perks li .i { width: 20px; height: 20px; color: var(--accent-fg); flex: none; margin-top: 2px; }
.perks b { display: block; font-size: 14.5px; }
.perks span { display: block; font-size: 13px; color: var(--text-2); }
.lock-card { display: flex; gap: 12px; align-items: center; }
.lock-card > .i { width: 22px; height: 22px; color: var(--accent-fg); flex: none; }
.lock-card b { display: block; }
.tab.locked { position: relative; }
.tab.locked::after { content: ""; position: absolute; top: 8px; inset-inline-end: calc(50% - 20px); width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); }
.gate .gate-ico { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; margin: 6px auto 0; background: var(--accent-soft); color: var(--accent-fg); }
.gate .gate-ico .i { width: 26px; height: 26px; }
.gate .gate-ico[data-s="expired"], .gate .gate-ico[data-s="suspended"], .gate .gate-ico[data-s="rejected"] { background: color-mix(in srgb, var(--critical) 18%, transparent); color: var(--critical); }
.how-steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 14px; }
.how-steps li { counter-increment: s; display: grid; grid-template-columns: 32px 1fr; column-gap: 12px; }
.how-steps li::before { content: counter(s); grid-row: span 2; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 850; display: grid; place-items: center; }
.how-steps span { color: var(--text-2); font-size: 13.5px; }
.pt-mini { display: flex; gap: 12px; align-items: flex-start; }
.pt-mini > .i { width: 22px; height: 22px; color: var(--accent-fg); flex: none; }
.pt-mini b { display: block; }
.li[aria-pressed="true"] { outline: 2px solid var(--accent-fg); outline-offset: -2px; }

/* Content protection: no selecting or saving outside form fields, nothing to print, hidden while in the background. */
html.protected body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
html.protected input, html.protected textarea, html.protected select { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
html.protected img { -webkit-user-drag: none; pointer-events: auto; }
html.shielded .shell, html.shielded .sheet-wrap { filter: blur(22px) brightness(.5); }
html.shielded body::after { content: "Golden Fitness · protected"; position: fixed; inset: 0; display: grid; place-items: center; font-weight: 800; color: var(--accent); z-index: 9999; }
#watermark { position: fixed; inset: 0; z-index: 9000; pointer-events: none; opacity: .07; background-repeat: repeat; }
@media print { html.protected body > * { display: none !important; } html.protected body::after { content: "Printing is disabled for Golden Fitness member content."; display: block; padding: 40px; font: 16px system-ui; } }

/* Coach diet plan */
.plan-head h2 { font-size: 21px; font-weight: 850; letter-spacing: -.01em; margin: 4px 0 2px; }
.plan-item { align-items: center; }
.plan-item .tick { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; color: transparent; flex: none; }
.plan-item .tick .i { width: 16px; height: 16px; }
.plan-item.is-eaten .tick { background: var(--good); border-color: var(--good); color: #fff; }
.plan-item.is-eaten .plan-name .t { color: var(--text-2); }
.plan-name { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; }

/* ============ Right-to-left (Arabic) ============ */
[dir="rtl"] body { font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans Arabic", "Geeza Pro", Tahoma, Arial, sans-serif; letter-spacing: 0; }
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] .eyebrow, [dir="rtl"] .divider-label { letter-spacing: 0; }
/* Arrows and chevrons point the other way; charts, numbers-with-units, phone numbers and the BMI scale stay left-to-right. */
[dir="rtl"] .i-flip { transform: scaleX(-1); }
[dir="rtl"] svg:not(.i), [dir="rtl"] .bmi-bar, [dir="rtl"] .num, [dir="rtl"] input[type="tel"], [dir="rtl"] input[type="email"] { direction: ltr; }
[dir="rtl"] .select { background-position: 20px 22px, 15px 22px; }
[dir="rtl"] .food-pick[aria-pressed="true"] { box-shadow: inset -3px 0 0 var(--accent-fg); }
@media (min-width: 960px) { [dir="rtl"] .rest-pill { left: calc(50% - 124px); } }
.lang-switch { display: inline-flex; width: auto; }
.lang-switch button { padding-inline: 14px; }
