/* ==========================================================
   BODYBLENDER — Cinema Athletic stylesheet (rebrand bb-mega21)
   Direction: premium dark, single-accent orange, glassmorphic
   surfaces, Barlow type, cubic-bezier motion. Signature violet→
   pink→orange gradient preserved only on the logo mark + hero
   "BLEND" wordmark + chat user bubble.
========================================================== */

:root {
  color-scheme: dark;

  /* ---------- TONAL BASE ---------- */
  --bg-deep:     #020203;
  --bg-base:     #060608;
  --bg-elevated: #0d0e12;
  --bg-card:     #0f1116;          /* legacy alias, used by .card */
  --bg: var(--bg-base);             /* legacy alias */
  --bg-2: var(--bg-elevated);       /* legacy alias */
  --bg-3: #12141a;                  /* legacy alias, inputs + muted wells */

  /* Glass surfaces */
  --surface:       rgba(255,255,255,0.04);
  --surface-hi:    rgba(255,255,255,0.07);
  --surface-input: rgba(255,255,255,0.03);

  /* ---------- BORDERS ---------- */
  --border:        rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);
  --line:      var(--border);           /* legacy alias */
  --line-soft: rgba(255,255,255,0.05);  /* legacy alias */

  /* ---------- FOREGROUND (contrast-verified against bg-deep) ---------- */
  --text:        #EDEDEF;  /* 17.7:1 AA */
  --text-dim:    #9098a5;  /* 7.1:1  AA */
  --text-faint:  #70788a;  /* 4.6:1  AA (was #5c6371 — 3.4:1, failed) */
  --bone:        #EDEDEF;  /* legacy alias */

  /* Text color that sits ON a solid --accent surface. White on #F97316
     is 2.8:1 (fails). Near-black is 7.1:1 — safer + more premium. */
  --on-accent:   #0a0a0c;

  /* ---------- BRAND GRADIENT tokens (retired 2026-04-21, kept as
     orange aliases so any missed reference stays on-brand) ---------- */
  --g1: #C2410C;   /* was violet — now accent-dark */
  --g2: #F97316;   /* was pink   — now accent */
  --g3: #FB923C;   /* was orange — unchanged */

  /* ---------- PRIMARY ACCENT — energy orange ---------- */
  --accent:       #F97316;
  --accent-2:     #FB923C;              /* hover */
  --accent-dark:  #C2410C;              /* pressed */
  --accent-glow:  rgba(249,115,22,0.32);
  --accent-glow-soft: rgba(249,115,22,0.14);

  /* Gold/amber aliases now point to orange so retained selectors stay on-brand */
  --gold:       var(--accent);
  --gold-deep:  var(--accent-dark);
  --amber:      var(--accent);
  --amber-deep: var(--accent-dark);

  /* ---------- SUPPORTING DATA COLORS ---------- */
  --success:       #22C55E;             /* PRs, streaks, completed sets */
  --success-glow:  rgba(34,197,94,0.28);
  --teal:          #2dd4bf;              /* charts + data variety */
  --teal-deep:     #0f766e;
  --mint:          #2dd4bf;              /* legacy alias */
  --blue:          #60a5fa;
  --purple:        #a78bfa;
  --pink:          #ec4899;              /* logo gradient reuse only */
  --warn:          #fbbf24;
  --danger:        #ef4444;

  /* Legacy chrome-* kept for any straggler reference */
  --chrome-hi: rgba(255,255,255,0.12);
  --chrome-mid: rgba(255,255,255,0.06);
  --chrome-lo: rgba(0,0,0,0.3);
  --chrome-shadow: rgba(0,0,0,0.6);

  /* ---------- SHAPE + MOTION ---------- */
  --radius-sm: 10px;
  --radius:    14px;                     /* legacy alias */
  --radius-md: 16px;
  --radius-lg: 20px;
  --ease:      cubic-bezier(.16,1,.3,1);
  --dur-fast:  150ms;
  --dur:       220ms;
  --dur-slow:  320ms;
  --shadow:    0 10px 40px rgba(0,0,0,.55);
  --shadow-sm: 0 2px 10px rgba(0,0,0,.35);
  --shadow-accent: 0 8px 30px var(--accent-glow);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg-deep);
  color: var(--text);
  font-family: 'Barlow', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  font-feature-settings: 'tnum' 1, 'cv01' 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body { min-height: 100vh; overflow-x: hidden; }

[hidden] { display: none !important; }

/* ==========================================================
   ICON SYSTEM — inline SVG sprite referenced via <use>.
   Scoped to svg.icon so legacy class="icon" usage on non-SVG
   elements (test harness, accountability pin) isn't clobbered.
========================================================== */
svg.icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  vertical-align: -4px;
  flex: 0 0 auto;
  color: inherit;
  overflow: visible;
}
svg.icon.icon-xs { width: 14px; height: 14px; vertical-align: -2px; }
svg.icon.icon-sm { width: 16px; height: 16px; vertical-align: -3px; }
svg.icon.icon-md { width: 20px; height: 20px; vertical-align: -4px; }
svg.icon.icon-lg { width: 24px; height: 24px; vertical-align: -5px; }
svg.icon.icon-xl { width: 32px; height: 32px; vertical-align: -8px; }
svg.icon.icon-2xl { width: 48px; height: 48px; }
/* (nav/sub-tab icons are laid out via flex gap on their parent) */

/* Theme-aware scrollbars — keeps the dark aesthetic consistent across
   every scrolling region (chat log, food search, sub-tabs, etc.) */
html { scrollbar-color: rgba(255,255,255,.14) transparent; scrollbar-width: thin; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.22); }
::selection { background: rgba(249,115,22,.35); color: var(--text); }

/* ==========================================================
   AMBIENT — cinematic base gradient + two slow drifting blobs.
   Fixed, pointer-events:none, sits behind #app (z-index 0).
   Respects prefers-reduced-motion.
========================================================== */
body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(1200px 700px at 15% -10%, rgba(249,115,22,.12), transparent 55%),
    radial-gradient(1000px 700px at 105% 20%, rgba(124,58,237,.09), transparent 55%),
    linear-gradient(180deg, #0a0a0c 0%, #060608 45%, #020203 100%);
  pointer-events: none;
  z-index: 0;
}
body::after {
  content: '';
  position: fixed;
  left: 60%; top: 70%;
  width: 620px; height: 620px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(249,115,22,.16), transparent 72%);
  filter: blur(28px);
  pointer-events: none;
  z-index: 0;
  animation: bbBlobDrift 18s ease-in-out infinite;
}
@keyframes bbBlobDrift {
  0%, 100% { transform: translate(-4%, 0) scale(1); opacity: .9; }
  50%      { transform: translate(6%, -8%) scale(1.08); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  body::after { animation: none; }
}

#app { position: relative; z-index: 1; }

/* Native form control tinting */
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
  background: var(--surface-input);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
  color-scheme: dark;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
input[type="date"]:hover,
input[type="time"]:hover,
input[type="datetime-local"]:hover { border-color: rgba(249,115,22,.35); }
input[type="date"]:focus,
input[type="time"]:focus,
input[type="datetime-local"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow-soft);
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(0.8) sepia(0.4) saturate(1.6) hue-rotate(-5deg);
  cursor: pointer;
  opacity: .85;
}

/* Focus ring for everything keyboard-reachable */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
button, a, select, label[for] { cursor: pointer; }

/* ==========================================================
   Screens (one shows at a time)
========================================================== */
.screen { display: none; min-height: 100vh; padding: clamp(24px, 4vw, 48px); }
.screen.active { display: block; }

/* ==========================================================
   Welcome / hero
========================================================== */
.hero { max-width: 880px; margin: 0 auto; padding-top: 8vh; }
.logo-block { display: flex; align-items: center; gap: 18px; margin-bottom: 32px; }
.logo-mark {
  width: 88px; height: 88px;
  flex-shrink: 0;
  filter:
    drop-shadow(0 4px 18px rgba(249,115,22,.38))
    drop-shadow(0 2px 8px rgba(0,0,0,.45));
}
.logo-mark.small { width: 60px; height: 60px; }

.logo-text h1 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 52px;
  font-weight: 800;
  letter-spacing: 4px;
  margin: 0;
  line-height: 1;
  text-transform: uppercase;
  display: inline-flex;
  align-items: baseline;
  gap: 0;
}
.logo-text h1 .wm-body {
  color: var(--text);
  font-weight: 500;
}
.logo-text h1 .wm-blender {
  color: var(--accent);
  font-weight: 800;
  margin-left: 6px;
  filter: drop-shadow(0 2px 12px var(--accent-glow-soft));
}
.logo-text span {
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 4px;
  text-transform: uppercase;
  font-weight: 600;
  display: block;
  margin-top: 8px;
}

.hero-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: clamp(56px, 9vw, 120px);
  line-height: 0.92;
  letter-spacing: -1px;
  margin: 0 0 24px;
  color: var(--text);
  text-transform: uppercase;
  font-weight: 700;
}
.hero-title em {
  font-style: normal;
  color: var(--accent);
  filter: drop-shadow(0 3px 20px rgba(249,115,22,.4));
}
.hero-sub { color: var(--text-dim); font-size: clamp(16px, 1.8vw, 19px); max-width: 680px; margin: 0 0 24px; }
.hero-sub em { color: var(--accent); font-style: normal; font-weight: 600; }

.hero-quote {
  max-width: 620px;
  margin: 0 0 40px;
  padding: 14px 22px;
  border-left: 3px solid var(--accent);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: .2px;
  background: linear-gradient(90deg, rgba(255,255,255,.04), transparent);
  border-radius: 0 10px 10px 0;
}
.hero-quote em { font-style: italic; color: var(--text); }

.hero-cta { display: flex; gap: 14px; margin-bottom: 56px; flex-wrap: wrap; }

