/* HealthfulApp design tokens - lifted verbatim from V1 index.html. */
:root{
  --bg:#F7F5F1; --panel:#FDFCFA; --ink:#22201D; --ink-soft:#4A4640; --muted:#7A756C;
  --line:#E6E1D8; --line-strong:#D6D0C4;
  --teal:#4A7C74; --clay:#C2553B; --mustard:#B98A2C;
  --teal-bg:#E8F0EE; --clay-bg:#F8EAE5; --mustard-bg:#F6EEDC;
  --ub:#2F4A6B; --lb:#2E5A45; --ca:#7B322B;
  --ub-bg:#ECF0F6; --lb-bg:#EBF1EC; --ca-bg:#F7ECEA;
  --ub-line:#D5DEEA; --lb-line:#D6E1D8; --ca-line:#EDD8D4;
  --pl:#553A73; --fi:#7A5A1E; --ts:#6E2F52;
  --pl-bg:#F1ECF6; --fi-bg:#F5EFE2; --ts-bg:#F7EAF0;
  --pl-line:#DFD4EA; --fi-line:#E6DBC5; --ts-line:#EAD2DF;
  --surface:#FFFFFF; --hover:#F1EDE6; --on-ink:#FDFCFA; --track:#EDE8DF;
  --neutral-bg:#F1EEE7; --neutral-ink:#5B564C; --chip-idle-bg:#F2EFE9; --chip-idle-ink:#A8A298;
  --navbar-bg:rgba(247,245,241,.96); --focus-ring:rgba(34,32,29,.10);
  --warn:#B3261E;
  color-scheme:light;
  --radius:12px; --radius-sm:8px;
  --gutter:clamp(18px,3.5vw,40px);
  --font:'Plus Jakarta Sans',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
  --ease:cubic-bezier(.16,1,.3,1);
}

/* V1 final dark direction: dark background with slightly lighter elevated surfaces.
   No pure black panels against pure white text. */
html[data-theme="dark"]{
  --bg:#141412; --panel:#242321; --ink:#EFEBE3; --ink-soft:#CFC9BE; --muted:#9A948A;
  --line:#34322E; --line-strong:#45413B;
  --teal:#63A297; --clay:#D07A5F; --mustard:#C79A45;
  --teal-bg:#1B2926; --clay-bg:#2E211D; --mustard-bg:#2C2519;
  --ub:#8FB2DC; --lb:#82C39A; --ca:#DE9384;
  --ub-bg:#1E2733; --lb-bg:#1C2A21; --ca-bg:#2E211E;
  --ub-line:#33414F; --lb-line:#2F4436; --ca-line:#4A322D;
  --pl:#B49DDA; --fi:#D6B366; --ts:#DC96B8;
  --pl-bg:#272134; --fi-bg:#2B2519; --ts-bg:#2F1F28;
  --pl-line:#3E3452; --fi-line:#473D26; --ts-line:#4B3340;
  --surface:#2A2926; --hover:#302E2A; --on-ink:#1A1917; --track:#36332F;
  --neutral-bg:#302E2A; --neutral-ink:#C9C3B8; --chip-idle-bg:#2A2825; --chip-idle-ink:#9A948A;
  --navbar-bg:rgba(20,20,18,.96); --focus-ring:rgba(239,235,227,.14);
  --warn:#EF7A6D;
  color-scheme:dark;
}

/* Result / summary cards lift off the panel in dark mode without going glaring. */
html[data-theme="dark"] .macro-stat,
html[data-theme="dark"] .readout,
html[data-theme="dark"] .alloc-key{background:#35322D;border-color:#4A463F}
/* Base layer. Component styles live in shell.css and with their features. */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { min-height: 100%; }
body { min-height: 100dvh; overflow-x: hidden; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

/* dvh so browser-chrome changes never need JavaScript to correct.
   See src/shell/MobileBottomNav.tsx for why that matters. */
#root { min-height: 100dvh; }

a { color: inherit; }
button { font-family: inherit; }


/* A render exception should never present as an unexplained white screen. */
.fatal-error {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}
.fatal-error-card { width: min(520px, 100%); }
.fatal-error-details { margin-top: 18px; color: var(--muted); font-size: 12px; }
.fatal-error-details code { display: block; margin-top: 8px; overflow-wrap: anywhere; }
/* ==========================================================================
   Shell, navigation, auth and card styles.
   Every colour is a V1 token — nothing new is invented here. The layout is
   V1's compact interface adapted to a persistent desktop sidebar.
   ========================================================================== */

/* ---------- shared bits ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.full-loader {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background: var(--bg);
}
.full-loader-mark {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  border-top-color: var(--teal);
  animation: spin 0.7s linear infinite;
  /* Hold off briefly so a fast session resolve doesn't flash a spinner. */
  opacity: 0;
  animation-name: spin, fade-in;
  animation-duration: 0.7s, 0.2s;
  animation-delay: 0s, 0.25s;
  animation-fill-mode: none, forwards;
  animation-iteration-count: infinite, 1;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .full-loader-mark { animation: fade-in 0.2s 0.25s forwards; }
  * { transition-duration: 0.01ms !important; }
}

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 34px;
  height: 34px;
  object-fit: contain;
  /* V1 ships a white-on-transparent mark; invert it to ink in light mode. */
  filter: invert(1) brightness(0.15);
}
html[data-theme='dark'] .brand-mark { filter: none; }
.brand-sm .brand-mark { width: 26px; height: 26px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.brand-sub {
  font-size: 10.5px;
  letter-spacing: 0.055em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: var(--on-ink); }
.btn-primary:not(:disabled):hover { background: var(--ink-soft); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:not(:disabled):hover { background: var(--hover); }
.btn-quiet { background: none; color: var(--muted); }
.btn-quiet:not(:disabled):hover { color: var(--ink); }
.btn-block { width: 100%; margin-top: 4px; }

/* ---------- fields ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.field-input {
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
  min-height: 42px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}
.field-input:disabled { background: var(--neutral-bg); color: var(--muted); }
.field-input[aria-invalid='true'] { border-color: var(--warn); }
.field-hint { font-size: 12px; color: var(--muted); margin: 0; }
.field-error { font-size: 12px; color: var(--warn); margin: 0; font-weight: 500; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }

/* ---------- alerts ---------- */
.alert {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 14px;
  border: 1px solid;
  line-height: 1.45;
}
.alert-error { background: var(--clay-bg); border-color: var(--clay); color: var(--clay); }
.alert-ok { background: var(--teal-bg); border-color: var(--teal); color: var(--teal); }
.alert-info { background: var(--mustard-bg); border-color: var(--mustard); color: var(--mustard); }

/* ---------- auth screens ---------- */
.centred-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 18px;
  background: var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 26px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 12px 32px -18px rgba(0, 0, 0, 0.22);
}
.auth-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 22px 0 4px;
  color: var(--ink);
}
.auth-sub { font-size: 14px; color: var(--muted); margin: 0 0 20px; line-height: 1.5; }
.auth-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--muted);
  text-align: center;
}
.auth-footer a, .auth-link-quiet { color: var(--teal); font-weight: 600; text-decoration: none; }
.auth-footer a:hover, .auth-link-quiet:hover { text-decoration: underline; }
.auth-link-quiet { display: block; text-align: center; margin-top: 14px; font-size: 13px; }

/* ---------- onboarding choices ---------- */
.choice-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.choice {
  text-align: left;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  cursor: pointer;
  font: inherit;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.choice:hover { background: var(--hover); }
.choice-on { border-color: var(--teal); background: var(--teal-bg); }
.choice-title { font-weight: 600; font-size: 14.5px; color: var(--ink); }
.choice-blurb { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.onboard-details { margin-bottom: 4px; }

/* ---------- shell ---------- */
.shell { min-height: 100dvh; background: var(--bg); }
.shell-main { min-height: 100dvh; }

.app-scroll {
  padding: var(--gutter);
  max-width: 1120px;
  margin: 0 auto;
  /* Clearance for the fixed bottom bar plus the home indicator. */
  padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px) + 20px);
}

/* ---------- desktop sidebar ---------- */
.sidebar { display: none; }

@media (min-width: 861px) {
  .shell { display: grid; grid-template-columns: 250px 1fr; }
  .sidebar {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100dvh;
    background: var(--panel);
    border-right: 1px solid var(--line);
    padding: 26px 14px 20px;
  }
  .sidebar-head { padding: 4px 4px 18px; margin: 0; }
  .sidebar-brand-row { display:flex; align-items:center; gap:6px; width:100%; min-width:0; }
  .sidebar-brand-row .brand { flex:1; min-width:0; }
  .sidebar-head .brand { gap: 12px; }
  .sidebar-head .brand-text { gap: 2px; line-height: 1.18; }
  .sidebar-head .brand-sub { margin-top: 1px; }
  .sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
  .sidebar-foot {
    padding-top: 14px;
    border-top: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .sidebar-user {
    font-size: 12.5px;
    color: var(--muted);
    margin: 0;
    padding: 0 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .app-scroll { padding-bottom: var(--gutter); }
}

.nav-group {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 14px 0 4px;
  padding: 0 8px;
}
.nav-group:first-child { margin-top: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 8px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.nav-item:hover { background: var(--hover); color: var(--ink); }
.nav-item-on { background: var(--hover); color: var(--ink); font-weight: 600; }
.icon { width: 18px; height: 18px; flex: none; }

/* ---------- theme toggle ---------- */
.theme-btn {
  width:30px;height:30px;flex:none;border:1px solid var(--line);background:var(--panel);color:var(--muted);
  border-radius:9px;display:grid;place-items:center;padding:0;transition:color .18s var(--ease),background .18s var(--ease);
}
.theme-btn:hover{color:var(--ink);background:var(--hover)}
.theme-btn.topbar-toggle{display:none}
.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--track);
  border-radius: var(--radius-sm);
}
.seg-opt {
  flex: 1;
  border: 0;
  background: none;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.seg-opt-on { background: var(--surface); color: var(--ink); }

/* ---------- mobile bottom nav ----------
   Rendered through a React portal directly into <body>. This keeps the bar
   outside the dashboard scroll/layout tree. The bar and the overflow trigger
   are each position:fixed against the viewport. No JavaScript viewport offset
   is involved, and the portal root is never a containing block for them. */
.mobile-nav-portal-root {
  position: static;
}
.mobile-nav {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  top: auto !important;
  bottom: 0 !important;
  width: 100vw !important;
  max-width: none !important;
  margin: 0 !important;
  z-index: 2147483000;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding: 8px calc(10px + env(safe-area-inset-right, 0px))
           calc(8px + env(safe-area-inset-bottom, 0px))
           calc(10px + env(safe-area-inset-left, 0px));
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  touch-action: manipulation;
}
@media (min-width: 861px) {
  .mobile-nav, .mobile-overflow-trigger { display: none; }
}
.mobile-overflow-trigger {
  position: fixed !important;
  right: calc(10px + env(safe-area-inset-right, 0px));
  bottom: calc(82px + env(safe-area-inset-bottom, 0px));
  z-index: 2147483001;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
}
.mobile-overflow-trigger:hover,
.mobile-overflow-trigger-on { background: var(--hover); color: var(--ink); }
.mobile-overflow-trigger .icon { width: 16px; height: 16px; }
.mobile-overflow-trigger .mnav-icon-wrap { display: grid; place-items: center; position: relative; }
@media (max-width: 860px) {
  .theme-btn.topbar-toggle { display:grid; }
}

.mnav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  min-width: 0;
  min-height: 58px;
  padding: 8px 2px 7px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  font: inherit;
  font-size: 10.5px;
  line-height: 1.2;
  font-weight: 500;
  color: var(--ink-soft);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
}
.mnav-item .icon { width: 20px; height: 20px; opacity: .75; flex: none; }
.mnav-item > span:last-child { display:block; width:100%; min-width:0; max-width:100%; white-space:normal; overflow:hidden; text-align:center; overflow-wrap:break-word; hyphens:auto; }
@media (hover: hover) and (pointer: fine) {
  .mnav-item:hover {
    background: var(--hover);
    color: var(--ink);
  }
}
.mnav-item-on { background: var(--ink); color: var(--on-ink); }
.mnav-item-on .icon { opacity: 1; stroke: var(--on-ink); }
@media (max-width: 400px) {
  .mnav-item { font-size: 9.5px; padding: 8px 1px 7px; }
  .mnav-item .icon { width: 19px; height: 19px; }
}

/* ---------- more sheet ---------- */
.sheet-scrim {
  position: fixed;
  inset: 0;
  z-index: 60;
  border: 0;
  background: rgba(20, 20, 18, 0.4);
}
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 61;
  background: var(--panel);
  border-top: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
  padding: 10px 14px calc(14px + env(safe-area-inset-bottom, 0px));
  animation: sheet-up 0.2s var(--ease);
}
@keyframes sheet-up { from { transform: translateY(12px); opacity: 0; } }
.sheet-grip {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--line-strong);
  margin: 2px auto 12px;
}
.sheet-nav { display: flex; flex-direction: column; gap: 2px; }
.sheet-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
}
.sheet-item-on { background: var(--hover); color: var(--ink); font-weight: 600; }
.sheet-foot { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }

/* ---------- pages ---------- */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.page-title {
  font-size: clamp(21px, 3.4vw, 27px);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0;
  color: var(--ink);
}
.page-sub { font-size: 13.5px; color: var(--muted); margin: 3px 0 0; }

.card-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}
.card-grid .card { margin-bottom: 0; }
.card-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
  margin: 0 0 10px;
}
.card-empty { font-size: 13.5px; color: var(--muted); margin: 0; line-height: 1.5; }
.stat-line { font-size: 16px; font-weight: 600; color: var(--ink); margin: 0 0 4px; }

.empty-card { max-width: 480px; }
.empty-what { font-size: 14.5px; color: var(--ink-soft); margin: 0 0 8px; line-height: 1.55; }
.empty-when { font-size: 12.5px; color: var(--muted); margin: 0; }

.card .btn + .btn { margin-left: 8px; }
.card .btn { margin-top: 6px; }

/* ==========================================================================
   Phase 3 — training, nutrition, weight, 1RM.
   Category colours are V1 tokens; nothing new is invented.
   ========================================================================== */

.btn-sm { min-height: 34px; padding: 0 11px; font-size: 13px; }
.btn-icon { min-width: 38px; padding: 0 10px; font-size: 17px; line-height: 1; }
.week-nav { display: flex; gap: 6px; }

/* ---------- category chips ---------- */
.cat-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip {
  border: 1px solid var(--line-strong);
  background: var(--chip-idle-bg);
  color: var(--chip-idle-ink);
  border-radius: 999px;
  padding: 6px 13px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.chip:hover { color: var(--ink); }
.chip-ub.chip-on { background: var(--ub-bg); color: var(--ub); border-color: var(--ub-line); }
.chip-lb.chip-on { background: var(--lb-bg); color: var(--lb); border-color: var(--lb-line); }
.chip-ca.chip-on { background: var(--ca-bg); color: var(--ca); border-color: var(--ca-line); }
.chip-pl.chip-on { background: var(--pl-bg); color: var(--pl); border-color: var(--pl-line); }
.chip-fi.chip-on { background: var(--fi-bg); color: var(--fi); border-color: var(--fi-line); }
.chip-ts.chip-on { background: var(--ts-bg); color: var(--ts); border-color: var(--ts-line); }
.chip-on:not([class*='chip-u']):not([class*='chip-l']):not([class*='chip-c']):not([class*='chip-p']):not([class*='chip-f']):not([class*='chip-t']) {
  background: var(--hover); color: var(--ink); border-color: var(--line-strong);
}

/* ---------- week strip ---------- */
.week-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  margin-bottom: 14px;
}
.day-card {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 2px 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius-sm);
  cursor: pointer; font: inherit;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.day-card:hover { background: var(--hover); }
.day-card-on { border-color: var(--ink); background: var(--hover); }
.day-card-today .day-num { color: var(--teal); font-weight: 700; }
.day-name { font-size: 10px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.day-num { font-size: 16px; font-weight: 600; color: var(--ink); line-height: 1.1; }
.day-dots { display: flex; gap: 3px; min-height: 6px; }
.dot { width: 5px; height: 5px; border-radius: 50%; display: inline-block; }
.dot-ub { background: var(--ub); } .dot-lb { background: var(--lb); } .dot-ca { background: var(--ca); }
.dot-pl { background: var(--pl); } .dot-fi { background: var(--fi); } .dot-ts { background: var(--ts); }

/* ---------- exercise rows ---------- */
.day-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.day-head .card-title { margin-bottom: 0; }
.card-link { font-size: 12.5px; font-weight: 600; color: var(--teal); text-decoration: none; }
.card-link:hover { text-decoration: underline; }

.ex-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.ex-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 6px;
  border-bottom: 1px solid var(--line);
}
.ex-row:last-child { border-bottom: 0; }
.ex-list-compact .ex-row { padding: 7px 0; }
.ex-badge {
  flex: none; min-width: 42px; text-align: center;
  font-size: 10.5px; font-weight: 700; letter-spacing: .02em;
  padding: 4px 6px; border-radius: 6px; border: 1px solid;
}
.badge-ub { background: var(--ub-bg); color: var(--ub); border-color: var(--ub-line); }
.badge-lb { background: var(--lb-bg); color: var(--lb); border-color: var(--lb-line); }
.badge-ca { background: var(--ca-bg); color: var(--ca); border-color: var(--ca-line); }
.badge-pl { background: var(--pl-bg); color: var(--pl); border-color: var(--pl-line); }
.badge-fi { background: var(--fi-bg); color: var(--fi); border-color: var(--fi-line); }
.badge-ts { background: var(--ts-bg); color: var(--ts); border-color: var(--ts-line); }
.ex-main { flex: 1; min-width: 0; }
.ex-name { margin: 0; font-size: 14.5px; font-weight: 600; color: var(--ink); }
.ex-done { text-decoration: line-through; color: var(--muted); }
.ex-detail { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.ex-notes { margin: 3px 0 0; font-size: 12px; color: var(--ink-soft); font-style: italic; }
.ex-more { padding: 7px 0; font-size: 12.5px; color: var(--muted); }
.ex-actions { display: flex; gap: 1px; flex: none; }
.icon-btn {
  width: 30px; height: 30px; border: 0; background: none;
  color: var(--muted); font-size: 15px; cursor: pointer; border-radius: 6px;
}
.icon-btn:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.icon-btn:disabled { opacity: .3; cursor: not-allowed; }
.icon-danger:hover:not(:disabled) { color: var(--warn); }

/* ---------- entry form ---------- */
.ex-form-actions { display: flex; gap: 8px; margin-top: 6px; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.overload-note {
  margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--muted); line-height: 1.5;
}
.overload-note a, .guidance a { color: var(--teal); text-decoration: none; }

/* ---------- autocomplete ---------- */
.suggest-wrap { position: relative; }
.suggest-list {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 20;
  list-style: none; margin: 4px 0 0; padding: 4px;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px -12px rgba(0,0,0,.3);
  max-height: 230px; overflow-y: auto;
}
.suggest-list li { display: flex; align-items: center; }
.suggest-item {
  flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 9px; border: 0; background: none; font: inherit; font-size: 14px;
  color: var(--ink); text-align: left; cursor: pointer; border-radius: 6px;
}
.suggest-item:hover { background: var(--hover); }
.suggest-tag { font-size: 11px; color: var(--muted); font-weight: 600; }
.suggest-forget {
  width: 26px; height: 26px; border: 0; background: none;
  color: var(--muted); cursor: pointer; border-radius: 6px; font-size: 15px;
}
.suggest-forget:hover { color: var(--warn); background: var(--hover); }

/* ---------- copy from ---------- */
.copy-wrap { position: relative; }
.copy-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 25;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 6px; min-width: 210px;
  box-shadow: 0 8px 24px -12px rgba(0,0,0,.3);
}
.copy-hint { margin: 2px 6px 6px; font-size: 11.5px; color: var(--muted); }
.copy-opt {
  width: 100%; display: flex; justify-content: space-between; gap: 10px;
  padding: 7px 8px; border: 0; background: none; font: inherit; font-size: 13.5px;
  color: var(--ink); cursor: pointer; border-radius: 6px; text-align: left;
}
.copy-opt:hover { background: var(--hover); }
.copy-count { color: var(--muted); font-size: 12px; }

/* ---------- calendar ---------- */
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 6px; }
.cal-dow { text-align: center; font-size: 10.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-day {
  aspect-ratio: 1 / 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 1px solid var(--line); background: var(--panel);
  border-radius: var(--radius-sm); cursor: pointer; font: inherit;
  min-height: 40px;
}
.cal-day:hover { background: var(--hover); }
.cal-out { opacity: .35; }
.cal-on { border-color: var(--ink); background: var(--hover); }
.cal-today .cal-num { color: var(--teal); font-weight: 700; }
.cal-num { font-size: 13px; color: var(--ink); }
.cal-dots { display: flex; gap: 2px; min-height: 5px; }
.cal-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.cal-foot-hint { font-size: 11.5px; color: var(--muted); }

/* ---------- macros ---------- */
.calc-summary { margin: 0; font-size: 15px; color: var(--ink-soft); }
.calc-result { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.calc-line { margin: 0 0 4px; font-size: 15.5px; color: var(--ink); }
.range { width: 100%; accent-color: var(--teal); }
.macro-row { margin-bottom: 13px; }
.macro-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 5px; }
.macro-label { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.macro-val { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.macro-over { color: var(--warn); font-weight: 600; }
.macro-track { height: 7px; background: var(--track); border-radius: 4px; overflow: hidden; }
.macro-fill { height: 100%; background: var(--teal); border-radius: 4px; transition: width .3s var(--ease); }
.macro-fill-over { background: var(--warn); }
.macro-warn { margin: 5px 0 0; font-size: 11.5px; color: var(--mustard); }
.guidance { line-height: 1.6; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.toggle { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-soft); cursor: pointer; }
.toggle input { accent-color: var(--teal); }

/* ---------- lists ---------- */
.food-list { list-style: none; margin: 14px 0 0; padding: 0; }
.food-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.food-row:last-child { border-bottom: 0; }
.lib-group { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }
.lib-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2px; }
.lib-item { display: flex; align-items: center; gap: 9px; padding: 7px 0; font-size: 14px; color: var(--ink-soft); }
.rm-group { margin-bottom: 18px; }
.rm-ex-name { font-size: 13.5px; font-weight: 600; color: var(--ink); margin: 0; }
.rm-tag { margin-left: 7px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--teal); background: var(--teal-bg); padding: 2px 6px; border-radius: 4px; }
.spark { width: 100%; height: auto; margin-top: 10px; }

/* ---------- mobile ---------- */
@media (max-width: 560px) {
  .week-strip { gap: 3px; }
  .day-card { padding: 7px 1px 6px; }
  .day-name { font-size: 9px; }
  .day-num { font-size: 14px; }
  .field-row { grid-template-columns: 1fr; }
  .lib-list { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .cal-day { min-height: 34px; }
  .cal-num { font-size: 12px; }
}

/* ==========================================================================
   Phase 4 — coach experience, habits, Non-Negotiables.
   Same tokens, same language. The coach side is denser, not different.
   ========================================================================== */

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px;
  text-decoration: none;
  display: block;
}
a.stat-card:hover { background: var(--hover); }
.stat-value { margin: 0; font-size: 25px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); line-height: 1.1; }
.stat-label { margin: 4px 0 0; font-size: 12px; font-weight: 600; color: var(--muted); }
.stat-hint { margin: 3px 0 0; font-size: 11.5px; color: var(--muted); }

/* ---------- clients ---------- */
.client-list { list-style: none; margin: 0; padding: 0; }
.client-wrap { border-bottom: 1px solid var(--line); }
.client-wrap:last-child { border-bottom: 0; }
.client-wrap .client-row { border-bottom: 0; }
.client-row {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.client-list > .client-row:last-child { border-bottom: 0; }
.avatar {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--teal-bg); color: var(--teal);
  font-size: 12px; font-weight: 700; letter-spacing: .02em;
}
.client-meta { display: flex; gap: 5px; flex: none; }
.client-end { margin: 0 0 10px 45px; }

.pill {
  font-size: 10.5px; font-weight: 700; letter-spacing: .03em;
  padding: 3px 8px; border-radius: 999px;
  background: var(--track); color: var(--muted); text-transform: capitalize;
}
.pill-warn { background: var(--clay-bg); color: var(--clay); }
.pill-info { background: var(--mustard-bg); color: var(--mustard); }
.pill-pending { background: var(--mustard-bg); color: var(--mustard); }
.pill-accepted { background: var(--teal-bg); color: var(--teal); }
.pill-expired, .pill-revoked { background: var(--track); color: var(--muted); }

/* ---------- alerts ---------- */
.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.alert-row:last-child { border-bottom: 0; }
.alert-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; }
.alert-dot-warn { background: var(--clay); }
.alert-dot-info { background: var(--mustard); }

/* ---------- tabs ---------- */
.tab-strip {
  display: flex; gap: 2px; margin-bottom: 16px;
  border-bottom: 1px solid var(--line); overflow-x: auto;
}
.tab {
  border: 0; background: none; font: inherit; font-size: 13.5px; font-weight: 600;
  color: var(--muted); padding: 9px 13px; cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab-on { color: var(--ink); border-bottom-color: var(--ink); }

/* ---------- client modification callout ---------- */
.ex-modified {
  margin: 4px 0 0; font-size: 12px; font-weight: 600; color: var(--mustard);
}

/* ---------- habits & non-negotiables ---------- */
.habit-list { list-style: none; margin: 0 0 14px; padding: 0; }
.habit-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.habit-row:last-child { border-bottom: 0; }
.habit-divider { height: 1px; background: var(--line-strong); margin: 6px 0; list-style: none; }
.habit-check {
  flex: none; width: 24px; height: 24px; border-radius: 7px;
  border: 1.5px solid var(--line-strong); background: var(--surface);
  color: var(--teal); font-size: 13px; font-weight: 700; cursor: pointer;
  display: grid; place-items: center; padding: 0;
}
.habit-check[aria-pressed='true'] { background: var(--teal-bg); border-color: var(--teal); }
.habit-done .habit-title { text-decoration: line-through; color: var(--muted); }
.habit-title { margin: 0; font-size: 14.5px; font-weight: 600; color: var(--ink); }
.habit-tag {
  flex: none; min-width: 34px; text-align: center;
  font-size: 10px; font-weight: 700; letter-spacing: .03em;
  padding: 3px 6px; border-radius: 5px; border: 1px solid;
  background: var(--neutral-bg); color: var(--muted); border-color: var(--line-strong);
}
/* Trainer's Non-Negotiables use V1's clay accent, as requested. */
.habit-tag-nn { background: var(--clay-bg); color: var(--clay); border-color: var(--clay); }
.habit-count { font-size: 12.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.habit-add { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.habit-add .field-input { flex: 1; min-width: 160px; }

.adherence-list { list-style: none; margin: 0; padding: 0; }
.adherence-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.adherence-row:last-child { border-bottom: 0; }

/* ---------- dialog ---------- */
.dialog {
  position: fixed; z-index: 61;
  left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(420px, calc(100vw - 32px));
  background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: var(--radius); padding: 24px;
  box-shadow: 0 20px 60px -24px rgba(0,0,0,.4);
}
.dialog-title { margin: 0 0 6px; font-size: 18px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); }
.dialog-actions { display: flex; gap: 8px; margin-top: 6px; }

@media (max-width: 560px) {
  .client-row { flex-wrap: wrap; }
  .client-meta { order: 3; width: 100%; margin-left: 45px; }
  .stat-row { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-value { font-size: 21px; }
  .dialog { top: auto; bottom: 0; transform: translateX(-50%); width: 100vw; border-radius: 16px 16px 0 0; padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
}

/* ==========================================================================
   Phase 5 — messaging.
   Same tokens as everywhere else. Bubbles use the surface/panel pair, own
   messages pick up the teal accent already used for primary actions.
   ========================================================================== */

.page-actions-row { display: flex; gap: 8px; }

/* ---------- nav badges ---------- */
.nav-item { position: relative; }
.nav-badge {
  margin-left: auto;
  background: var(--clay);
  color: var(--on-ink);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}
.sheet-item { position: relative; }
.sheet-item .nav-badge { margin-left: auto; }

.mnav-icon-wrap { position: relative; display: inline-flex; }
.mnav-dot {
  position: absolute;
  top: -1px;
  right: -2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--clay);
  border: 1.5px solid var(--panel);
}

/* ---------- conversation shell ---------- */
.chat-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.chat {
  display: flex;
  flex-direction: column;
  height: min(600px, 70dvh);
}
.chat-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
}
.chat-empty { margin: auto; text-align: center; max-width: 280px; }
.chat-daymark {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin: 14px 0 10px;
}
.chat-daymark:first-child { margin-top: 0; }

.chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.chat-back {
  display: none;
  border: 0;
  background: none;
  font-size: 20px;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0 4px;
}
.chat-name { font-size: 14.5px; font-weight: 600; color: var(--ink); }

/* ---------- bubbles ---------- */
.bubble-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.bubble-row { display: flex; margin-bottom: 6px; }
.bubble-mine { justify-content: flex-end; }
.bubble {
  max-width: 78%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px 14px 14px 4px;
  padding: 8px 12px;
}
.bubble-own {
  background: var(--teal);
  border-color: var(--teal);
  border-radius: 14px 14px 4px 14px;
}
.bubble-body {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}
.bubble-own .bubble-body { color: var(--on-ink); }
.bubble-time {
  display: block;
  margin-top: 3px;
  font-size: 10.5px;
  color: var(--muted);
}
.bubble-own .bubble-time { color: rgba(253, 252, 250, 0.75); }
.bubble-read { font-weight: 600; }

/* ---------- composer ---------- */
.composer {
  flex: none;
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--panel);
}
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.composer-input {
  flex: 1;
  resize: none;
  max-height: 120px;
  min-height: 42px;
  padding: 10px 13px;
  border-radius: 20px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14.5px;
  line-height: 1.4;
}
.composer-row .btn { border-radius: 20px; flex: none; }
.composer-closed {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
  padding: 6px 0;
}

/* ---------- coach inbox ---------- */
.inbox {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 14px;
  align-items: start;
}
.inbox-list {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  max-height: 640px;
  overflow-y: auto;
}
.convo-list { list-style: none; margin: 0; padding: 4px; display: flex; flex-direction: column; gap: 1px; }
.convo-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 0;
  background: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  font: inherit;
}
.convo-row:hover { background: var(--hover); }
.convo-on { background: var(--hover); }
.convo-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.convo-head { display: flex; justify-content: space-between; gap: 8px; }
.convo-name { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.convo-time { font-size: 11px; color: var(--muted); flex: none; }
.convo-preview {
  font-size: 12.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.unread-badge {
  flex: none;
  background: var(--clay);
  color: var(--on-ink);
  font-size: 10.5px;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
  padding: 2px 6px;
  border-radius: 999px;
}

@media (max-width: 760px) {
  .inbox { grid-template-columns: 1fr; }
  .inbox-list { max-height: none; }
  /* Mobile shows list OR thread, never both — matches a native chat pattern. */
  .inbox-thread { display: none; }
  .inbox.inbox-open .inbox-list { display: none; }
  .inbox.inbox-open .inbox-thread { display: flex; }
  .chat-back { display: inline-block; }
  .chat { height: calc(100dvh - 220px); }
}

/* ==========================================================================
   Phase 6 — billing, integrations, admin.
   Same tokens as everywhere else. Plan cards borrow the .card look; admin
   stats reuse .stat-card/.stat-row from the coach dashboard.
   ========================================================================== */

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.plan-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}
.plan-current { border-color: var(--teal); background: var(--teal-bg); }
.plan-name { margin: 0; font-size: 15px; font-weight: 700; color: var(--ink); }

@media (max-width: 560px) {
  .plan-grid { grid-template-columns: 1fr 1fr; }
}

/* ==========================================================================
   Phase 6 — workout grouping + prescription emphasis.
   Exercise numbering is display-only; it is derived from current ordering.
   ========================================================================== */
:root {
  --prescription-weight: #294f7a;
  --prescription-rest: #823e36;
}
[data-theme='dark'] {
  --prescription-weight: #91b8e1;
  --prescription-rest: #e79a8c;
}

.session-stack { display: flex; flex-direction: column; gap: 16px; }
.training-session + .training-session { border-top: 1px solid var(--line); padding-top: 16px; }
.workout-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 10px; flex-wrap: wrap;
}
.grouping-select-label { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.grouping-select { width: auto; min-width: 135px; padding: 6px 9px; font-size: 12.5px; }
.workout-groups { display: flex; flex-direction: column; gap: 10px; }
.workout-block { min-width: 0; }
.workout-block-category + .workout-block-category { margin-top: 7px; }
.workout-block-superset {
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); padding: 8px 10px;
}
.workout-group-title {
  margin: 0 0 5px; font-size: 11px; font-weight: 700; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: .055em;
}
.superset-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.superset-head .workout-group-title { margin-bottom: 0; }
.superset-create-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm);
}
.exercise-sequence {
  flex: none; width: 24px; padding-top: 3px; text-align: right;
  font-size: 11px; font-weight: 700; line-height: 1.4; color: var(--muted);
  font-variant-numeric: tabular-nums; letter-spacing: .025em;
}
.superset-check { margin-top: 5px; accent-color: var(--teal); }
.prescription-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0; }
.prescription-weight { color: var(--prescription-weight); font-weight: 650; }
.prescription-rest { color: var(--prescription-rest); font-weight: 650; }
.prescription-sep { color: var(--muted); }
.superset-add-actions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 5px; }
.superset-member-actions { display: flex; gap: 2px; align-items: center; flex: none; }
.btn-xs { padding: 4px 7px; min-height: 26px; font-size: 11px; }