.hero-badges {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

/* Mobile-only feature strip — desktop has the long hero-sub paragraph instead,
   so this section is hidden by default and only shows inside the ≤640px media. */
.hero-features { display: none; }

/* Continue-as-guest link: underlined tertiary action below the primary CTA.
   Deliberately quiet so it doesn't compete with "Start my plan". */
.btn-link {
  display: block;
  margin: 0 auto 18px;
  background: transparent;
  border: 0;
  color: var(--text-faint, #70788a);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .2px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 6px;
  text-align: center;
}
.btn-link:hover,
.btn-link:focus-visible {
  color: var(--accent, #F97316);
  text-decoration: underline;
}

/* Guest quick-setup modal — reuses the existing .form-modal framework but
   adds compact stacked select fields scoped with .guest-field. */
.guest-field {
  display: block;
  margin-bottom: 14px;
}
.guest-field .guest-label {
  display: block;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-faint, #70788a);
  font-weight: 700;
  margin-bottom: 6px;
}
.guest-field select {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface-input, rgba(255,255,255,0.03));
  color: var(--text, #EDEDEF);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 10px;
  font-size: 14px;
}
.guest-field select:focus {
  border-color: var(--accent, #F97316);
  outline: none;
}

/* Guest mode: hide Nutrition + Coach tabs entirely; they're meal/diet-centric
   and guests explicitly opted out of that part of the app. Training and
   Progress remain available. Sub-panels inside those tabs are also hidden
   so a direct URL/deep-link can't render diet content. */
body.is-guest .nav-btn[data-tab="nutrition"],
body.is-guest .nav-btn[data-tab="coach"] {
  display: none;
}
body.is-guest #panel-nutrition,
body.is-guest #panel-coach { display: none !important; }

/* Give the three remaining tabs equal mobile width when there are only
   three in the bottom bar (Overview / Training / Progress). */
@media (max-width: 640px) {
  body.is-guest #screen-plan .plan-header .plan-nav {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Upgrade CTA pill that appears in the sticky header while in guest mode */
.guest-upgrade {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-glow-soft, rgba(249,115,22,0.14));
  border: 1px solid var(--accent, #F97316);
  color: var(--accent, #F97316);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  margin-left: 6px;
  flex-shrink: 0;
}
body.is-guest .guest-upgrade { display: inline-flex; }

/* On mobile the header area is tight — make Adjust + Unlock share nicely */
@media (max-width: 640px) {
  body.is-guest .plan-adjust-btn { padding: 6px 9px; font-size: 10.5px; }
  body.is-guest .plan-adjust-icon { display: none; }
  body.is-guest .guest-upgrade { padding: 6px 9px; font-size: 10px; }
}

/* ==========================================================
   Badges (hero feature cards) — glass surface, accent corona
========================================================== */
.badge {
  --accent-a: var(--accent);
  --accent-b: var(--accent-2);
  --accent-glow-rgb: 249,115,22;

  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 22px 22px;
  overflow: hidden;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.04),
    0 2px 10px rgba(0,0,0,.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.badge::before {
  content: '';
  position: absolute;
  inset: -1px -1px auto -1px;
  height: 55%;
  background: radial-gradient(80% 100% at 50% 0%, rgba(var(--accent-glow-rgb), .14), transparent 70%);
  pointer-events: none;
}
.badge:hover {
  transform: translateY(-2px);
  border-color: rgba(var(--accent-glow-rgb), .4);
  box-shadow:
    0 10px 34px rgba(var(--accent-glow-rgb), .22),
    inset 0 1px 0 rgba(255,255,255,.06);
}

.badge-icon {
  font-size: 22px;
  line-height: 1;
  margin-bottom: 12px;
  filter: drop-shadow(0 2px 8px rgba(var(--accent-glow-rgb), .35));
}
.badge-value {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 44px;
  line-height: .95;
  letter-spacing: 1px;
  margin-bottom: 6px;
  color: var(--text);
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}
.badge-label {
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.35;
  letter-spacing: .3px;
  text-transform: uppercase;
  font-weight: 600;
}

/* Per-variant accent tint */
.badge-violet { --accent-glow-rgb: 167,139,250; }
.badge-pink   { --accent-glow-rgb: 56,189,248; }   /* cyan, as per brand note */
.badge-orange { --accent-glow-rgb: 249,115,22; }
.badge-mint   { --accent-glow-rgb: 34,197,94; }    /* success green */

/* ---- Compact badge variant — the "button" style from the welcome screen,
        reused throughout the app for info-display cards (calorie targets,
        macros, etc.) to keep visual rhythm consistent. ---- */
.feat-badge {
  padding: 14px 12px 16px;
}
.feat-badge .badge-icon {
  margin-bottom: 8px;
  filter: none;
}
.feat-badge .badge-icon .icon {
  width: 22px;
  height: 22px;
  color: var(--accent, #F97316);
}
.feat-badge .badge-value {
  font-size: 15px;
  line-height: 1.1;
  letter-spacing: .4px;
  margin-bottom: 4px;
}
.feat-badge .badge-label {
  font-size: 11px;
  line-height: 1.35;
  letter-spacing: .3px;
}
.feat-badge .badge-number {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 22px;
  line-height: 1;
  letter-spacing: .5px;
  color: var(--accent, #F97316);
  font-variant-numeric: tabular-nums;
  margin-bottom: 2px;
}

/* Grid for in-app feat-badge rows (calorie targets, macros, stats).
   2-col on mobile so each card has room for label + number + sub,
   4-col on wider screens. */
.feat-badge-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (min-width: 640px) {
  .feat-badge-row { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
}

/* ==========================================================
   Buttons
========================================================== */
.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  border: 0;
  padding: 14px 28px;
  border-radius: 12px;
  font-family: 'Barlow', sans-serif;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  cursor: pointer;
  min-height: 44px;
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur-fast) var(--ease);
  box-shadow:
    0 6px 22px var(--accent-glow),
    inset 0 1px 0 rgba(255,255,255,.22);
}
.btn-primary:hover {
  transform: translateY(-2px);
  background: var(--accent-2);
  box-shadow: 0 12px 30px var(--accent-glow);
}
.btn-primary:active { transform: translateY(0) scale(.98); background: var(--accent-dark); }
.btn-primary[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary.btn-big { padding: 18px 36px; font-size: 16px; }

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 14px 22px;
  border-radius: var(--radius-sm);
  font-family: 'Barlow', sans-serif;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: .4px;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface-hi);
}
.btn-ghost.small { padding: 10px 16px; font-size: 13px; min-height: 38px; }

.btn-back {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  padding: 10px 14px;
  border-radius: 8px;
  min-height: 40px;
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.btn-back:hover { color: var(--accent); background: var(--surface); }

/* ==========================================================
   Onboarding
========================================================== */
.onboarding-header {
  max-width: 900px;
  margin: 0 auto 32px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
}
.progress-track {
  height: 6px;
  background: var(--surface);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-fill {
  height: 100%; width: 20%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width .4s var(--ease);
  border-radius: 999px;
  box-shadow: 0 0 16px var(--accent-glow-soft);
}
.progress-label { color: var(--text-dim); font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; font-weight: 600; }

.section { max-width: 900px; margin: 0 auto; }
.section-tag {
  display: inline-block;
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 12px;
}
.section h2 {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: clamp(34px, 5vw, 52px);
  margin: 0 0 8px;
  letter-spacing: .5px;
  color: var(--text);
  text-transform: uppercase;
  line-height: 1;
}
.section-sub { color: var(--text-dim); margin: 0 0 32px; max-width: 620px; font-size: 16px; }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field > span, .field label > span { color: var(--text-dim); font-size: 13px; font-weight: 600; letter-spacing: .3px; }
.field-double { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; grid-column: 1 / -1; }
.field-double label { display: flex; flex-direction: column; gap: 8px; }

input[type="text"], input[type="number"], input[type="email"], input[type="password"], input[type="date"], select, textarea {
  background: var(--surface-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  min-height: 44px;
  /* width:100% + min-width:0 so inputs fill their grid/flex cell instead
     of falling back to their intrinsic size (~200px for number, ~400px for
     selects with long options). Without this, form fields overflow their
     parent on narrow viewports and get clipped by body's overflow-x:clip. */
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease);
}
/* Same story for flex/grid children that hold the input — grid items
   default to min-width: auto which lets them expand to content size. */
.field, .field-double label {
  min-width: 0;
}
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239098a5' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
  color-scheme: dark;
}
/* Native dropdown list styling — Chrome/Edge/Firefox honor these on
   <option>. Without this, the list opens with the browser's default
   (usually white) and the light-colored option text becomes unreadable. */
select option,
select optgroup {
  background-color: #0f1116;
  color: #EDEDEF;
}
select option:disabled {
  color: var(--text-faint, #70788a);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-glow-soft);
}
textarea { resize: vertical; min-height: 70px; }

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  background: transparent;
  padding: 10px 0;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  background: var(--accent);
  border-radius: 50%;
  border: 3px solid var(--bg-deep);
  margin-top: -9px;
  cursor: pointer;
  box-shadow: 0 2px 12px var(--accent-glow);
}
.range-label { color: var(--accent); font-weight: 700; font-size: 14px; }

.wellness-note {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  padding: 16px 20px;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid rgba(251,191,36,.28);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-dim);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.wellness-icon { font-size: 22px; filter: drop-shadow(0 2px 6px rgba(251,191,36,.4)); }
.wellness-note strong { color: var(--text); display: block; margin-bottom: 4px; }

/* Goal picker */
.goal-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 6px;
}
.goal-card {
  --glow: 249,115,22;
  --tint: var(--accent);
  position: relative;
  cursor: pointer;
  padding: 18px 16px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  overflow: hidden;
  text-align: left;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.goal-card input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.goal-card:hover {
  transform: translateY(-2px);
  border-color: rgba(var(--glow), .4);
  box-shadow: 0 6px 24px rgba(var(--glow), .22);
}
.goal-card:has(input:checked) {
  border-color: rgba(var(--glow), .7);
  background:
    radial-gradient(120% 140% at 50% -30%, rgba(var(--glow), .14), transparent 60%),
    var(--surface-hi);
  box-shadow: 0 8px 28px rgba(var(--glow), .28), inset 0 0 0 1px rgba(var(--glow), .25);
}
.goal-card::before {
  content: '';
  position: absolute;
  inset: -1px -1px auto -1px;
  height: 50%;
  background: radial-gradient(70% 100% at 50% 0%, rgba(var(--glow), .12), transparent 72%);
  pointer-events: none;
}
.goal-icon { font-size: 24px; margin-bottom: 8px; filter: drop-shadow(0 2px 6px rgba(var(--glow), .4)); }
.goal-name { font-weight: 700; font-size: 15px; color: var(--tint); letter-spacing: .3px; margin-bottom: 4px; }
.goal-desc { color: var(--text-dim); font-size: 12px; line-height: 1.4; }

.goal-cut      { --glow: 249,115,22;   --tint: var(--accent); }
.goal-maintain { --glow: 96,165,250;   --tint: #60a5fa; }
.goal-bulk     { --glow: 34,197,94;    --tint: var(--success); }
.goal-recomp   { --glow: 45,212,191;   --tint: var(--teal); }

/* Chip-style multi-pickers */
.field .hint {
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 500;
  font-style: normal;
  margin-left: 4px;
}
.pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.pick-grid-dense { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.pick {
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .2px;
  text-align: left;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all var(--dur-fast) var(--ease);
  user-select: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.pick:hover {
  border-color: rgba(249,115,22,.4);
  color: var(--text);
  transform: translateY(-1px);
}
.pick.active {
  background: rgba(249,115,22,.16);
  border-color: var(--accent);
  color: var(--text);
  box-shadow: 0 4px 14px var(--accent-glow);
}
.pick-hate.active {
  background: rgba(239,68,68,.16);
  border-color: var(--danger);
  color: var(--text);
  box-shadow: 0 4px 14px rgba(239,68,68,.28);
}

.chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.chips label {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .2px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  transition: all var(--dur-fast) var(--ease);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.chips label:hover {
  border-color: rgba(249,115,22,.4);
  color: var(--text);
  transform: translateY(-1px);
}
.chips input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0; height: 0;
}
.chips label:has(input:checked) {
  background: rgba(249,115,22,.16);
  border-color: var(--accent);
  color: var(--text);
  box-shadow: 0 4px 14px var(--accent-glow);
}

.onboarding-footer {
  max-width: 900px;
  margin: 40px auto 0;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ==========================================================
   Loader
========================================================== */
#screen-loading .loader-wrap {
  max-width: 520px; margin: 0 auto; padding-top: 15vh; text-align: center;
}
.loader-ring {
  width: 80px; height: 80px; margin: 0 auto 28px;
  border: 4px solid var(--surface);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  box-shadow: 0 0 30px var(--accent-glow-soft);
}
@keyframes spin { to { transform: rotate(360deg); } }
#loader-text {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 40px;
  letter-spacing: 1px;
  margin: 0 0 10px;
  color: var(--text);
  text-transform: uppercase;
}
.loader-sub { color: var(--text-dim); }

/* ==========================================================
   Plan dashboard
========================================================== */
.plan-header {
  max-width: 1200px;
  margin: 0 auto 24px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.plan-title { display: flex; gap: 14px; align-items: center; grid-column: 1 / -1; }
.plan-title h1 {
  margin: 0;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  letter-spacing: 1.5px;
  font-size: 30px;
  color: var(--text);
  text-transform: uppercase;
  line-height: 1;
}
.plan-title p { margin: 0; color: var(--text-dim); font-size: 13px; }
.plan-title .plan-greeting-wrap { flex: 1 1 auto; min-width: 0; }

.plan-adjust-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  background: rgba(249,115,22,.08);
  border: 1px solid rgba(249,115,22,.3);
  color: var(--text);
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .5px;
  text-transform: uppercase;
  cursor: pointer;
  min-height: 40px;
  transition: all var(--dur-fast) var(--ease);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.plan-adjust-btn:hover {
  background: rgba(249,115,22,.14);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-glow);
}
.plan-adjust-icon { font-size: 15px; line-height: 1; }
@media (max-width: 480px) {
  .plan-adjust-btn { padding: 8px 12px; font-size: 12px; gap: 6px; }
  .plan-adjust-icon { font-size: 14px; }
}

/* Top nav — glass strip */
.plan-nav {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  overflow-x: auto;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  scroll-snap-type: x proximity;
  scroll-padding-inline: 6px;
  scrollbar-width: none;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}
.plan-nav::-webkit-scrollbar { display: none; }
.plan-nav .nav-btn { scroll-snap-align: start; }
@media (max-width: 640px) {
  .plan-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    overflow: visible;
  }
  .plan-nav .nav-btn {
    padding: 10px 2px;
    font-size: 10.5px;
    letter-spacing: .2px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    line-height: 1.1;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }
}

.nav-btn {
  position: relative;
  background: transparent;
  color: var(--text-dim);
  border: 0;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .3px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease);
}
.nav-btn .icon { vertical-align: 0; }
.nav-btn:hover {
  color: var(--text);
  background: var(--surface-hi);
}
.nav-btn.active {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow:
    0 4px 18px var(--accent-glow),
    inset 0 1px 0 rgba(255,255,255,.22);
}
.nav-btn.active:hover { filter: brightness(1.05); }

.plan-tools { display: flex; gap: 8px; grid-column: 2 / 3; grid-row: 1 / 2; align-self: start; }

.plan-body { max-width: 1200px; margin: 0 auto; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeSlide .4s var(--ease); }
@keyframes fadeSlide { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ==========================================================
   Plan cards
========================================================== */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 20px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}
.card:hover {
  border-color: rgba(249,115,22,.22);
  box-shadow: 0 6px 28px rgba(0,0,0,.35), 0 0 0 1px rgba(249,115,22,.08) inset;
}
.card h3 {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  letter-spacing: 1px;
  font-size: 28px;
  margin: 0 0 8px;
  color: var(--text);
  text-transform: uppercase;
  line-height: 1.05;
  -webkit-text-fill-color: currentColor;
  background: none;
}
.card.highlight h3 {
  color: var(--accent);
  -webkit-text-fill-color: currentColor;
}
.card h4 { font-size: 16px; margin: 0 0 8px; color: var(--accent); letter-spacing: .3px; font-weight: 700; }
.card p { color: var(--text-dim); margin: 0 0 12px; }

.card.highlight {
  border-color: rgba(249,115,22,.4);
  box-shadow:
    0 0 0 1px rgba(249,115,22,.2) inset,
    0 10px 40px rgba(249,115,22,.14);
  overflow: hidden;
}
.card.highlight::before {
  content: '';
  position: absolute;
  inset: -1px -1px auto -1px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: .8;
}
.card.warn { border-left: 4px solid var(--warn); }

/* Favourites */
.favourites-card { border-left: 4px solid var(--accent); }
.fav-count {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 800;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 999px;
  letter-spacing: .4px;
  vertical-align: 2px;
  box-shadow: 0 2px 8px var(--accent-glow);
}
.fav-list { display: grid; gap: 10px; }
.fav-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: var(--surface-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.fav-item:hover { border-color: rgba(249,115,22,.35); background: var(--surface); }
.fav-info { min-width: 0; }
.fav-name { font-weight: 700; font-size: 14px; color: var(--text); margin-bottom: 2px; }
.fav-macros { font-size: 12px; color: var(--text-dim); font-family: 'JetBrains Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.fav-macros em { color: var(--accent); font-style: normal; font-weight: 700; }
.fav-desc { font-size: 12px; color: var(--text-faint); margin-top: 4px; line-height: 1.35; }
.fav-remove {
  flex: 0 0 auto;
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: all var(--dur-fast) var(--ease);
  filter: drop-shadow(0 2px 6px var(--accent-glow-soft));
}
.fav-remove:hover {
  background: rgba(249,115,22,.1);
  color: var(--text-dim);
  filter: none;
}

/* Collapsible card */
.expandable-card { cursor: pointer; }
.expandable-card > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  padding: 2px 0;
}
.expandable-card > summary::-webkit-details-marker { display: none; }
.expandable-card > summary::marker { content: ''; }
.expandable-card .expand-icon {
  display: inline-block;
  color: var(--accent);
  font-weight: 800;
  transition: transform var(--dur) var(--ease);
  width: 12px;
  text-align: center;
}
.expandable-card[open] .expand-icon { transform: rotate(90deg); }
.expandable-card .expandable-body {
  margin-top: 10px;
  cursor: text;
  animation: expandIn var(--dur) var(--ease);
}
@keyframes expandIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* Stat cards */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }

/* .stat retooled to match the feat-badge "button" shape — compact padding,
   small uppercase title (via .label), orange Barlow Condensed value, dim
   caption below. Unified across every info card in the app. */
.stat {
  --accent-glow-rgb: 249,115,22;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 12px 16px;
  overflow: hidden;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.04),
    0 2px 10px rgba(0,0,0,.35);
}
.stat::before {
  content: '';
  position: absolute;
  inset: -1px -1px auto -1px;
  height: 55%;
  background: radial-gradient(80% 100% at 50% 0%, rgba(var(--accent-glow-rgb), .14), transparent 70%);
  pointer-events: none;
}
.stat:hover {
  transform: translateY(-2px);
  border-color: rgba(var(--accent-glow-rgb), .4);
  box-shadow:
    0 10px 34px rgba(var(--accent-glow-rgb), .22),
    inset 0 1px 0 rgba(255,255,255,.06);
}
.stat .label {
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: .6px;
  text-transform: uppercase;
  margin-bottom: 4px;
  font-weight: 700;
  font-family: 'Barlow Condensed', sans-serif;
  position: relative;
  font-size: 15px;   /* matches feat-badge .badge-value */
  line-height: 1.1;
  letter-spacing: .4px;
}
.stat .value {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: .5px;
  line-height: 1;
  color: rgba(var(--accent-glow-rgb), 1);
  text-transform: none;
  font-variant-numeric: tabular-nums;
  margin-bottom: 2px;
  position: relative;
}
.stat .unit {
  font-size: 11px;
  color: var(--text-faint);
  margin-left: 3px;
  font-weight: 500;
}
.stat .sub {
  color: var(--text-faint);
  font-size: 11px;
  letter-spacing: .3px;
  line-height: 1.35;
  margin-top: 2px;
  position: relative;
}

/* Stat card accent cycle — orange → success → violet → cyan (no pink) */
.stat-row > .stat:nth-child(4n+1) { --accent-glow-rgb: 249,115,22; }
.stat-row > .stat:nth-child(4n+2) { --accent-glow-rgb: 34,197,94; }
.stat-row > .stat:nth-child(4n+3) { --accent-glow-rgb: 167,139,250; }
.stat-row > .stat:nth-child(4n)   { --accent-glow-rgb: 45,212,191; }

/* Macro row — solid pastel tracks, no gradient value clip */
.macro-bar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.macro {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  transition: transform var(--dur-fast) var(--ease);
  overflow: hidden;
}
.macro:hover { transform: translateY(-2px); }
.macro.protein { border-top: 3px solid var(--accent); }
.macro.carbs   { border-top: 3px solid var(--blue); }
.macro.fats    { border-top: 3px solid var(--warn); }
.macro .label {
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 6px;
  font-weight: 700;
}
.macro .value {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 30px;
  letter-spacing: .5px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.macro.protein .value { color: var(--accent); }
.macro.carbs   .value { color: var(--blue); }
.macro.fats    .value { color: var(--warn); }
.macro .pct { color: var(--text-faint); font-size: 12px; margin-top: 4px; }

.calc-step {
  background: var(--surface-input);
  border: 1px solid var(--border);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  color: var(--text-dim);
  font-size: 14px;
}
.calc-step .eq { color: var(--accent); font-weight: 700; }

/* Day / meals */
.day {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  overflow: hidden;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.day-header {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  background: linear-gradient(90deg, rgba(249,115,22,.06), transparent);
  border-bottom: 1px solid var(--border);
}
.day-title { display: flex; align-items: baseline; gap: 12px; }
.day-title .num {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 32px;
  color: var(--accent);
  letter-spacing: 1px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.day-title h3 {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 22px;
  margin: 0;
  letter-spacing: .5px;
  color: var(--text);
  text-transform: uppercase;
}
.day-totals { display: flex; gap: 14px; color: var(--text-dim); font-size: 13px; flex-wrap: wrap; }
.day-totals strong { color: var(--text); font-variant-numeric: tabular-nums; }

.meals { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.meal {
  position: relative;
  padding: 18px 20px;
  border-right: 1px solid var(--border);
  transition: background var(--dur-fast) var(--ease);
}
.meal:hover { background: var(--surface-hi); }
.meal:last-child { border-right: 0; }
.meal-type {
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.meal-name { font-weight: 700; font-size: 15px; margin-bottom: 4px; color: var(--text); }
.meal-desc { color: var(--text-dim); font-size: 13px; margin-bottom: 10px; }
.meal-macros { display: flex; gap: 12px; font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.meal-macros span strong { color: var(--text); }
.meal-flags { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.flag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.flag.treat { background: rgba(167,139,250,.14); color: var(--purple); }
.flag.prep  { background: rgba(96,165,250,.14); color: var(--blue); }

.swap-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.swap-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.swap-from { color: var(--danger); font-size: 13px; text-decoration: line-through; margin-bottom: 4px; }
.swap-to { font-weight: 700; font-size: 15px; margin-bottom: 6px; color: var(--text); }
.swap-why { color: var(--text-dim); font-size: 13px; margin-bottom: 8px; }
.swap-cal { color: var(--accent); font-size: 13px; font-weight: 700; }

/* Rules */
.rules { display: grid; gap: 12px; }
.rule {
  position: relative;
  padding: 16px 18px 16px 52px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.rule::before {
  content: '●';
  position: absolute;
  left: 18px;
  top: 14px;
  color: var(--accent);
  font-size: 18px;
  filter: drop-shadow(0 0 8px var(--accent-glow));
}
.rule h4 { margin: 0 0 6px; color: var(--accent); font-size: 16px; font-weight: 700; }
.rule p { color: var(--text-dim); margin: 0; font-size: 14px; }

/* Timeline */
.timeline { position: relative; padding-left: 32px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 8px; top: 4px; bottom: 4px;
  width: 2px;
  background: linear-gradient(180deg, var(--accent), transparent);
}
.milestone {
  position: relative;
  padding: 4px 0 22px;
}
.milestone::before {
  content: '';
  position: absolute;
  left: -30px;
  top: 6px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--bg-base), 0 0 16px var(--accent-glow);
}
.milestone h4 { margin: 0 0 4px; color: var(--accent); font-size: 15px; font-weight: 700; }
.milestone p { color: var(--text-dim); margin: 0; font-size: 14px; }

/* Supplements */
.supp {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin-bottom: 12px;
}
.supp-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.supp-head h4 { margin: 0; color: var(--accent); font-size: 17px; font-weight: 700; }
.supp-tag {
  background: rgba(249,115,22,.14);
  color: var(--accent);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  font-weight: 800;
}
.supp-tag.optional { background: var(--surface); color: var(--text-dim); border: 1px solid var(--border); }
.supp-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.supp-meta div { background: var(--surface-input); border: 1px solid var(--border); border-radius: 8px; padding: 10px; font-size: 13px; color: var(--text-dim); }
.supp-meta strong { display: block; color: var(--accent); font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 4px; font-weight: 800; }

/* Week / training */
.week { margin-bottom: 28px; }
.week-header {
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.week-header h3 {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 24px;
  letter-spacing: 1px;
  margin: 0;
  color: var(--text);
  text-transform: uppercase;
}
.week-focus { color: var(--accent); font-size: 13px; font-weight: 700; letter-spacing: .5px; }
.week-days { display: grid; gap: 10px; }
.workout-day {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 16px;
  align-items: start;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.workout-day:last-child { border-bottom: 0; }
.workout-day .wd-label h4 { margin: 0 0 4px; color: var(--accent); font-size: 15px; font-weight: 700; }
.workout-day .wd-label .sub { color: var(--text-faint); font-size: 12px; }
.exercise-list { display: grid; gap: 8px; }
.exercise {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  align-items: center;
}
.exercise .ex-name { font-weight: 600; color: var(--text); }
.exercise .ex-sets {
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

/* Motto quote card */
.quote-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 20px 24px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
}
.quote-card blockquote {
  margin: 0 0 10px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 24px;
  letter-spacing: .5px;
  color: var(--text);
  line-height: 1.25;
  text-transform: uppercase;
}
.quote-card cite {
  color: var(--text-dim);
  font-size: 13px;
  font-style: normal;
}

.accountability {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 14px;
  align-items: center;
}
.accountability .icon { font-size: 28px; }
.accountability .text { color: var(--text-dim); font-size: 14px; }
.accountability .text strong { color: var(--text); }

/* Weight log entry */
.weight-entry {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}
.weight-entry input, .weight-entry select {
  padding: 11px 14px;
  font-size: 14px;
}
.weight-entry button {
  padding: 12px 20px;
  background: var(--accent);
  color: var(--on-accent);
  border: 0;
  border-radius: 8px;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .8px;
  text-transform: uppercase;
  cursor: pointer;
  min-height: 44px;
  transition: all var(--dur-fast) var(--ease);
  box-shadow: 0 4px 14px var(--accent-glow);
}
.weight-entry button:hover { background: var(--accent-2); transform: translateY(-1px); }

.meas-entry {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.meas-entry label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: .3px;
}
.meas-entry label input { padding: 10px 12px; font-size: 14px; }
.meas-entry button {
  padding: 12px 20px;
  background: var(--accent);
  color: var(--on-accent);
  border: 0;
  border-radius: 8px;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .8px;
  text-transform: uppercase;
  cursor: pointer;
  min-height: 44px;
  grid-column: 1 / -1;
  transition: all var(--dur-fast) var(--ease);
  box-shadow: 0 4px 14px var(--accent-glow);
}
.meas-entry button:hover { background: var(--accent-2); transform: translateY(-1px); }

.meas-history { margin-top: 16px; }
.meas-history table { width: 100%; border-collapse: collapse; font-size: 13px; }
.meas-history th, .meas-history td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.meas-history th {
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 800;
}
.meas-history td { color: var(--text-dim); font-variant-numeric: tabular-nums; }
.meas-history td:first-child { color: var(--text); font-weight: 600; }
.meas-history .del { background: transparent; border: 0; color: var(--text-faint); cursor: pointer; font-size: 14px; }
.meas-history .del:hover { color: var(--danger); }

/* Photos */
.photo-upload {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}
.photo-pick {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
}
.photo-pick:hover { border-color: var(--accent); color: var(--accent); }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.photo-tile {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 3/4;
}
.photo-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-tile .photo-meta {
  position: absolute;
  inset: auto 0 0 0;
  padding: 8px 10px;
  background: linear-gradient(0deg, rgba(0,0,0,.8), transparent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}
.photo-tile .del {
  position: absolute;
  top: 8px; right: 8px;
  background: rgba(0,0,0,.6);
  color: #fff;
  border: 0;
  width: 36px; height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
  display: grid;
  place-items: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background var(--dur-fast) var(--ease);
}
.photo-tile .del:hover { background: var(--danger); }

.photo-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.photo-compare img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.photo-compare .photo-meta {
  color: var(--text-dim);
  font-size: 12px;
  margin-top: 6px;
  letter-spacing: .3px;
}

/* Review grid */
.review-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.review-day {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
  min-height: 90px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.review-day.empty { opacity: .45; }
.rd-date {
  color: var(--text-faint);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 700;
}
.rd-cal {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 22px;
  color: var(--text);
  letter-spacing: .5px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.rd-macros { color: var(--text-dim); font-size: 11px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.rd-empty { color: var(--text-faint); font-size: 22px; }
.rd-workout { margin-top: 8px; font-size: 16px; color: var(--text-faint); }

@media (max-width: 720px) {
  .review-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Sub-tabs */
.sub-tabs {
  display: flex;
  gap: 6px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 6px;
  scrollbar-width: none;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.sub-tabs::-webkit-scrollbar { display: none; }
.sub-tab { scroll-snap-align: start; }
.sub-tab {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  padding: 11px 14px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .4px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--dur-fast) var(--ease);
  min-height: 40px;
}
.sub-tab .icon { vertical-align: 0; }
.sub-tab:hover:not(.active) {
  color: var(--text);
  background: var(--surface-hi);
}
.sub-tab.active {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 3px 14px var(--accent-glow);
}
.sub-tab.active:hover { filter: brightness(1.05); }

.sub-panel { display: none; }
.sub-panel.active { display: block; }

/* Ingredients */
.ingredients-wrap {
  background: var(--surface-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 10px;
}
.ingredients-wrap summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .3px;
  list-style: none;
}
.ingredients-wrap summary::-webkit-details-marker { display: none; }
.ingredients-wrap summary::before {
  content: '▸';
  color: var(--accent);
  transition: transform var(--dur) var(--ease);
  display: inline-block;
  width: 10px;
}
.ingredients-wrap[open] summary::before { transform: rotate(90deg); }

.ingr-scale {
  font-size: 12px;
  color: var(--text-faint);
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}
.ingr-scale strong { color: var(--blue); font-variant-numeric: tabular-nums; }

.ingredients { list-style: none; padding: 0; margin: 10px 0 0; }
.ingredients li {
  display: flex;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
  color: var(--text-dim);
}
.ingredients li:last-child { border-bottom: 0; }
.ing-name { flex: 1; }
.ing-weight {
  color: var(--text);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  white-space: nowrap;
}

.recipe-wrap {
  background: var(--surface-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 10px;
}
.recipe-wrap summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .3px;
  list-style: none;
}
.recipe-wrap summary::-webkit-details-marker { display: none; }
.recipe-wrap summary::before {
  content: '▸';
  color: var(--accent);
  transition: transform var(--dur) var(--ease);
  display: inline-block;
  width: 10px;
}
.recipe-wrap[open] summary::before { transform: rotate(90deg); }
.recipe-steps { list-style: none; padding: 0; margin: 10px 0 0; counter-reset: step; }
.recipe-steps li {
  padding: 8px 0 8px 32px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-dim);
  position: relative;
  counter-increment: step;
}
.recipe-steps li:last-child { border-bottom: 0; }
.recipe-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 8px;
  width: 22px; height: 22px;
  background: rgba(249,115,22,.14);
  color: var(--accent);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

/* Shopping */
.shop-card h4 { color: var(--accent); margin: 0 0 10px; display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; }
.shop-count {
  background: rgba(249,115,22,.14);
  color: var(--accent);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .5px;
}
.shop-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.shop-item label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.shop-item label:hover { border-color: var(--accent); background: var(--surface); }
.shop-item.checked label {
  opacity: .6;
  background: var(--surface-hi);
}
.shop-item.checked .shop-name {
  text-decoration: line-through;
  color: var(--text-faint);
}
.shop-name { flex: 1; font-size: 13px; color: var(--text); font-weight: 500; }
.shop-hint { color: var(--text-faint); font-size: 11px; margin-top: 2px; }
.shop-weight {
  color: var(--text-dim);
  font-size: 12px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Tracker date bar */
.tracker-date-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.tracker-date-bar .date-nav {
  display: flex;
  gap: 6px;
  align-items: center;
}
.date-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
  font-weight: 600;
  min-height: 40px;
}
.date-btn:hover { border-color: var(--accent); color: var(--accent); }
.streak-pill {
  background: rgba(249,115,22,.14);
  color: var(--accent);
  border: 1px solid rgba(249,115,22,.3);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .5px;
}
.date-bar-right {
  margin-left: auto;
  display: flex;
  gap: 8px;
}
.rest-day-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  min-height: 40px;
}
.rest-day-btn:hover {
  border-color: var(--purple);
  color: var(--purple);
  background: rgba(167,139,250,.08);
}

.rest-day-card {
  text-align: center;
  padding: 60px 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.rest-day-card .rest-day-icon { font-size: 64px; filter: drop-shadow(0 4px 20px rgba(167,139,250,.4)); margin-bottom: 16px; }
.rest-day-card h3 {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 32px;
  letter-spacing: 1px;
  margin: 0 0 12px;
  color: var(--text);
  text-transform: uppercase;
}
.rest-day-card p { color: var(--text-dim); max-width: 400px; margin: 0 auto 16px; }

/* Food summary */
.food-summary {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
  margin-bottom: 18px;
  align-items: start;
}
.summary-total {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.summary-ring {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background:
    conic-gradient(var(--accent) calc(var(--progress, 0) * 1%), var(--surface-input) 0);
  display: grid;
  place-items: center;
  position: relative;
  margin: 0 auto;
}
.summary-ring::before {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: var(--bg-elevated);
}
.summary-ring .inner { position: relative; text-align: center; z-index: 1; }
.summary-ring .inner .big {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 32px;
  color: var(--accent);
  line-height: 1;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
}
.summary-ring .inner .small {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 4px;
  font-weight: 700;
}
.summary-total .legend { flex: 1; }
.summary-total .legend .row {
  color: var(--text-dim);
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
}
.summary-total .legend .row strong { color: var(--text); font-variant-numeric: tabular-nums; }

.summary-macros {
  display: grid;
  gap: 10px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.mbar {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}
.mbar .label { font-weight: 700; letter-spacing: .3px; }
.mbar.p .label { color: var(--accent); }
.mbar.c .label { color: var(--blue); }
.mbar.f .label { color: var(--warn); }
.mbar .track {
  background: var(--surface-input);
  border: 1px solid var(--border);
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
}
.mbar .fill {
  height: 100%;
  transition: width .4s var(--ease);
  border-radius: 999px;
}
.mbar.p  .fill { background: linear-gradient(90deg, var(--accent-dark), var(--accent)); }
.mbar.c  .fill { background: linear-gradient(90deg, #1d4ed8, var(--blue)); }
.mbar.f  .fill { background: linear-gradient(90deg, #d97706, var(--warn)); }
.mbar.fi .fill { background: linear-gradient(90deg, #15803d, var(--success)); }
.mbar.fi .label { color: var(--success); }
.mbar .nums {
  color: var(--text-dim);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  white-space: nowrap;
}
.mbar .nums strong { color: var(--text); }
.mbar.over .fill { background: linear-gradient(90deg, #991b1b, var(--danger)) !important; }

/* Quick add / search */
.quick-add {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 16px;
}
.quick-add h4 { color: var(--accent); margin: 0 0 12px; font-weight: 700; }
.food-search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 12px;
  align-items: stretch;
}

.scan-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  background: rgba(249,115,22,.08);
  border: 1px solid rgba(249,115,22,.3);
  color: var(--text);
  border-radius: 10px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .3px;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
  overflow: hidden;
  white-space: nowrap;
}
.scan-btn::before { content: none; }
.scan-btn:hover {
  background: rgba(249,115,22,.16);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px var(--accent-glow);
}
.scan-btn-icon { font-size: 16px; line-height: 1; }
.scan-btn-label { font-size: 12px; }
@media (max-width: 480px) {
  .scan-btn { padding: 10px 14px; gap: 6px; }
  .scan-btn-label { font-size: 11px; }
}

.food-results {
  display: grid;
  gap: 2px;
  max-height: 300px;
  overflow-y: auto;
  margin-top: 8px;
}
.food-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.food-row:last-child { border-bottom: 0; }
.food-row .fr-name { color: var(--text); font-size: 14px; }
.food-row .fr-macros { color: var(--text-faint); font-size: 11px; font-family: 'JetBrains Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.food-row button {
  background: var(--surface-input);
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 9px 14px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: .8px;
  text-transform: uppercase;
  transition: all var(--dur-fast) var(--ease);
  min-height: 36px;
}
.food-row button:hover { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.food-row.from-plan { background: rgba(249,115,22,.04); }

.entries { display: grid; gap: 8px; margin-top: 12px; }
.entry {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  background: var(--surface-input);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.entry .time { color: var(--text-faint); font-family: 'JetBrains Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; font-size: 11px; }
.entry .name { color: var(--text); font-weight: 500; font-size: 14px; }
.entry .macros { color: var(--text-dim); font-size: 12px; font-family: 'JetBrains Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.entry .del {
  background: transparent;
  border: 0;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 15px;
  padding: 8px 10px;
  border-radius: 6px;
  min-width: 36px;
  min-height: 36px;
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.entry .del:hover { color: var(--danger); background: rgba(239,68,68,.08); }

.manual-form {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  gap: 8px;
  margin-top: 10px;
}
.manual-form input { padding: 10px 12px; font-size: 13px; }
.manual-form button {
  padding: 12px 18px;
  background: var(--accent);
  color: var(--on-accent);
  border: 0;
  border-radius: 8px;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .8px;
  text-transform: uppercase;
  cursor: pointer;
  min-height: 44px;
  transition: all var(--dur-fast) var(--ease);
  box-shadow: 0 4px 14px var(--accent-glow);
}
.manual-form button:hover { background: var(--accent-2); transform: translateY(-1px); }

.tab-tip {
  padding: 12px 16px;
  background: rgba(249,115,22,.06);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 14px;
}
.tab-tip strong { color: var(--accent); }

/* ==========================================================
   EMPTY STATE — shared look for "no X yet" surfaces.
   Centers a muted message inside its parent card, with
   optional leading icon. Replaces ad-hoc inline styles.
========================================================== */
.empty-state {
  display: grid;
  gap: 10px;
  padding: 24px 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.55;
}
.empty-state-icon {
  font-size: 32px;
  opacity: .45;
  filter: grayscale(.3);
  line-height: 1;
}
.empty-state p { margin: 0; max-width: 420px; justify-self: center; }
.empty-state strong { color: var(--text); }
.empty-state.compact {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-faint);
}

/* Adjust modal */
.form-modal-inner.adjust-inner { max-width: 720px; }
.adj-milestone {
  padding: 12px 16px;
  background: var(--surface-input);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  margin-bottom: 12px;
}
.adj-milestone strong { display: block; color: var(--accent); margin-bottom: 2px; }
.adj-milestone span { color: var(--text-dim); font-size: 13px; }

.adj-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color var(--dur) var(--ease);
}
.adj-card[open] { border-color: rgba(249,115,22,.4); }
.adj-card summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  list-style: none;
}
.adj-card summary::-webkit-details-marker { display: none; }
.adj-card summary::after {
  content: '▸';
  margin-left: auto;
  color: var(--text-faint);
  transition: transform var(--dur) var(--ease);
}
.adj-card[open] summary::after { transform: rotate(90deg); color: var(--accent); }
.adj-icon { font-size: 22px; flex-shrink: 0; }
.adj-label { display: flex; flex-direction: column; gap: 2px; }
.adj-label strong { color: var(--text); font-size: 15px; }
.adj-label .adj-sub { color: var(--text-dim); font-size: 12px; }
.adj-body {
  padding: 0 18px 18px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.adj-hint { color: var(--text-dim); font-size: 13px; margin: 6px 0; }
.adj-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

/* Milestone banner */
.milestone-banner {
  position: relative;
  background: var(--surface);
  border: 1px solid rgba(249,115,22,.4);
  border-radius: var(--radius-md);
  padding: 22px 26px;
  margin-bottom: 24px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(249,115,22,.14);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.milestone-banner::before {
  content: '';
  position: absolute;
  inset: -1px -1px auto -1px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: .9;
}
.mb-badge {
  display: inline-block;
  background: var(--accent);
  color: var(--on-accent);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 1.5px;
  font-weight: 800;
  margin-bottom: 10px;
  box-shadow: 0 3px 10px var(--accent-glow);
  text-transform: uppercase;
}
.mb-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 36px;
  letter-spacing: 1.5px;
  margin: 0 0 6px;
  color: var(--text);
  text-transform: uppercase;
  line-height: 1;
}
.mb-sub { color: var(--text-dim); margin: 0 0 16px; font-size: 14px; }
.mb-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.mb-stat {
  background: var(--surface-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.mb-stat-label {
  color: var(--text-faint);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 800;
  margin-bottom: 6px;
}
.mb-stat-value { font-size: 14px; color: var(--text); }
.mb-stat-value strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.mb-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.mb-actions .btn-primary { padding: 11px 20px; font-size: 13px; }
.mb-actions .btn-ghost { padding: 11px 20px; font-size: 13px; }

/* Form guide modal */
.form-modal {
  position: fixed; inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  animation: fade 200ms var(--ease);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.form-modal-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.form-modal-inner {
  position: relative;
  max-width: 720px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 28px 30px;
  box-shadow: 0 30px 80px rgba(0,0,0,.8), inset 0 1px 0 rgba(255,255,255,.04);
}
.form-modal-close {
  position: absolute;
  top: 14px; right: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 40px; height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
  display: grid; place-items: center;
  transition: all var(--dur-fast) var(--ease);
}
.form-modal-close:hover { color: var(--danger); border-color: var(--danger); background: rgba(239,68,68,.1); }

.form-modal-head { margin-bottom: 18px; padding-right: 40px; }
.form-modal-label {
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  font-weight: 800;
  margin-bottom: 6px;
}
.form-modal-head h2 {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 34px;
  letter-spacing: .5px;
  margin: 0;
  color: var(--text);
  text-transform: uppercase;
  line-height: 1;
}

.form-modal-body { display: grid; gap: 16px; margin-bottom: 20px; }
.form-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 14px 18px;
}
.form-section h3 {
  font-size: 14px;
  margin: 0 0 10px;
  color: var(--accent);
  letter-spacing: .5px;
  font-weight: 700;
}
.form-section.dos   { border-left-color: var(--success); }
.form-section.dos h3   { color: var(--success); }
.form-section.donts { border-left-color: var(--danger); }
.form-section.donts h3 { color: var(--danger); }
.form-section.red   { border-left-color: var(--warn); }
.form-section.red h3   { color: var(--warn); }
.form-section ul {
  margin: 0; padding-left: 18px;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.6;
}
.form-section li { padding: 3px 0; }

.form-modal-foot {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.form-modal-yt {
  display: inline-block;
  background: var(--accent);
  color: var(--on-accent);
  border: 0;
  padding: 13px 22px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-decoration: none;
  text-align: center;
  min-height: 44px;
  box-shadow: 0 4px 16px var(--accent-glow);
  transition: all var(--dur-fast) var(--ease);
}
.form-modal-yt:hover { background: var(--accent-2); transform: translateY(-1px); }
.form-modal-hint {
  color: var(--text-faint);
  font-size: 12px;
  font-style: italic;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .form-modal { padding: 12px; }
  .form-modal-inner { padding: 20px; }
  .form-modal-head h2 { font-size: 28px; }
}

/* Unit toggle */
.unit-toggle-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.unit-toggle-label {
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 800;
}
.unit-toggle {
  display: inline-flex;
  background: var(--surface-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
}
.unit-toggle button {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  padding: 6px 16px;
  border-radius: 5px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
}
.unit-toggle button.active {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 3px 10px var(--accent-glow);
}
.unit-toggle button:hover:not(.active) { color: var(--text); }
.unit-note {
  color: var(--text-faint);
  font-size: 12px;
  margin-left: auto;
  font-style: italic;
}

/* Training tools */
.train-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.tool {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.tool-label {
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 800;
  margin-bottom: 8px;
}
.rt-display {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 52px;
  letter-spacing: 2px;
  color: var(--text);
  text-align: center;
  margin: 6px 0;
  transition: color var(--dur) var(--ease);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.rt-display.rt-low  { color: var(--warn); }
.rt-display.rt-zero { color: var(--accent); animation: flash 600ms ease 3; }
@keyframes flash { 50% { opacity: .3; } }
.rt-controls, .rt-actions { display: flex; gap: 6px; justify-content: center; margin-top: 6px; flex-wrap: wrap; }
.rt-controls button, .rt-actions button {
  background: var(--surface-input);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: .6px;
  text-transform: uppercase;
  transition: all var(--dur-fast) var(--ease);
  min-height: 36px;
}
.rt-controls button.active,
.rt-actions button:not(.ghost) {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
  font-weight: 800;
  box-shadow: 0 2px 10px var(--accent-glow);
}
.rt-controls button:hover:not(.active) { color: var(--text); border-color: var(--text-dim); }

.pc-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: end;
  margin: 6px 0 8px;
}
.pc-inputs label {
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pc-inputs input { padding: 8px 10px; font-size: 14px; }
.pc-inputs button {
  background: var(--accent);
  color: var(--on-accent);
  border: 0;
  padding: 12px 16px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 11px;
  cursor: pointer;
  letter-spacing: 1px;
  text-transform: uppercase;
  min-height: 40px;
  box-shadow: 0 3px 10px var(--accent-glow);
  transition: all var(--dur-fast) var(--ease);
}
.pc-inputs button:hover { background: var(--accent-2); transform: translateY(-1px); }
.pc-out {
  display: grid;
  gap: 6px;
  padding: 10px 2px 4px;
}
.pc-label {
  color: var(--text-faint);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 700;
}
.pc-empty { color: var(--text-faint); font-size: 13px; font-style: italic; }
.pc-error { color: var(--danger); font-size: 13px; font-weight: 600; }
.pc-just-bar {
  color: var(--accent);
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: .5px;
  text-transform: uppercase;
  line-height: 1;
}
.pc-warn {
  color: var(--warn);
  font-size: 12px;
  line-height: 1.4;
  padding: 8px 10px;
  background: rgba(251,191,36,.08);
  border-left: 2px solid var(--warn);
  border-radius: 0 6px 6px 0;
  margin-top: 4px;
}
.plate-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.plate-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  background: rgba(249,115,22,.1);
  border: 1px solid rgba(249,115,22,.28);
  color: var(--accent);
  padding: 6px 10px;
  border-radius: 8px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: .3px;
}
.plate-pill strong {
  color: var(--text);
  font-weight: 800;
  margin-right: 2px;
}
.plate-pill .plate-unit {
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  margin-left: 2px;
  letter-spacing: .5px;
}

.ex-target {
  color: var(--text-faint);
  font-size: 11px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  margin-left: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(var(--ex-glow, 249,115,22), .08);
  border: 1px solid rgba(var(--ex-glow, 249,115,22), .22);
}

.ex-swap-btn {
  background: rgba(var(--ex-glow, 249,115,22), .06);
  border: 1px solid rgba(var(--ex-glow, 249,115,22), .22);
  color: var(--text-dim);
  padding: 3px 10px;
  font-size: 10px;
  letter-spacing: .8px;
  border-radius: 999px;
  margin-left: 6px;
  cursor: pointer;
  vertical-align: 2px;
  text-transform: uppercase;
  font-weight: 700;
  transition: all var(--dur-fast) var(--ease);
}
.ex-swap-btn:hover {
  color: #fff;
  background: rgba(var(--ex-glow, 249,115,22), .18);
  border-color: rgba(var(--ex-glow, 249,115,22), .55);
}

@media (max-width: 640px) {
  .train-tools { grid-template-columns: 1fr; }
}

/* Workout log */
.workout-picker {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 16px;
  display: grid;
  gap: 10px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.workout-picker-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}
.workout-picker select { padding: 10px 12px; }

.session {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0;
  margin-bottom: 16px;
  overflow: hidden;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.session-head {
  padding: 18px 22px;
  background: linear-gradient(90deg, rgba(249,115,22,.08), transparent);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.session-head h3 {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  letter-spacing: 1px;
  margin: 0;
  font-size: 26px;
  color: var(--text);
  text-transform: uppercase;
  line-height: 1;
}
.session-head .sh-sub { color: var(--text-dim); font-size: 13px; }

.ex-block {
  --ex-glow: 167,139,250;
  --ex-color: var(--purple);
  position: relative;
  padding: 18px 22px 20px;
  border-bottom: 1px solid var(--border);
  transition: background var(--dur) var(--ease);
}
.ex-block.is-main {
  --ex-glow: 249,115,22;
  --ex-color: var(--accent);
}
.ex-block::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, rgba(var(--ex-glow), .7), rgba(var(--ex-glow), 0));
}
.ex-block::after {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(var(--ex-glow), .35), transparent);
  opacity: .6;
}
.ex-block:hover { background: linear-gradient(90deg, rgba(var(--ex-glow), .04), transparent 40%); }
.ex-block:last-child { border-bottom: 0; }

.ex-block-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.ex-block-head .ex-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.ex-block-head .ex-title .main-star {
  color: var(--ex-color);
  filter: drop-shadow(0 0 8px rgba(var(--ex-glow), .55));
  font-size: 18px;
  line-height: 1;
}
.ex-block-head .ex-pb {
  color: var(--accent);
  font-size: 12px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  background: rgba(249,115,22,.1);
  border: 1px solid rgba(249,115,22,.28);
  padding: 4px 10px;
  border-radius: 999px;
}
.ex-block-head .ex-suggest {
  color: var(--success);
  font-size: 12px;
  background: rgba(34,197,94,.08);
  border: 1px solid rgba(34,197,94,.28);
  padding: 4px 10px;
  border-radius: 999px;
  cursor: help;
}
.ex-block-head .ex-suggest strong {
  color: #fff;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.set-table {
  display: grid;
  grid-template-columns: 36px 1fr 1fr 60px 36px;
  gap: 8px;
  align-items: center;
  font-size: 14px;
}
.set-table .set-hdr {
  font-size: 10px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 2px;
  padding: 4px 0;
  font-weight: 700;
}
.set-table input[type="number"] {
  padding: 9px 12px;
  font-size: 14px;
  background: var(--surface-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur-fast) var(--ease);
  font-variant-numeric: tabular-nums;
}
.set-table input[type="number"]:hover { border-color: rgba(249,115,22,.28); }
.set-table input[type="number"]:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(249,115,22,.06);
  box-shadow: 0 0 0 3px var(--accent-glow-soft);
}

.set-num {
  background: linear-gradient(135deg, rgba(var(--ex-glow), .22), rgba(var(--ex-glow), .08));
  border: 1px solid rgba(var(--ex-glow), .3);
  text-align: center;
  border-radius: 8px;
  padding: 9px 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--ex-color);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}
.set-table .set-target {
  text-align: center;
  padding: 9px 0;
  font-size: 12px;
  color: rgba(var(--ex-glow), .9);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  border: 1px dashed rgba(var(--ex-glow), .3);
  border-radius: 8px;
  font-weight: 600;
}

.set-done {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--surface-input);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 17px;
  transition: all var(--dur-fast) var(--ease);
}
.set-done:hover:not(.done) {
  border-color: rgba(var(--ex-glow), .5);
  background: rgba(var(--ex-glow), .08);
}
.set-done.done {
  background: var(--success);
  color: #0a0a0c;
  border-color: transparent;
  box-shadow: 0 2px 10px var(--success-glow);
}

.set-actions { margin-top: 14px; display: flex; gap: 8px; }
.set-actions button {
  background: rgba(var(--ex-glow), .05);
  border: 1px solid rgba(var(--ex-glow), .2);
  color: var(--text-dim);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 12px;
  letter-spacing: .3px;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
  font-weight: 600;
}
.set-actions button:hover {
  color: var(--ex-color);
  border-color: rgba(var(--ex-glow), .5);
  background: rgba(var(--ex-glow), .12);
}

.session-footer {
  padding: 18px 22px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  background: var(--surface-input);
  border-top: 1px solid var(--border);
}
.session-footer button {
  background: var(--accent);
  color: var(--on-accent);
  border: 0;
  padding: 13px 24px;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  min-height: 44px;
  box-shadow: 0 4px 14px var(--accent-glow);
  transition: all var(--dur-fast) var(--ease);
}
.session-footer button:hover { background: var(--accent-2); transform: translateY(-1px); }
.session-footer textarea {
  flex: 1;
  min-width: 240px;
  min-height: 44px;
  font-size: 13px;
}

.pr-badge {
  display: inline-block;
  background: var(--success);
  color: #0a0a0c;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.2px;
  margin-left: 6px;
  box-shadow: 0 2px 8px var(--success-glow);
  text-transform: uppercase;
}

.history-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 10px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
}
.history-item .date {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 24px;
  color: var(--accent);
  letter-spacing: .5px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.history-item .desc { color: var(--text-dim); font-size: 13px; }
.history-item .desc strong { color: var(--text); }

@media (max-width: 720px) {
  .food-summary { grid-template-columns: 1fr; }
  .manual-form { grid-template-columns: 1fr 1fr; }
  .set-table { grid-template-columns: 30px 1fr 1fr 50px 28px; font-size: 13px; }
}

/* PWA install banner */
.install-banner {
  position: fixed;
  left: max(20px, env(safe-area-inset-left));
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-elevated);
  border: 1px solid rgba(249,115,22,.45);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 50px rgba(0,0,0,.6), 0 0 30px var(--accent-glow);
  animation: slideUp 400ms var(--ease);
  max-width: 640px;
  margin: 0 auto;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.install-banner strong { color: var(--accent); display: block; font-size: 14px; }
.install-banner div > div { color: var(--text-dim); font-size: 13px; margin-top: 4px; }
.install-banner button {
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .5px;
  text-transform: uppercase;
  cursor: pointer;
  margin-left: 6px;
  transition: all var(--dur-fast) var(--ease);
}
.install-banner button:not(.ghost) {
  background: var(--accent);
  color: var(--on-accent);
  border: 0;
  box-shadow: 0 4px 14px var(--accent-glow);
  font-weight: 800;
}
.install-banner button:not(.ghost):hover { background: var(--accent-2); transform: translateY(-1px); }
.install-banner button.ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.install-banner button.ghost:hover { color: var(--text); border-color: var(--text-dim); }

.offline-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 95;
  background: var(--warn);
  color: #0a0c10;
  text-align: center;
  padding: max(8px, env(safe-area-inset-top)) 16px 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .3px;
  box-shadow: 0 2px 10px rgba(0,0,0,.4);
}
html.is-offline #app { padding-top: calc(40px + env(safe-area-inset-top)); }

/* Settings */
.settings-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.settings-row button, .settings-row label {
  padding: 11px 20px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .3px;
}
.auth-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  gap: 10px;
  margin-top: 12px;
  align-items: center;
}
.auth-row input { padding: 11px 14px; font-size: 14px; }
.auth-row button { padding: 11px 18px; }
@media (max-width: 720px) {
  .auth-row { grid-template-columns: 1fr; }
}

.badge-inline {
  display: inline-block;
  background: rgba(249,115,22,.14);
  color: var(--accent);
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 800;
  margin-left: 8px;
  vertical-align: 2px;
}
.badge-inline.badge-off {
  background: var(--surface);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.quota-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  margin-top: 10px;
}
.quota-bar {
  background: var(--surface-input);
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.quota-fill {
  height: 100%;
  transition: width .4s var(--ease);
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent));
}
.quota-nums {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
}

.notif-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.notif-row label { color: var(--text-dim); font-size: 13px; }
.notif-row input[type="time"] {
  background: var(--surface-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 6px;
  font-family: inherit;
  margin-left: 6px;
}
.notif-status { font-size: 12px; color: var(--text-dim); }

/* ==========================================================
   DAILY METRICS — Sleep, Steps, Water, Alcohol, Body-fat
========================================================== */
.daily-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.daily-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 18px 16px;
  overflow: hidden;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.daily-card::before {
  content: '';
  position: absolute;
  inset: -1px -1px auto -1px;
  height: 50%;
  background: radial-gradient(80% 100% at 50% 0%, rgba(var(--glow), .14), transparent 70%);
  pointer-events: none;
}
.daily-card:hover {
  transform: translateY(-2px);
  border-color: rgba(var(--glow), .5);
  box-shadow: 0 8px 28px rgba(var(--glow), .22);
}
.daily-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  position: relative;
}
.daily-icon { font-size: 24px; filter: drop-shadow(0 2px 6px rgba(var(--glow), .5)); }
.daily-meta { flex: 1; }
.daily-name { font-weight: 700; font-size: 14px; color: var(--text); letter-spacing: .3px; }
.daily-target { font-size: 11px; color: var(--text-dim); letter-spacing: 1px; text-transform: uppercase; margin-top: 2px; }
.daily-status {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
}
.daily-status.good { background: rgba(34,197,94,.18); color: var(--success); }
.daily-status.flag { background: rgba(251,191,36,.15); color: var(--warn); }
.daily-value-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 4px 0 14px;
  position: relative;
}
.daily-input {
  flex: 1;
  background: rgba(var(--glow), .05);
  border: 1px solid rgba(var(--glow), .22);
  color: var(--text);
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 40px;
  letter-spacing: 1px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: all var(--dur-fast) var(--ease);
  font-variant-numeric: tabular-nums;
}
.daily-input:focus {
  outline: none;
  border-color: rgba(var(--glow), .7);
  background: rgba(var(--glow), .1);
  box-shadow: 0 0 0 3px rgba(var(--glow), .15);
}
.daily-input::placeholder { color: var(--text-faint); }
.daily-unit {
  font-size: 13px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1.8px;
  font-weight: 700;
}
.daily-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  position: relative;
}
.daily-avg { font-size: 12px; color: var(--text-dim); }
.daily-avg strong { color: var(--text); font-variant-numeric: tabular-nums; }
.daily-spark { height: 24px; width: 90px; opacity: .9; }
.daily-spark-empty { color: var(--text-faint); font-size: 12px; }
.daily-tip {
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.5;
  padding-top: 10px;
  border-top: 1px dashed rgba(var(--glow), .18);
  position: relative;
}

.mood-row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 12px; }
.mood-block { }
.mood-label {
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 800;
  margin-bottom: 8px;
}
.mood-scale { display: flex; gap: 8px; }
.mood-btn {
  flex: 1;
  background: var(--surface-input);
  border: 1px solid var(--border);
  padding: 10px 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 56px;
}
.mood-btn .mood-num {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 22px;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.mood-btn .mood-word {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
}
.mood-btn.active .mood-num { color: var(--on-accent); }
.mood-btn.active .mood-word { color: var(--on-accent); opacity: .8; }
.mood-btn:hover { transform: translateY(-1px); border-color: var(--accent); }
.mood-btn.active {
  background: var(--accent);
  color: var(--on-accent);
  border-color: transparent;
  box-shadow: 0 4px 14px var(--accent-glow);
  transform: translateY(-1px);
}
@media (max-width: 640px) {
  .mood-row { grid-template-columns: 1fr; }
}

/* Photo compare */
.compare-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0 16px;
}
@media (max-width: 640px) { .compare-picker { grid-template-columns: 1fr; } }
.compare-stage {
  position: relative;
  background: var(--surface-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  padding: 0;
}
.compare-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: #000;
  overflow: hidden;
  cursor: ew-resize;
  user-select: none;
  touch-action: none;
}
.compare-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.compare-clip {
  position: absolute; top: 0; bottom: 0; left: 0;
  width: 50%;
  overflow: hidden;
  transition: width .03s linear;
}
.compare-clip .compare-right { width: 100vw; max-width: none; }
.compare-divider {
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 3px;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent-glow);
  pointer-events: none;
  transform: translateX(-50%);
}
.compare-handle {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--accent);
  color: var(--on-accent);
  width: 44px; height: 44px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 6px 20px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.3);
  pointer-events: none;
}
.compare-badge-left, .compare-badge-right {
  position: absolute;
  top: 14px;
  background: rgba(0,0,0,.7);
  color: #fff;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  pointer-events: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-transform: uppercase;
}
.compare-badge-left { left: 14px; }
.compare-badge-right { right: 14px; }
.compare-slider-wrap { padding: 14px; }
.compare-slider { width: 100%; accent-color: var(--accent); }

/* Muscle volume */
.vol-grid { display: grid; gap: 8px; margin-top: 12px; }
.vol-row {
  display: grid;
  grid-template-columns: 90px 1fr 70px 32px;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
}
.vol-label { font-size: 13px; font-weight: 700; color: var(--text); letter-spacing: .3px; }
.vol-track {
  position: relative;
  height: 18px;
  background: var(--surface-input);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.vol-band {
  position: absolute; top: 0; bottom: 0;
  background: rgba(249,115,22,.15);
  border-left: 1px dashed rgba(249,115,22,.5);
  border-right: 1px dashed rgba(249,115,22,.5);
}
.vol-ideal {
  position: absolute; top: -3px; bottom: -3px;
  width: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  transform: translateX(-1px);
}
.vol-fill {
  position: absolute; top: 0; bottom: 0; left: 0;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent));
  border-radius: 999px;
  transition: width .3s var(--ease);
}
.vol-row.vol-under .vol-fill { background: linear-gradient(90deg, #1d4ed8, var(--blue)); opacity: .7; }
.vol-row.vol-over  .vol-fill { background: linear-gradient(90deg, #b45309, var(--danger)); }
.vol-value {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--text);
  text-align: right;
}
.vol-value strong { font-size: 15px; color: var(--accent); }
.vol-value span { color: var(--text-faint); font-size: 11px; }
.vol-badge {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
}
.vol-badge.good  { background: rgba(34,197,94,.18);  color: var(--success); }
.vol-badge.under { background: rgba(96,165,250,.18); color: var(--blue); }
.vol-badge.over  { background: rgba(239,68,68,.18);  color: var(--danger); }
.vol-legend {
  display: flex;
  gap: 14px 20px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.4;
}
.vol-legend-item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}
.vol-legend-item strong { color: var(--text); }
/* Shape prefix doubles as the badge icon so state reads without color */
.vol-key {
  display: inline-grid;
  place-items: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  flex-shrink: 0;
  align-self: center;
}
.vol-key.good  { background: rgba(34,197,94,.18);  color: var(--success); }
.vol-key.under { background: rgba(96,165,250,.18); color: var(--blue); }
.vol-key.over  { background: rgba(239,68,68,.18);  color: var(--danger); }

@media (max-width: 640px) {
  .vol-row { grid-template-columns: 70px 1fr 60px 26px; gap: 8px; }
  .vol-label { font-size: 12px; }
}

/* Badges / achievements */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.badge-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 12px;
  text-align: center;
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.badge-tile.earned {
  background: rgba(249,115,22,.06);
  border-color: rgba(249,115,22,.4);
  box-shadow: 0 4px 14px rgba(249,115,22,.15);
}
.badge-tile.earned::before {
  content: '';
  position: absolute;
  inset: -1px -1px auto -1px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: .95;
}
.badge-tile.earned:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--accent-glow);
}
.badge-tile.locked {
  opacity: .35;
  filter: grayscale(.6);
}
.badge-tile .badge-icon { font-size: 32px; margin-bottom: 6px; }
.badge-tile .badge-name { font-weight: 800; font-size: 13px; color: var(--text); letter-spacing: .3px; margin-bottom: 4px; }
.badge-tile .badge-hint { font-size: 10px; color: var(--text-faint); line-height: 1.3; }

/* Alerts */
.alerts-card { border-left: 3px solid var(--warn); }
.alert {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(251,191,36,.06);
  border: 1px solid rgba(251,191,36,.25);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.alert-warn { border-color: rgba(239,68,68,.4); background: rgba(239,68,68,.06); }
.alert-icon { font-size: 18px; }
.alert-body { font-size: 13px; color: var(--text-dim); line-height: 1.5; }

/* Meal controls */
.meal { position: relative; }
.meal-controls {
  position: absolute;
  top: 12px; right: 12px;
  display: flex;
  gap: 4px;
  z-index: 2;
}
.meal-ctrl-btn {
  background: rgba(0,0,0,.5);
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 36px; height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
  display: grid;
  place-items: center;
  transition: all var(--dur-fast) var(--ease);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.meal-ctrl-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.08);
}
.meal-ctrl-btn.fav-btn.active {
  color: var(--warn);
  background: rgba(251,191,36,.15);
  border-color: rgba(251,191,36,.5);
  box-shadow: 0 0 10px rgba(251,191,36,.4);
}

.swap-list { display: grid; gap: 8px; margin-top: 12px; }
.swap-option {
  position: relative;
  background: var(--surface-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
}
.swap-option:hover {
  border-color: var(--accent);
  background: rgba(249,115,22,.06);
  transform: translateX(2px);
}
.swap-fav-tag {
  position: absolute;
  top: 10px; right: 10px;
  background: rgba(251,191,36,.2);
  color: var(--warn);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.swap-option-name { font-weight: 700; font-size: 14px; color: var(--text); margin-bottom: 4px; }
.swap-option-desc { color: var(--text-dim); font-size: 12px; margin-bottom: 6px; }
.swap-option-macros { color: var(--text-faint); font-size: 11px; font-family: 'JetBrains Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }

/* Barcode */
.barcode-stage {
  position: relative;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 4 / 3;
}
.barcode-stage video { width: 100%; height: 100%; object-fit: cover; }
.barcode-frame {
  position: absolute;
  top: 25%; left: 10%; right: 10%; bottom: 25%;
  border: 2px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.35);
  animation: bcPulse 1.5s ease-in-out infinite;
}
@keyframes bcPulse {
  0%, 100% { box-shadow: 0 0 0 9999px rgba(0,0,0,.35), 0 0 0 0 rgba(249,115,22,.6); }
  50%      { box-shadow: 0 0 0 9999px rgba(0,0,0,.35), 0 0 0 8px rgba(249,115,22,0); }
}
@media (prefers-reduced-motion: reduce) { .barcode-frame { animation: none; } }
.barcode-status {
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 10px;
  text-align: center;
}
.barcode-product {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid rgba(249,115,22,.4);
  border-radius: var(--radius-sm);
}
@media (max-width: 640px) { .barcode-product { grid-template-columns: 1fr; } }
.bc-name { font-weight: 800; font-size: 15px; color: var(--text); margin-bottom: 4px; }
.bc-meta { color: var(--text-dim); font-size: 12px; margin-bottom: 4px; }
.bc-macros { color: var(--text-faint); font-size: 11px; font-family: 'JetBrains Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.bc-portion label { display: block; color: var(--text-dim); font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 4px; font-weight: 700; }
.bc-portion input { width: 100px; padding: 8px 10px; margin-right: 8px; }

/* ==========================================================
   AI COACH CHAT
========================================================== */
.ai-card {
  background:
    radial-gradient(140% 180% at 0% 0%, rgba(124,58,237,.14), transparent 55%),
    radial-gradient(140% 180% at 100% 100%, rgba(249,115,22,.12), transparent 55%),
    var(--surface);
}
.chat-stage {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}
.chat-log {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  min-height: 200px;
  max-height: 560px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.chat-welcome { text-align: center; padding: 30px 20px; }
.chat-welcome-icon { font-size: 48px; margin-bottom: 12px; filter: drop-shadow(0 4px 14px var(--accent-glow)); }
.chat-welcome h3 {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 36px;
  letter-spacing: 1.5px;
  margin: 0 0 8px;
  color: var(--text);
  text-transform: uppercase;
  line-height: 1;
}
.chat-welcome h3 em { font-style: normal; color: var(--accent); }
.chat-welcome p { color: var(--text-dim); font-size: 14px; max-width: 420px; margin: 0 auto; }

.chat-bubble {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: bubbleIn 220ms var(--ease);
}
.chat-fallback-tag {
  align-self: flex-start;
  margin-top: 4px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--text-faint);
  background: rgba(148,163,184,.08);
  border: 1px solid rgba(148,163,184,.15);
  border-radius: 6px;
  cursor: help;
}
@keyframes bubbleIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.chat-bubble.user { align-self: flex-end; }
.chat-bubble.assistant { align-self: flex-start; }
.chat-bubble-inner {
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.chat-bubble.user .chat-bubble-inner {
  background: var(--accent);
  color: var(--on-accent);
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 14px var(--accent-glow);
  font-weight: 600;
}
.chat-bubble.assistant .chat-bubble-inner {
  background: var(--surface-hi);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.typing-dots { display: inline-flex; gap: 4px; }
.typing-dots span {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  animation: typingBounce 1.2s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes typingBounce {
  0%, 60%, 100% { opacity: .3; transform: translateY(0); }
  30%           { opacity: 1; transform: translateY(-4px); }
}

.chat-starters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: -4px; }
.chat-starter {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
  font-family: inherit;
  min-height: 36px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.chat-starter:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.chat-composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: stretch;
}
.chat-composer textarea {
  resize: none;
  padding: 12px 16px;
  font-size: 14px;
  min-height: 50px;
}
.chat-composer button { padding: 12px 24px; }

.chat-send-btn {
  width: 50px;
  height: 50px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  border: 0;
  color: var(--on-accent);
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 20px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.22);
}
.chat-send-btn svg {
  position: relative;
  z-index: 1;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  transition: transform var(--dur) var(--ease);
}
.chat-send-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent-2);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.chat-send-btn:hover {
  box-shadow: 0 10px 28px var(--accent-glow);
  transform: translateY(-1px);
}
.chat-send-btn:hover::before { opacity: 1; }
.chat-send-btn:hover svg { transform: translateX(2px); position: relative; z-index: 1; }
.chat-send-btn:active { transform: scale(.95); }

/* ==========================================================
   Responsive
========================================================== */
@media (max-width: 880px) {
  .hero-title { font-size: clamp(44px, 7vw, 74px); }
  .plan-nav { overflow-x: auto; padding-bottom: 4px; }
  .plan-nav .nav-btn { flex-shrink: 0; }
  .sub-tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .sub-tab { flex-shrink: 0; }
}

@media (max-width: 720px) {
  .screen { padding: 16px; }
  /* Onboarding section headers were oversized on mobile — 34px+ headings
     plus 16px subcopy ate the top half of the viewport before a single
     form field showed. Compact them so the first input is above the fold. */
  .section-label { font-size: 10px; letter-spacing: 2px; margin-bottom: 8px; }
  .section h2 { font-size: 24px; letter-spacing: .4px; line-height: 1.08; margin-bottom: 6px; }
  .section-sub { font-size: 13px; line-height: 1.45; margin-bottom: 18px; }
  .field > span, .field label > span { font-size: 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .plan-header { grid-template-columns: 1fr; }
  .plan-tools { grid-column: 1; grid-row: auto; justify-self: end; }
  .workout-day { grid-template-columns: 1fr; }
  .macro-bar { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .meal-macros { flex-wrap: wrap; gap: 8px; }
  .manual-form { grid-template-columns: 1fr 1fr; }
  .manual-form input:first-child { grid-column: 1 / -1; }
  .manual-form button { grid-column: 1 / -1; }
  .hero-badges { grid-template-columns: 1fr; }
  .hero-cta { flex-direction: column; align-items: stretch; }
  .hero-cta button { width: 100%; }
  .weight-entry { grid-template-columns: 1fr 1fr; }
  .weight-entry > button { grid-column: 1 / -1; }
  .photo-upload { grid-template-columns: 1fr; }
  .photo-compare { grid-template-columns: 1fr; }
  .meas-history { overflow-x: auto; }
  .meas-history table { min-width: 520px; }
  .session-head { padding: 14px 16px; }
  .ex-block { padding: 14px 16px; }
  .set-table { grid-template-columns: 30px 1fr 1fr 44px 28px; font-size: 13px; gap: 6px; }
  .shop-list { grid-template-columns: 1fr; }
  .logo-text h1 { font-size: 38px; letter-spacing: 4px; }
  .logo-mark { width: 56px; height: 56px; }
  .day-totals { flex-wrap: wrap; gap: 8px; font-size: 12px; }
  .exercise { grid-template-columns: 1fr; text-align: left; }
  .exercise .ex-sets { justify-self: start; }
  .train-tools { grid-template-columns: 1fr; }
  .supp-meta { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 520px) {
  .hero-title { font-size: 46px; letter-spacing: -.5px; }
  .hero-sub { font-size: 15px; }
  .plan-title h1 { font-size: 24px; }
  .plan-nav .nav-btn { padding: 9px 12px; font-size: 12px; }
  .sub-tab { padding: 8px 12px; font-size: 12px; }
  .review-grid { grid-template-columns: repeat(2, 1fr); }
  .meals { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr; }
  .pc-inputs { grid-template-columns: 1fr 1fr; }
  .pc-inputs button { grid-column: 1 / -1; }
  .entry { grid-template-columns: 1fr auto; }
  .entry .time { grid-row: 2; }
  .entry .macros { grid-column: 1 / -1; grid-row: 2; }
}

/* ==========================================================
   BADGE UNLOCK TOAST
========================================================== */
#bb-toast-root {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: calc(100vw - 32px);
}
.bb-toast {
  position: relative;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 280px;
  max-width: 360px;
  padding: 14px 18px 14px 16px;
  background: linear-gradient(180deg, rgba(13,14,18,.96), rgba(2,2,3,.96));
  border: 1px solid rgba(249,115,22,.4);
  border-radius: var(--radius-md);
  box-shadow:
    0 16px 44px rgba(124,58,237,.3),
    0 4px 14px var(--accent-glow),
    inset 0 1px 0 rgba(255,255,255,.08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transform: translateX(110%);
  opacity: 0;
  transition: transform .5s cubic-bezier(.2,.9,.3,1.2), opacity var(--dur-slow) var(--ease);
  overflow: hidden;
}
.bb-toast::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: .95;
}
.bb-toast.visible { transform: translateX(0); opacity: 1; }
.bb-toast.exit { transform: translateX(110%); opacity: 0; }
.bb-toast-icon {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  border-radius: var(--radius-sm);
  background: radial-gradient(circle at 50% 30%, rgba(251,146,60,.35), rgba(249,115,22,.2) 60%, transparent 100%);
  filter: drop-shadow(0 2px 8px var(--accent-glow));
}
.bb-toast-body { flex: 1 1 auto; min-width: 0; }
.bb-toast-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 2px;
}
.bb-toast-label {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: .2px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bb-toast-hint {
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.35;
}
.bb-toast-spark {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  background: var(--accent-2);
  box-shadow: 0 0 8px 2px rgba(251,146,60,.8);
  animation: bb-spark 1.6s ease-out forwards;
}
.bb-toast-spark:nth-child(1) { top: 10%; left: 16%; animation-delay: .2s; background: var(--accent); box-shadow: 0 0 8px 2px rgba(249,115,22,.9); }
.bb-toast-spark:nth-child(2) { top: 70%; left: 10%; animation-delay: .45s; background: var(--success); box-shadow: 0 0 8px 2px rgba(34,197,94,.9); }
.bb-toast-spark:nth-child(3) { top: 25%; left: 72%; animation-delay: .7s; }
@keyframes bb-spark {
  0%   { transform: scale(0) translateY(0); opacity: 0; }
  30%  { transform: scale(1.4) translateY(-4px); opacity: 1; }
  100% { transform: scale(.3) translateY(-16px); opacity: 0; }
}
@media (max-width: 520px) {
  #bb-toast-root { top: 8px; right: 8px; left: 8px; }
  .bb-toast { min-width: 0; max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .bb-toast { transition: opacity .2s ease; transform: none; }
  .bb-toast.visible, .bb-toast.exit { transform: none; }
  .bb-toast-spark { display: none; }
}

/* ==========================================================
   MOBILE LAYOUT HARDENING (≤480px)
========================================================== */
@media (max-width: 480px) {
  html, body { max-width: 100%; overflow-x: hidden; }

  .train-tools, .train-tools > .tool,
  .weight-entry, .manual-form,
  .pc-inputs, .pc-inputs > label,
  .chat-stage, .chat-composer,
  .entry, .entries, .food-row,
  .workout-picker, .workout-picker-row,
  .card, .day, .tool { min-width: 0; }

  .train-tools > .tool { width: 100%; box-sizing: border-box; }

  .pc-inputs {
    grid-template-columns: 1fr 1fr;
    gap: 8px 10px;
  }
  .pc-inputs > button { grid-column: 1 / -1; padding: 10px 16px; }
  .pc-inputs input { width: 100%; box-sizing: border-box; min-width: 0; }

  .weight-entry {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px;
  }
  .weight-entry > input[type="date"] { grid-column: 1 / -1; }
  .weight-entry > button { grid-column: 1 / -1; }
  .weight-entry input, .weight-entry select { width: 100%; box-sizing: border-box; min-width: 0; }

  .manual-form {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px;
  }
  .manual-form input { width: 100%; box-sizing: border-box; min-width: 0; }
  .manual-form input:first-child { grid-column: 1 / -1; }
  .manual-form button { grid-column: 1 / -1; padding: 10px 18px; }

  .workout-picker-row { grid-template-columns: 1fr !important; }

  .set-table {
    grid-template-columns: 28px 1fr 1fr 48px 26px !important;
    gap: 6px !important;
    font-size: 13px;
  }
  .set-table input[type="number"] {
    width: 100%; min-width: 0; box-sizing: border-box;
    padding: 8px 8px !important; font-size: 13px;
  }
  .set-table .set-hdr { font-size: 9px; letter-spacing: 1.2px; }

  .sub-tabs { -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .sub-tabs::-webkit-scrollbar { display: none; }
}

/* ==========================================================
   REDUCED MOTION — shut down every decorative animation
========================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  body::after { animation: none; }
}

/* ==========================================================
   ACCESSIBILITY + MOTIVATIONAL UX (2026-04-21)
   Matched to the A11Y module in js/app.js. Non-invasive: every
   rule is either additive or gated behind an opt-in class set
   from localStorage preferences.
========================================================== */

/* Font-size slider — scales root so any rem-sized text grows with it.
   Fallback --font-scale of 1 keeps the default 16px root size. */
html {
  font-size: calc(16px * var(--font-scale, 1));
}

/* High-contrast mode: brighter foreground + stronger borders, no colour
   changes to the orange accent (brand preservation). Toggle via:
   html.a11y-high-contrast. */
html.a11y-high-contrast {
  --text: #FFFFFF;
  --text-dim: #EDEDEF;
  --text-faint: #D1D5DB;
  --border: rgba(255,255,255,0.35);
  --border-strong: rgba(255,255,255,0.6);
  --line: rgba(255,255,255,0.35);
  --line-soft: rgba(255,255,255,0.18);
  --surface: rgba(255,255,255,0.08);
  --surface-hi: rgba(255,255,255,0.12);
}

/* Forced reduced motion (user-opt-in via Settings). Mirrors the OS
   prefers-reduced-motion behaviour on demand. */
html.a11y-force-reduced-motion *,
html.a11y-force-reduced-motion *::before,
html.a11y-force-reduced-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}

/* Set-done pulse: brief scale bounce when a set is marked complete.
   Trigger by adding .just-done for ~500ms, then remove. */
@keyframes a11y-set-pulse {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.28); }
  100% { transform: scale(1); }
}
.set-done.just-done {
  animation: a11y-set-pulse 420ms cubic-bezier(.16,1,.3,1);
}
html.a11y-force-reduced-motion .set-done.just-done { animation: none; }

/* PR-unlock confetti burst. The A11Y module positions .a11y-confetti at
   a fixed screen coordinate and populates it with .a11y-conf-piece spans
   whose --dx/--dy are set per piece. */
.a11y-confetti {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  width: 0;
  height: 0;
}
.a11y-conf-piece {
  position: absolute;
  width: 8px;
  height: 10px;
  border-radius: 2px;
  transform: translate(-50%, -50%) scale(0.6);
  opacity: 0;
  animation: a11y-conf-fly 1000ms cubic-bezier(.2,.6,.3,1) forwards;
}
@keyframes a11y-conf-fly {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.6) rotate(0deg);
  }
  18% { opacity: 1; }
  100% {
    opacity: 0;
    transform:
      translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px) + 80px))
      scale(1)
      rotate(720deg);
  }
}

/* Accessibility settings — row layout + toggle switches. */
.a11y-pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}
.a11y-pref-row:last-child { border-bottom: 0; }
.a11y-pref-label {
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
}
.a11y-pref-hint {
  color: var(--text-faint);
  font-size: 12px;
  margin-top: 2px;
  line-height: 1.4;
}
.a11y-pref-control input[type="range"] {
  width: 160px;
  accent-color: var(--accent);
}

.a11y-switch {
  position: relative;
  width: 46px;
  height: 26px;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 180ms cubic-bezier(.16,1,.3,1),
              border-color 180ms cubic-bezier(.16,1,.3,1);
}
.a11y-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-faint);
  transition: transform 180ms cubic-bezier(.16,1,.3,1),
              background 180ms cubic-bezier(.16,1,.3,1);
}
.a11y-switch.on {
  background: var(--accent-glow-soft);
  border-color: var(--accent);
}
.a11y-switch.on::after {
  transform: translateX(20px);
  background: var(--accent);
}
.a11y-switch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Progress-visualisation animations for the new Overview + Weekly
   Review charts. Entry-only; honour reduced-motion preference. */
@keyframes cal-bar-grow {
  from { transform: scaleY(0); }
  to   { transform: scaleY(1); }
}
@keyframes weight-line-draw {
  to { stroke-dashoffset: 0; }
}
@media (prefers-reduced-motion: reduce) {
  [style*="cal-bar-grow"] { animation: none !important; transform: none !important; }
  [style*="weight-line-draw"] { animation: none !important; stroke-dashoffset: 0 !important; }
}
html.a11y-force-reduced-motion [style*="cal-bar-grow"] {
  animation: none !important;
  transform: none !important;
}
html.a11y-force-reduced-motion [style*="weight-line-draw"] {
  animation: none !important;
  stroke-dashoffset: 0 !important;
}

/* ==========================================================
   APP-NATIVE FEEL (2026-04-21)
   Mobile chrome: fixed bottom tab bar, sticky glass header,
   safe-area insets, tap feedback, iOS input font-size floor,
   snappier tab-switch transition.
========================================================== */

/* Global: remove "browser-ness" */
html, body {
  overscroll-behavior-y: none;          /* no rubber-band pull-to-refresh */
}
/* `overflow-x: hidden` on body from earlier in this file implicitly creates
   a scroll container, which breaks `position: sticky` on descendants.
   `overflow-x: clip` clips without making body a scroll container.
   Clip has full coverage in modern PWA targets (Chrome 90+, FF 81+, Safari 15.4+). */
@supports (overflow-x: clip) {
  body { overflow-x: clip; }
}
* {
  -webkit-tap-highlight-color: transparent;  /* kill the blue flash on tap */
}
body {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;           /* no long-press menu on images/text */
}
/* Re-enable text selection where it's actually useful */
input, textarea, [contenteditable="true"],
.card, .card *, .entry, .daily-tip,
blockquote, cite, code, pre {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

/* iOS Safari zooms in when an input with font-size < 16px is focused.
   That zoom is the single loudest "this is a web page" tell. */
@media (max-width: 768px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
  textarea,
  select {
    font-size: 16px !important;
  }
}

/* Instant press-down on touch devices — the "native replied" micro-feedback */
@media (hover: none) and (pointer: coarse) {
  button:not(.a11y-switch):not(.nav-btn):active,
  .btn-primary:active, .btn-ghost:active,
  .sub-tab:active,
  .set-done:active, .meal-ctrl-btn:active,
  .plan-adjust-btn:active,
  .daily-input:active {
    transform: scale(0.96);
    transition: transform 90ms cubic-bezier(.16,1,.3,1);
  }
  .nav-btn:active { transform: scale(0.92); transition: transform 90ms; }
}

/* Snappier tab-switch (was 400ms — too leisurely for an "app") */
.tab-panel.active { animation-duration: 220ms; }
@media (prefers-reduced-motion: reduce) {
  .tab-panel.active { animation: none; }
}
html.a11y-force-reduced-motion .tab-panel.active { animation: none; }

/* App chrome applies at ALL widths — native apps don't have UI that scrolls
   away on bigger screens either. Desktop keeps the top-nav-in-header layout;
   mobile has the bottom tab bar override below. */
#screen-plan .plan-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: linear-gradient(180deg, rgba(6,6,8,0.92), rgba(6,6,8,0.68));
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  /* Negative margin so the blur extends edge-to-edge past .screen's padding
     on desktop viewports. .screen padding is clamp(24px, 4vw, 48px), so we
     use a safe negative max. The ::before avoids the containing-block trap. */
  margin-left: calc(-1 * clamp(24px, 4vw, 48px));
  margin-right: calc(-1 * clamp(24px, 4vw, 48px));
  margin-top: calc(-1 * clamp(24px, 4vw, 48px));
  padding-left: clamp(24px, 4vw, 48px);
  padding-right: clamp(24px, 4vw, 48px);
  padding-top: calc(env(safe-area-inset-top, 0px) + 18px);
  padding-bottom: 18px;
  border-radius: 0;
}

/* Focus-visible: branded ring for keyboard users, invisible for mouse/touch */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent, #F97316);
  outline-offset: 2px;
  border-radius: 4px;
}
button:focus-visible,
.btn-primary:focus-visible,
.btn-ghost:focus-visible,
.nav-btn:focus-visible,
.sub-tab:focus-visible {
  outline-offset: 3px;
  box-shadow: 0 0 0 4px var(--accent-glow, rgba(249,115,22,0.25));
}

/* Images shouldn't be drag-ghostable from the UI (feels webby).
   Keep img inside articles/content drag-enabled via opt-in. */
img, svg { -webkit-user-drag: none; user-drag: none; }
img[draggable="true"] { -webkit-user-drag: auto; user-drag: auto; }

/* Momentum scrolling on touch — already native in most browsers but
   explicit on containers that might have scroll. */
html, body, .tab-panel, .sub-panel {
  -webkit-overflow-scrolling: touch;
}

/* Prevent text cursor (caret) showing up where it shouldn't. Caret should
   only appear inside actual text fields. */
body { caret-color: transparent; }
input, textarea, [contenteditable="true"] { caret-color: var(--accent, #F97316); }

/* ==========================================================
   DENSITY PASS (2026-04-21)
   Condenses card + stat + typography spacing so the app shows
   more information per screen. Values tuned from the Barlow
   Condensed display type so numbers stay legible at smaller size.
========================================================== */

/* Cards: trim padding + vertical rhythm (desktop stays roomier) */
.card {
  padding: 16px;
  margin-bottom: 12px;
}
@media (min-width: 768px) {
  .card { padding: 22px; margin-bottom: 16px; }
}

/* Card headings: the old 28px h3 filled a quarter of a phone screen */
.card h3 {
  font-size: 20px;
  letter-spacing: .6px;
  line-height: 1.08;
  margin-bottom: 4px;
}
@media (min-width: 768px) {
  .card h3 { font-size: 26px; letter-spacing: 1px; margin-bottom: 8px; }
}
.card h4 {
  font-size: 13px;
  margin-bottom: 4px;
  letter-spacing: .4px;
}
@media (min-width: 768px) {
  .card h4 { font-size: 15px; margin-bottom: 8px; }
}
.card p {
  margin-bottom: 8px;
  font-size: 13.5px;
  line-height: 1.45;
}
@media (min-width: 768px) {
  .card p { font-size: 14.5px; line-height: 1.55; margin-bottom: 12px; }
}

/* Stat-row: force a 2-col grid on narrow screens (was stacking to 1-col
   under 360px with the old 180px minmax). Goes 4-col on tablet+. */
.stat-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
@media (min-width: 560px) {
  .stat-row { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
}

/* Stats: smaller padding, much smaller value (was 42px — huge on phone) */
.stat {
  padding: 10px 12px;
}
.stat .value {
  font-size: 24px;
  letter-spacing: .6px;
}
@media (min-width: 560px) {
  .stat { padding: 14px 16px; }
  .stat .value { font-size: 32px; letter-spacing: 1px; }
}
@media (min-width: 1024px) {
  .stat .value { font-size: 38px; }
}
.stat .label {
  font-size: 10px;
  letter-spacing: 1.4px;
  margin-bottom: 4px;
}
.stat .unit { font-size: 12px; margin-left: 2px; }
.stat .sub { font-size: 11px; margin-top: 3px; line-height: 1.35; }

/* ---- Today hero card: the "what do I do right now" bar at the top
        of Overview. Compact, action-first, action-second. ---- */
.today-hero {
  border-left: 3px solid var(--accent, #F97316);
  padding: 14px 16px 16px !important;
  margin-bottom: 14px !important;
}
.today-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.today-kicker {
  font-size: 11px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-faint, #70788a);
  font-weight: 700;
}
.today-chip {
  font-size: 11px;
  letter-spacing: .6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
  white-space: nowrap;
}
.today-chip.done {
  background: rgba(34,197,94,0.14);
  color: #22C55E;
  border: 1px solid rgba(34,197,94,0.3);
}
.today-chip.rest {
  background: rgba(167,139,250,0.14);
  color: #A78BFA;
  border: 1px solid rgba(167,139,250,0.3);
}
.today-chip.todo {
  background: var(--surface, rgba(255,255,255,0.04));
  color: var(--text-faint, #70788a);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
}

.today-metrics {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}
.today-metric .tm-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}
.today-metric .tm-label {
  font-size: 12px;
  color: var(--text-dim, #9098a5);
  font-weight: 600;
}
.today-metric .tm-num {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text, #EDEDEF);
  letter-spacing: .4px;
  font-variant-numeric: tabular-nums;
}
.today-metric .tm-slash {
  color: var(--text-faint, #70788a);
  font-weight: 500;
  font-size: 14px;
}
.today-metric .tm-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--line-soft, rgba(255,255,255,0.05));
  overflow: hidden;
}
.today-metric .tm-fill {
  height: 100%;
  background: var(--accent, #F97316);
  border-radius: 3px;
  transition: width 600ms cubic-bezier(.2,.6,.3,1);
}
.today-metric .tm-fill.protein { background: #22C55E; }
.today-metric .tm-fill.good { background: #22C55E; }
.today-metric .tm-fill.over { background: #EF4444; }

.today-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.today-actions.today-actions-single {
  grid-template-columns: 1fr;
}

/* ---- Live session tracker (Training → Today's Session)
        Top-of-page hero that updates live as sets are marked done.
        Styled after the reference activity-tracker aesthetic: big
        primary stats + a circular completion ring on the right. ---- */
.live-session {
  border-left: 3px solid var(--accent, #F97316);
  padding: 16px !important;
  margin-bottom: 14px !important;
}
.live-session .ls-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.live-session .ls-kicker {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-faint, #70788a);
  font-weight: 700;
  margin-bottom: 4px;
}
.live-session .ls-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: .6px;
  line-height: 1.05;
  margin: 0 0 2px;
  color: var(--text, #EDEDEF);
  text-transform: uppercase;
}
.live-session .ls-sub {
  font-size: 12px;
  color: var(--text-dim, #9098a5);
  letter-spacing: .3px;
}
.live-session .ls-ring {
  position: relative;
  width: 60px;
  height: 60px;
  flex-shrink: 0;
}
.live-session .ls-ring-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--text, #EDEDEF);
  letter-spacing: .2px;
  font-variant-numeric: tabular-nums;
}
.live-session .ls-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.live-session .ls-stat {
  padding: 10px 12px;
  background: var(--surface-input, rgba(255,255,255,0.03));
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 10px;
  text-align: center;
}
.live-session .ls-stat-val {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text, #EDEDEF);
  letter-spacing: .4px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.live-session .ls-stat-val strong {
  color: var(--accent, #F97316);
  font-weight: 700;
}
.live-session .ls-stat-val span {
  font-size: 12px;
  color: var(--text-faint, #70788a);
  font-weight: 500;
  margin-left: 2px;
}
.live-session .ls-stat-lbl {
  font-size: 10px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-faint, #70788a);
  margin-top: 4px;
  font-weight: 700;
}

/* Accent color variety on the 3 stats — matches the reference's
   per-metric palette. Keeps orange on the primary (sets done). */
.live-session .ls-stat:nth-child(1) .ls-stat-val strong { color: var(--accent, #F97316); }
.live-session .ls-stat:nth-child(2) .ls-stat-val strong { color: #22C55E; }
.live-session .ls-stat:nth-child(3) .ls-stat-val strong { color: #2DD4BF; }

/* ==========================================================
   COMMUNITY — challenges, quick-shares, waitlist
   (Coach → Community sub-tab. No leaderboards yet; waitlist collects
    intent for when the backend sync release lands.)
========================================================== */
.challenge-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 4px;
}
@media (min-width: 768px) {
  .challenge-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
}
.challenge {
  position: relative;
  padding: 14px 14px 16px;
  background: var(--surface-input, rgba(255,255,255,0.03));
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.challenge.complete {
  border-color: rgba(34,197,94,0.5);
  background: rgba(34,197,94,0.05);
}
.challenge .ch-head { display: flex; align-items: center; gap: 8px; }
.challenge .ch-icon {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent, #F97316);
  background: var(--accent-glow-soft, rgba(249,115,22,0.14));
  border-radius: 8px;
  flex-shrink: 0;
}
.challenge.complete .ch-icon {
  color: #22C55E;
  background: rgba(34,197,94,0.14);
}
.challenge .ch-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: .6px;
  color: var(--text, #EDEDEF);
  text-transform: uppercase;
  flex: 1;
  min-width: 0;
}
.challenge .ch-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .4px;
  color: #22C55E;
  background: rgba(34,197,94,0.14);
  border: 1px solid rgba(34,197,94,0.4);
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}
.challenge .ch-desc {
  font-size: 12px;
  color: var(--text-dim, #9098a5);
  line-height: 1.4;
}
.challenge .ch-track {
  height: 6px;
  background: var(--line-soft, rgba(255,255,255,0.05));
  border-radius: 3px;
  overflow: hidden;
}
.challenge .ch-fill {
  height: 100%;
  background: var(--accent, #F97316);
  border-radius: 3px;
  transition: width 400ms cubic-bezier(.16,1,.3,1);
}
.challenge.complete .ch-fill { background: #22C55E; }
.challenge .ch-nums {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  color: var(--text-faint, #70788a);
  font-variant-numeric: tabular-nums;
}
.challenge .ch-nums strong { color: var(--text, #EDEDEF); font-weight: 700; }
.challenge.complete .ch-nums strong { color: #22C55E; }
.challenge .ch-share {
  margin-top: 4px;
  font-size: 12px;
  padding: 8px 12px;
  min-height: 34px;
}

.share-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.share-row button {
  flex: 1 1 180px;
  min-height: 44px;
  font-size: 13px;
}

.waitlist { display: flex; gap: 8px; margin-top: 12px; }
.waitlist input[type="email"] {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  background: var(--surface-input, rgba(255,255,255,0.03));
  color: var(--text, #EDEDEF);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 10px;
  font-size: 14px;
}
.waitlist input[type="email"]:focus {
  outline: none;
  border-color: var(--accent, #F97316);
}
.waitlist button { min-height: 44px; white-space: nowrap; }

/* Daily metrics explicit-save bar + confirmation banner.
   Auto-save still runs on every change; this bar exists for users who
   want a button to tap as a final confirmation. */
.daily-save-bar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-top: 10px;
  margin-bottom: 18px;
}
.daily-save-btn {
  width: 100%;
  min-height: 48px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  border-radius: 12px;
}
.daily-save-hint {
  text-align: center;
  color: var(--text-faint, #70788a);
  font-size: 11px;
  letter-spacing: .3px;
}
.daily-save-banner {
  position: fixed;
  left: 50%;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  transform: translate(-50%, -20px);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: rgba(34,197,94,0.18);
  border: 1px solid rgba(34,197,94,0.5);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.45), 0 0 40px rgba(34,197,94,0.25);
  z-index: 9000;
  opacity: 0;
  transition: transform 280ms cubic-bezier(.16,1,.3,1), opacity 200ms ease-out;
  pointer-events: none;
}
.daily-save-banner.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.daily-save-banner .dsb-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #22C55E;
  color: #042f18;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 18px;
  flex-shrink: 0;
}
.daily-save-banner .dsb-title {
  color: #EDEDEF;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .3px;
}
.daily-save-banner .dsb-sub {
  color: var(--text-dim, #9098a5);
  font-size: 12px;
  margin-top: 1px;
}
@media (prefers-reduced-motion: reduce) {
  .daily-save-banner { transition: opacity 120ms; }
  .daily-save-banner.show { transform: translate(-50%, 0); }
}
html.a11y-force-reduced-motion .daily-save-banner {
  transition: opacity 120ms;
}
html.a11y-force-reduced-motion .daily-save-banner.show {
  transform: translate(-50%, 0);
}

/* "✓ Saved" flash pip — appears beside a Daily Metric label the moment
   its input saves. Pure CSS animation so no JS timing is required. */
.daily-saved-flash {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: #22C55E;
  background: rgba(34,197,94,0.12);
  border: 1px solid rgba(34,197,94,0.35);
  border-radius: 999px;
  vertical-align: 2px;
  animation: saved-flash 1200ms cubic-bezier(.16,1,.3,1) forwards;
}
@keyframes saved-flash {
  0%   { opacity: 0; transform: translateY(-2px) scale(0.9); }
  12%  { opacity: 1; transform: translateY(0) scale(1); }
  75%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-2px); }
}
@media (prefers-reduced-motion: reduce) {
  .daily-saved-flash { animation: none; opacity: 1; }
}
html.a11y-force-reduced-motion .daily-saved-flash {
  animation: none;
  opacity: 1;
}
.today-actions .today-act {
  min-height: 40px;
  font-size: 13px;
  letter-spacing: .4px;
  font-weight: 700;
  text-transform: uppercase;
}

/* ---- Mobile welcome: fit the entire hero in one viewport, no scroll.
        Uses 100dvh (dynamic viewport height) so iOS browser chrome doesn't
        steal visible space. The long explanatory paragraph is dropped on
        mobile; the one-line title, quote, CTA, and 2×2 badge grid remain. ---- */
@media (max-width: 640px) {
  /* Scope to .active so the welcome screen stays hidden when the user
     navigates away. Without this, display:flex overrode .screen { display:none }
     and welcome kept rendering on top of the plan. */
  #screen-welcome.active {
    padding: 16px !important;
    min-height: 100dvh;
    display: flex;
  }
  #screen-welcome .hero {
    padding-top: 0;
    display: flex;
    flex-direction: column;
    min-height: calc(100dvh - 32px);
    width: 100%;
    gap: 0;
  }
  #screen-welcome .logo-block {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
  }
  #screen-welcome .logo-mark {
    width: 54px;
    height: 54px;
    flex-shrink: 0;
  }
  #screen-welcome .logo-text h1 {
    font-size: 26px;
    letter-spacing: 1.2px;
    line-height: 1;
    margin: 0 0 2px;
  }
  #screen-welcome .logo-text > span {
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--text-dim);
  }
  #screen-welcome .hero-title {
    font-size: 34px;
    line-height: 1.05;
    margin: 6px 0 4px;
  }
  /* Long explanatory paragraph adds scroll without adding value on mobile.
     Desktop still gets the full pitch. */
  #screen-welcome .hero-sub { display: none; }
  #screen-welcome .hero-quote {
    font-size: 13px;
    line-height: 1.45;
    margin: 10px 0 18px;
    padding: 10px 14px;
  }
  #screen-welcome .hero-cta {
    margin-top: auto;          /* pin CTAs to the bottom of the hero column */
    margin-bottom: 10px;
    gap: 8px;
    flex-direction: column;
  }
  #screen-welcome .btn-link {
    margin-bottom: calc(env(safe-area-inset-bottom, 0px) + 4px);
  }
  #screen-welcome .hero-cta .btn-primary,
  #screen-welcome .hero-cta .btn-ghost {
    width: 100%;
    min-height: 48px;
    font-size: 14px;
    padding: 14px 20px;
  }
  /* "Inside the app" feature pills — fill the gap between CTA and pillar
     badges with secondary capabilities, matching the glass/orange banner
     theme. Mobile-only; desktop still gets the long hero-sub paragraph. */
  #screen-welcome .hero-features {
    display: block;
    margin: 4px 0 14px;
  }
  #screen-welcome .hero-features-title {
    font-size: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-faint, #70788a);
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
  }
  /* Unified "Inside the app" grid — all 9 items share the same compact
     feat-badge style from the screenshot: icon top-left + bold uppercase
     title + dim uppercase description, 3 per row. No separate pillar
     badges; they're one thing now. */
  #screen-welcome .hero-features-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
  #screen-welcome .feat-badge {
    padding: 12px 10px 14px;
  }
  #screen-welcome .feat-badge .badge-icon {
    margin-bottom: 6px;
  }
  #screen-welcome .feat-badge .badge-icon .icon {
    width: 22px;
    height: 22px;
    color: var(--accent, #F97316);
  }
  #screen-welcome .feat-badge .badge-value {
    font-size: 14px;
    line-height: 1.05;
    letter-spacing: .4px;
    margin-bottom: 3px;
  }
  #screen-welcome .feat-badge .badge-label {
    font-size: 9.5px;
    line-height: 1.25;
    letter-spacing: .2px;
  }

  /* Push badges to the bottom so the whole screen balances visually. */
  #screen-welcome .hero-badges {
    margin-top: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 4px);
  }
  #screen-welcome .badge {
    padding: 12px 14px;
  }
  #screen-welcome .badge-icon {
    width: 28px;
    height: 28px;
    margin-bottom: 6px;
  }
  #screen-welcome .badge-value {
    font-size: 13px;
    letter-spacing: .6px;
  }
  #screen-welcome .badge-label {
    font-size: 10.5px;
    line-height: 1.3;
  }
}

/* ---- Plan-header + plan-title — tighten on mobile so the sticky chrome
        doesn't eat half the viewport ---- */
@media (max-width: 640px) {
  .plan-title h1 {
    font-size: 20px;
    letter-spacing: 1px;
    line-height: 1.05;
  }
  .plan-title p { font-size: 11px; line-height: 1.3; }
  .plan-title .logo-mark.small { width: 36px; height: 36px; }
  .plan-adjust-btn {
    padding: 7px 11px;
    font-size: 11px;
    min-height: 34px;
  }
  #screen-plan .plan-header {
    padding-top: calc(env(safe-area-inset-top, 0px) + 10px);
    padding-bottom: 10px;
  }
}

/* ==========================================================
   MOBILE CHROME — ≤640px: fixed bottom nav + sticky glass header
   Desktop keeps the original layout untouched.
========================================================== */
@media (max-width: 640px) {
  /* Sticky glass header. Blur goes on a ::before pseudo so the header
     itself does NOT create a containing block — that would break the
     fixed-position bottom nav inside it (backdrop-filter on a parent
     re-roots position:fixed to the parent, not the viewport). */
  #screen-plan .plan-header {
    position: sticky;
    top: 0;
    z-index: 40;
    margin: -24px -24px 18px;
    padding: calc(env(safe-area-inset-top, 0px) + 14px) 20px 14px;
    border-radius: 0;
    border-bottom: 1px solid var(--border);
    /* On mobile the nav pops out into position:fixed inside this header —
       putting backdrop-filter directly on .plan-header would create a new
       containing block and break the fixed nav. So on mobile we keep the
       header transparent and apply blur via ::before instead. */
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    isolation: auto;
  }
  #screen-plan .plan-header::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(180deg, rgba(6,6,8,0.92), rgba(6,6,8,0.72));
    backdrop-filter: blur(18px) saturate(150%);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
  }

  /* Pop the top nav out of flow and pin to bottom of viewport */
  #screen-plan .plan-header .plan-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    grid-column: auto;
    margin: 0;
    padding: 6px 6px calc(env(safe-area-inset-bottom, 0px) + 6px);
    border-radius: 0;
    border: 0;
    border-top: 1px solid var(--border);
    background: linear-gradient(0deg, rgba(6,6,8,0.96), rgba(6,6,8,0.82));
    backdrop-filter: blur(22px) saturate(150%);
    -webkit-backdrop-filter: blur(22px) saturate(150%);
    box-shadow: 0 -8px 24px rgba(0,0,0,0.5);
    gap: 2px;
  }

  /* Reset active-tab styling for the bottom bar — iOS-style coloured
     icon/text instead of a solid pill, which would overwhelm at the
     bottom-edge density. */
  #screen-plan .plan-header .plan-nav .nav-btn {
    padding: 8px 2px 4px;
    background: transparent;
    color: var(--text-faint);
    box-shadow: none;
    border-radius: 10px;
  }
  #screen-plan .plan-header .plan-nav .nav-btn .icon {
    width: 22px;
    height: 22px;
  }
  #screen-plan .plan-header .plan-nav .nav-btn.active {
    background: transparent;
    color: var(--accent);
    box-shadow: none;
  }
  #screen-plan .plan-header .plan-nav .nav-btn.active .icon {
    color: var(--accent);
    filter: drop-shadow(0 0 8px var(--accent-glow));
  }
  /* Subtle glow top-line on active tab (iOS-ish) */
  #screen-plan .plan-header .plan-nav .nav-btn.active::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 24%;
    right: 24%;
    height: 2px;
    border-radius: 0 0 2px 2px;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
  }

  /* Content room for the fixed bottom bar (nav ≈ 68px + safe-area) */
  #screen-plan {
    padding-bottom: calc(82px + env(safe-area-inset-bottom, 0px));
  }

  /* Sub-tabs inside a panel shouldn't visually collide with the sticky
     header — bump them a touch so shadows don't overlap. */
  .sub-tabs {
    margin-top: 6px;
  }
}

/* ==========================================================
   Print
========================================================== */
@media print {
  body { background: #fff; color: #000; }
  body::before, body::after { display: none !important; }
  .plan-header, .plan-nav, .plan-tools, .btn-primary, .btn-ghost { display: none !important; }
  .card, .day, .supp, .rule, .milestone { break-inside: avoid; border-color: #ccc; background: #fff; color: #000; }
  .tab-panel { display: block !important; page-break-after: always; }
  .stat .value, .macro .value, .day-title .num, .card h3, .section h2 { color: #000 !important; -webkit-text-fill-color: #000 !important; }
}