@media (max-width: 560px) {
  .workout-toolbar { align-items: flex-start; }
  .grouping-select-label { width: 100%; justify-content: space-between; }
  .grouping-select { flex: 1; }
  .exercise-sequence { width: 20px; }
  .workout-block-superset { padding: 7px; }
  .superset-create-bar { align-items: flex-start; flex-direction: column; }
  .superset-member-actions { flex-wrap: wrap; justify-content: flex-end; }
}

/* Phase 7 QA completion: coach programme templates */
.programme-template-picker { max-width: 760px; }
.programme-editor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.programme-day-strip { margin: 18px 0 20px; }
.template-day-list { display: grid; gap: 14px; margin-bottom: 20px; }
.template-day-block { border: 1px solid var(--border); border-radius: 10px; padding: 14px; background: var(--surface-soft); }
.template-day-block h3 { margin: 0 0 10px; font-size: 14px; }
.template-exercise-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.template-exercise-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 10px 0; border-top: 1px solid var(--border); }
.template-exercise-row:first-child { border-top: 0; padding-top: 0; }
.template-exercise-row strong { font-size: 13px; }
.food-row-actions { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
@media (max-width: 720px) {
  .programme-editor-head, .template-exercise-row { flex-direction: column; }
  .programme-editor-head .btn, .template-exercise-row .btn { width: 100%; }
}

/* Coach email ------------------------------------------------------------ */
.email-status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.email-status-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--surface-soft);
  min-width: 0;
}
.email-status-item span,
.email-preview-meta span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}
.email-status-item strong,
.email-preview-meta strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 14px;
}
.email-preview {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-soft);
}
.email-preview-meta {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 10px;
}
.email-preview-meta p { margin: 0; }
.email-preview-body {
  max-width: 560px;
  margin: 20px auto;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.email-preview-brand { margin: 0; font-weight: 700; font-size: 18px; }
.email-preview-kicker { margin: 3px 0 20px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .055em; }
.email-preview-button {
  display: inline-block;
  margin: 8px 0 16px;
  background: var(--ink);
  color: var(--surface);
  border-radius: 9px;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 600;
}
@media (max-width: 700px) {
  .email-status-grid { grid-template-columns: 1fr; }
  .email-preview-body { margin: 12px; padding: 18px; }
}

/* Coach invite codes ----------------------------------------------------- */
.invite-code-box {
  display: grid;
  gap: 8px;
  place-items: center;
  margin: 18px 0;
  padding: 20px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-soft);
  text-align: center;
}
.invite-code-value {
  font-size: clamp(22px, 5vw, 30px);
  font-weight: 800;
  letter-spacing: .08em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  user-select: all;
}
.invite-code-expiry { color: var(--muted); font-size: 12px; }
.invite-code-actions { flex-wrap: wrap; }
.invite-code-preview {
  margin: 14px 0 4px;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-soft);
}
.invite-code-preview-kicker {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .055em;
}
.invite-code-preview-name { margin: 0 0 4px; font-size: 18px; font-weight: 750; }
.btn.disabled, .btn[aria-disabled='true'] { opacity: .5; cursor: not-allowed; pointer-events: none; }
@media (max-width: 560px) {
  .invite-code-actions { flex-direction: column; }
  .invite-code-actions .btn { width: 100%; }
}

/* ========================================================================== 
   Correction Pass A — acceptance-test refinements
   ========================================================================== */

/* Auth brand breathing room. */
.auth-card { padding-top: 34px; }
.auth-card > .brand { margin: 2px 0 12px; gap: 14px; }
.auth-card > .brand .brand-text { gap: 5px; line-height: 1.22; }
.auth-card > .brand .brand-sub { margin-top: 2px; }
.auth-card > .brand + .auth-title { margin-top: 32px; }

/* Named coach invitations. */
.dialog-wide { width: min(760px, calc(100vw - 28px)); max-width: 760px; }
.invite-inline-form { display: grid; grid-template-columns: 1fr 1fr minmax(220px, 1.35fr) auto; gap: 10px; align-items: end; }
.invite-inline-form .field { margin-bottom: 0; }
.invite-submit { min-width: 92px; margin-bottom: 0; }
.invite-code-meta { display: block; margin-top: 5px; font-size: 12.5px; color: var(--muted); }
.invitation-row { align-items: flex-start; }
.invite-list-code { margin: 5px 0 2px; font-size: 15px; font-weight: 750; letter-spacing: .07em; color: var(--ink); font-variant-numeric: tabular-nums; }

/* Today is the original small red dot, not a recoloured date. */
.day-card-today .day-num { color: var(--ink); font-weight: 700; }
.today-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--clay); display: block; box-shadow: 0 0 0 2px var(--clay-bg); }

/* Stronger category identity while retaining the existing palette. */
.ex-row-ub { box-shadow: inset 3px 0 0 var(--ub); background: color-mix(in srgb, var(--ub-bg) 55%, transparent); }
.ex-row-lb { box-shadow: inset 3px 0 0 var(--lb); background: color-mix(in srgb, var(--lb-bg) 55%, transparent); }
.ex-row-ca { box-shadow: inset 3px 0 0 var(--ca); background: color-mix(in srgb, var(--ca-bg) 55%, transparent); }
.ex-row-pl { box-shadow: inset 3px 0 0 var(--pl); background: color-mix(in srgb, var(--pl-bg) 55%, transparent); }
.ex-row-fi { box-shadow: inset 3px 0 0 var(--fi); background: color-mix(in srgb, var(--fi-bg) 55%, transparent); }
.ex-row-ts { box-shadow: inset 3px 0 0 var(--ts); background: color-mix(in srgb, var(--ts-bg) 55%, transparent); }
.ex-row-complete { opacity: .68; }
.weekly-overload-note { margin-top: 16px; }

/* Stable completion interaction: fixed square, no text-width/layout change. */
.completion-check {
  width: 27px; height: 27px; flex: 0 0 27px; padding: 0; display: inline-grid; place-items: center;
  border: 1.5px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--surface);
  cursor: pointer; transition: background .1s var(--ease), border-color .1s var(--ease), color .1s var(--ease);
}
.completion-check:hover { border-color: var(--teal); }
.completion-check-on { background: var(--teal); border-color: var(--teal); color: white; }
.completion-check .action-icon { width: 17px; height: 17px; }
.superset-title-row { display: flex; align-items: center; gap: 9px; }

/* Larger semantic row actions. */
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; }
.action-icon { width: 20px; height: 20px; display: block; }

/* Actual trend charts instead of a list-only history. */
.trend-chart-wrap { margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.trend-chart { display: block; width: 100%; height: 150px; overflow: visible; }
.trend-line { fill: none; stroke: var(--teal); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.trend-point { fill: var(--surface); stroke: var(--teal); stroke-width: 3; }
.trend-grid-line { stroke: var(--line); stroke-width: 1; stroke-dasharray: 4 5; }
.trend-chart-range, .trend-chart-axis { display: flex; justify-content: space-between; gap: 12px; font-size: 11.5px; color: var(--muted); }
.trend-chart-range { font-weight: 650; color: var(--ink-soft); }

/* Coach client presentation. */
.client-name-link { color: var(--ink); font-size: 14.5px; font-weight: 700; text-decoration: none; }
.client-name-link:hover { color: var(--teal); text-decoration: underline; }
.attention-explainer { margin: -3px 0 10px; }

/* Coach-started messages. */
.inbox-section-label { margin: 12px 12px 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.start-conversation-list { padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.start-convo-row { width: 100%; }

/* Macro V1-style compact cards/batteries. */
.macro-battery-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.macro-battery { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; background: var(--surface); min-width: 0; }
.macro-battery-head { display: flex; justify-content: space-between; gap: 8px; color: var(--ink-soft); font-size: 12.5px; font-weight: 700; }
.macro-battery-head strong { color: var(--teal); font-variant-numeric: tabular-nums; }
.macro-battery-value { margin: 8px 0 10px; font-size: 22px; font-weight: 750; color: var(--ink); font-variant-numeric: tabular-nums; }
.macro-battery-value span { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.macro-battery-track { height: 11px; border-radius: 999px; background: var(--track); overflow: hidden; }
.macro-battery-track span { display: block; height: 100%; background: var(--teal); border-radius: inherit; transition: width .2s var(--ease); }
.macro-battery-over .macro-battery-head strong, .macro-battery-over .macro-battery-value { color: var(--warn); }
.macro-battery-over .macro-battery-track span { background: var(--warn); }
.macro-distribution { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.nutrition-guidance-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.guidance-card { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; background: var(--surface); }
.guidance-card h3 { margin: 0 0 6px; font-size: 13px; color: var(--ink); }
.guidance-card p { margin: 0; font-size: 12px; line-height: 1.55; color: var(--muted); }
.guidance-card a { color: var(--teal); text-decoration: none; }
.nutrition-owner-card { border-left: 3px solid var(--teal); }

@media (max-width: 760px) {
  .invite-inline-form { grid-template-columns: 1fr; }
  .macro-battery-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .nutrition-guidance-grid { grid-template-columns: 1fr; }
}
@media (max-width: 390px) {
  .macro-battery-grid { grid-template-columns: 1fr; }
}


/* Correction Pass A follow-up: discoverable supersets, goal weight, gram-first macros. */
.workout-toolbar-actions { display: flex; align-items: end; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.goal-weight-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.goal-weight-row .field { margin-bottom: 0; }
.macro-battery-progress { margin: 7px 0 0; font-size: 11.5px; color: var(--muted); }
.macro-battery-head strong { font-size: 13px; }
@media (max-width: 560px) {
  .goal-weight-row { grid-template-columns: 1fr; }
  .workout-toolbar-actions { width: 100%; align-items: stretch; }
  .workout-toolbar-actions > .btn { width: 100%; }
}

/* ========================================================================== 
   HealthfulApp — V1 1:1 parity layer for the five original client screens.
   Scoped to .v1-page so coach/admin-only pages retain their existing V2 UI.
   ========================================================================== */

/* Supplied HealthfulApp artwork: light/dark variants, no redrawn wordmark. */
.healthful-logo { display:block; width:min(184px,100%); height:auto; object-fit:contain; }
.healthful-logo-dark { display:none; }
html[data-theme='dark'] .healthful-logo-light { display:none; }
html[data-theme='dark'] .healthful-logo-dark { display:block; }
.brand { display:flex; flex-direction:column; align-items:flex-start; justify-content:center; gap:7px; min-width:0; }
.brand-sm .healthful-logo { width:142px; }
.sidebar-head .healthful-logo { width:170px; max-width:100%; }
.auth-card .healthful-logo { width:226px; max-width:100%; }
.brand-with-subtitle .brand-sub { margin-top:1px; }
.v1-mobile-brand { display:none; }

.v1-page { width:100%; color:var(--ink); font-size:15px; line-height:1.5; }
.v1-page h1,.v1-page h2,.v1-page h3,.v1-page p { margin-top:0; }
.v1-grow { min-width:0; flex:1; }
.v1-topbar { display:flex; align-items:flex-end; justify-content:space-between; gap:16px; flex-wrap:wrap; margin-bottom:26px; }
.v1-eyebrow { font-size:10.5px; letter-spacing:.18em; text-transform:uppercase; color:var(--muted); margin-bottom:6px; }
.v1-topbar h1 { margin:0; font-size:clamp(22px,3vw,29px); line-height:1.2; letter-spacing:-.025em; }
.v1-topbar-right,.v1-today { font-size:13.5px; color:var(--muted); }
.v1-topbar-right { display:flex; align-items:center; gap:12px; margin-left:auto; }
.v1-panel { background:var(--panel); border:1px solid var(--line); border-radius:var(--radius); padding:clamp(16px,2vw,22px); }
.v1-panel + .v1-panel { margin-top:18px; }
.v1-panel-head { display:flex; align-items:center; justify-content:space-between; gap:14px; flex-wrap:wrap; margin-bottom:16px; }
.v1-panel-head h2 { margin:0; font-size:15.5px; line-height:1.35; }
.v1-sub { font-size:12.5px; color:var(--muted); margin:2px 0 0; }
.v1-label { display:block; font-size:11px; letter-spacing:.1em; text-transform:uppercase; color:var(--muted); margin-bottom:6px; font-weight:600; }
.v1-input { width:100%; min-width:0; padding:9px 11px; min-height:40px; border:1px solid var(--line-strong); border-radius:var(--radius-sm); background:var(--surface); color:var(--ink); font:inherit; }
.v1-input:focus { outline:none; border-color:var(--ink); box-shadow:0 0 0 3px var(--focus-ring); }
.v1-btn { display:inline-flex; align-items:center; justify-content:center; gap:7px; border:1px solid var(--ink); background:var(--ink); color:var(--on-ink); padding:9px 16px; min-height:0; border-radius:var(--radius-sm); font:inherit; font-weight:600; font-size:14px; line-height:1.25; text-decoration:none; white-space:nowrap; cursor:pointer; transition:opacity .18s var(--ease),transform .18s var(--ease),background .18s var(--ease); }
.v1-btn:hover { opacity:.86; }
.v1-btn:active { transform:translateY(1px); }
.v1-btn:disabled { opacity:.45; cursor:not-allowed; }
.v1-btn-ghost { background:transparent; color:var(--ink-soft); border-color:var(--line-strong); }
.v1-btn-ghost:hover { opacity:1; background:var(--hover); color:var(--ink); }
.v1-btn-sm { padding:6px 11px; font-size:13px; font-weight:500; }
.v1-full { width:100%; }
.v1-icon-btn { display:inline-grid; place-items:center; border:0; background:transparent; padding:6px; min-width:30px; min-height:30px; border-radius:6px; color:var(--muted); font:inherit; line-height:1; cursor:pointer; text-decoration:none; }
.v1-icon-btn:hover:not(:disabled) { background:var(--hover); color:var(--ink); }
.v1-icon-btn:disabled { opacity:.35; cursor:not-allowed; }
.v1-icon-btn .action-icon { width:16px; height:16px; }
.v1-icon-danger:hover { color:var(--warn); }
.v1-empty { border:1px dashed var(--line-strong); border-radius:var(--radius); padding:22px; text-align:center; color:var(--muted); font-size:13.5px; }
.v1-empty .v1-btn { margin-top:12px; }
.v1-src { color:var(--ink); text-decoration:none; font-weight:600; border-bottom:1px solid var(--ink); white-space:nowrap; }
.v1-button-row,.v1-acts,.v1-row-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }

/* V1 category tags. */
.v1-tag { display:inline-flex; align-items:center; gap:6px; font-size:11px; font-weight:700; letter-spacing:.06em; padding:3px 8px; border-radius:99px; border:1px solid transparent; }
.v1-tag.ub,.v1-page .badge-ub { background:var(--ub-bg); color:var(--ub); border-color:var(--ub-line); }
.v1-tag.lb,.v1-page .badge-lb { background:var(--lb-bg); color:var(--lb); border-color:var(--lb-line); }
.v1-tag.ca,.v1-page .badge-ca { background:var(--ca-bg); color:var(--ca); border-color:var(--ca-line); }
.v1-tag.pl,.v1-page .badge-pl { background:var(--pl-bg); color:var(--pl); border-color:var(--pl-line); }
.v1-tag.fi,.v1-page .badge-fi { background:var(--fi-bg); color:var(--fi); border-color:var(--fi-line); }
.v1-tag.ts,.v1-page .badge-ts { background:var(--ts-bg); color:var(--ts); border-color:var(--ts-line); }

/* Dashboard --------------------------------------------------------------- */
.v1-ex-row { display:flex; align-items:center; gap:12px; padding:11px 0; border-bottom:1px solid var(--line); }
.v1-ex-row:last-child { border-bottom:0; padding-bottom:0; }
.v1-ex-row:first-child { padding-top:0; }
.v1-check { width:20px; height:20px; flex:0 0 20px; border:1.5px solid var(--line-strong); border-radius:6px; background:var(--surface); color:var(--on-ink); display:grid; place-items:center; padding:0; transition:all .15s var(--ease); }
.v1-check .action-icon { width:12px; height:12px; opacity:0; }
.v1-check[aria-pressed='true'] { background:var(--ink); border-color:var(--ink); }
.v1-check[aria-pressed='true'] .action-icon { opacity:1; }
.v1-dashboard-ex-title { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.v1-ex-name { font-weight:600; color:var(--ink); }
.v1-ex-meta { font-size:12.5px; color:var(--muted); margin-top:2px; }
.v1-ex-row.done .v1-ex-name { text-decoration:line-through; color:var(--muted); }
.v1-macro-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; }
.v1-macro-stat { border:1px solid var(--line); border-radius:var(--radius-sm); padding:13px 14px; background:var(--surface); min-width:0; }
.v1-macro-stat .k { font-size:10.5px; letter-spacing:.12em; text-transform:uppercase; color:var(--muted); font-weight:600; }
.v1-macro-stat .v { font-size:19px; font-weight:700; margin-top:6px; letter-spacing:-.02em; white-space:nowrap; }
.v1-macro-stat .v small { font-size:13px; font-weight:500; color:var(--muted); }
.v1-macro-stat.over .v { color:var(--warn); }
.v1-track { height:9px; border-radius:99px; background:var(--track); margin-top:10px; overflow:hidden; border:1px solid var(--line); }
.v1-track > span,.v1-fill { display:block; height:100%; border-radius:99px; transition:width .3s var(--ease); }
.v1-fill.tone-ink { background:var(--ink); }
.v1-fill.tone-teal { background:var(--teal); }
.v1-fill.tone-mustard { background:var(--mustard); }
.v1-fill.tone-clay { background:var(--clay); }
.v1-fill.over { background:var(--warn); }
.v1-page .v1-habit-row { display:flex; align-items:center; gap:12px; padding:9px 0; border-bottom:1px solid var(--line); }
.v1-page .v1-habit-row:last-of-type { border-bottom:0; }
.v1-page .v1-habit-row .nm { flex:1; min-width:0; }
.v1-page .v1-habit-row.done .nm { color:var(--muted); text-decoration:line-through; }
.v1-page .v1-inline-add { display:flex; gap:10px; margin-top:14px; }
.v1-page .v1-inline-add input { flex:1; }

/* Weekly Plan ------------------------------------------------------------- */
.v1-weeknav { display:flex; align-items:center; justify-content:space-between; gap:14px; margin:-6px 0 16px; min-height:38px; }
.v1-weeknav-main { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.v1-weeknav-main strong { min-width:180px; text-align:center; font-size:13.5px; color:var(--ink-soft); }
.v1-week-position { font-size:11.5px; color:var(--muted); white-space:nowrap; }
.v1-daybar { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:8px; margin-bottom:20px; }
.v1-daybtn { border:1px solid var(--line); background:var(--panel); border-radius:var(--radius-sm); padding:11px 8px; display:flex; flex-direction:column; align-items:center; gap:6px; transition:all .18s var(--ease); min-width:0; color:var(--ink); cursor:pointer; }
.v1-daybtn:hover { border-color:var(--line-strong); background:var(--surface); }
.v1-daybtn .d { font-size:12px; font-weight:600; letter-spacing:.04em; text-transform:uppercase; color:var(--ink-soft); white-space:nowrap; }
.v1-daybtn .c { font-size:11px; color:var(--muted); white-space:nowrap; }
.v1-daybtn .chips { display:flex; flex-wrap:wrap; gap:3px; justify-content:center; max-width:100%; min-height:18px; }
.v1-daybtn .dtype { font-size:10px; font-weight:700; letter-spacing:.05em; line-height:1.5; padding:1px 7px; border-radius:99px; border:1px solid var(--line); background:var(--chip-idle-bg); color:var(--chip-idle-ink); max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.v1-daybtn .dtype.ub { background:var(--ub-bg); color:var(--ub); border-color:var(--ub-line); }
.v1-daybtn .dtype.lb { background:var(--lb-bg); color:var(--lb); border-color:var(--lb-line); }
.v1-daybtn .dtype.ca { background:var(--ca-bg); color:var(--ca); border-color:var(--ca-line); }
.v1-daybtn .dtype.pl { background:var(--pl-bg); color:var(--pl); border-color:var(--pl-line); }
.v1-daybtn .dtype.fi { background:var(--fi-bg); color:var(--fi); border-color:var(--fi-line); }
.v1-daybtn .dtype.ts { background:var(--ts-bg); color:var(--ts); border-color:var(--ts-line); }
.v1-daybtn .dtype.more { background:var(--chip-idle-bg); color:var(--chip-idle-ink); border-color:var(--line); }
.v1-daybtn .v1-daycount { font-size:9.5px; color:var(--muted); white-space:nowrap; }
.v1-daybtn.blank .d { color:var(--muted); }
.v1-daybtn[aria-current='date'] { border-color:var(--ink); background:var(--surface); box-shadow:0 0 0 1px var(--ink); }
.v1-daybtn.today .d::after { content:''; display:inline-block; width:7px; height:7px; border-radius:99px; background:var(--clay); margin-left:5px; vertical-align:middle; box-shadow:0 0 0 1px color-mix(in srgb,var(--clay) 30%,transparent); }
.v1-today-dot { display:none; width:7px; height:7px; border-radius:99px; background:var(--clay); box-shadow:0 0 0 1px color-mix(in srgb,var(--clay) 30%,transparent); }
.v1-week-panel { position:relative; }
.v1-week-panel-head { padding-right:min(46%,410px); min-height:34px; }
.v1-week-entry > .v1-ex-form > .cat-chips { position:absolute; top:18px; right:22px; width:min(48%,520px); justify-content:flex-end; margin:0; }
.v1-ex-form .cat-chips { display:flex; gap:8px; flex-wrap:wrap; }
.v1-ex-form .chip { border:1px solid var(--line-strong); background:var(--surface); border-radius:99px; padding:7px 15px; min-height:0; font-size:13px; font-weight:600; color:var(--muted); transition:all .16s var(--ease); }
.v1-ex-form .chip:hover { background:var(--hover); }
.v1-ex-form .chip-ub { color:var(--ub); }.v1-ex-form .chip-lb { color:var(--lb); }.v1-ex-form .chip-ca { color:var(--ca); }.v1-ex-form .chip-pl { color:var(--pl); }.v1-ex-form .chip-fi { color:var(--fi); }.v1-ex-form .chip-ts { color:var(--ts); }
.v1-ex-form .chip-ub.chip-on { background:var(--ub-bg); border-color:var(--ub); box-shadow:inset 0 0 0 1px var(--ub); }
.v1-ex-form .chip-lb.chip-on { background:var(--lb-bg); border-color:var(--lb); box-shadow:inset 0 0 0 1px var(--lb); }
.v1-ex-form .chip-ca.chip-on { background:var(--ca-bg); border-color:var(--ca); box-shadow:inset 0 0 0 1px var(--ca); }
.v1-ex-form .chip-pl.chip-on { background:var(--pl-bg); border-color:var(--pl); box-shadow:inset 0 0 0 1px var(--pl); }
.v1-ex-form .chip-fi.chip-on { background:var(--fi-bg); border-color:var(--fi); box-shadow:inset 0 0 0 1px var(--fi); }
.v1-ex-form .chip-ts.chip-on { background:var(--ts-bg); border-color:var(--ts); box-shadow:inset 0 0 0 1px var(--ts); }
.v1-ex-form .ex-fields { margin:18px 0 8px; padding:16px 0 2px; border-top:1px solid var(--line); }
.v1-ex-form .field { margin-bottom:10px; gap:6px; }
.v1-ex-form .field-label { display:block; font-size:11px; letter-spacing:.1em; text-transform:uppercase; color:var(--muted); font-weight:600; }
.v1-ex-form .field-input { min-height:39px; padding:8px 10px; }
.v1-ex-form .field-grid { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:10px; align-items:end; }
.v1-ex-form .suggest-wrap { position:relative; }
.v1-ex-form .suggest-list { z-index:90; }
.v1-ex-form .ex-form-actions { display:flex; gap:8px; align-items:center; margin-top:4px; }
.v1-ex-form .ex-form-actions .btn { min-height:0; padding:9px 16px; }
.v1-note { display:flex; gap:9px; align-items:flex-start; margin-top:14px; padding:11px 13px; border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--chip-idle-bg); font-size:12.5px; line-height:1.45; color:var(--ink-soft); }
.v1-note a { color:inherit; }
.v1-note-icon { width:17px; height:17px; flex:0 0 17px; display:grid; place-items:center; border:1px solid var(--line-strong); border-radius:50%; color:var(--muted); font-size:10px; font-weight:700; margin-top:1px; }
.v1-weekly-tools { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin:16px 0 2px; }
.v1-copy-pop { z-index:120; }
.v1-session-stack { margin-top:18px; border-top:1px solid var(--line); }
.v1-training-session { padding-top:2px; }
.v1-workout-toolbar { padding:12px 0 8px; border-bottom:1px solid var(--line); }
.v1-grouping-label { display:flex; align-items:center; gap:8px; font-size:11.5px; color:var(--muted); }
.v1-grouping-label .grouping-select { min-height:34px; padding:5px 30px 5px 9px; font-size:12.5px; }
.v1-page .workout-block { border:0; padding:0; background:transparent; }
.v1-page .workout-group-title { margin:14px 0 4px; font-size:12px; letter-spacing:.08em; text-transform:uppercase; color:var(--muted); }
.v1-page .superset-head { margin-top:12px; padding:10px 12px; border:1px solid var(--line); border-bottom:0; border-radius:var(--radius-sm) var(--radius-sm) 0 0; background:var(--chip-idle-bg); }
.v1-page .superset-create-bar { margin:12px 0; padding:10px 12px; border:1px dashed var(--line-strong); border-radius:var(--radius-sm); background:transparent; }
.v1-page .ex-list { margin:0; padding:0; list-style:none; border-top:1px solid var(--line); }
.v1-page .ex-row { position:relative; display:flex; align-items:center; gap:10px; min-height:62px; padding:11px 0; border:0; border-bottom:1px solid var(--line); background:transparent; box-shadow:none; }
.v1-page .ex-row:first-child { padding-top:11px; }
.v1-page .ex-row:last-child { border-bottom:0; }
.v1-page .exercise-sequence { width:26px; flex:0 0 26px; font-size:11px; color:var(--muted); font-variant-numeric:tabular-nums; }
.v1-page .ex-badge { display:inline-flex; align-items:center; justify-content:center; flex:0 0 auto; border:1px solid transparent; border-radius:99px; padding:3px 7px; min-width:31px; font-size:10px; font-weight:700; letter-spacing:.05em; }
.v1-page .ex-main { min-width:0; flex:1; }
.v1-page .ex-name { margin:0; font-size:14px; font-weight:600; color:var(--ink); }
.v1-page .ex-name.ex-done { color:var(--muted); text-decoration:line-through; }
.v1-page .prescription-line { margin-top:2px; font-size:12.5px; color:var(--muted); }
.v1-page .prescription-weight { color:var(--ub); font-weight:650; }
.v1-page .prescription-rest { color:var(--ca); font-weight:650; }
.v1-page .ex-notes { margin:3px 0 0; font-size:11.5px; color:var(--muted); }
.v1-page .completion-check { width:20px; height:20px; flex:0 0 20px; border:1.5px solid var(--line-strong); border-radius:6px; background:var(--surface); color:var(--on-ink); padding:0; }
.v1-page .completion-check-on { background:var(--ink); border-color:var(--ink); color:var(--on-ink); }
.v1-page .completion-check .action-icon { width:12px; height:12px; }
.v1-page .ex-row-complete { opacity:1; }
.v1-page .v1-ex-actions,.v1-page .ex-actions { display:flex; align-items:center; gap:1px; flex:none; }
.v1-page .superset-member-actions { display:flex; gap:2px; align-items:center; flex-wrap:wrap; }
.v1-page .superset-check { width:17px; height:17px; accent-color:var(--ink); }

/* Monthly Plan ------------------------------------------------------------ */
.v1-monthly-toolbar { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:16px; }
.v1-month-switch,.v1-month-actions { display:flex; align-items:center; gap:8px; }
.v1-month-switch .d { font-size:13.5px; font-weight:600; min-width:150px; text-align:center; }
.v1-cal { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:6px; }
.v1-dow { font-size:10.5px; letter-spacing:.1em; text-transform:uppercase; color:var(--muted); text-align:center; font-weight:600; padding-bottom:4px; }
.v1-cell { border:1px solid var(--line); background:var(--surface); border-radius:var(--radius-sm); min-height:78px; display:flex; flex-direction:column; align-items:flex-start; justify-content:space-between; padding:8px; min-width:0; transition:all .16s var(--ease); color:var(--ink); cursor:pointer; }
.v1-cell:hover { border-color:var(--ink); }
.v1-cell .n { font-size:13px; font-weight:600; color:var(--ink-soft); }
.v1-cell.blank { border:0; background:transparent; pointer-events:none; }
.v1-cell.today { box-shadow:inset 0 0 0 1px var(--line-strong); }
.v1-cell.today .n { color:var(--clay); }
.v1-cell[aria-pressed='true'] { border-color:var(--ink); box-shadow:0 0 0 1px var(--ink); }
.v1-cell .marks { display:flex; gap:4px; flex-wrap:wrap; }
.v1-cell .mk { font-size:10px; font-weight:700; letter-spacing:.04em; padding:2px 5px; border-radius:4px; }
.v1-cell .mk.ub { background:var(--ub-bg); color:var(--ub); }.v1-cell .mk.lb { background:var(--lb-bg); color:var(--lb); }.v1-cell .mk.ca { background:var(--ca-bg); color:var(--ca); }.v1-cell .mk.pl { background:var(--pl-bg); color:var(--pl); }.v1-cell .mk.fi { background:var(--fi-bg); color:var(--fi); }.v1-cell .mk.ts { background:var(--ts-bg); color:var(--ts); }
.v1-monthly-day-detail { margin-top:18px; padding-top:16px; border-top:1px solid var(--line); }
.v1-monthly-day-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.v1-monthly-day-head h3 { margin:0; font-size:15px; }
.v1-monthly-ex-list { margin-top:10px; border-top:1px solid var(--line); }
.v1-monthly-ex-row { display:flex; align-items:flex-start; gap:10px; padding:11px 0; border-bottom:1px solid var(--line); }
.v1-monthly-ex-row:last-child { border-bottom:0; padding-bottom:0; }
.v1-monthly-ex-num { width:22px; flex:none; color:var(--muted); font-size:12px; padding-top:2px; }
.v1-monthly-ex-body { min-width:0; flex:1; }

/* Macro Tracker ----------------------------------------------------------- */
.v1-calcgrid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; align-items:end; }
.v1-calcgrid .span2 { grid-column:span 2; }
.v1-calcrow { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.3fr) minmax(0,1.1fr); gap:12px; align-items:end; }
.v1-readout { border:1px solid var(--line); border-radius:var(--radius-sm); padding:13px 14px; background:var(--surface); min-width:0; }
.v1-readout .k { font-size:10.5px; letter-spacing:.12em; text-transform:uppercase; color:var(--muted); font-weight:600; }
.v1-readout .v { margin-top:5px; font-size:20px; font-weight:700; }
.v1-result-note { font-size:12.5px; color:var(--muted); margin-top:12px; }
.v1-goal-guide { display:grid; gap:8px; margin:12px 0 16px; }
.v1-goal-guide > * { margin:0; padding:10px 12px; border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--surface); color:var(--ink-soft); font-size:12.5px; line-height:1.5; }
.v1-alloc-bar { position:relative; height:22px; border-radius:6px; background:var(--track); display:flex; overflow:hidden; user-select:none; }
.v1-alloc-bar .seg-p { background:var(--teal); }.v1-alloc-bar .seg-c { background:var(--mustard); }.v1-alloc-bar .seg-f { background:var(--clay); }
.v1-alloc-keys { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin-top:18px; }
.v1-alloc-key { border:1px solid var(--line); border-radius:var(--radius-sm); padding:12px; background:var(--surface); }
.v1-alloc-key .nm { display:flex; align-items:center; gap:7px; font-size:12px; font-weight:600; color:var(--ink-soft); }
.v1-alloc-key .g { font-size:18px; font-weight:700; margin-top:7px; letter-spacing:-.02em; }
.v1-alloc-key .pct { margin-top:5px; font-size:11.5px; color:var(--muted); }
.v1-allocation-controls { display:grid; grid-template-columns:repeat(2,minmax(0,180px)); gap:10px; margin-top:12px; }
.v1-datenav { display:flex; align-items:center; gap:8px; }
.v1-datenav .d { font-size:13.5px; font-weight:600; min-width:150px; text-align:center; }
.v1-food-row { display:grid; grid-template-columns:minmax(0,2fr) minmax(75px,.8fr) minmax(80px,.9fr) repeat(4,minmax(66px,.72fr)) auto; gap:9px; align-items:end; }
.v1-food-list { margin-top:18px; border-top:1px solid var(--line); }
.v1-food-item { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:10px; align-items:center; padding:11px 0; border-bottom:1px solid var(--line); }
.v1-food-item:last-child { border-bottom:0; }
.v1-food-amount { font-size:12.5px; color:var(--muted); margin-top:2px; }
.v1-suggest-wrap { position:relative; }
.v1-suggest-list { position:absolute; z-index:100; top:calc(100% + 4px); left:0; right:0; max-height:240px; overflow:auto; padding:4px; margin:0; list-style:none; background:var(--panel); border:1px solid var(--line-strong); border-radius:var(--radius-sm); box-shadow:0 6px 20px rgba(0,0,0,.10); }
.v1-suggest-list button { width:100%; border:0; background:transparent; color:var(--ink); font:inherit; text-align:left; padding:8px 9px; border-radius:6px; }
.v1-suggest-list button:hover { background:var(--hover); }
.v1-owner-panel { border-left:3px solid var(--teal); }

.datefield-wrap { position:relative; min-width:0; }
.datefield {
  display:flex; align-items:center; justify-content:space-between; gap:8px; width:100%;
  padding:9px 11px; border:1px solid var(--line-strong); border-radius:var(--radius-sm);
  background:var(--surface); color:var(--ink); font-size:15px; text-align:left;
}
.datefield .datefield-icon { width:15px; height:15px; color:var(--muted); flex:none; }
.datefield:hover,.datefield.open { border-color:var(--ink); }
.pk {
  position:absolute; top:calc(100% + 6px); left:0; z-index:70; width:262px; max-width:88vw; padding:10px;
  background:var(--panel); border:1px solid var(--line-strong); border-radius:var(--radius);
  box-shadow:0 10px 28px rgba(0,0,0,.14);
}
.pk-head { display:flex; align-items:center; justify-content:space-between; gap:6px; margin-bottom:6px; }
.pk-head .v1-icon-btn { width:30px; height:30px; }
.pk-arrow { width:16px; height:16px; display:block; }
.pk-title { font-size:13px; font-weight:600; }
.pk-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:2px; }
.pk-dow { font-size:10px; color:var(--muted); text-align:center; font-weight:700; padding-bottom:4px; }
.pk-blank { height:30px; }
.pk-day {
  height:30px; border:0; background:transparent; border-radius:7px; font-size:12.5px;
  color:var(--ink-soft); font-variant-numeric:tabular-nums;
}
.pk-day:hover:not(:disabled) { background:var(--hover); color:var(--ink); }
.pk-day.today { color:var(--clay); font-weight:700; }
.pk-day.sel { background:var(--ink); color:var(--on-ink); font-weight:700; }
.pk-day:disabled { opacity:.3; cursor:not-allowed; }
.pk-foot { display:flex; justify-content:flex-end; margin-top:8px; padding-top:8px; border-top:1px solid var(--line); }
@media (max-width:620px) {
  .datefield-wrap .pk { width:min(262px,calc(100vw - 24px)); max-width:calc(100vw - 24px); }
}

/* Weight Tracker ---------------------------------------------------------- */
.v1-weighform { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto; gap:12px; align-items:end; }
.v1-history-edit { grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto auto; }
.v1-goal-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:10px; align-items:end; margin-top:14px; padding-top:14px; border-top:1px solid var(--line); }
.v1-chartwrap { width:100%; min-height:250px; overflow:hidden; }
.v1-chartwrap svg { display:block; width:100%; height:auto; min-height:250px; overflow:visible; }
.v1-chartwrap .grid { stroke:var(--line); stroke-width:1; }
.v1-chartwrap .area { fill:color-mix(in srgb,var(--teal) 13%,transparent); }
.v1-chartwrap .line { fill:none; stroke:var(--teal); stroke-width:2.5; stroke-linecap:round; stroke-linejoin:round; }
.v1-chartwrap .dot { fill:var(--surface); stroke:var(--teal); stroke-width:2.5; }
.v1-chartwrap .ylab,.v1-chartwrap .xlab,.v1-chartwrap .axtitle { fill:var(--muted); font-family:var(--font); font-size:10.5px; }

/* Dark V1 elevated readouts. */
html[data-theme='dark'] .v1-macro-stat,
html[data-theme='dark'] .v1-readout,
html[data-theme='dark'] .v1-alloc-key { background:#35322D; border-color:#4A463F; }

/* Responsive parity ------------------------------------------------------- */
@media (max-width:860px) {
  .v1-daybtn.today .d::after { display:none; }
  .v1-daybtn.today .v1-today-dot { display:block; margin-top:1px; }
  .v1-mobile-brand { display:flex; align-items:center; margin:-2px 0 20px; }
  .v1-mobile-brand .healthful-logo { width:170px; }
  .v1-topbar { margin-bottom:22px; }
}
@media (max-width:760px) {
  .v1-macro-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .v1-daybar { gap:5px; }
  .v1-daybtn { padding:9px 4px; gap:4px; }
  .v1-daybtn .c { font-size:10px; }
  .v1-daybtn .v1-daycount { display:none; }
  .v1-daybtn .dtype { padding:1px 4px; font-size:9px; }
  .v1-daybtn .dtype:nth-child(n+2) { display:none; }
  .v1-daybtn .dtype.more { display:none; }
  .v1-week-panel-head { padding-right:0; padding-bottom:48px; }
  .v1-week-entry > .v1-ex-form > .cat-chips { top:70px; left:16px; right:16px; width:auto; justify-content:flex-start; overflow-x:auto; flex-wrap:nowrap; padding-bottom:2px; }
  .v1-ex-form .chip { padding:6px 11px; font-size:12px; flex:none; }
  .v1-ex-form .field-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .v1-food-row { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .v1-food-row .f-name { grid-column:1 / -1; }
  .v1-food-row .f-act { grid-column:1 / -1; }
  .v1-calcgrid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .v1-calcgrid .span2 { grid-column:span 2; }
  .v1-alloc-keys { grid-template-columns:1fr; }
  .v1-allocation-controls { grid-template-columns:1fr 1fr; }
}
@media (max-width:620px) {
  .v1-page { font-size:14px; }
  .v1-topbar { align-items:flex-start; margin-bottom:20px; }
  .v1-today { width:100%; margin-top:-6px; }
  .v1-panel { padding:16px; }
  .v1-weeknav { align-items:flex-start; flex-direction:column; gap:5px; }
  .v1-week-position { align-self:flex-end; margin-top:-30px; }
  .v1-weeknav-main strong { min-width:130px; font-size:12.5px; }
  .v1-monthly-toolbar { align-items:stretch; flex-direction:column; }
  .v1-month-switch,.v1-month-actions { justify-content:space-between; width:100%; }
  .v1-month-switch .d { flex:1; min-width:0; }
  .v1-cal { gap:3px; }
  .v1-dow { font-size:9px; }
  .v1-cell { min-height:58px; padding:5px; }
  .v1-cell .n { font-size:11px; }
  .v1-cell .mk { font-size:8px; padding:1px 3px; }
  .v1-calcrow { grid-template-columns:1fr; }
  .v1-weighform,.v1-history-edit,.v1-goal-row { grid-template-columns:1fr; }
  .v1-chartwrap { min-height:210px; }
  .v1-chartwrap svg { min-height:210px; }
}
@media (max-width:430px) {
  .v1-macro-grid { grid-template-columns:1fr; }
  .v1-panel-head { align-items:flex-start; }
  .v1-daybtn .c { display:none; }
  .v1-daybtn { min-height:67px; }
  .v1-week-panel-head { padding-bottom:43px; }
  .v1-week-entry > .v1-ex-form > .cat-chips { top:68px; }
  .v1-ex-form .field-grid { grid-template-columns:1fr; }
  .v1-calcgrid { grid-template-columns:1fr; }
  .v1-calcgrid .span2 { grid-column:auto; }
  .v1-allocation-controls { grid-template-columns:1fr; }
  .v1-page .v1-inline-add { flex-direction:column; }
}

/* Screenshot-verified V1 parity shell: scoped to the five original pages. */
@media (min-width:861px){
  .shell-v1-parity{grid-template-columns:250px minmax(0,1fr)}
  .shell-v1-parity .app-scroll{max-width:1180px;margin:0;padding:clamp(22px,3vw,34px) var(--gutter) 64px}
  .mobile-overflow-trigger{display:none!important}
}
.sidebar-secondary{position:relative}
.sidebar-secondary summary{list-style:none;display:flex;align-items:center;gap:8px;width:100%;padding:7px 9px;border:1px solid var(--line);border-radius:var(--radius-sm);background:var(--panel);color:var(--muted);font-size:12px;font-weight:600;cursor:pointer}
.sidebar-secondary summary::-webkit-details-marker{display:none}
.sidebar-secondary summary .icon{width:15px;height:15px}
.sidebar-secondary-menu{display:flex;flex-direction:column;gap:2px;margin-top:6px;padding:5px;border:1px solid var(--line);border-radius:var(--radius-sm);background:var(--panel)}
.sidebar-secondary-item{display:flex;align-items:center;gap:8px;padding:7px 8px;border-radius:6px;color:var(--ink-soft);text-decoration:none;font-size:12.5px}
.sidebar-secondary-item:hover,.sidebar-secondary-item-on{background:var(--hover);color:var(--ink)}
.sidebar-secondary-item .icon{width:15px;height:15px}


/* Screenshot-based parity corrections: monthly overflow cells are visually blank like V1. */
.v1-cell.blank,.v1-cell.blank:hover,.v1-cell.blank[aria-pressed="true"]{border-color:transparent;background:transparent;box-shadow:none;pointer-events:none}
.v1-cell.blank>*{visibility:hidden}

/* Goal Weight remains functional, but outside the three V1 Weight Tracker panels. */
.v1-secondary-control{margin-top:12px}
.v1-secondary-control>summary{list-style:none;display:inline-flex;align-items:center;min-height:30px;padding:6px 10px;border:1px solid var(--line);border-radius:var(--radius-sm);background:var(--surface);color:var(--muted);font-size:12px;font-weight:600;cursor:pointer}
.v1-secondary-control>summary::-webkit-details-marker{display:none}
.v1-secondary-control[open]>summary{color:var(--ink);border-color:var(--line-strong)}
.v1-goal-control .v1-goal-row{max-width:560px;margin-top:10px;padding:12px;border:1px solid var(--line);border-radius:var(--radius-sm);background:var(--panel)}

/* Macros Tracker — screenshot-verified V1 allocation geometry. */
.v1-daily-goal .v1-goal-head{align-items:flex-start}
.v1-daily-goal .v1-goal-head>div:first-child{min-width:0;flex:1}
.v1-goal-guide{display:block;margin:8px 0 0;max-width:660px;min-width:0}
.v1-goal-guide>*,.v1-goal-guide p{margin:0 0 8px;padding:0;border:0;border-radius:0;background:transparent;color:var(--muted);font-size:12.5px;line-height:1.45}
.v1-goal-guide p:last-child{margin-bottom:0}
.v1-goal-guide b{color:var(--ink-soft);font-weight:600}
.v1-calorie-target{width:130px;flex:0 0 130px;align-self:flex-end}
.v1-alloc-bar{position:relative;height:22px;border-radius:6px;background:var(--track);display:flex;overflow:visible;user-select:none;touch-action:none;margin-top:4px}
.v1-alloc-bar .alloc-seg{height:100%;min-width:0}
.v1-alloc-bar .seg-p{background:var(--teal);border-radius:6px 0 0 6px}
.v1-alloc-bar .seg-c{background:var(--mustard)}
.v1-alloc-bar .seg-f{background:var(--clay);border-radius:0 6px 6px 0}
.v1-handle{position:absolute;top:-5px;width:14px;height:32px;margin-left:-7px;padding:0;border:1px solid var(--line-strong);border-radius:5px;background:var(--surface);box-shadow:0 2px 6px rgba(0,0,0,.12);cursor:ew-resize;touch-action:none;z-index:2}
.v1-handle:hover{border-color:var(--ink)}
.v1-alloc-key .nm i{width:9px;height:9px;border-radius:3px;display:inline-block;flex:none}
.v1-alloc-key .nm i.teal{background:var(--teal)}
.v1-alloc-key .nm i.mustard{background:var(--mustard)}
.v1-alloc-key .nm i.clay{background:var(--clay)}
.v1-alloc-key .pctrow{display:flex;align-items:center;gap:6px;margin-top:9px}
.v1-alloc-key .pctrow input{width:100%;padding:6px 8px;text-align:center}
.v1-alloc-key .pctrow span{color:var(--muted);font-size:13px}
.v1-alloc-key .g.over,.v1-alloc-key .pct-warn{color:var(--warn)}
.v1-alloc-key .pctrow input.over{color:var(--warn);border-color:var(--warn)}
.v1-alloc-help{font-size:12.5px;margin-top:12px}
.v1-add-food{grid-template-columns:minmax(0,2fr) minmax(75px,.8fr) minmax(80px,.9fr) repeat(4,minmax(66px,.72fr))}
.v1-food-actions{display:flex;gap:8px;justify-content:flex-start;margin-top:10px}
@media(max-width:760px){
  .v1-calorie-target{width:130px;flex-basis:130px}
  .v1-add-food{grid-template-columns:repeat(2,minmax(0,1fr))}
  .v1-add-food .f-name{grid-column:1/-1}
}
@media(max-width:620px){
  .v1-goal-head{flex-direction:column;gap:12px}
  .v1-calorie-target{align-self:flex-start;width:150px;flex-basis:auto}
}

/* Screenshot parity corrections: exact V1 desktop field geometry */
@media (min-width:621px){
  .v1-weight-page .v1-weighform:not(.v1-history-edit){
    grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,.9fr);
  }
}
.v1-weight-page .v1-weighform .v1-full{width:100%;}
.v1-add-food{
  grid-template-columns:minmax(0,2fr) minmax(0,1fr) minmax(0,.9fr) minmax(0,.8fr) minmax(0,.8fr) minmax(0,.8fr) auto;
}
@media (max-width:620px){
  .v1-add-food{grid-template-columns:repeat(2,minmax(0,1fr));}
  .v1-add-food .f-name{grid-column:1/-1;}
}

/* Visual parity QA: desktop geometry taken directly from the V1 rendered layout. */
@media (min-width:861px){
  .shell-v1-parity .app-scroll{padding:clamp(22px,3vw,40px) var(--gutter) 64px}
  .v1-week-entry > .v1-ex-form > .cat-chips{
    width:min(56%,594px);
    flex-wrap:nowrap;
  }
  .v1-week-panel > .v1-empty{margin-top:18px}
}


/* Consolidated client correction: one permanent desktop navigation structure. */
@media (min-width:861px){
  .shell-v1-parity .sidebar{padding:26px 14px 20px;background:var(--panel);gap:0}
  .shell-v1-parity .sidebar-head{padding:4px 4px 18px;margin:0}
  .sidebar-head .brand{gap:5px}
  .sidebar-head .brand-sub{margin-top:0;font-size:10.5px;letter-spacing:.01em;text-transform:none;line-height:1.25;color:var(--muted)}
  .sidebar-foot-row{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:6px;padding-top:12px}
  .sidebar-user-link{display:block;flex:0 1 auto;min-width:0;max-width:170px;padding:6px 8px;border-radius:7px;text-decoration:none;color:var(--muted)}
  .sidebar-user-link:hover,.sidebar-user-link.active{background:var(--hover);color:var(--ink)}
  .sidebar-theme-toggle{margin-left:0}
}

/* 1RM history: compact per-exercise expandable groups, no charts. */
.rm-history-group{
  margin-top:8px;
  border:1px solid var(--line);
  border-radius:var(--radius-sm);
  background:var(--surface);
  overflow:hidden;
}
.rm-history-summary{
  list-style:none;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  min-height:42px;
  padding:10px 12px;
  color:var(--ink);
  font-size:13.5px;
  font-weight:600;
  cursor:pointer;
}
.rm-history-summary::-webkit-details-marker{display:none}
.rm-history-summary:hover{background:var(--hover)}
.rm-history-chevron{font-size:16px;color:var(--muted);transform:rotate(0deg);transition:transform .15s var(--ease)}
.rm-history-group[open] .rm-history-chevron{transform:rotate(180deg)}
.rm-history-entries{margin:0;padding:0 12px;border-top:1px solid var(--line)}
.rm-history-entry{padding:10px 0}

/* Client micro-correction: small breathing room below the calculator fields. */
.v1-calc-action-row{margin-top:8px}

/* O client annotation pass — 26 Aug 2026. Keep V1 geometry compact and stable. */
@media (min-width:861px){
  /* Remove wasted top/sidebar space and clearly divide Coaching / My Training. */
  .shell-v1-parity .sidebar{padding-top:14px}
  .shell-v1-parity .sidebar-head{padding-top:0;padding-bottom:12px}
  .shell-v1-parity .sidebar-nav .nav-group:not(:first-child){border-top:1px solid var(--line);padding-top:10px;margin-top:10px}
  /* V1 day boxes show date only; activity is communicated by the coloured selector/detail area. */
  .v1-weekly-page .v1-daybtn .c{display:none!important}
  .v1-weekly-page .v1-daybtn{min-height:54px;justify-content:center}
  /* One clean separator before the exercise list, not two stacked horizontal rules. */
  .v1-session-stack{border-top:0;margin-top:12px}
  .v1-workout-toolbar{border-bottom:0;padding:6px 0 5px}
  .v1-page .ex-list{border-top:1px solid var(--line)}
  /* Compact, single-line exercise identity; completion control sits before the name. */
  .v1-page .ex-row{min-height:48px;padding:8px 0;gap:7px}
  .v1-page .exercise-sequence{width:22px;flex-basis:22px}
  .v1-page .ex-badge{min-width:28px;padding:2px 6px}
  .v1-page .completion-check{order:0}
  .v1-page .ex-main{display:flex;align-items:center;gap:9px;flex-wrap:wrap}
  .v1-page .ex-name{white-space:nowrap}
  .v1-page .prescription-line{margin-top:0}
  /* Monthly detail rows use the same baseline and compact coloured category marker. */
  .v1-monthly-ex-row{align-items:center;padding:8px 0;gap:7px}
  .v1-monthly-ex-num{padding-top:0;width:22px}
  .v1-monthly-ex-body{display:flex;align-items:center;gap:9px;flex-wrap:wrap}
  .v1-monthly-ex-body .v1-dashboard-ex-title{flex-wrap:nowrap;gap:7px}
  .v1-monthly-ex-body .v1-ex-meta{margin-top:0}
  .v1-monthly-ex-body .v1-tag{padding:2px 6px;font-size:9.5px}
}

@media (max-width:860px){
  /* O: overflow must use the whole screen rather than a hidden bottom sheet. */
  .sheet-scrim{z-index:2147483002;background:var(--panel)}
  .sheet{inset:0;z-index:2147483003;border:0;border-radius:0;padding:calc(22px + env(safe-area-inset-top,0px)) 18px calc(92px + env(safe-area-inset-bottom,0px));overflow-y:auto;animation:none}
  .sheet-grip{display:none}
  .sheet-nav{gap:5px;max-width:560px;margin:0 auto}
  .sheet-item{padding:14px 12px;font-size:16px;border-bottom:1px solid var(--line);border-radius:8px}
  .sheet::before{content:'Menu';display:block;max-width:560px;margin:0 auto 14px;font-size:24px;font-weight:700;color:var(--ink)}
  /* Keep the V1 bottom bar visible and fixed even while the overflow is open. */
  .mobile-nav{z-index:2147483005}
  .mobile-overflow-trigger{z-index:2147483006}
}


/* ========================================================================
   O screenshot correction closure — 26 Aug 2026
   These rules intentionally sit last so the approved HTML/V1 geometry wins.
   ======================================================================== */

/* Desktop sidebar: same structure/spacing on every route, not parity-route dependent. */
@media (min-width:861px){
  .sidebar{padding:8px 14px 16px;gap:0}
  .sidebar-head{padding:0 4px 10px;margin:0}
  .sidebar-head .healthful-logo{width:158px;max-width:100%;height:auto;object-fit:contain}
  .sidebar-head .brand{gap:3px}
  .sidebar-head .brand-sub{margin:0;font-size:10px;line-height:1.2;letter-spacing:.01em;text-transform:none;color:var(--muted)}
  .sidebar-nav{gap:2px}
  .sidebar-nav .nav-group{margin:8px 0 4px;padding:0 8px}
  .sidebar-nav .nav-group:not(:first-child){border-top:1px solid var(--line);padding-top:10px;margin-top:10px}
  .sidebar-foot{border-top:1px solid var(--line);padding-top:10px}
  .sidebar-foot-row{gap:6px}
  /* Neutralise older parity-only sidebar spacing so routes never rearrange the shell. */
  .shell-v1-parity .sidebar{padding:8px 14px 16px}
  .shell-v1-parity .sidebar-head{padding:0 4px 10px}
  /* Dark mode must use the supplied white/turquoise wordmark, fully visible. */
  html[data-theme='dark'] .sidebar-head .healthful-logo-light{display:none!important}
  html[data-theme='dark'] .sidebar-head .healthful-logo-dark{display:block!important}
  html[data-theme='light'] .sidebar-head .healthful-logo-light{display:block!important}
  html[data-theme='light'] .sidebar-head .healthful-logo-dark{display:none!important}
}

/* Weekly date strip: date only (no UB/LB/category labels in day cards). */
.v1-weekly-page .v1-daybtn .c,
.v1-weekly-page .v1-daybtn .v1-daycount{display:none!important}
.v1-weekly-page .v1-daybtn{justify-content:flex-start}

/* Weekly exercise area: one separator and V1 identity/action alignment. */
.v1-weekly-page .v1-session-stack{margin-top:12px;border-top:0!important}
.v1-weekly-page .v1-training-session{padding-top:0}
.v1-weekly-page .v1-workout-toolbar{padding:6px 0 5px;border-top:0!important;border-bottom:0!important}
.v1-weekly-page .workout-groups>.workout-block:first-of-type>.ex-list{border-top:1px solid var(--line)}
.v1-weekly-page .workout-block+.workout-block{border-top:0}
.v1-weekly-page .ex-list{margin-top:0}
.v1-weekly-page .ex-row{display:flex;align-items:center;gap:8px;min-height:48px;padding:9px 0}
.v1-weekly-page .exercise-sequence{width:24px;flex:0 0 24px;padding:0;text-align:left}
.v1-weekly-page .ex-main{display:block;min-width:0;flex:1}
.v1-weekly-page .ex-title-line{display:flex;align-items:center;gap:7px;min-width:0;line-height:1}
.v1-weekly-page .ex-title-line .completion-check,
.v1-weekly-page .ex-title-line .superset-check{order:0;margin:0;flex:none}
.v1-weekly-page .ex-title-line .ex-name{order:1;margin:0;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.v1-weekly-page .ex-title-line .ex-badge{order:2;min-width:0;padding:2px 6px;font-size:9.5px}
.v1-weekly-page .prescription-line{margin:3px 0 0 27px;line-height:1.25}
.v1-weekly-page .ex-notes{margin-left:27px}
.v1-weekly-page .v1-ex-actions,.v1-weekly-page .ex-actions{align-self:center}

/* Monthly: V1 small coloured markers in cells and level selected-day rows. */
.v1-cell .marks{display:flex;align-items:center;gap:3px;flex-wrap:wrap;max-width:100%}
.v1-cell .mk{display:inline-flex;align-items:center;justify-content:center;font-size:9px;font-weight:700;line-height:1.2;letter-spacing:.035em;padding:1px 4px;border-radius:4px;white-space:nowrap}
.v1-cell .mk.ub{background:var(--ub-bg);color:var(--ub)}
.v1-cell .mk.lb{background:var(--lb-bg);color:var(--lb)}
.v1-cell .mk.ca{background:var(--ca-bg);color:var(--ca)}
.v1-cell .mk.pl{background:var(--pl-bg);color:var(--pl)}
.v1-cell .mk.fi{background:var(--fi-bg);color:var(--fi)}
.v1-cell .mk.ts{background:var(--ts-bg);color:var(--ts)}
.v1-monthly-ex-row{display:flex;align-items:center;gap:8px;padding:9px 0}
.v1-monthly-ex-num{width:24px;flex:0 0 24px;padding:0;line-height:20px}
.v1-monthly-ex-body{display:block;min-width:0;flex:1}
.v1-monthly-ex-mainline{display:flex;align-items:center;gap:7px;min-width:0;line-height:20px}
.v1-monthly-ex-mainline .v1-ex-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.v1-monthly-ex-mainline .v1-tag{flex:none;padding:2px 6px;font-size:9px}
.v1-monthly-ex-mainline .v1-ex-meta{margin:0 0 0 2px;white-space:nowrap}

/* Mobile: stable five-column bar; avoid Safari chrome/safe-area double spacing. */
@media (max-width:860px){
  .app-scroll{padding-bottom:calc(72px + max(8px, env(safe-area-inset-bottom,0px)))}
  .mobile-nav{
    bottom:0!important;
    padding:7px calc(8px + env(safe-area-inset-right,0px)) max(7px, env(safe-area-inset-bottom,0px)) calc(8px + env(safe-area-inset-left,0px));
    min-height:68px;
    contain:layout paint;
  }
  .mobile-overflow-trigger{bottom:76px;}
  /* A true full-screen destination chooser. It covers the bottom bar while open. */
  .sheet-scrim{z-index:2147483002;background:var(--panel);opacity:1}
  .sheet.sheet-fullscreen{position:fixed;inset:0;z-index:2147483007;width:100vw;height:100dvh;max-height:none;border:0;border-radius:0;padding:calc(18px + env(safe-area-inset-top,0px)) 18px calc(20px + env(safe-area-inset-bottom,0px));overflow-y:auto;background:var(--panel);animation:none}
  .sheet-fullscreen::before{content:none!important}
  .sheet-head{display:flex;align-items:center;justify-content:space-between;gap:16px;max-width:560px;margin:0 auto 16px;padding-bottom:12px;border-bottom:1px solid var(--line)}
  .sheet-head strong{font-size:24px;letter-spacing:-.02em;color:var(--ink)}
  .sheet-close{width:36px;height:36px;border:1px solid var(--line);border-radius:9px;background:var(--surface);color:var(--ink);line-height:0;padding:0;display:grid;place-items:center}
  .sheet-close .sheet-close-icon{width:19px;height:19px;display:block;stroke:currentColor}
  .sheet-sections{max-width:560px;margin:0 auto;display:grid;gap:20px}
  .sheet-section+.sheet-section{padding-top:18px;border-top:1px solid var(--line)}
  .sheet-group{margin:0 0 6px;padding:0 10px;font-size:10.5px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
  .sheet-nav{gap:2px;max-width:none;margin:0}
  .sheet-item{min-height:48px;padding:12px 10px;font-size:15px;border-bottom:0;border-radius:8px}
  .sheet-item .icon{width:19px;height:19px}
  .sheet-item-on{background:var(--ink);color:var(--on-ink)}
  .sheet-item-on .icon{stroke:var(--on-ink)}
  /* The bar and the trigger are not rendered at all while the full-screen
     menu is open, so no visibility toggling is required here. */
  /* Compact monthly markers remain readable on phone without dominating cells. */
  .v1-cell .mk{font-size:8px;padding:1px 3px}
}

/* Weekly V1 add form: match the original HTML's compact single-row entry. */
.v1-entry-fields{margin-top:12px}
.v1-entrypick{display:flex;align-items:center;gap:7px;margin:0 0 7px;font-size:11.5px;color:var(--muted)}
.v1-entrypick .lead{color:var(--muted)}
.v1-addgrid{display:grid;gap:10px;align-items:end;padding:10px 0 2px;border-top:1px solid var(--line)}
.v1-addgrid-strength{grid-template-columns:minmax(0,2.3fr) repeat(5,minmax(0,.85fr)) auto}
.v1-addgrid-cardio{grid-template-columns:minmax(0,2.2fr) repeat(5,minmax(0,.82fr)) auto}
.v1-addgrid-duration{grid-template-columns:minmax(0,2.3fr) minmax(0,1.2fr) auto}
.v1-addgrid .field{margin:0;gap:5px}
.v1-addgrid .field-label{font-size:10px;letter-spacing:.08em}
.v1-addgrid .field-input{min-height:36px;padding:7px 9px}
.v1-add-actions{display:flex;align-items:end;gap:8px;white-space:nowrap}
.v1-add-actions .btn{min-height:36px;padding:8px 12px}
.v1-entry-notes{margin-top:7px}
.v1-entry-notes>summary{list-style:none;display:inline-flex;align-items:center;min-height:26px;padding:4px 8px;border:0;background:transparent;color:var(--muted);font-size:11px;cursor:pointer}
.v1-entry-notes>summary::-webkit-details-marker{display:none}
.v1-entry-notes[open]>summary{color:var(--ink-soft)}
.v1-entry-notes>.field{max-width:460px;margin-top:5px}
@media(max-width:1100px) and (min-width:861px){
  .v1-addgrid-strength,.v1-addgrid-cardio{grid-template-columns:minmax(0,2fr) repeat(3,minmax(0,1fr));}
  .v1-addgrid-strength .v1-add-actions,.v1-addgrid-cardio .v1-add-actions{grid-column:-2/-1}
}
@media(max-width:860px){
  .v1-entry-fields{margin-top:10px}
  .v1-addgrid,.v1-addgrid-strength,.v1-addgrid-cardio,.v1-addgrid-duration{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding-top:9px}
  .v1-add-name{grid-column:1/-1}
  .v1-add-actions{grid-column:1/-1}
  .v1-add-actions .btn{flex:1}
  .v1-entry-notes>.field{max-width:none}
}


/* Final O closure — Weekly screenshot + compact Monthly markers + stable mobile viewport. */
.v1-cell .marks{gap:2px!important}
.v1-cell .mk{font-size:7px!important;line-height:1!important;letter-spacing:.025em!important;padding:1px 2px!important;border-radius:3px!important;min-height:0!important}
.v1-weekly-page .v1-weekly-tools{margin:14px 0 4px}
.v1-weekly-page .v1-week-entry{margin-top:4px}
.v1-weekly-page .v1-entry-fields{margin-top:0}
.v1-weekly-page .v1-addgrid{padding-top:8px}
@media (min-width:861px){
  .v1-weekly-page .v1-panel-head.v1-week-panel-head{min-height:38px}
  .v1-weekly-page .v1-week-entry>.v1-ex-form>.cat-chips{top:18px;right:22px;width:min(56%,594px);flex-wrap:nowrap;justify-content:flex-end}
  .v1-weekly-page .v1-addgrid-strength{grid-template-columns:minmax(0,2.6fr) repeat(5,minmax(0,.85fr)) auto}
  .v1-weekly-page .v1-add-actions .btn{min-height:36px}
}
@media (max-width:860px){
  .mobile-nav{bottom:0!important}
  .mobile-overflow-trigger{bottom:76px!important}
  .v1-cell .mk{font-size:6.5px!important;padding:1px 2px!important}
}


/* ========================================================================
   O final-polish pass — 27 Aug 2026. Only explicitly requested corrections.
   ======================================================================== */

/* Desktop: subtle brand separator above COACHING; preserve existing logo/subtitle sizing. */
@media (min-width:861px){
  .sidebar-head{
    border-bottom:1px solid var(--line);
    padding-bottom:10px!important;
    margin-bottom:8px!important;
  }
}

/* Monthly calendar: React uses .v1-mk (not .mk). Compact V1 coloured indicators. */
.v1-cell .marks{
  display:flex;
  align-items:flex-end;
  align-content:flex-end;
  gap:2px;
  flex-wrap:wrap;
  max-width:100%;
  min-width:0;
}
.v1-cell .v1-mk{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:0;
  max-width:100%;
  padding:1px 3px;
  border:1px solid transparent;
  border-radius:4px;
  font-size:8px;
  font-weight:700;
  line-height:1.15;
  letter-spacing:.025em;
  white-space:nowrap;
}
.v1-cell .v1-mk.ub{background:var(--ub-bg);color:var(--ub);border-color:var(--ub-line)}
.v1-cell .v1-mk.lb{background:var(--lb-bg);color:var(--lb);border-color:var(--lb-line)}
.v1-cell .v1-mk.ca{background:var(--ca-bg);color:var(--ca);border-color:var(--ca-line)}
.v1-cell .v1-mk.pl{background:var(--pl-bg);color:var(--pl);border-color:var(--pl-line)}
.v1-cell .v1-mk.fi{background:var(--fi-bg);color:var(--fi);border-color:var(--fi-line)}
.v1-cell .v1-mk.ts{background:var(--ts-bg);color:var(--ts);border-color:var(--ts-line)}

/* Weekly V1 selector: compact pills and deterministic left-start on narrow screens. */
.v1-weekly-page .v1-ex-form .cat-chips{
  scrollbar-width:none;
  -ms-overflow-style:none;
}
.v1-weekly-page .v1-ex-form .cat-chips::-webkit-scrollbar{display:none}
.v1-weekly-page .v1-ex-form .chip{
  padding:6px 12px;
  font-size:12px;
  line-height:1.2;
}

/* Macros: only a small breathing space above Add / Clear. */
.v1-food-actions{margin-top:12px!important;margin-bottom:8px!important}

@media (max-width:860px){
  /* Use actual CSS viewport widths (375/390/430) instead of a forced 90% page scale. */
  html,body,#root,.shell,.shell-main{max-width:100%;overflow-x:hidden}

  /* Bottom bar owns the safe area once. Avoid duplicated body/content/footer spacing. */
  .app-scroll{
    padding-bottom:calc(68px + max(8px, calc(env(safe-area-inset-bottom,0px) - 10px)))!important;
  }
  .mobile-nav{
    bottom:0!important;
    min-height:64px!important;
    padding:6px calc(8px + env(safe-area-inset-right,0px)) max(6px, calc(env(safe-area-inset-bottom,0px) - 10px)) calc(8px + env(safe-area-inset-left,0px))!important;
    background:var(--navbar-bg)!important;
  }
  .mnav-item{
    min-height:54px;
    padding:6px 2px 5px;
  }

  /* Coach/overflow access remains, but sits clearly above — never on top of Weight Tracker. */
  .mobile-overflow-trigger{
    right:calc(10px + env(safe-area-inset-right,0px))!important;
    bottom:calc(72px + max(8px, calc(env(safe-area-inset-bottom,0px) - 10px)))!important;
  }

  /* Weekly category row starts at the left edge and never loads clipped/shifted. */
  .v1-week-panel-head{padding-bottom:46px!important}
  .v1-week-entry>.v1-ex-form>.cat-chips{
    left:16px!important;
    right:16px!important;
    width:auto!important;
    max-width:calc(100% - 32px)!important;
    justify-content:flex-start!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    flex-wrap:nowrap!important;
    padding:0 2px 3px 0!important;
    margin:0!important;
    scroll-padding-left:0!important;
    overscroll-behavior-x:contain;
    -webkit-overflow-scrolling:touch;
  }
  .v1-weekly-page .v1-ex-form .chip{flex:0 0 auto;padding:6px 11px;font-size:11.5px}

  /* Monthly markers stay tiny at all realistic phone widths and can wrap within a date cell. */
  .v1-cell .v1-mk{font-size:7.5px;padding:1px 2px;border-radius:3px}

  /* Dark theme only: readable fixed-nav labels/icons without changing light mode. */
  html[data-theme='dark'] .mobile-nav .mnav-item:not(.mnav-item-on){color:var(--ink-soft)!important}
  html[data-theme='dark'] .mobile-nav .mnav-item:not(.mnav-item-on) .icon{stroke:var(--ink-soft)!important;opacity:1!important}
  html[data-theme='dark'] .mobile-nav .mnav-item-on{background:var(--ink)!important;color:var(--on-ink)!important}
  html[data-theme='dark'] .mobile-nav .mnav-item-on .icon{stroke:var(--on-ink)!important;opacity:1!important}
}

@media (max-width:430px){
  .v1-cell{min-height:56px}
  .v1-cell .v1-mk{font-size:7px;padding:1px 2px}
}

/* ========================================================================
   FINAL CLOSURE PASS — A/B/C only.
   A: mobile horizontal lock + fixed five-column nav.
   C: existing theme toggle positioned on shared signed-out auth shell.
   ======================================================================== */

.auth-card{position:relative}
.theme-btn.auth-theme-toggle{
  position:absolute;
  top:16px;
  right:16px;
  z-index:2;
}

@media (max-width:860px){
  html,
  body{
    width:100%;
    max-width:100%;
    min-width:0;
    overflow-x:hidden!important;
    overflow-x:clip!important;
    overscroll-behavior-x:none;
  }
  #root,
  .shell,
  .shell-main,
  .app-scroll{
    width:100%;
    max-width:100%;
    min-width:0;
    overflow-x:hidden!important;
    overflow-x:clip!important;
  }

  /* Single controlled clearance for the fixed nav + iPhone safe area. */
  .app-scroll{
    padding-bottom:calc(76px + env(safe-area-inset-bottom,0px))!important;
  }

  .mobile-nav-portal-root{
    width:0;
    max-width:0;
    overflow:visible;
  }

  .mobile-nav{
    position:fixed!important;
    left:0!important;
    right:0!important;
    bottom:0!important;
    top:auto!important;
    width:100%!important;
    max-width:100vw!important;
    min-width:0!important;
    margin:0!important;
    box-sizing:border-box!important;
    display:grid!important;
    grid-template-columns:repeat(5,minmax(0,1fr))!important;
    gap:0!important;
    padding:6px max(6px,env(safe-area-inset-right,0px)) max(6px,env(safe-area-inset-bottom,0px)) max(6px,env(safe-area-inset-left,0px))!important;
    min-height:64px!important;
    overflow:hidden!important;
    contain:layout paint;
    transform:none!important;
    -webkit-transform:none!important;
  }

  .mnav-item{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    align-self:stretch;
    justify-self:stretch;
    padding:6px 1px 5px!important;
    overflow:hidden!important;
  }
  .mnav-item .mnav-icon-wrap,
  .mnav-item > span:last-child{
    min-width:0!important;
    max-width:100%!important;
  }
  .mnav-item > span:last-child{
    width:100%!important;
    overflow:hidden!important;
    text-overflow:clip;
  }

  .mobile-overflow-trigger{
    position:fixed!important;
    right:max(10px,env(safe-area-inset-right,0px))!important;
    left:auto!important;
    bottom:calc(70px + env(safe-area-inset-bottom,0px))!important;
    width:30px!important;
    max-width:30px!important;
    transform:none!important;
    -webkit-transform:none!important;
  }

  .sheet-scrim{
    left:0!important;
    right:0!important;
    width:100%!important;
    max-width:100vw!important;
    overflow:hidden!important;
  }
  .sheet.sheet-fullscreen{
    left:0!important;
    right:0!important;
    top:0!important;
    bottom:0!important;
    width:100%!important;
    max-width:100vw!important;
    min-width:0!important;
    height:100dvh!important;
    box-sizing:border-box!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    overscroll-behavior-x:none;
  }
  .sheet-head,
  .sheet-sections,
  .sheet-section,
  .sheet-nav,
  .sheet-item{
    width:100%;
    max-width:100%;
    min-width:0;
    box-sizing:border-box;
  }
  .sheet-item span{
    min-width:0;
    overflow-wrap:anywhere;
  }

  html[data-theme="dark"] .mobile-nav .mnav-item:not(.mnav-item-on){color:var(--ink-soft)!important}
  html[data-theme="dark"] .mobile-nav .mnav-item:not(.mnav-item-on) .icon{color:var(--ink-soft)!important;stroke:currentColor!important;opacity:1!important}
  html[data-theme="dark"] .mobile-nav .mnav-item-on{background:var(--ink)!important;color:var(--on-ink)!important}
  html[data-theme="dark"] .mobile-nav .mnav-item-on .icon{color:var(--on-ink)!important;stroke:currentColor!important;opacity:1!important}
}



/* ==========================================================================
   FINAL HARD MOBILE X-LOCK — 29 Aug 2026
   The mobile app is a fixed viewport shell. The document itself never scrolls
   or pans horizontally; only .app-scroll may scroll vertically.
   ========================================================================== */
@media (max-width:860px){

  html,
  body,
  #root{
    position:fixed!important;
    inset:0!important;
    width:100%!important;
    max-width:100%!important;
    height:100%!important;
    min-width:0!important;
    margin:0!important;
    padding:0!important;
    overflow:hidden!important;
    overscroll-behavior:none!important;
  }

  html,
  body{
    touch-action:pan-y pinch-zoom!important;
  }

  #root{
    contain:layout paint!important;
  }

  .shell{
    position:absolute!important;
    inset:0!important;
    width:100%!important;
    max-width:100%!important;
    height:100%!important;
    min-width:0!important;
    min-height:0!important;
    margin:0!important;
    overflow:hidden!important;
  }

  .shell-main{
    position:absolute!important;
    inset:0!important;
    width:100%!important;
    max-width:100%!important;
    height:100%!important;
    min-width:0!important;
    min-height:0!important;
    margin:0!important;
    overflow:hidden!important;
  }

  .app-scroll{
    position:absolute!important;
    inset:0!important;
    width:100%!important;
    max-width:100%!important;
    height:100%!important;
    min-width:0!important;
    margin:0!important;
    box-sizing:border-box!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    overscroll-behavior-x:none!important;
    overscroll-behavior-y:auto!important;
    touch-action:pan-y pinch-zoom!important;
    -webkit-overflow-scrolling:touch;
  }

  /* Every direct page/content box stays inside the viewport formatting box. */
  .app-scroll > *,
  .v1-page,
  .v1-panel,
  .v1-topbar,
  .v1-weekly-page,
  .v1-monthly-page,
  .v1-macros-page,
  .v1-weight-page,
  .page,
  .card{
    max-width:100%!important;
    min-width:0!important;
    box-sizing:border-box!important;
  }

  /* Five equal fixed cells. Nothing in a label is allowed to expand the bar. */
  .mobile-nav{
    position:fixed!important;
    left:0!important;
    right:0!important;
    bottom:0!important;
    top:auto!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin:0!important;
    box-sizing:border-box!important;
    display:grid!important;
    grid-template-columns:repeat(5,minmax(0,1fr))!important;
    overflow:hidden!important;
    transform:none!important;
    -webkit-transform:none!important;
    touch-action:manipulation!important;
  }

  .mobile-nav > .mnav-item,
  .mobile-nav .mnav-item{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    box-sizing:border-box!important;
    overflow:hidden!important;
    white-space:nowrap!important;
  }

  .mobile-nav .mnav-item > *,
  .mobile-nav .mnav-item span{
    min-width:0!important;
    max-width:100%!important;
  }

  /* Overflow trigger is also anchored to the viewport, never document width. */
  .mobile-overflow-trigger{
    position:fixed!important;
    left:auto!important;
    right:max(10px,env(safe-area-inset-right,0px))!important;
    max-width:40px!important;
    transform:none!important;
    -webkit-transform:none!important;
  }

  /* Full-screen menu cannot create page width. */
  .sheet-scrim,
  .sheet.sheet-fullscreen{
    position:fixed!important;
    left:0!important;
    right:0!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    box-sizing:border-box!important;
    overflow-x:hidden!important;
  }

  /* Remove the last intentional horizontal scroller from the V1 weekly form.
     Category buttons wrap instead of ever allowing the app to pan sideways. */
  .v1-week-entry > .v1-ex-form > .cat-chips,
  .v1-weekly-page .v1-ex-form .cat-chips{
    max-width:calc(100% - 32px)!important;
    overflow-x:hidden!important;
    overflow-y:visible!important;
    flex-wrap:wrap!important;
    touch-action:pan-y!important;
  }

  /* Signed-out/auth pages also stay inside device width while remaining
     vertically scrollable when keyboard/content requires it. */
  .centred-page{
    position:fixed!important;
    inset:0!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    height:100%!important;
    min-height:0!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    box-sizing:border-box!important;
    touch-action:pan-y pinch-zoom!important;
    -webkit-overflow-scrolling:touch;
  }

  .auth-card{
    max-width:min(400px,100%)!important;
    min-width:0!important;
    box-sizing:border-box!important;
  }
}


/* ==========================================================================
   WEEKLY MOBILE WRAPPED-CATEGORY CLEARANCE — 29 Aug 2026
   The hard no-horizontal-scroll pass intentionally wraps all six category
   pills on phones. Reserve the height of both rows so they can never overlap
   the progressive-overload callout below.
   ========================================================================== */
@media (max-width:620px){
  .v1-weekly-page .v1-week-panel-head,
  .v1-week-panel-head{
    padding-bottom:96px!important;
  }

  .v1-week-entry > .v1-ex-form > .cat-chips,
  .v1-weekly-page .v1-ex-form .cat-chips{
    row-gap:8px!important;
    align-content:flex-start!important;
  }
}


/* ==========================================================================
   FINAL FIXED BOTTOM NAV CLOSURE — 29 Aug 2026 (simplified 1 Sep 2026)
   - portal root is a zero-size, non-layout wrapper only
   - bottom nav and overflow trigger are each fixed directly to the viewport
   - no JavaScript-calculated viewport offset
   - reduced iPhone safe-area padding removes the oversized blank band
   - existing hard horizontal lock remains untouched
   ========================================================================== */
@media (max-width:860px){

  /* Must never be a containing block for its fixed children: no inset, no
     size, no transform, no contain. */
  .mobile-nav-portal-root{
    position:static!important;
    inset:auto!important;
    width:0!important;
    height:0!important;
    max-width:0!important;
    max-height:0!important;
    margin:0!important;
    padding:0!important;
    border:0!important;
    overflow:visible!important;
    contain:none!important;
    transform:none!important;
  }

  .mobile-nav{
    position:fixed!important;
    left:0!important;
    right:0!important;
    top:auto!important;
    bottom:0!important;
    width:auto!important;
    max-width:none!important;
    min-width:0!important;
    margin:0!important;
    box-sizing:border-box!important;
    display:grid!important;
    grid-template-columns:repeat(5,minmax(0,1fr))!important;
    gap:0!important;
    overflow:hidden!important;
    pointer-events:auto!important;
    z-index:2147483005!important;

    /* Keep enough iPhone home-indicator clearance without the huge empty band. */
    padding:
      4px
      max(6px,env(safe-area-inset-right,0px))
      max(10px,calc(env(safe-area-inset-bottom,0px) - 20px))
      max(6px,env(safe-area-inset-left,0px))!important;

    min-height:62px!important;
    transform:none!important;
    -webkit-transform:none!important;
  }

  .mobile-nav .mnav-item{
    min-height:50px!important;
    padding:5px 1px 3px!important;
    margin:0!important;
    min-width:0!important;
    width:100%!important;
    max-width:100%!important;
    box-sizing:border-box!important;
  }

  .mobile-overflow-trigger{
    position:fixed!important;
    left:auto!important;
    right:max(10px,env(safe-area-inset-right,0px))!important;
    bottom:72px!important;
    pointer-events:auto!important;
    z-index:2147483006!important;
    transform:none!important;
    -webkit-transform:none!important;
  }

  /* One controlled clearance only: enough to scroll the last content above
     the fixed bar, without creating a visible second footer band. */
  .app-scroll{
    padding-bottom:calc(70px + max(8px,calc(env(safe-area-inset-bottom,0px) - 20px)))!important;
  }
}


/* ==========================================================================
   iOS AUTH AUTO-ZOOM CLOSURE — 1 Sep 2026
   iOS Safari/WebKit zooms the whole page in when a focused form control has a
   computed font-size below 16px. Every signed-out screen (Sign In, Sign Up,
   Onboarding, Join Coach, Accept Invite, Forgot/Reset Password) renders
   through AuthLayout > .auth-card and uses Field / .field-input at 15px, so
   focusing Email or First Name triggers it. Because auth navigates into the
   signed-in app via SPA routing, that zoom state carries through and the
   Dashboard / Coach Dashboard opens looking zoomed in.

   16px is the exact threshold at which iOS stops auto-zooming. Scoped to
   mobile auth screens only: signed-in app form sizing and desktop auth
   sizing are untouched. No viewport, scale, transform or CSS zoom change.
   ========================================================================== */
@media (max-width: 860px) {
  .auth-card input,
  .auth-card select,
  .auth-card textarea,
  .auth-card .field-input {
    font-size: 16px !important;
  }
}

@media (max-width: 860px) {
  .mobile-nav .mnav-item-on,
  .mobile-nav .mnav-item-on:hover,
  .mobile-nav .mnav-item-on:active {
    background: var(--ink) !important;
    color: var(--on-ink) !important;
  }

  .mobile-nav .mnav-item-on .icon,
  .mobile-nav .mnav-item-on:hover .icon,
  .mobile-nav .mnav-item-on:active .icon {
    color: var(--on-ink) !important;
    stroke: currentColor !important;
    opacity: 1 !important;
  }
}


/* ==========================================================================
   O final HTML/UI closure — 10 Sep 2026.
   Narrowly scoped to the eight requested UI changes only.
   ========================================================================== */

/* Mobile full-menu return control. Hidden on desktop; lives inside existing page title rows. */
.mobile-menu-back,
.page-mobile-brand{display:none}
.page-title-row,
.v1-title-row{display:flex;align-items:center;gap:10px;min-width:0}

@media (max-width:860px){
  .mobile-menu-back{
    display:grid;
    place-items:center;
    flex:0 0 34px;
    width:34px;
    height:34px;
    padding:0;
    border:1px solid var(--line);
    border-radius:9px;
    background:var(--surface);
    color:var(--ink);
    cursor:pointer;
  }
  .mobile-menu-back svg{display:block;width:20px;height:20px}
  .page-mobile-brand{display:block;flex:0 0 auto}
  .page-mobile-brand .healthful-logo{width:104px;max-width:104px;height:auto}
  .page-title-row .page-title{min-width:0}
  .v1-title-row>div{min-width:0}
}

/* Weekly day strip: match the coach-client weekly view.
   - Selected/viewed day = dark/ink outline only; the tile is never filled black.
   - Today's real calendar date = red/clay outline.
   - If today is selected, show both states: red outer frame + ink inner frame.
   Category codes remain inside the tile using the established V1 colours. */
.v1-weekly-page .v1-daybtn{
  justify-content:flex-start;
  min-height:72px;
}
.v1-weekly-page .v1-daybtn .chips{
  display:flex!important;
  min-height:18px;
  margin-top:1px;
}
.v1-weekly-page .v1-daybtn .dtype{display:inline-flex!important}
.v1-weekly-page .v1-daybtn.today .d::after,
.v1-weekly-page .v1-today-dot{display:none!important}

/* Selected/viewed day: outline only, matching the client weekly view. */
.v1-weekly-page .v1-daybtn[aria-selected='true']{
  border-color:var(--ink)!important;
  box-shadow:0 0 0 1px var(--ink)!important;
  background:var(--hover)!important;
}
.v1-weekly-page .v1-daybtn[aria-selected='true'] .d{
  color:var(--ink)!important;
}

/* Actual current date: red/clay frame, whether selected or not. */
.v1-weekly-page .v1-daybtn.today{
  border-color:var(--clay)!important;
  box-shadow:0 0 0 1px var(--clay)!important;
}
.v1-weekly-page .v1-daybtn.today .d{
  color:var(--clay)!important;
}

/* Selected + today: preserve both indicators without filling the tile. */
.v1-weekly-page .v1-daybtn.today[aria-selected='true']{
  background:var(--hover)!important;
  border-color:var(--clay)!important;
  box-shadow:inset 0 0 0 1px var(--ink),0 0 0 1px var(--clay)!important;
}
@media (max-width:760px){
  .v1-weekly-page .v1-daybtn .dtype:nth-child(n+2){display:none!important}
  .v1-weekly-page .v1-daybtn{min-height:68px}
}

/* 1RM result guide: compact responsive table using the current app tokens. */
.rm-percentage-guide{margin-top:16px;padding-top:14px;border-top:1px solid var(--line);overflow-x:auto}
.rm-percentage-title{margin:0 0 8px;font-size:13.5px;color:var(--ink)}
.rm-percentage-table{width:100%;border-collapse:collapse;font-size:13px;font-variant-numeric:tabular-nums}
.rm-percentage-table th,
.rm-percentage-table td{padding:7px 9px;border:1px solid var(--line);text-align:right;white-space:nowrap}
.rm-percentage-table th{background:var(--hover);color:var(--ink);font-weight:700}
.rm-percentage-table th:first-child,
.rm-percentage-table td:first-child{text-align:center}

/* Coach client profile: tab row scrolls only horizontally, never vertically. */
.client-detail-tabs{
  overflow-x:auto;
  overflow-y:hidden;
  scrollbar-width:none;
  -ms-overflow-style:none;
  overscroll-behavior-x:contain;
}
.client-detail-tabs::-webkit-scrollbar{display:none}

/* Coach client Training weekly state: mirror My Training exactly.
   - Selected/viewed day = ink outline only; never a solid black fill.
   - Today's real date = clay/red outline.
   - Selected + today = ink inner outline + clay/red outer outline. */
.client-training-week-strip .day-card-on{
  border-color:var(--ink)!important;
  box-shadow:0 0 0 1px var(--ink)!important;
  background:var(--panel)!important;
}
.client-training-week-strip .day-card-on .day-num{
  color:var(--ink)!important;
}
.client-training-week-strip .day-card-today{
  border-color:var(--clay)!important;
  box-shadow:0 0 0 1px var(--clay)!important;
  background:var(--panel)!important;
}
.client-training-week-strip .day-card-today .day-num{color:var(--clay)!important;font-weight:700}
.client-training-week-strip .day-card-on.day-card-today{
  border-color:var(--clay)!important;
  box-shadow:inset 0 0 0 1px var(--ink),0 0 0 1px var(--clay)!important;
  background:var(--panel)!important;
}

/* Coach client prescription categories use the same established category colours even before selection. */
.client-prescribe-card .chip-ub{background:var(--ub-bg);color:var(--ub);border-color:var(--ub-line)}
.client-prescribe-card .chip-lb{background:var(--lb-bg);color:var(--lb);border-color:var(--lb-line)}
.client-prescribe-card .chip-ca{background:var(--ca-bg);color:var(--ca);border-color:var(--ca-line)}
.client-prescribe-card .chip-pl{background:var(--pl-bg);color:var(--pl);border-color:var(--pl-line)}
.client-prescribe-card .chip-fi{background:var(--fi-bg);color:var(--fi);border-color:var(--fi-line)}
.client-prescribe-card .chip-ts{background:var(--ts-bg);color:var(--ts);border-color:var(--ts-line)}
.client-prescribe-card .chip-ub.chip-on{border-color:var(--ub);box-shadow:inset 0 0 0 1px var(--ub)}
.client-prescribe-card .chip-lb.chip-on{border-color:var(--lb);box-shadow:inset 0 0 0 1px var(--lb)}
.client-prescribe-card .chip-ca.chip-on{border-color:var(--ca);box-shadow:inset 0 0 0 1px var(--ca)}
.client-prescribe-card .chip-pl.chip-on{border-color:var(--pl);box-shadow:inset 0 0 0 1px var(--pl)}
.client-prescribe-card .chip-fi.chip-on{border-color:var(--fi);box-shadow:inset 0 0 0 1px var(--fi)}
.client-prescribe-card .chip-ts.chip-on{border-color:var(--ts);box-shadow:inset 0 0 0 1px var(--ts)}

/* O four-item closure: HealthfulApp wordmark in the mobile full-menu header. */
@media (max-width:860px){
  .sheet-head .sheet-brand{display:flex;align-items:center;min-width:0}
  .sheet-head .sheet-brand .brand{gap:0}
  .sheet-head .sheet-brand .healthful-logo{width:142px;max-width:100%;height:auto}
}

/* O four-item closure: readable category abbreviations in coach/client Training day tiles. */
.client-training-week-strip .client-day-markers{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:3px;
  min-height:16px;
  max-width:100%;
}
.client-training-week-strip .client-day-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:22px;
  max-width:38px;
  padding:1px 4px;
  border:1px solid var(--line);
  border-radius:99px;
  font-size:8px;
  font-weight:700;
  line-height:1.35;
  letter-spacing:.03em;
  white-space:nowrap;
}
.client-training-week-strip .client-day-badge.ub{background:var(--ub-bg);color:var(--ub);border-color:var(--ub-line)}
.client-training-week-strip .client-day-badge.lb{background:var(--lb-bg);color:var(--lb);border-color:var(--lb-line)}
.client-training-week-strip .client-day-badge.ca{background:var(--ca-bg);color:var(--ca);border-color:var(--ca-line)}
.client-training-week-strip .client-day-badge.pl{background:var(--pl-bg);color:var(--pl);border-color:var(--pl-line)}
.client-training-week-strip .client-day-badge.fi{background:var(--fi-bg);color:var(--fi);border-color:var(--fi-line)}
.client-training-week-strip .client-day-badge.ts{background:var(--ts-bg);color:var(--ts);border-color:var(--ts-line)}


/* ==========================================================================
   Stripe Connect Stage 1 — coach client-payment connection.
   Separate from /coach/billing, which remains HealthfulApp subscription billing.
   ========================================================================== */
.eyebrow { margin:0 0 4px; font-size:10.5px; font-weight:800; letter-spacing:.085em; color:var(--muted); }
.stripe-connect-card { display:flex; flex-direction:column; gap:16px; }
.stripe-connect-head { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; }
.stripe-connect-copy { max-width:720px; margin-top:6px; }
.stripe-status-badges { display:flex; align-items:center; justify-content:flex-end; gap:7px; flex-wrap:wrap; }
.stripe-status-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
.stripe-status-item { min-width:0; border:1px solid var(--line); border-radius:var(--radius-sm); padding:12px; background:var(--surface); }
.stripe-status-item > span:first-child { display:block; margin-bottom:7px; font-size:10.5px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.05em; }
.stripe-status-item strong { display:block; color:var(--ink); font-size:13px; overflow-wrap:anywhere; }
.stripe-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.stripe-connect-button { align-self:flex-start; min-width:150px; }
.stripe-flow-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin-top:14px; }
.stripe-flow-step { display:flex; align-items:flex-start; gap:10px; min-width:0; padding:13px; border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--surface); }
.stripe-flow-step strong { display:block; margin:1px 0 4px; color:var(--ink); font-size:13px; }
.stripe-flow-step p { margin:0; }
.stripe-flow-number { display:inline-grid; place-items:center; flex:0 0 27px; width:27px; height:27px; border-radius:999px; background:var(--ink); color:var(--on-ink); font-size:11px; font-weight:800; }
.btn-danger { border-color:var(--clay); color:var(--clay); background:transparent; }
.btn-danger:hover:not(:disabled) { background:var(--clay-bg); }

@media (max-width: 760px) {
  .stripe-connect-head { flex-direction:column; gap:10px; }
  .stripe-status-badges { justify-content:flex-start; }
  .stripe-status-grid { grid-template-columns:1fr 1fr; }
  .stripe-flow-grid { grid-template-columns:1fr; }
}
@media (max-width: 420px) {
  .stripe-status-grid { grid-template-columns:1fr; }
  .stripe-actions .btn { width:100%; justify-content:center; }
  .stripe-connect-button { width:100%; }
}
