/* ============================================================
   Lyca — Soft Brutalist Refined design system
   Warm cream palette · hard offset shadows · 3-tier card hierarchy
   Bricolage Grotesque / DM Sans / JetBrains Mono / Newsreader
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* ── Warm cream palette ─────────────────────────────────── */
  /* The ground: one step deeper than the paper cards that sit on it, so a
     borderless .card still lifts off (design refinement, 2026-11-28). */
  --bg:           #E2D8C0;
  --paper:        #FCF7EA;
  --paper-shade:  #E8DFC8;
  --ink:          #14111C;
  --ink-soft:     #6B6175;
  --pencil:       #6B6175;
  --pencil-light: #B0A8BC;
  --rule:         #D4CABC;
  --highlight:    #EDE6D4;

  /* ── Themeable accent — the ONE white-label axis ─────────────
     applyBrand() overwrites these on :root per trainer. Default =
     Forma purple. The platform signature (paper / ink / type / radii /
     shadows / hot acid-lime) is fixed and never themed. */
  --accent:       #7C3AED;
  --accent-deep:  #6D28D9;
  --accent-soft:  #EDE4FF;
  --accent-ring:  #D0C0FF;

  /* ── State colors ───────────────────────────────────────── */
  --warn:         #a83a3a;
  --success:      #16A34A;
  --success-soft: #E7F6EC;

  /* ── Hot accent — acid lime ─────────────────────────────── */
  --hot:          #CCFF3D;
  --hot-ink:      #1A1A0F;

  /* ── Typography ─────────────────────────────────────────── */
  --ds-display:   'Bricolage Grotesque', system-ui, sans-serif;
  --ds-body:      'DM Sans', system-ui, sans-serif;
  --ds-mono:      'JetBrains Mono', ui-monospace, monospace;
  --ds-serif:     'Newsreader', Georgia, serif;
  --sans:         var(--ds-body);

  /* ── Hair-thin ghost value — used for ghost ticks, separators, faint grids ── */
  --ink-hair: rgba(20,17,28,0.12);

  /* ── Shadow tiers ───────────────────────────────────────── */
  /* A shadow means "you can press this": buttons, the tab bar, .card-press.
     Information cards carry none. */
  --shadow-card:  3px 3px 0 var(--ink);
  --shadow-hero:  6px 6px 0 var(--pencil-light);
  --shadow-btn:   2px 2px 0 var(--ink);

  /* ── The ink hero ───────────────────────────────────────── */
  /* Resolved here, on :root, so they keep the real ink even inside
     .card-hero, which swaps --ink/--paper for its own contents. */
  --hero-fill:    var(--ink);
  --hero-text:    var(--paper);

  /* ── The ground's dot grid ──────────────────────────────── */
  --ground-dots:  radial-gradient(circle, var(--ink-hair) 1px, transparent 1px);

  /* ── Charts ─────────────────────────────────────────────── */
  /* Secondary charts fill with the trainer's brand tint; charts inside the
     ink hero use var(--hot) instead. */
  --chart-fill:   var(--accent-ring);
  --chart-dot:    var(--accent);
}

html { height: 100%; overscroll-behavior: none; }
/* dvh tracks the visual viewport as browser chrome shows/hides; in installed
   (standalone PWA) mode there is no chrome and dvh = svh = lvh. On desktop
   the overflow:hidden media query overrides this. */
body { min-height: 100dvh; }
#root { min-height: 100%; }

body {
  font-family: var(--ds-body);
  font-size: 14px;
  line-height: 1.4;
  background-color: var(--bg);
  background-image: var(--ground-dots);
  background-size: 18px 18px;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* ── Utility ──────────────────────────────────────────────── */
.sb-num { font-variant-numeric: tabular-nums; }
/* The system's "deck" voice: caps mono micro-label (design/SYSTEM.md). */
.mono-label {
  font-family: var(--ds-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* loading shell ──────────────────────────────────────────────── */
.loading-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 100%;
  background-color: var(--bg);
  background-image: var(--ground-dots);
  background-size: 18px 18px;
}
.loading-text {
  font-family: var(--ds-mono);
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--pencil);
}

/* ============================================================
   RESPONSIVE APP SHELL
   ============================================================ */
.phone-frame {
  /* position: relative so the document participates in window scroll —
     iOS Safari collapses its chrome on window scroll, not inner-div scroll. */
  position: relative;
  background-color: var(--bg);
  background-image: var(--ground-dots);
  background-size: 18px 18px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  /* minmax(0, 1fr): a wide child (a long brand name in the top bar) must not
     widen the single column — that pushed every screen past the viewport. */
  grid-template-columns: minmax(0, 1fr);
  overflow: visible;
  width: 100%;
  max-width: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  min-height: 100dvh;
}

@media (min-width: 481px) {
  body {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
    overflow: hidden;
    height: 100dvh;
    background-color: var(--bg);
    background-image: var(--ground-dots);
    background-size: 18px 18px;
  }
  html, body { overflow: hidden; height: 100dvh; }
  .phone-frame {
    position: relative;
    inset: auto;
    /* Definite dimensions: percentage width/height can't resolve through
       #root's auto-sized box, which let the frame shrink-wrap to content. */
    width: 420px;
    max-width: 420px;
    height: min(900px, 100dvh - 48px);
    /* Cancel the mobile 100dvh floor — min-height beats height/max-height, so
       without this the frame overflows the body padding and clips its corners. */
    min-height: 0;
    max-height: min(900px, 100dvh - 48px);
    border: 2px solid var(--ink);
    border-radius: 32px;
    box-shadow: 8px 8px 0 var(--ink);
    overflow: hidden;
  }
}

/* Portaled overlays (bottom sheets, full-screen takeovers). They live on
   <body>, outside .phone-frame, so on desktop they must be sized to the
   frame's box themselves — otherwise they anchor to the viewport and hang
   24px below the frame, overshooting its rounded corners.
   Mobile: cover the viewport (frame IS the viewport). Desktop: mirror the
   frame's geometry exactly and clip to its radius. Keep z-index and scrim
   color on the element — they vary per sheet. */
.frame-overlay {
  position: fixed;
  inset: 0;
  /* Lift bottom sheets above the on-screen keyboard, and below any iOS pan
     of the visual viewport (utils/keyboardInset.ts). */
  padding-top: var(--kb-top, 0px);
  padding-bottom: var(--kb-inset, 0px);
  box-sizing: border-box;
}
/* The sheet itself scrolls when the space above the keyboard is short.
   Sheets that set their own inline max-height must cap it with
   min(…dvh, 100%) — iOS doesn't shrink dvh for the keyboard. */
.frame-overlay > * { max-height: 100%; overflow-y: auto; }
/* iOS 26 floats its ↑ ↓ ✓ form bar in a strip below the visible area, so the
   sheet ended above it and the dimmed page showed through between sheet,
   bar and keyboard. Paint that strip (and everything behind the keyboard)
   sheet paper so the sheet runs down into the keyboard. 0 tall when closed. */
.frame-overlay::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--kb-inset, 0px);
  background: var(--paper);
  pointer-events: none;
}
@media (min-width: 481px) {
  /* Only when a phone frame is actually on screen — the trainer desktop
     shell (≥1024px, .trainer-desktop) has no frame, and its sheets should
     keep anchoring to the viewport. */
  body:has(.phone-frame) .frame-overlay {
    inset: auto;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    /* body flex-centers the frame inside 24px padding; replicate that box */
    width: min(420px, 100vw - 48px);
    height: min(900px, 100dvh - 48px);
    border-radius: 32px;
    overflow: hidden;
  }
}

/* ============================================================
   DESKTOP LOGIN — two-panel layout
   The athlete app stays phone-framed everywhere; only /login breaks
   out on wide screens. We keep the .phone-frame class (so all the
   centering / overlay machinery still applies) and only override the
   frame's dimensions + internal grid at >=900px. Everything below
   900px — phones and small tablets — is untouched. NB: the hook class
   is .desktop-login, NOT .login-frame (that name is a legacy layout,
   below). Inline styles on
   the three regions win by specificity, so the few properties we must
   change on desktop use !important intentionally.
   ============================================================ */
@media (min-width: 900px) {
  /* #root is taller than the 660px card, so center it vertically too —
     scoped to the login page, the other frames fill the height. */
  #root:has(> .desktop-login) { display: flex; align-items: center; justify-content: center; }

  .phone-frame.desktop-login {
    display: grid;
    width: min(1040px, 100vw - 48px);
    max-width: min(1040px, 100vw - 48px);
    height: min(660px, 100dvh - 48px);
    max-height: min(660px, 100dvh - 48px);
    grid-template-columns: 1.05fr 0.95fr;
    grid-template-rows: auto 1fr;
  }

  /* Mono bar spans both panels along the top */
  .desktop-login > .login-topbar {
    grid-column: 1 / -1;
    grid-row: 1;
    padding: 18px 30px 0 !important;
  }

  /* Left panel: the brand hero, vertically centered with room to breathe */
  .desktop-login > .login-hero {
    grid-column: 1;
    grid-row: 2;
    padding: 8px 30px 8px 46px !important;
  }

  /* Right panel: the sign-in stack, centered against a hard divider */
  .desktop-login > .login-auth {
    grid-column: 2;
    grid-row: 2;
    align-self: center;
    justify-content: center;
    padding: 32px 46px 32px 40px !important;
    border-left: 2px solid var(--ink);
    overflow-y: auto;
  }
}

/* top bar ────────────────────────────────────────────────────── */
.top-bar,
.role-bar {
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: max(env(safe-area-inset-top), 12px) 16px 12px;
  /* Sits on the ground, not on a paper strip. Plain --bg (no dots): the bar
     is sticky, so dots here would slide against the page's dots on scroll.
     A hairline keeps content from vanishing under it without a hard edge. */
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
  z-index: 100;
  position: sticky;
  top: 0;
}
@media (min-width: 481px) {
  .phone-frame > .top-bar,
  .phone-frame > .role-bar {
    border-top-left-radius: 30px;
    border-top-right-radius: 30px;
  }
  .top-bar,
  .role-bar { padding-top: 14px; }
}
.top-bar .label,
.role-bar .label {
  font-family: var(--ds-mono);
  color: var(--pencil);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}
/* The wordmark takes the free space so the buttons stay on the right. */
.top-bar > .wordmark-fit { flex: 1; }
/* Wrap a <Wordmark> in .wordmark-fit where space is tight (top bar, desktop
   rail): a long trainer brand shrinks and ellipsizes instead of pushing its
   container past the screen edge. */
.wordmark-fit { min-width: 0; display: flex; }
.wordmark-fit > span { display: flex; min-width: 0; }
.wordmark-fit > span > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* The top bar only ever renders inside the phone-width frame (≤420px wide at
   any viewport), so the account pill is avatar-only; the name is in its menu. */
.top-bar .user-menu-trigger .name { display: none; }

/* Top-bar icon button (client messages, Story 27.3). Same height, border
   and shadow as the account pill beside it. */
.topbar-icon-btn {
  position: relative;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 1.5px 1.5px 0 var(--ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.topbar-icon-btn svg { width: 17px; height: 17px; }
.topbar-icon-btn:hover { background: var(--paper-shade); }
.topbar-icon-btn:active { transform: translate(1.5px, 1.5px); box-shadow: none; }
.unread-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--accent);
  border: 2px solid var(--ink);
}

/* user menu dropdown ─────────────────────────────────────────── */
.user-menu { position: relative; display: inline-flex; }
.user-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px 4px 8px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--ds-body);
  box-shadow: 1.5px 1.5px 0 var(--ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.user-menu-trigger:active { transform: translate(1.5px, 1.5px); box-shadow: none; }
.user-menu-trigger:hover { background: var(--paper-shade); }
.user-menu-trigger .chev {
  width: 14px; height: 14px;
  color: var(--pencil);
  transition: transform 0.15s;
}
.user-menu.open .user-menu-trigger .chev { transform: rotate(180deg); }
.user-menu-trigger .name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-trigger .mini-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11px;
  font-family: var(--ds-mono);
  border: 1.5px solid var(--ink);
}
.user-menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 14px;
  box-shadow: var(--shadow-card);
  padding: 6px;
  z-index: 200;
}
.user-menu-panel .menu-meta {
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 6px;
}
.user-menu-panel .menu-meta .menu-name { font-size: 13px; font-weight: 700; color: var(--ink); }
.user-menu-panel .menu-meta .menu-email { font-size: 11px; color: var(--pencil); margin-top: 2px; word-break: break-all; }
.user-menu-panel .menu-item {
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: none;
  background: transparent;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  border-radius: 8px;
  font-family: var(--ds-body);
}
.user-menu-panel .menu-item:hover { background: var(--paper-shade); }
.user-menu-panel .menu-item.danger { color: var(--warn); }
.user-menu-panel .menu-item .icon { color: currentColor; }

/* screen header ──────────────────────────────────────────────── */
.screen-header {
  padding: 18px 18px 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: transparent;
}
.screen-header h1 {
  font-family: var(--ds-display);
  font-weight: 800;
  font-size: 28px;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.8px;
}
.screen-header .subtitle {
  font-family: var(--ds-mono);
  font-size: 10px;
  color: var(--pencil);
  margin-top: 4px;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 700;
}
.header-icon {
  width: 34px; height: 34px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-btn);
  transition: transform .08s ease, box-shadow .08s ease;
}
.header-icon:active { transform: translate(2px, 2px); box-shadow: none; }

/* icon ───────────────────────────────────────────────────────── */
.icon {
  width: 18px; height: 18px;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex-shrink: 0;
  vertical-align: middle;
}
.icon-lg { width: 22px; height: 22px; }
.icon-sm { width: 14px; height: 14px; }
.icon-xl { width: 28px; height: 28px; }

/* screens ────────────────────────────────────────────────────── */
.screen { display: block; padding-bottom: 16px; }
.screen.active { display: block; }

/* ============================================================
   CARD SYSTEM — 3 tiers
   ============================================================ */

/* Standard card — an information slab: paper on the ground, no border, no
   shadow. The ground's contrast is what sets it off. */
.card {
  background: var(--paper);
  border: none;
  border-radius: 14px;
  box-shadow: none;
  margin: 12px 16px;
  padding: 14px 16px;
  position: relative;
  transition: transform .08s ease, box-shadow .08s ease;
}

/* Micro card — stat cells, small info blocks. Paper on the ground; a sunken
   well when it sits inside a card. */
.card-micro {
  background: var(--paper);
  border: none;
  border-radius: 10px;
  box-shadow: none;
  position: relative;
}
:is(.card, .card-hero, .card-micro, .bottom-sheet) .card-micro { background: var(--paper-shade); }

/* Pressable card — the card itself is the tap target, so it earns the ink
   border and the offset shadow, and tilts into the shadow on press. */
.card-press {
  cursor: pointer;
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-card);
}
.card-press:active {
  transform: translate(3px, 3px);
  box-shadow: none !important;
}

/* Hero card — exactly one per screen, filled ink. Its contents keep styling
   themselves with --ink / --paper / --ink-soft / --rule, so the hero swaps
   those tokens locally: text that said "ink" now reads paper, surfaces that
   said "paper" now read ink. Shadow tokens were resolved on :root and stay
   real ink. Lime (--hot) is unchanged and belongs here. */
.card-hero {
  --ink:          #FCF7EA;
  --paper:        #14111C;
  --ink-soft:     rgba(252, 247, 234, 0.62);
  --pencil:       rgba(252, 247, 234, 0.62);
  --pencil-light: rgba(252, 247, 234, 0.38);
  --rule:         rgba(252, 247, 234, 0.16);
  --ink-hair:     rgba(252, 247, 234, 0.14);
  --paper-shade:  #26222F;
  --highlight:    #26222F;
  --bg:           #26222F;
  /* warn red is too dark on ink: the same red mixed toward paper */
  --warn:         color-mix(in srgb, #a83a3a 55%, #FCF7EA);
  /* the brand accent is too dark to read on ink; its ring tint is not */
  --accent:       var(--accent-ring);
  --accent-deep:  var(--accent-ring);
  --accent-soft:  rgba(252, 247, 234, 0.1);
  background: var(--hero-fill);
  color: var(--ink);
  border: none;
  border-radius: 20px;
  box-shadow: var(--shadow-hero);
  overflow: hidden;
  position: relative;
}
/* A hero-sized lime CTA (a button styled as a hero, filled --hot inline):
   lime is light, so it keeps the normal dark tokens and its ink border. */
.card-hero.on-hot {
  --ink:          #14111C;
  --paper:        #FCF7EA;
  --ink-soft:     #6B6175;
  --pencil:       #6B6175;
  --pencil-light: #B0A8BC;
  --rule:         #D4CABC;
  --ink-hair:     rgba(20, 17, 28, 0.12);
  --paper-shade:  #E8DFC8;
  --highlight:    #EDE6D4;
  --bg:           #E2D8C0;
  --warn:         #a83a3a;
  border: 3px solid var(--ink);
  box-shadow: var(--shadow-card);
}
/* A lime button inside the hero: no paper outline, no shadow lost on ink. */
.card-hero .btn-hot { border-color: var(--hot); }
/* A brand button inside the hero sits on the light ring tint: dark text. */
.card-hero .btn-primary { color: var(--hero-fill); }

.card-flat { border: none; background: transparent; box-shadow: none; }
.card-soft { background: var(--paper-shade); }

/* Status card variants — tinted, flat. A thin state-colored border marks
   attention/success; the brand tint alone marks a brand note. */
.card-attention {
  background: #FFF7F5;
  border: 1.5px solid var(--warn);
  box-shadow: none;
}
.card-attention .card-title { color: var(--warn); }
.card-success {
  background: var(--success-soft);
  border: 1.5px solid var(--success);
  box-shadow: none;
}
.card-success .card-title { color: var(--success); }
.card-brand {
  background: var(--accent-soft);
  border: none;
  box-shadow: none;
}
.card-brand .card-title { color: var(--accent-deep); }

/* Tool row — a strip of equal secondary actions (Swap / Jump to / Cues /
   Skip lift, the −5 / +5 / rep steppers). Still buttons, but one quiet paper
   strip split by hairlines, so they don't compete with the hero or the
   primary action. */
.tool-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  background: var(--paper);
  border-radius: 14px;
  overflow: hidden;
}
.tool-row > button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 4px;
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--ds-body);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.tool-row > button + button { border-left: 1px solid var(--rule); }
.tool-row.inline > button { flex-direction: row; gap: 7px; padding: 11px 6px; }
.tool-row > button.warn { color: var(--warn); }
.tool-row > button:active { background: var(--paper-shade); }
.tool-row > button:disabled { opacity: 0.45; cursor: not-allowed; }
/* On a paper surface (a card, a sheet) the strip sinks into a well. */
:is(.card, .card-hero, .bottom-sheet) .tool-row { background: var(--paper-shade); }
:is(.card, .card-hero, .bottom-sheet) .tool-row > button:active { background: var(--rule); }

/* Slab list — rows inside one card, split by hairlines instead of each row
   being its own card. */
.slab-list > * + * { border-top: 1px solid var(--rule); }

/* Ink progress bar (macros, steps): a sunken track, an ink fill. Inside the
   ink hero the swapped tokens make it a dark track with a paper fill. */
.today-bar { height: 7px; border-radius: 999px; background: var(--paper-shade); overflow: hidden; }
.today-bar > div { height: 100%; background: var(--ink); border-radius: 999px; }

/* Workout recap — the stats as the ink hero: a 2×2 grid on hairlines, the
   PR cell filled lime (dark text: lime is light), the RPE as its footer. */
.recap-stats { padding: 0; }
.recap-stats-grid { display: grid; grid-template-columns: 1fr 1fr; }
.recap-stat { padding: 16px 18px; min-width: 0; }
.recap-stat:nth-child(odd) { border-right: 1px solid var(--rule); }
.recap-stat:nth-child(-n+2) { border-bottom: 1px solid var(--rule); }
.recap-stat-value {
  font-family: var(--ds-display); font-weight: 800; font-size: 30px;
  letter-spacing: -1.2px; line-height: 0.95; margin-top: 8px;
}
.recap-stat-pr { background: var(--hot); color: var(--hot-ink); border-color: transparent !important; }
.recap-stat-pr .mono-label { color: var(--hot-ink); opacity: 0.65; }

/* Trainer note on client Today — a quiet tinted row: avatar, two lines of
   the message (tap to open the thread), one small Got it. */
.trainer-note {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px 12px 12px 14px;
}
.trainer-note-avatar {
  width: 30px; height: 30px; border-radius: 999px;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--ds-display); font-weight: 800; font-size: 11px;
  align-self: start;
}
.trainer-note-body {
  background: none; border: none; padding: 0; margin: 0;
  text-align: left; color: var(--ink); cursor: pointer; min-width: 0;
}
.trainer-note-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-family: var(--ds-body);
  font-size: 13.5px;
  line-height: 1.35;
  margin-top: 3px;
}

.card-title {
  font-family: var(--ds-body);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.2;
  color: var(--ink);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: -0.1px;
}
.card-title .icon { width: 16px; height: 16px; }
.card-title .badge {
  font-family: var(--ds-mono);
  font-size: 10px;
  font-weight: 700;
  margin-left: auto;
  padding: 2px 8px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  color: var(--pencil);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

/* annotation ─────────────────────────────────────────────────── */
.annotation {
  background: var(--paper-shade);
  color: var(--pencil);
  margin: 10px 16px;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.45;
  border-left: 2px solid var(--ink);
}
.annotation strong { color: var(--ink); font-weight: 700; }
.annotation.tight { margin: 6px 16px; padding: 6px 10px; font-size: 12px; }

/* divider ────────────────────────────────────────────────────── */
.divider {
  height: 0;
  border-top: 1px solid var(--rule);
  margin: 10px 16px;
}
.divider-or {
  text-align: center;
  color: var(--pencil);
  font-size: 12px;
  margin: 8px 0;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-family: var(--ds-mono);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  font-family: var(--ds-body);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 16px;
  cursor: pointer;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  border-radius: 10px;
  box-shadow: var(--shadow-btn);
  transition: transform .08s ease, box-shadow .08s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  letter-spacing: -0.1px;
}
.btn:hover { background: var(--paper-shade); }
.btn:active { transform: translate(2px, 2px); box-shadow: none !important; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; box-shadow: var(--shadow-btn) !important; }

/* Primary — brand purple */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--ink);
}
.btn-primary:hover { background: var(--accent-deep); }

/* Hot — acid lime hero CTA */
.btn-hot {
  background: var(--hot);
  color: var(--hot-ink);
  border-color: var(--ink);
  font-weight: 800;
}
.btn-hot:hover { filter: brightness(0.96); }

.btn-block { display: flex; width: 100%; }
.btn-sm { font-size: 12px; padding: 6px 10px; }
.btn-ghost { border-style: dashed; color: var(--pencil); box-shadow: none; }
.btn-warn { color: var(--warn); border-color: var(--warn); box-shadow: 2px 2px 0 var(--warn); }

/* Set tiles — the workout recap's sets (22.7 / 22.16). Each one is a small
   button: the hard shadow says it can be tapped to fix, a dashed tile is a
   set not logged yet, and .static reads only (archived client). */
.set-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
  gap: 6px;
  margin-top: 10px;
  align-items: start;
}
.set-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 5px 4px 6px;
  margin: 0;
  /* A sunken well in the lift's slab (design refinement, E30): still a
     button (tap to fix), but quiet next to the hero. */
  background: var(--paper-shade);
  color: var(--ink);
  border: 1.5px solid transparent;
  border-radius: 4px;
  box-shadow: none;
  font-family: var(--ds-mono);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease;
}
button.set-tile:not(.top):active { background: var(--rule); }
.set-tile-label { font-size: 9px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--ink-soft); }
.set-tile-value { font-size: 12px; font-weight: 800; letter-spacing: 0.2px; white-space: nowrap; }
.set-tile-drop { font-size: 10.5px; font-weight: 700; letter-spacing: 0.2px; white-space: nowrap; color: var(--ink-soft); font-variant-numeric: tabular-nums; border-top: 1px dashed var(--ink-hair); align-self: stretch; padding-top: 2px; }
.set-tile.top .set-tile-drop { color: var(--paper); border-top-color: rgba(255,255,255,0.25); }
.set-tile.top { background: var(--ink); color: var(--paper); }
.set-tile.top .set-tile-label { color: rgba(252, 247, 234, 0.6); }
.set-tile.missed { background: transparent; border-style: dashed; border-color: var(--ink-soft); color: var(--ink-soft); }
.set-tile.static { box-shadow: none; cursor: default; }

/* dashed CTA rows (log food etc.) */
.dashed-cta {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 4px;
  background: none;
  border: 1.5px dashed var(--rule);
  border-radius: 10px;
  color: var(--pencil);
  font-size: 13px;
  font-family: var(--ds-body);
  cursor: pointer;
  justify-content: center;
}
.dashed-cta:hover { border-color: var(--ink); color: var(--ink); }

/* chip ───────────────────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--ds-mono);
  font-size: 10px;
  color: var(--ink);
  font-weight: 700;
  padding: 3px 9px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  letter-spacing: 0.3px;
}
.chip.muted { color: var(--pencil); border-color: var(--rule); }
.chip.warn { color: var(--warn); border-color: var(--warn); }
.chip.filled { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip.highlight { background: var(--highlight); }
.chip.brand { background: var(--accent-soft); color: var(--accent-deep); border-color: var(--accent-ring); }
.chip.success { background: var(--success-soft); color: var(--success); border-color: var(--success); }

/* Story 10.7 — "trained recently" rows on Pulse + the desktop dashboard. */
/* One paper slab, rows on hairlines (design refinement, E30) — on mobile and
   inside the desktop card alike. */
.trained-list { display: flex; flex-direction: column; background: var(--paper); border-radius: 14px; padding: 0 14px; }
.trained-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 11px 0; text-align: left; cursor: pointer;
  background: none; color: var(--ink);
  border: none; border-radius: 0;
  font: inherit;
}
.trained-row + .trained-row { border-top: 1px solid var(--rule); }
/* Inside a card the list is already on paper: no second inset. */
.card .trained-list { padding: 0; border-radius: 0; }
.trained-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.trained-name { font-family: var(--ds-display); font-size: 13.5px; font-weight: 800; letter-spacing: -0.3px; }
.trained-sub {
  font-family: var(--ds-mono); font-size: 9.5px; font-weight: 600; letter-spacing: 0.4px;
  color: var(--ink-soft); text-transform: uppercase; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.trained-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.trained-when { font-family: var(--ds-mono); font-size: 9px; font-weight: 700; letter-spacing: 0.8px; color: var(--ink); }
.trained-note { font-size: 9px; padding: 1px 7px; }
.trained-empty {
  font-family: var(--ds-mono); font-size: 10px; font-weight: 700; letter-spacing: 0.6px;
  color: var(--ink-soft); padding: 8px 0;
}

/* week picker (Story 26.2) ──────────────────────────────────────
   Program builder week: seven micro cells, Mon → Sun. on = ink fill
   (a training day; a hidden native select switches it), rest = dashed
   rule border (tap to add the next unscheduled day). */
.week-editor { display: flex; flex-direction: column; gap: 8px; }
.week-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--ds-mono); font-size: 10px; font-weight: 700;
  letter-spacing: 1.2px; text-transform: uppercase; color: var(--ink-soft);
}
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.week-cell {
  position: relative; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 2px 8px; border: 1.5px solid var(--ink); border-radius: 4px;
  background: var(--paper); color: var(--ink);
  font-family: var(--ds-mono); cursor: pointer;
}
.week-cell .wd { font-size: 9px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--ink-soft); }
.week-cell .tag {
  max-width: 100%; padding: 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 10px; font-weight: 700; letter-spacing: 0.4px;
}
.week-cell .dn { font-size: 8px; font-weight: 700; letter-spacing: 0.6px; color: var(--ink-soft); }
.week-cell.on { background: var(--ink); color: var(--paper); }
.week-cell.on .wd, .week-cell.on .dn { color: var(--pencil-light); }
.week-cell.rest { background: transparent; border-style: dashed; border-color: var(--rule); color: var(--ink-soft); }
.week-cell.rest:disabled { cursor: default; opacity: 0.5; }
.week-cell select {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer; font-size: 16px; /* 16px: no iOS focus zoom */
}
.week-cell:focus-within, .week-cell:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.week-note {
  font-family: var(--ds-mono); font-size: 9px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase; color: var(--ink-soft); line-height: 1.5;
}
.week-note.warn { color: var(--warn); }
/* In the program builder the week cells are flat wells; ink marks a session (30.10). */
.week-editor .week-cell { border-color: transparent; background: var(--paper-shade); }
.week-editor .week-cell.on { background: var(--ink); }
.week-editor .week-cell.rest { background: transparent; border-color: var(--rule); }

/* E29 — a cardio session row (trainer Activity card; client cards in 29.3):
   name + meta on the left, chip / minutes / action on the right, hairline
   between rows. */
.activity-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.activity-row + .activity-row { border-top: 1px solid var(--rule); }
.dashed-cta:disabled { opacity: 0.45; cursor: not-allowed; border-color: var(--rule); color: var(--pencil); }

/* E29 · client Today (29.3–29.5, mockups B1c / B2c).
   .today-dateline — the mono line that replaced the big headline.
   .activity-sub   — a hairline sub-section inside the Today hero.
   .activity-check — the round Done check on a cardio row.
   .activity-min   — minutes as a display numeral with a mono suffix.
   .steps-line     — label · ink bar · numbers · Edit, on one row. */
.mono-label.ink { color: var(--ink); }
.mono-label.brand { color: var(--accent); }
.today-dateline {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  padding: 14px 18px 12px;
}
.link-btn {
  background: none; border: none; padding: 0; cursor: pointer;
  font-family: var(--ds-mono); font-size: 10px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase; color: var(--accent);
}
.activity-sub { border-top: 1.5px solid var(--rule); margin-top: 14px; padding-top: 10px; }
/* On a lifting day the activity leaves the hero for its own slab: the first
   sub-section needs no divider above it. */
.today-activity > .activity-sub:first-child { border-top: none; margin-top: 0; padding-top: 0; }.activity-sub-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.activity-row.tap { width: 100%; background: none; border: none; text-align: left; color: inherit; font: inherit; cursor: pointer; }
.activity-row .main { flex: 1; min-width: 0; }
.activity-row .name { font-weight: 700; font-size: 14px; letter-spacing: -0.2px; }
.activity-row .name.done { text-decoration: line-through; text-decoration-thickness: 1.5px; color: var(--ink-soft); }
.activity-row .meta { font-size: 12px; color: var(--ink-soft); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-check {
  width: 30px; height: 30px; flex-shrink: 0; display: grid; place-items: center;
  border: 2px solid var(--ink); border-radius: 999px; background: var(--paper); color: var(--paper);
  box-shadow: var(--shadow-btn); cursor: pointer; padding: 0;
}
.activity-check.on { background: var(--ink); box-shadow: none; }
.activity-min {
  font-family: var(--ds-display); font-weight: 800; font-size: 22px; letter-spacing: -0.8px;
  line-height: 1; text-align: right; flex-shrink: 0; font-variant-numeric: tabular-nums;
}
.activity-min small {
  display: block; font-family: var(--ds-mono); font-size: 8px; letter-spacing: 1px;
  color: var(--ink-soft); font-weight: 700; margin-top: 2px;
}
.steps-line { display: flex; align-items: center; gap: 10px; min-height: 32px; }
.steps-bar { flex: 1; min-width: 40px; height: 8px; background: var(--bg); border: 1.5px solid var(--ink); border-radius: 999px; overflow: hidden; }
.steps-bar > i { display: block; height: 100%; background: var(--ink); }
/* E29 · 29.6 — a week of steps: one ink bar per day against a dashed goal
   line; a day with no entry is an empty hairline slot. */
.steps-week { position: relative; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; height: 72px; align-items: end; margin-top: 10px; }
.steps-week .slot { height: 100%; display: flex; align-items: flex-end; border-bottom: 1.5px solid var(--ink); }
.steps-week .slot > i { display: block; width: 100%; background: var(--ink); border-radius: 4px 4px 0 0; }
.steps-week .slot.empty { border-bottom: 1.5px dashed var(--rule); }
.steps-week .goal { position: absolute; left: 0; right: 0; border-top: 1.5px dashed var(--ink-soft); pointer-events: none; }
.steps-week-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-top: 5px; text-align: center; }
.week-stepper { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.steps-input {
  width: 92px; padding: 4px 8px; border: 2px solid var(--ink); border-radius: 10px;
  background: var(--paper); color: var(--ink); font-family: var(--ds-display); font-weight: 800;
  font-size: 17px; letter-spacing: -0.4px; font-variant-numeric: tabular-nums; outline: none;
}
.big-num-input {
  display: flex; align-items: baseline; gap: 8px; border: 2px solid var(--ink);
  border-radius: 14px; padding: 8px 14px; background: var(--paper);
}
/* .field input[type=number] (later in this file) styles plain fields — out-rank it. */
.field .big-num-input input[type="number"] {
  flex: 1; min-width: 0; width: auto; border: none; outline: none; background: transparent; color: var(--ink); padding: 0; border-radius: 0;
  font-family: var(--ds-display); font-size: 44px; font-weight: 800; letter-spacing: -2px; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.bottom-sheet {
  width: 100%; max-width: 420px; background: var(--paper); border-top: 2px solid var(--ink);
  border-radius: 14px 14px 0 0; padding: 20px 16px max(env(safe-area-inset-bottom), 24px);
}
/* client week strip (Story 26.4) — same micro cells, client states.
   planned = paper · done = ink fill · missed = warn · rest = dashed
   today = accent border + offset · sel = accent-soft fill. */
.week-strip .week-cell .dn { font-size: 13px; color: inherit; font-family: var(--ds-display); font-weight: 800; letter-spacing: 0; }
.week-cell.done { background: var(--ink); color: var(--paper); }
.week-cell.done .wd { color: var(--pencil-light); }
.week-cell.missed { border-color: var(--warn); color: var(--warn); }
.week-cell.missed .wd { color: var(--warn); }
.week-cell.today { border: 2.5px solid var(--accent); box-shadow: 2px 2px 0 var(--accent); }
.week-cell.sel:not(.done) { background: var(--accent-soft); }
.week-cell.done.sel { outline: 2px solid var(--accent); outline-offset: 2px; }
/* E29 · 29.11 — cardio rings: one per session due that day.
   filled = done · hollow = due · warn = missed. Rings take the cell's
   text color, so they read on both paper and ink (done) cells. */
.week-dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; min-height: 7px; }
.week-dot { width: 7px; height: 7px; box-sizing: border-box; border-radius: 999px; border: 1.5px solid currentColor; }
.week-dot.on { background: currentColor; }
.week-dot.miss { border-color: var(--warn); }
/* a missed lift paints its cell warn — keep its rings ink so a missed ring still stands out */
.week-cell.missed .week-dot { color: var(--ink); }
/* moves + lifts + cardio can outgrow a phone: never split a phrase; the
   counts drop to their own line, right-aligned, only when they don't fit */
.week-strip .week-head { flex-wrap: wrap; column-gap: 8px; row-gap: 2px; }
.week-strip .week-head > span { white-space: nowrap; }
.week-strip .week-head > span:last-child { margin-left: auto; }
/* Story 26.5 — a day the client swapped this week */
.week-cell.swapped:not(.done) { border-style: dashed; border-color: var(--accent); }
.week-cell.swapped:not(.done) .tag { color: var(--accent); }

@media (max-width: 480px) {
  .week-grid { gap: 4px; }
  .week-cell .tag { font-size: 9px; letter-spacing: 0; padding: 0; }
}

/* unit picker (Epic 25) ───────────────────────────────────────── */
/* Chips double as tap targets here, so they get a finger-sized pad.
   filled = current unit · plain = available · muted dashed = needs a
   shared conversion first (shown with a leading +). */
.unit-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.unit-chips .chip {
  padding: 6px 10px; font-size: 11px; letter-spacing: 0.8px;
  text-transform: uppercase; cursor: pointer;
}
.unit-chips .chip.muted { border-style: dashed; }
.unit-chips .chip:disabled { cursor: default; opacity: 0.5; }
.unit-label {
  font-family: var(--ds-mono); font-size: 9px; font-weight: 700;
  letter-spacing: 1.2px; text-transform: uppercase; color: var(--ink-soft);
}
.unit-prov { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 8px; }
.unit-link {
  background: none; border: none; padding: 0; cursor: pointer;
  font-family: var(--ds-mono); font-size: 9px; font-weight: 700;
  letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--accent); text-decoration: underline; text-underline-offset: 2px;
}
.unit-trigger {
  display: inline-flex; align-items: center; gap: 4px; cursor: pointer;
  font-family: var(--ds-mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.8px; text-transform: uppercase;
  padding: 4px 8px; border: 1.5px solid var(--ink); border-radius: 999px;
  background: var(--paper); color: var(--ink); white-space: nowrap;
}

/* today headline metric ──────────────────────────────────────── */
.today-glance {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 4px 0 8px;
}

.gauge-wrap {
  width: 120px; height: 120px;
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gauge-wrap svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.gauge-center {
  text-align: center;
  z-index: 1;
  position: relative;
}
.gauge-num {
  font-family: var(--ds-display);
  font-weight: 800;
  font-size: 24px;
  color: var(--ink);
  line-height: 1;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}
.gauge-of {
  font-family: var(--ds-mono);
  font-size: 9px;
  color: var(--pencil);
  margin-top: 3px;
  letter-spacing: 0.3px;
  font-weight: 700;
  text-transform: uppercase;
}

.macro-bar-row { flex: 1; min-width: 0; }
.macro-bar-line { margin-bottom: 8px; }
.macro-bar-line:last-child { margin-bottom: 0; }
.macro-bar-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  color: var(--ink);
  margin-bottom: 4px;
  font-weight: 600;
}
.macro-bar-label .right {
  font-family: var(--ds-mono);
  color: var(--pencil);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.macro-bar-track {
  height: 8px;
  border: 1.5px solid var(--ink);
  border-radius: 0;
  background: transparent;
  overflow: hidden;
  position: relative;
}
.macro-bar-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}

.pill-row { display: flex; gap: 8px; flex-wrap: wrap; padding: 4px 0 0; }

/* intake summary (trainer client profile → Intake tab) ────────── */
.intake-stamp {
  margin: 0 16px 10px;
  font-family: var(--ds-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.intake-label {
  font-family: var(--ds-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.intake-value {
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.intake-empty { color: var(--pencil); font-style: italic; }

/* simple list rows ───────────────────────────────────────────── */
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--rule);
}
.row:last-child { border-bottom: none; }
.row .row-main { flex: 1; min-width: 0; }
.row .row-title { font-size: 14px; color: var(--ink); font-weight: 500; }
.row .row-sub {
  font-family: var(--ds-mono);
  font-size: 10px;
  color: var(--pencil);
  margin-top: 3px;
  letter-spacing: 0.3px;
  font-weight: 700;
}
.row .row-time {
  font-family: var(--ds-mono);
  font-size: 10px;
  color: var(--pencil);
  width: 60px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
}

/* avatar ─────────────────────────────────────────────────────── */
.avatar {
  width: 38px; height: 38px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--paper-shade);
  color: var(--ink);
  font-weight: 800;
  font-family: var(--ds-display);
  font-size: 15px;
  flex-shrink: 0;
}
.avatar.lg { width: 52px; height: 52px; font-size: 20px; }

/* form fields ────────────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-family: var(--ds-mono);
  font-size: 10px;
  color: var(--ink);
  margin-bottom: 6px;
  letter-spacing: 1px;
  font-weight: 700;
  text-transform: uppercase;
}
.text-input,
.field input[type="email"],
.field input[type="password"],
.field input[type="text"],
.field input[type="number"],
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--rule);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ds-body);
  font-size: 14px;
  outline: none;
  transition: border-color .1s;
}
.text-input:focus,
.field input:focus,
.field textarea:focus {
  border-color: var(--ink);
}
.field textarea { resize: vertical; min-height: 56px; }

.form-error {
  color: var(--warn);
  font-family: var(--ds-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  margin: -4px 0 8px;
}

/* login screen ───────────────────────────────────────────────── */
.login-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  min-height: 100%;
  background-color: var(--bg);
  background-image: var(--ground-dots);
  background-size: 18px 18px;
}
.login-stack {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.login-wordmark {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.login-brand {
  font-family: var(--ds-display);
  font-size: 52px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -2px;
  line-height: 0.9;
  margin-bottom: 4px;
}
.login-brand .brand-accent {
  color: var(--accent);
}
.login-tagline {
  font-family: var(--ds-serif);
  font-style: italic;
  font-size: 18px;
  color: var(--pencil);
  font-weight: 400;
  letter-spacing: -0.3px;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
}

/* bottom nav ─────────────────────────────────────────────────── */
.bottom-nav {
  /* Floating pill — exits grid flow on mobile */
  position: fixed;
  bottom: max(env(safe-area-inset-bottom) + 10px, 22px);
  left: 16px;
  right: 16px;
  display: flex;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--ink);
  padding: 5px 6px;
  z-index: 200;
  gap: 4px;
}
@media (min-width: 481px) {
  .phone-frame > .bottom-nav {
    /* Restore full-width bar within the desktop phone-frame */
    position: sticky;
    bottom: 0;
    left: auto;
    right: auto;
    border-radius: 0 0 30px 30px;
    border: none;
    border-top: 2px solid var(--ink);
    box-shadow: none;
    padding: 6px 8px 14px;
  }
}
.bottom-nav.hidden { display: none; }

/* Trainer tab bar — same floating-pill placement as .bottom-nav: fixed to the
   viewport on phones (the document scrolls, so an absolute bar would sit at the
   end of the page), pinned inside the boxed phone-frame on wider screens. */
.trainer-tab-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: max(env(safe-area-inset-bottom) + 10px, 14px);
  z-index: 200;
  padding: 6px;
  display: flex;
  justify-content: space-between;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 20px;
  box-shadow: var(--shadow-card);
}
@media (min-width: 481px) {
  .phone-frame > .trainer-tab-bar { position: absolute; bottom: 14px; }
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 6px;
  background: none;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  color: var(--pencil);
  font-family: var(--ds-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  transition: background 0.1s, color 0.1s;
}
.bottom-nav-item .icon { width: 20px; height: 20px; }
.bottom-nav-item.active {
  background: var(--ink);
  color: var(--paper);
}
.bottom-nav-item:not(.active):hover { background: var(--paper-shade); color: var(--ink); }

/* Post-workout "You showed up." screen is absolutely positioned over the
   whole frame, so the content area's nav padding doesn't reach it. Its CTA
   clears the floating pill nav (phones) and the in-frame bar (≥481px). */
.recap-loud-cta {
  flex-shrink: 0;
  position: relative;
  padding: 16px 24px max(env(safe-area-inset-bottom) + 96px, 110px);
}
@media (min-width: 481px) {
  .recap-loud-cta { padding-bottom: 96px; }
}

/* phone frame content area ─────────────────────────────────── */
.phone-frame-content {
  grid-row: 2;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  min-height: 0;
  position: relative;
  /* Clear space for the floating pill nav on mobile */
  padding-bottom: max(env(safe-area-inset-bottom) + 82px, 96px);
}
@media (min-width: 481px) {
  .phone-frame-content {
    padding-bottom: 0;
  }
}

/* tabs ───────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--ink);
  background: var(--paper);
  padding: 0 16px;
}
.tab {
  padding: 10px 14px;
  font-family: var(--ds-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--pencil);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: color 0.1s, border-color 0.1s;
}
.tab.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}
.tab:hover { color: var(--ink); }

/* Segmented strip (design refinement 30.9): a flat paper strip with the
   active segment filled ink. Replaces the underlined .tabs and the shadowed
   pill switches. Sinks into a well on a paper surface. */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px; background: var(--paper); border-radius: 14px; }
.seg > button {
  padding: 8px 10px; border: none; border-radius: 10px; background: transparent; cursor: pointer;
  font-family: var(--ds-mono); font-size: 10.5px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase;
  color: var(--ink-soft); white-space: nowrap;
}
.seg > button[aria-selected="true"], .seg > button[aria-checked="true"], .seg > button.on { background: var(--ink); color: var(--paper); }
.seg > button .seg-n { margin-left: 6px; opacity: 0.65; }
:is(.card, .bottom-sheet, .inspector-pane) .seg { background: var(--paper-shade); }

/* Program list rows (30.9): name over a mono spec line; desktop adds columns. */
.prog-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 0; background: none; border: none; text-align: left; cursor: pointer; color: var(--ink); font: inherit; }
.prog-row + .prog-row { border-top: 1px solid var(--rule); }
.prog-table-head, .prog-trow { display: grid; grid-template-columns: minmax(240px, 2fr) 1fr 0.7fr 0.7fr 0.7fr 16px; gap: 14px; align-items: center; padding: 11px 18px; }
.prog-table-head { padding-top: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--rule); }
.prog-trow { width: 100%; background: none; border: none; text-align: left; cursor: pointer; color: var(--ink); font: inherit; }
.prog-trow + .prog-trow { border-top: 1px solid var(--rule); }
.prog-trow:last-child { border-bottom-left-radius: 14px; border-bottom-right-radius: 14px; }
@media (hover: hover) { .prog-trow:hover, .prog-row:hover { background: var(--paper-shade); } }
.prog-desc { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* slider ─────────────────────────────────────────────────────── */
.slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}
.slider-row label {
  font-family: var(--ds-mono);
  font-size: 10px;
  color: var(--ink);
  min-width: 60px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.slider-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  height: 6px;
}
.slider-row .slider-val {
  font-family: var(--ds-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--pencil);
  min-width: 24px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* stat grid ──────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 4px 0;
}
.stat-box {
  text-align: center;
  padding: 12px 4px;
  background: var(--paper-shade);
  border-radius: 4px;
  border: 1.5px solid var(--ink);
}
.stat-box .stat-num {
  font-family: var(--ds-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.8px;
  line-height: 1;
}
.stat-box .stat-label {
  font-family: var(--ds-mono);
  font-size: 9px;
  color: var(--pencil);
  margin-top: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-weight: 700;
}
.stat-box.accent { background: var(--accent-soft); border-color: var(--accent); }
.stat-box.accent .stat-num { color: var(--accent-deep); }
.stat-box.success { background: var(--success-soft); border-color: var(--success); }
.stat-box.success .stat-num { color: var(--success); }

/* search input ───────────────────────────────────────────────── */
.search-input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  border: 2px solid var(--rule);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ds-body);
  font-size: 14px;
  outline: none;
  transition: border-color .1s;
}
.search-input:focus { border-color: var(--ink); }
.search-wrap { position: relative; margin: 12px 16px; }
.search-wrap .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--pencil);
}

/* Search on the ground (design refinement 30.8): a borderless paper well;
   the ink edge shows only while typing. */
.search-slab .search-input { border-color: transparent; }
.search-slab .search-input:focus { border-color: var(--ink); }

/* Client roster (30.8): one slab of hairline rows (phone) or roster rows
   (desktop). Neutral avatars come from .pulse-avatar; compliance is a
   numeral, warn under 60%, never a green/red pill. */
.roster-card { padding: 0 16px; }
.roster-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.roster-name { font-family: var(--ds-display); font-size: 15px; font-weight: 800; letter-spacing: -0.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.roster-sub { font-family: var(--ds-mono); font-size: 9.5px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.roster-sub.warn { color: var(--warn); }
.roster-pct { flex-shrink: 0; min-width: 42px; text-align: right; font-family: var(--ds-display); font-size: 17px; font-weight: 800; letter-spacing: -0.4px; }
.roster-pct small { font-family: var(--ds-mono); font-size: 9px; font-weight: 700; color: var(--ink-soft); letter-spacing: 0; }
.roster-pct.warn { color: var(--warn); }
.roster-row.archived .roster-name { color: var(--ink-soft); }
.roster-fold { display: flex; align-items: center; gap: 8px; margin: 0 18px 10px; padding: 0; background: none; border: none; cursor: pointer; }
.roster-table { margin: 0; padding: 0; }
.roster-table-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.roster-trow {
  display: grid; grid-template-columns: minmax(200px, 1.4fr) minmax(110px, 0.7fr) minmax(200px, 2fr) 80px 56px 16px;
  gap: 14px; align-items: center; width: 100%; padding: 11px 18px;
  background: none; border: none; text-align: left; cursor: pointer; color: var(--ink); font: inherit;
}
.roster-trow + .roster-trow { border-top: 1px solid var(--rule); }
@media (hover: hover) { .roster-trow:hover { background: var(--paper-shade); } }
.roster-trow:first-child { border-top-left-radius: 14px; border-top-right-radius: 14px; }
.roster-trow:last-child { border-bottom-left-radius: 14px; border-bottom-right-radius: 14px; }
.roster-trow-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.roster-trow.archived .roster-name { color: var(--ink-soft); }
.roster-chev { color: var(--ink-soft); }

/* Exercise library (30.11): one slab of hairline rows (two columns on
   desktop), flat thumbnail wells, flat filter chips. */
.lib-thumb { width: 40px; height: 40px; border-radius: 10px; background: var(--paper-shade); color: var(--ink-soft); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.lib-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 0; background: none; border: none; text-align: left; cursor: pointer; color: var(--ink); font: inherit; min-width: 0; }
.card > .lib-row + .lib-row { border-top: 1px solid var(--rule); }
.lib-chips { display: flex; gap: 6px; overflow-x: auto; padding: 0 16px 12px; scrollbar-width: none; }
.lib-chips::-webkit-scrollbar { display: none; }
.lib-chips > button { flex-shrink: 0; padding: 6px 12px; border-radius: 999px; border: none; background: var(--paper); cursor: pointer; font-family: var(--ds-mono); font-size: 10px; font-weight: 700; letter-spacing: 1px; color: var(--ink-soft); }
.lib-chips > button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.lib-create { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.lib-filters { width: 220px; flex-shrink: 0; overflow-y: auto; display: flex; flex-direction: column; background: var(--paper); border-right: 1.5px solid var(--ink); }
.lib-filters .search-slab .search-input { background: var(--paper-shade); }
.lib-filter { display: block; width: 100%; margin-bottom: 2px; padding: 6px 10px; border: none; border-radius: 10px; background: transparent; text-align: left; cursor: pointer; font-family: var(--ds-mono); font-size: 11px; font-weight: 700; letter-spacing: 0.6px; color: var(--ink); }
.lib-filter[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.lib-grid { margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: hidden; }
.lib-grid > .lib-row { padding: 12px 16px; }
.lib-grid > .lib-row:nth-child(odd) { border-right: 1px solid var(--rule); }
.lib-grid > .lib-row:nth-child(n + 3) { border-top: 1px solid var(--rule); }
@media (hover: hover) { .lib-grid > .lib-row:hover { background: var(--paper-shade); } }

/* Exercise creator + create sheet (30.11): fields are borderless wells —
   paper on the ground, sunken inside a card or the sheet. */
.ex-well { border: 1.5px solid transparent; background: var(--paper); color: var(--ink); font-family: var(--ds-body); outline: none; }
.ex-well:focus { border-color: var(--ink); }
:is(.card, .ex-sheet) .ex-well { background: var(--paper-shade); }
.ex-chip { padding: 6px 11px; border-radius: 999px; border: none; background: var(--paper); cursor: pointer; font-family: var(--ds-mono); font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--ink-soft); }
:is(.card, .ex-sheet) .ex-chip { background: var(--paper-shade); }
.ex-chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
/* A lime primary action with a trailing icon (Add to a program, Save lift). */
.detail-cta { justify-content: space-between; padding: 12px 16px; font-family: var(--ds-display); font-size: 15px; font-weight: 800; }

/* Desktop list pages (Clients, Programs, Library): left rail + a scrolling
   main column on the dotted ground, a mono eyebrow over a display title with
   one serif word, and the lime primary action on the right (30.8). */
.desk-page { display: flex; height: 100%; width: 100%; overflow: hidden; font-family: var(--ds-body); color: var(--ink); }
.desk-page-main { flex: 1; min-width: 0; overflow-y: auto; padding: 28px 32px; }
.desk-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.desk-page-title { margin: 6px 0 0; font-family: var(--ds-display); font-size: 44px; font-weight: 800; letter-spacing: -2px; line-height: 0.9; }
.serif-em { font-family: var(--ds-serif); font-style: italic; font-weight: 500; letter-spacing: -1px; }

/* back button ────────────────────────────────────────────────── */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-family: var(--ds-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--pencil);
  background: none;
  border: none;
  cursor: pointer;
}
.back-btn:hover { color: var(--ink); }

/* calendar ───────────────────────────────────────────────────── */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 0 16px;
}
.cal-header {
  text-align: center;
  font-family: var(--ds-mono);
  font-size: 9px;
  color: var(--pencil);
  padding: 4px 0;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 700;
}
.cal-day {
  text-align: center;
  padding: 8px 4px;
  font-size: 13px;
  border-radius: 6px;
  cursor: default;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.cal-day.today {
  background: var(--accent);
  color: var(--paper);
  font-weight: 800;
  border-radius: 8px;
}
.cal-day.muted { color: var(--pencil-light); }
.cal-day.has-event { position: relative; }
.cal-day.has-event::after {
  content: '';
  display: block;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent);
  margin: 2px auto 0;
}

/* client calendar (trainer profile → Calendar tab) ─────────────
   Builds on .cal-grid / .cal-day. Each day is a button; three
   markers sit under the numeral — session pill, kcal dot, and a
   hot check-in dot in the corner. Ink / warn / success / hot only. */
.client-cal-wrap { container-type: inline-size; }
.client-cal-split { display: block; }
@container (min-width: 720px) {
  .client-cal-split {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    align-items: start;
  }
}
.client-cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.client-cal-month {
  font-family: var(--ds-display);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.6px;
  line-height: 1;
  text-align: center;
}
.client-cal-label {
  font-family: var(--ds-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.client-cal-tally { text-align: center; margin-bottom: 12px; }
.cal-grid.client-cal { padding: 0; gap: 4px; }
.client-cal .cal-day {
  appearance: none;
  position: relative;
  min-width: 0;
  min-height: 46px;
  padding: 6px 2px 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 1.5px solid var(--ink-hair);
  border-radius: 4px;
  color: var(--ink);
  font-family: var(--ds-display);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.client-cal .cal-day:disabled { cursor: default; border-color: transparent; }
.client-cal .cal-day.muted { color: var(--pencil-light); font-weight: 500; }
.client-cal .cal-day.selected {
  border: 2px solid var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow-btn);
}
.client-cal .cal-num { line-height: 16px; padding: 0 5px; border-radius: 999px; }
.client-cal .cal-num.today { background: var(--ink); color: var(--paper); }
/* Story 26.5 — a day the client swapped this week */
.cal-swap {
  position: absolute; top: 3px; left: 4px; /* check-in dot owns the top-right */
  font-family: var(--ds-mono); font-size: 9px; font-weight: 700; line-height: 1;
  color: var(--accent);
}
.cal-swap.static { position: static; }
.cal-marks { display: flex; align-items: center; justify-content: center; gap: 3px; height: 6px; }
.cal-mark-session {
  width: 12px; height: 6px;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  box-sizing: border-box;
}
.cal-mark-session.done { background: var(--ink); }
.cal-mark-session.missed { border-color: var(--warn); }
.cal-mark-kcal {
  width: 6px; height: 6px;
  border-radius: 999px;
  box-sizing: border-box;
}
.cal-mark-kcal.hit { background: var(--success); }
.cal-mark-kcal.under { border: 1.5px solid var(--ink-soft); }
.cal-mark-checkin {
  width: 7px; height: 7px;
  border-radius: 999px;
  background: var(--hot);
  border: 1.5px solid var(--ink);
  box-sizing: border-box;
}
.client-cal .cal-day .cal-mark-checkin { position: absolute; top: 3px; right: 3px; }
.client-cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
}
.client-cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.client-cal-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.client-cal-section { margin-top: 14px; }
.client-cal-section .client-cal-label { margin-bottom: 4px; }

/* Story 21.8 — a client's end-of-workout rating + comment, read-only. */
.session-feedback-label {
  font-family: var(--ds-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink);
}
.session-feedback-comment {
  margin-top: 6px;
  padding-left: 8px;
  border-left: 2px solid var(--ink);
  font-family: var(--ds-body);
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.client-cal-section .row { padding: 9px 2px; align-items: flex-start; }
.client-cal-section .row-sub { text-transform: uppercase; }
.client-cal-letter {
  width: 18px;
  flex-shrink: 0;
  font-family: var(--ds-mono);
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  color: var(--ink-soft);
}
.client-cal-kcal {
  font-family: var(--ds-display);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.8px;
  line-height: 1;
  margin: 4px 0 8px;
}
.client-cal-kcal .of { font-size: 13px; font-weight: 700; letter-spacing: 0; color: var(--ink-soft); }
.client-cal-section .macro-bar-fill { background: var(--ink); }

/* ============================================================
   LIFT PROGRESS
   ============================================================ */
.lift-row { padding: 12px 0; border-bottom: 1px solid var(--rule); }
.lift-row:last-child { border-bottom: none; }
.lift-row-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.lift-name {
  font-family: var(--ds-body);
  font-size: 14px; font-weight: 700; color: var(--ink);
}
.lift-delta {
  font-family: var(--ds-mono);
  font-size: 11px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 2px 8px; border-radius: 999px;
  background: var(--paper-shade);
}
.lift-delta.up { background: var(--success-soft); color: var(--success); }
.lift-delta.down { background: #FBE7E2; color: var(--warn); }
.lift-delta.flat { color: var(--pencil); }
.lift-delta-pct { opacity: 0.7; font-weight: 700; }
.lift-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lift-chart { text-align: left; }
.lift-chart-label {
  font-family: var(--ds-mono);
  font-size: 9px; color: var(--pencil);
  letter-spacing: 0.5px; text-transform: uppercase; font-weight: 700;
  margin-bottom: 2px;
}
.lift-chart-current {
  font-family: var(--ds-display);
  font-size: 13px; font-weight: 800; color: var(--ink);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.sparkline { display: block; }

/* ============================================================
   PROGRAM BUILDER
   ============================================================ */
.prog-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px 0 4px; gap: 8px;
}
.prog-toolbar-right { display: flex; align-items: center; gap: 6px; }
.day-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.day-name-input {
  flex: 1;
  font-family: var(--ds-body);
  font-size: 15px; font-weight: 700; color: var(--ink);
  border: 1.5px solid transparent;
  background: transparent;
  padding: 6px 8px;
  border-radius: 6px;
  outline: none;
  letter-spacing: -0.1px;
}
.day-name-input:hover { border-color: var(--rule); }
.card .day-name-input { font-family: var(--ds-display); font-weight: 800; font-size: 17px; letter-spacing: -0.4px; min-width: 0; padding: 4px 6px; border-radius: 10px; }

/* Program builder (30.10): form fields are sunken wells, and the day picker
   is a wrapping row of chips so any number of days fits a phone. */
.prog-form .field :is(input, textarea) { border-color: transparent; background: var(--paper-shade); }
.prog-form .field :is(input, textarea):focus { border-color: var(--ink); }
.day-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 16px 12px; }
.day-chips > button {
  padding: 7px 12px; border-radius: 999px; border: none; background: var(--paper); cursor: pointer;
  font-family: var(--ds-mono); font-size: 10px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--ink-soft);
}
.day-chips > button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
/* Desktop builder (30.10): the day's lifts are one slab of hairline rows on
   the ground; the selected lift is tinted, not outlined. Inspector fields
   are sunken wells in plain text. */
.builder-lifts { margin: 0; padding: 0; overflow: hidden; }
.builder-lift { display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; }
.builder-lift + .builder-lift { border-top: 1px solid var(--rule); }
.builder-lift.sel { background: var(--accent-soft); }
@media (hover: hover) { .builder-lift:not(.sel):hover { background: var(--paper-shade); } }
.builder-move { width: 26px; height: 26px; border: none; border-radius: 10px; background: var(--paper-shade); cursor: pointer; font-family: var(--ds-mono); font-size: 11px; font-weight: 700; color: var(--ink); }
.builder-move:disabled { opacity: 0.35; cursor: not-allowed; }
.builder-well { display: block; width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1.5px solid transparent; border-radius: 10px; background: var(--paper-shade); font-family: var(--ds-body); color: var(--ink); outline: none; }
.builder-well:focus { border-color: var(--ink); }
.builder-week .week-cell:not(.on):not(.rest) { background: var(--paper); }
.day-chips > .day-chip-add { background: transparent; border: 1.5px dashed var(--ink-soft); color: var(--ink); padding: 5.5px 12px; }
.day-name-input:focus { border-color: var(--ink); background: var(--paper); }

/* Program lifts (design refinement 30.10): hairline rows inside the day's
   slab, not ink-bordered boxes. The open lift's fields run the full width,
   centred, as sunken wells; reorder/remove is a tool row at its foot. */
.ex-editor { border: none; border-radius: 0; background: transparent; margin: 0; }
.ex-editor + .ex-editor { border-top: 1px solid var(--rule); }
.ex-editor-head { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.ex-letter-pill {
  width: 20px; height: 28px;
  border: none;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--ds-mono);
  font-weight: 700; font-size: 13px; color: var(--ink-soft);
  flex-shrink: 0;
  background: none;
}
.ex-name-wrap { flex: 1; min-width: 0; }
.ex-name-input {
  width: 100%;
  font-size: 15px; font-weight: 800; letter-spacing: -0.3px; color: var(--ink);
  border: 1.5px solid transparent;
  background: transparent;
  padding: 4px 6px;
  border-radius: 10px;
  font-family: var(--ds-display);
  outline: none;
}
.ex-name-input:hover { border-color: var(--rule); }
.ex-name-input:focus { border-color: var(--ink); background: var(--paper); }
.ex-name-input::placeholder { color: var(--pencil-light); }
.ex-summary { font-family: var(--ds-mono); font-size: 10px; color: var(--pencil); padding: 2px 6px; letter-spacing: 0.3px; font-weight: 700; }
.ex-head-actions { display: flex; gap: 2px; flex-shrink: 0; }
.icon-btn {
  width: 28px; height: 28px;
  border: 1.5px solid var(--rule);
  background: var(--paper);
  border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--pencil);
  cursor: pointer;
  font-family: var(--ds-body);
}
.icon-btn:hover:not(:disabled) { background: var(--paper-shade); color: var(--ink); border-color: var(--ink); }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.ex-chev { transition: transform 0.15s; }
.ex-chev.open { transform: rotate(180deg); }
.ex-editor .icon-btn { border: none; background: var(--paper-shade); border-radius: 10px; color: var(--ink); }
.ex-editor-body { padding: 0 0 14px; }
.ex-actions { margin-top: 12px; }
/* minmax(0, 1fr), not 1fr: a bare 1fr track can't shrink below an <input>'s
   ~20ch intrinsic width, which pushed the third column out of narrow sheets. */
.ex-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.ex-field { display: flex; flex-direction: column; align-items: stretch; gap: 4px; min-width: 0; font-family: var(--ds-mono); font-size: 9px; color: var(--pencil); letter-spacing: 0.5px; text-transform: uppercase; font-weight: 700; text-align: center; }
.ex-field input {
  width: 100%; min-width: 0;
  padding: 8px;
  border: 1.5px solid transparent;
  border-radius: 10px;
  background: var(--paper-shade);
  font-size: 15px; font-weight: 700; color: var(--ink); text-align: center;
  font-family: var(--ds-body);
  outline: none;
  font-variant-numeric: tabular-nums;
}
.ex-field input:focus { border-color: var(--ink); }
.ex-section { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--rule); }
.ex-section-title {
  font-family: var(--ds-mono);
  font-size: 9px; font-weight: 700; color: var(--ink);
  letter-spacing: 0.5px; text-transform: uppercase;
  margin-bottom: 6px;
  display: flex; align-items: baseline; gap: 6px;
}
.ex-section-hint { font-size: 9px; color: var(--pencil); font-weight: 400; text-transform: none; letter-spacing: 0; font-family: var(--ds-body); }
.ex-tag-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.ex-tag-row select,
.ex-tag-row input {
  padding: 8px 10px;
  border: 1.5px solid transparent;
  border-radius: 10px;
  background: var(--paper-shade);
  font-size: 12px; color: var(--ink);
  font-family: var(--ds-body);
  outline: none;
}
.ex-tag-row select { flex: 1; }
.ex-empty { font-size: 12px; color: var(--pencil); padding: 4px 0; }

/* ============================================================
   MEAL PLAN BUILDER
   ============================================================ */
.day-strip {
  display: flex; gap: 4px; padding: 0 12px;
  overflow-x: auto; margin: 8px 0 4px; scrollbar-width: none;
}
.day-strip::-webkit-scrollbar { display: none; }
.day-chip {
  flex: 1; min-width: 50px;
  background: var(--paper);
  border: 1.5px solid var(--rule);
  border-radius: 8px;
  padding: 6px 4px 8px;
  text-align: center;
  cursor: pointer;
  font-family: var(--ds-body);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.day-chip:hover { background: var(--paper-shade); }
.day-chip-label { font-family: var(--ds-mono); font-size: 9px; color: var(--pencil); letter-spacing: 0.5px; text-transform: uppercase; font-weight: 700; }
.day-chip-kcal {
  font-family: var(--ds-display);
  font-size: 14px; font-weight: 800; color: var(--ink);
  font-variant-numeric: tabular-nums; letter-spacing: -0.5px;
}
.day-chip.empty .day-chip-kcal { color: var(--pencil-light); }
.day-chip.low { background: var(--paper-shade); }
.day-chip.low .day-chip-kcal { color: var(--pencil); }
.day-chip.good { background: var(--success-soft); border-color: var(--success); }
.day-chip.good .day-chip-kcal { color: var(--success); }
.day-chip.over { background: #FBE7E2; border-color: var(--warn); }
.day-chip.over .day-chip-kcal { color: var(--warn); }
.day-chip.active { border-color: var(--accent); border-width: 2px; box-shadow: 2px 2px 0 var(--accent); }
.day-chip.active .day-chip-label { color: var(--accent-deep); font-weight: 700; }

.ingredient-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.ingredient-row:last-of-type { border-bottom: none; }
.ingredient-info { flex: 1; min-width: 0; }
.ingredient-name { font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.ingredient-sub { font-family: var(--ds-mono); font-size: 10px; color: var(--pencil); margin-top: 1px; font-weight: 700; letter-spacing: 0.3px; }
.ingredient-amount {
  width: 60px; padding: 6px 8px;
  border: 1.5px solid var(--rule);
  border-radius: 6px;
  background: var(--paper);
  font-size: 13px; color: var(--ink);
  font-family: var(--ds-body);
  outline: none;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.ingredient-amount:focus { border-color: var(--ink); }
.ingredient-unit { font-family: var(--ds-mono); font-size: 10px; color: var(--pencil); min-width: 32px; font-weight: 700; }

/* utility ────────────────────────────────────────────────────── */
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }

/* ============================================================
   BRAND MARK
   ============================================================ */
.brand-mark {
  font-family: var(--ds-display);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.5px;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.brand-mark .brand-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent);
  border: 1.5px solid var(--ink);
  flex-shrink: 0;
}

/* ─── Desktop trainer shell ──────────────────────────────── */
.trainer-desktop {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  background-image: var(--ground-dots);
  background-size: 18px 18px;
}
.trainer-desktop-body {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

/* gauge arc */
.gauge-progress { stroke: var(--accent) !important; }

/* legal documents (/legal/*) ─────────────────────────────────── */
/* Own scroll container: body is a fixed-height flex box at ≥481px. */
.legal-page {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  background-color: var(--bg);
  background-image: var(--ground-dots);
  background-size: 18px 18px;
  color: var(--ink);
  font-family: var(--ds-body);
}
.legal-column { max-width: 680px; margin: 0 auto; padding: max(env(safe-area-inset-top), 16px) 16px 48px; }
.legal-bar { display: flex; justify-content: space-between; align-items: center; }
.legal-label {
  font-family: var(--ds-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.legal-label.accent { color: var(--accent); }
.legal-back { background: none; border: none; padding: 0; cursor: pointer; }
.legal-title {
  font-family: var(--ds-display);
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -1.6px;
  line-height: 0.95;
  margin: 10px 0 0;
}
.legal-page .card { margin: 20px 0 0; padding: 18px 18px 8px; }
.legal-prose { font-size: 15px; line-height: 1.6; letter-spacing: -0.1px; }
.legal-prose h2 {
  font-family: var(--ds-display);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.15;
  margin: 26px 0 8px;
}
.legal-prose h2:first-child { margin-top: 4px; }
.legal-prose h3 { font-family: var(--ds-display); font-size: 16px; font-weight: 800; margin: 18px 0 6px; }
.legal-prose p { margin: 0 0 12px; }
.legal-prose ul { margin: 0 0 12px; padding-left: 20px; }
.legal-prose li { margin-bottom: 6px; }
.legal-prose a { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 2px; }
.legal-prose code { font-family: var(--ds-mono); font-size: 13px; }
.legal-table-wrap { overflow-x: auto; margin: 0 0 14px; }
.legal-prose table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 1.45; }
.legal-prose th {
  font-family: var(--ds-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: left;
  padding: 6px 10px 6px 0;
  border-bottom: 1.5px solid var(--ink);
}
.legal-prose td { padding: 8px 10px 8px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.legal-foot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.legal-foot a { text-decoration: none; }

/* password rules under the signup password field ─────────────── */
.password-checklist {
  list-style: none;
  margin: -2px 0 10px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 10px;
}
.password-checklist li {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--ds-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.password-checklist li.ok { color: var(--success); }
.password-checklist .mark {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  border-radius: 999px;
  border: 1.5px solid currentColor;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.password-checklist li.ok .mark { background: var(--success); color: var(--paper); border-color: var(--success); }
.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;
}

/* login: forgot password ─────────────────────────────────────── */
.login-forgot {
  display: block;
  margin: 6px 0 0 auto;
  padding: 2px 0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--ds-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--accent-deep);
}
.login-forgot:disabled { color: var(--ink-soft); cursor: default; }
.login-notice {
  padding: 8px 12px;
  background: var(--success-soft);
  border: 1.5px solid var(--success);
  border-radius: 14px;
  font-family: var(--ds-body);
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink);
  overflow-wrap: anywhere;
}

/* auth email links (/auth/action) — reset password, verify email ───── */
.auth-action-page {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  background-color: var(--paper);
  background-image: radial-gradient(circle, var(--ink-hair) 1px, transparent 1px);
  background-size: 18px 18px;
  color: var(--ink);
  font-family: var(--ds-body);
}
.auth-action-column { max-width: 440px; margin: 0 auto; padding: max(env(safe-area-inset-top), 16px) 16px 48px; }
.auth-action-bar { display: flex; justify-content: space-between; align-items: center; }
.auth-action-headline { margin-top: 44px; }
.auth-action-body { font-size: 14px; line-height: 1.55; color: var(--ink-soft); margin: 14px 0 0; overflow-wrap: anywhere; }
.auth-action-body strong { color: var(--ink); }
.auth-action-card { margin-top: 20px; padding: 20px; }
.auth-action-card .field input { font-size: 16px; } /* 16px stops iOS zooming on focus */
.auth-action-card .form-error { margin: -4px 0 12px; }
.auth-action-cta { padding: 14px 18px; font-family: var(--ds-display); font-size: 16px; }

/* guides (/guides) — builds on the .legal-page reading surface ───── */
.guide-hero { display: block; margin-top: 20px; padding: 20px; color: inherit; text-decoration: none; }
.guide-hero-title { font-family: var(--ds-display); font-size: 24px; font-weight: 800; letter-spacing: -0.6px; margin: 8px 0 4px; }
.guide-summary { display: block; font-size: 13.5px; line-height: 1.5; color: var(--ink-soft); }
.guide-section { margin-top: 26px; }
.guide-section-head { display: flex; justify-content: space-between; margin-bottom: 10px; }
.guide-list.card { margin: 0; padding: 0; }
.guide-row {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px;
  color: inherit; text-decoration: none; border-top: 1px solid var(--rule);
}
.guide-row:first-child { border-top: none; }
.guide-row:hover { background: var(--paper-shade); }
.guide-row-num { font-family: var(--ds-mono); font-size: 11px; font-weight: 700; letter-spacing: 1px; color: var(--accent); padding-top: 3px; min-width: 22px; }
.guide-row-text { flex: 1; min-width: 0; }
.guide-row-title { display: block; font-family: var(--ds-display); font-size: 16px; font-weight: 800; letter-spacing: -0.3px; margin-bottom: 2px; }
.guide-row-arrow { font-family: var(--ds-mono); color: var(--ink-soft); padding-top: 2px; }
.guide-lede { margin-top: 12px; font-size: 15px; line-height: 1.55; color: var(--ink-soft); }
.guide-lede p { margin: 0; }
.legal-prose ol { margin: 0 0 12px; padding-left: 24px; }
.legal-prose ol li::marker { font-family: var(--ds-mono); font-weight: 700; color: var(--accent); }
.md-callout {
  margin: 0 0 14px; padding: 10px 14px; border-left: 4px solid var(--accent);
  background: var(--accent-soft); border-radius: 4px; font-size: 14px; line-height: 1.5;
}
.guide-shot { margin: 4px 0 18px; }
.guide-shot img {
  display: block; width: 100%; height: auto; border: 2px solid var(--ink);
  border-radius: 14px; box-shadow: var(--shadow-card); background: var(--bg);
}
.guide-shot.phone img { max-width: 320px; margin: 0 auto; }
/* A guide page is wider than the legal pages so desktop captures stay
   readable inside the card; text keeps a comfortable line length. */
.guide-page .legal-column { max-width: 920px; }
.guide-body > p, .guide-body > ul, .guide-body > ol, .guide-body > .md-callout, .guide-lede { max-width: 68ch; }
.guide-shot figcaption {
  margin-top: 8px; text-align: center; font-family: var(--ds-mono); font-size: 10px;
  font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--ink-soft);
}
.guide-pager { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin-top: 18px; }
.guide-pager-link {
  display: block; padding: 12px 14px; border: 2px solid var(--ink); border-radius: 14px;
  background: var(--paper); box-shadow: var(--shadow-card); color: inherit; text-decoration: none;
}
.guide-pager-link.next { text-align: right; }
.guide-pager-link .guide-row-title { margin: 4px 0 0; font-size: 14px; }

/* ============================================================
   MESSAGE THREAD (E27)
   A reading surface: ledger entries, not bubbles. No hero card,
   no crop marks (design/SYSTEM.md, "message threads have no hero").
   ============================================================ */

/* Full-page thread: header and composer stay put, the ledger scrolls
   between them. The height gives way to the on-screen keyboard
   (utils/keyboardInset.ts) so the composer is never behind it. */
.phone-frame-content.flush { padding-bottom: 0; }
.thread-screen {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - var(--kb-inset, 0px) - var(--kb-top, 0px));
  margin-top: var(--kb-top, 0px);
  background-color: var(--bg);
  background-image: var(--ground-dots);
  background-size: 18px 18px;
}
@media (min-width: 481px) {
  .thread-screen { height: 100%; margin-top: 0; }
}
.thread-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: max(env(safe-area-inset-top), 14px) 16px 12px;
  /* On the ground with a hairline, like the top bar (30.12). */
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
}
.thread-head-title {
  font-family: var(--ds-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.8px;
  line-height: 1.05;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thread-back {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-btn);
  cursor: pointer;
}
.thread-back:active { transform: translate(2px, 2px); box-shadow: none; }
.thread-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.thread { padding: 0 16px 8px; }
.thread-day { display: flex; align-items: center; gap: 10px; margin: 14px 0 2px; }
.thread-day::before,
.thread-day::after { content: ''; flex: 1; height: 1px; background: var(--rule); }
.thread-empty { padding: 40px 24px; text-align: center; }
.thread-empty p { margin-top: 8px; color: var(--ink-soft); }
.thread-closed { padding: 12px 16px max(env(safe-area-inset-bottom), 14px); border-top: 1px solid var(--rule); background: var(--paper); text-align: center; }

/* Bubbles (30.12, Sam 2026-11-29 — replaces the 2026-11-09 ledger): yours
   anchored right and filled ink (tokens swapped like the hero so a ref inside
   reads light), theirs anchored left on paper, unread theirs tinted
   accent-soft. A run of one person's messages groups; the tail corner is the
   4px radius, the rest 14px. On a paper surface (the desktop inspector)
   their bubbles sink to paper-shade. */
.bubble-row { display: flex; flex-direction: column; align-items: flex-start; margin-top: 4px; }
.bubble-row.mine { align-items: flex-end; }
.bubble-row.run-start { margin-top: 14px; }
.thread-day + .bubble-row { margin-top: 8px; }
.bubble {
  max-width: min(80%, 560px); padding: 9px 13px 10px; border-radius: 14px;
  background: var(--paper); color: var(--ink);
  font-size: 14px; line-height: 1.42; white-space: pre-wrap; overflow-wrap: anywhere;
}
.bubble-row.theirs .bubble.tail { border-bottom-left-radius: 4px; }
.bubble-row.theirs.unread .bubble { background: var(--accent-soft); }
.bubble-row.mine .bubble {
  --ink: #FCF7EA; --paper: #14111C; --ink-soft: rgba(252, 247, 234, 0.62); --rule: rgba(252, 247, 234, 0.16);
  --paper-shade: #26222F;
  background: var(--hero-fill); color: var(--ink);
}
.bubble-row.mine .bubble.tail { border-bottom-right-radius: 4px; }
.inspector-thread .bubble-row.theirs:not(.unread) .bubble { background: var(--paper-shade); }
.bubble-meta { display: flex; align-items: center; gap: 6px; margin: 4px 4px 0; min-height: 18px; }
.bubble-meta .mono-label { font-size: 9px; }
.bubble-ref { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 8px; padding: 7px 10px; border: none; border-radius: 10px; background: var(--paper-shade); color: var(--ink); font: inherit; text-align: left; white-space: normal; }
button.bubble-ref { cursor: pointer; }
.bubble-row.theirs:not(.unread) .bubble-ref { background: var(--bg); }
.inspector-thread .bubble-row.theirs:not(.unread) .bubble-ref { background: var(--paper); }
.bubble-ref .mono-label { font-size: 9px; flex-shrink: 0; }
.bubble-ref-title { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bubble-ref-open { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.msg-ref { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin-top: 8px; }
.msg-ref-title { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Story 27.9 — a tappable attachment (button) reads like the static one. */
button.msg-ref { width: 100%; text-align: left; font: inherit; color: var(--ink); cursor: pointer; }
.msg-ref .mono-label { font-size: 9px; flex-shrink: 0; }
.msg-ref-action { color: var(--ink); }
button.msg-ref-action { background: none; border: 0; padding: 4px 0 4px 6px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.composer-ref { margin: 0 0 8px; }

.composer {
  padding: 10px 16px max(env(safe-area-inset-bottom), 14px);
  border-top: 1px solid var(--rule);
  background: var(--paper);
}
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.composer-input { resize: none; min-height: 42px; max-height: 132px; line-height: 1.4; font-size: 16px; }
.composer .composer-input { border-color: transparent; background: var(--paper-shade); }
.composer .composer-input:focus { border-color: var(--ink); }
.composer-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; }
.composer-meta .mono-label { font-size: 9px; }

/* Desktop inspector Messages view (Story 27.5): the switch sits under the
   inspector header; the thread fills the rest with the composer at the
   bottom of the column. */
.inspector-switch { display: flex; gap: 6px; }
.inspector-switch .chip { cursor: pointer; font-size: 11px; padding: 4px 11px; }
.inspector-thread { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--paper); }
.inspector-thread .thread { padding: 0 16px 8px; }
.inspector-thread .composer { padding-bottom: 14px; }

/* Waiting on you (Story 27.7): triage card on Pulse / the desktop dashboard,
   and the same state as a strip above a trainer thread's composer. */
.waiting-card { padding: 12px 16px 6px; background: var(--accent-soft); }
.waiting-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.waiting-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--accent-ring); }
.waiting-row:last-child { border-bottom: none; }
.waiting-open { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; background: none; border: none; padding: 0; text-align: left; cursor: pointer; color: var(--ink); }
.waiting-name { font-family: var(--ds-display); font-size: 15px; font-weight: 800; letter-spacing: -0.3px; }
.waiting-preview { max-width: 100%; font-size: 12px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.waiting-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 16px; border-top: 1px solid var(--accent-ring); background: var(--accent-soft); }

/* Trainer inbox (Story 27.11): every client thread, newest first. Rows are
   ledger lines like the thread itself — hairline rules, no cards per row.
   Mobile: one .card of rows. Desktop: a thread-list column beside the open
   thread. Unread rows carry the same accent tint as an unread message. */
.inbox-card { padding: 0; overflow: hidden; }
.inbox-row { display: flex; flex-direction: column; gap: 3px; width: 100%; padding: 11px 16px; background: none; border: none; border-bottom: 1px solid var(--rule); text-align: left; cursor: pointer; color: var(--ink); font-family: var(--ds-body); }
.inbox-row:last-child { border-bottom: none; }
@media (hover: hover) { .inbox-row:hover { background: var(--paper-shade); } }
.inbox-row.unread { background: var(--accent-soft); }
.inbox-row.active { background: var(--paper-shade); }
.inbox-row-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.inbox-name { flex: 1; min-width: 0; font-family: var(--ds-display); font-size: 15px; font-weight: 800; letter-spacing: -0.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-time { flex-shrink: 0; font-size: 9px; }
.inbox-preview { flex: 1; min-width: 0; font-size: 12px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-row.unread .inbox-preview { color: var(--ink); font-weight: 600; }
.inbox-waiting { flex-shrink: 0; font-size: 9px; color: var(--accent-deep); }
.inbox-desktop { display: flex; height: 100%; width: 100%; overflow: hidden; color: var(--ink); font-family: var(--ds-body); }
.inbox-column { width: 300px; flex-shrink: 0; display: flex; flex-direction: column; background: var(--paper); border-right: 1.5px solid var(--ink); }
.inbox-pane-head { height: 56px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 16px; border-bottom: 1.5px solid var(--ink); background: var(--paper); }
.inbox-column-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; }
.inbox-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: transparent; }
.inbox-thread-title { min-width: 0; font-family: var(--ds-display); font-size: 18px; font-weight: 800; letter-spacing: -0.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-main .inspector-thread { background: transparent; }
.inbox-main .inspector-thread .bubble-row.theirs:not(.unread) .bubble { background: var(--paper); }
.inbox-main .inspector-thread .bubble-row.theirs:not(.unread) .bubble-ref { background: var(--bg); }
.inbox-main .inspector-thread .thread { max-width: 760px; margin: 0 auto; }
.inbox-main .composer-row, .inbox-main .composer-meta { max-width: 728px; margin-left: auto; margin-right: auto; }

/* Bodyweight trend (Stories 17.7 / 17.8): weigh-ins from check-ins, shared by
   client Progress, the trainer's mobile Overview and the desktop inspector.
   Ink line over a hot fill, like the Progress hero chart. The change is
   plain ink — whether down is good depends on the client's phase. */
.weight-trend-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.weight-trend-value { font-family: var(--ds-display); font-size: 36px; font-weight: 800; letter-spacing: -1.4px; line-height: 0.95; color: var(--ink); }
.weight-trend-value .mono-label { margin-left: 6px; letter-spacing: 1px; }
.weight-trend-change { margin-top: 6px; color: var(--ink); }
.weight-trend-chart { display: block; width: 100%; height: 72px; margin-top: 12px; }
.weight-trend-axis { display: flex; justify-content: space-between; margin-top: 6px; font-size: 9px; }
.weight-trend-empty { font-family: var(--ds-body); font-size: 13px; line-height: 1.45; color: var(--ink-soft); }

/* Food log — one slab per meal: rows on hairlines, "+ Add" as the last row
   (design refinement, E30). */
.food-slot { padding: 2px 14px; }
.food-slot-row { padding: 11px 0; }
.food-slot-row + .food-slot-row { border-top: 1px solid var(--rule); }
.food-slot-add {
  display: block; width: 100%; text-align: left;
  background: none; border: none; cursor: pointer;
  font-family: var(--ds-body); font-size: 13px; font-weight: 700;
  color: var(--accent-deep);
}

/* Stat cells — a row of small stats as one slab split by hairlines, instead
   of a row of shadowed tiles (design refinement, E30). Check-in, Pulse. */
.checkin-stats, .stat-cells { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.checkin-stats > * + *, .stat-cells > * + * { border-left: 1px solid var(--rule); }
.stat-cells > * { padding: 11px 12px; min-width: 0; }

/* Pulse lists (prep order, needs attention) — rows on hairlines inside one
   slab, neutral avatars (design refinement, E30). */
.pulse-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 11px 0; background: none; border: none; text-align: left;
  color: var(--ink); font: inherit; cursor: pointer;
}
.pulse-row + .pulse-row { border-top: 1px solid var(--rule); }
.pulse-avatar {
  width: 30px; height: 30px; border-radius: 999px; flex-shrink: 0;
  border: 1.5px solid var(--ink); background: var(--paper);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--ds-display); font-size: 10px; font-weight: 800; color: var(--ink);
}

/* Desktop inspectors are paper columns: a card inside one sinks into a well
   so it still reads as a block (design refinement, E30). */
.client-inspector .card { background: var(--paper-shade); }


/* ============================================================
   Marketing site (Story 20.1) — layered on top of globals.css,
   so tokens, cards, buttons, chips and the legal prose are the
   app's own. This file only adds page layout.
   Radii stay on the system's set: 4 / 14 / 20 (hero) / 999.
   ============================================================ */

/* globals.css locks the body into a fixed-height phone frame at ≥481px.
   The marketing site is an ordinary scrolling document. */
@media (min-width: 481px) {
  html, body { overflow: visible; height: auto; }
  body { display: block; padding: 0; }
}
html { overscroll-behavior: auto; scroll-behavior: smooth; }
body { font-size: 15px; line-height: 1.5; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.mk-wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.mk-narrow { max-width: 760px; margin: 0 auto; }
.mk-accent { color: var(--accent); }
/* The desktop dashboard is unreadable at phone width; phones get the phone Pulse. */
.mk-only-narrow { display: none; }
@media (max-width: 759px) {
  .mk-only-wide { display: none; }
  .mk-only-narrow { display: block; }
}
.mk-pulse-phone { width: min(300px, 82%); margin: 26px auto 0; }

/* header ──────────────────────────────────────────────────── */
.mk-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(env(safe-area-inset-top), 18px) 0 18px;
}
.mk-home { color: var(--ink); text-decoration: none; }
.mk-wordmark { display: inline-flex; align-items: center; gap: 8px; }
.mk-wordmark-name {
  font-family: var(--ds-display);
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}
.mk-wordmark-tint { color: var(--accent); }
.mk-nav { display: flex; align-items: center; gap: 12px; }
@media (min-width: 600px) { .mk-nav { gap: 20px; } }
.mk-nav a.mono-label { text-decoration: none; }
.mk-nav a.mono-label:hover, .mk-nav a.mono-label[aria-current='page'] { color: var(--ink); }
.mk-nav .btn { text-decoration: none; }

/* shared type ─────────────────────────────────────────────── */
.mk-main { padding-bottom: 8px; }
.mk-main .card { margin: 14px 0 0; padding: 18px 18px 6px; }
/* :where() keeps this at one class of specificity, so a section can recolour its links. */
.mk-main :where(a:not(.btn):not(.chip):not(.mk-link-mono)) {
  color: var(--accent-deep);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.mk-h1 {
  font-family: var(--ds-display);
  font-weight: 800;
  font-size: clamp(38px, 9vw, 64px);
  line-height: 0.95;
  letter-spacing: -0.04em;
  margin: 12px 0 0;
  max-width: 15ch;
}
.mk-h1-xl { font-size: clamp(44px, 8.4vw, 88px); max-width: 12ch; }
.mk-h1 em, .mk-h2 em {
  font-family: var(--ds-serif);
  font-style: italic;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.mk-h2 {
  font-family: var(--ds-display);
  font-weight: 800;
  font-size: clamp(34px, 5.6vw, 58px);
  line-height: 0.95;
  letter-spacing: -0.04em;
  margin: 0;
  max-width: 16ch;
}
.mk-lede { font-size: 17px; line-height: 1.5; margin: 16px 0 0; max-width: 52ch; }
.mk-body { font-size: 17px; line-height: 1.55; margin: 16px 0 0; max-width: 60ch; }

/* hero ────────────────────────────────────────────────────── */
.mk-hero { padding: 26px 22px 22px; margin: 6px 0 22px; }
.mk-cta { margin-top: 20px; font-size: 15px; padding: 13px 18px; text-decoration: none; }
.mk-cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.mk-cta-row .mk-cta { margin-top: 0; }
.mk-hero-foot { margin-top: 16px; }
.mk-hero-foot a { color: inherit; }

.mk-hero-split { display: grid; gap: 28px; }
.mk-hero-shot { justify-self: center; width: min(280px, 82%); }
@media (min-width: 860px) {
  .mk-hero-split {
    grid-template-columns: minmax(0, 1fr) 300px;
    align-items: center;
    gap: 40px;
    padding: 44px 44px 40px;
  }
  .mk-hero-shot { width: 100%; }
}

/* screenshots ─────────────────────────────────────────────── */
.mk-phone {
  border: 3px solid var(--ink);
  border-radius: 20px;
  overflow: hidden;
  background: var(--paper);
  box-shadow: var(--shadow-card);
}
.mk-phone img, .mk-window img { display: block; width: 100%; height: auto; }

.mk-window {
  margin-top: 28px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  overflow: hidden;
  background: var(--paper);
  box-shadow: var(--shadow-card);
}
.mk-window-bar {
  padding: 10px 14px;
  border-bottom: 2px solid var(--ink);
  background: var(--paper);
  text-transform: lowercase;
}

.mk-figures {
  display: flex;
  gap: 16px;
  margin-top: 26px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 0 4px 10px 0;
  -webkit-overflow-scrolling: touch;
}
.mk-figure { flex: 0 0 72%; margin: 0; scroll-snap-align: start; }
@media (min-width: 760px) {
  .mk-figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; overflow: visible; padding: 0; }
}
.mk-figure figcaption { margin-top: 14px; }
.mk-figure figcaption p { margin: 4px 0 0; font-size: 14.5px; line-height: 1.45; max-width: 34ch; }

/* ticker ──────────────────────────────────────────────────── */
.mk-ticker {
  background: var(--ink);
  color: var(--paper);
  border-radius: 14px;
  overflow: hidden;
  padding: 12px 0;
  margin: 0 0 8px;
}
.mk-ticker-track { display: flex; width: max-content; animation: mk-ticker 48s linear infinite; }
.mk-ticker-run { display: flex; }
.mk-ticker-item {
  font-family: var(--ds-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.3px;
  white-space: nowrap;
}
.mk-ticker-item::after { content: '·'; color: var(--hot); margin: 0 16px; }
@keyframes mk-ticker { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .mk-ticker-track { animation: none; }
}

/* sections ────────────────────────────────────────────────── */
.mk-band { margin-top: 72px; }
.mk-band-tight { margin-top: 36px; }
.mk-section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 10px;
  margin-bottom: 18px;
  border-bottom: 2px solid var(--ink);
}
.mk-section-head .mono-label:first-child { color: var(--ink); }

.mk-grid-4 { display: grid; gap: 12px; margin-top: 22px; }
@media (min-width: 600px) { .mk-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 960px) { .mk-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.mk-feature { padding: 14px 14px 12px; }
.mk-feature p { margin: 6px 0 0; font-size: 14.5px; line-height: 1.45; }

.mk-brands { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 24px; }
@media (min-width: 760px) { .mk-brands { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.mk-brand { padding: 16px 14px; display: flex; flex-direction: column; gap: 10px; }
.mk-brand-mark .mk-wordmark-name { font-size: 18px; letter-spacing: -0.5px; white-space: normal; }

/* pricing ─────────────────────────────────────────────────── */
.mk-tiers { display: grid; gap: 14px; margin-top: 24px; }
@media (min-width: 760px) { .mk-tiers { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.mk-main .mk-tier { margin: 0; padding: 18px; }
.mk-tier-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mk-tier-name { font-family: var(--ds-display); font-weight: 800; font-size: 20px; letter-spacing: -0.4px; margin: 0; }
.mk-tier-price {
  font-family: var(--ds-display);
  font-weight: 800;
  font-size: 56px;
  line-height: 1;
  letter-spacing: -2px;
  margin-top: 18px;
}
.mk-tier-dollar { font-size: 28px; vertical-align: top; margin-right: 2px; letter-spacing: 0; }
.mk-tier-per { margin-left: 6px; letter-spacing: 1.2px; }
.mk-tier-seats { margin-top: 12px; color: var(--ink); }
.mk-after-tiers { margin-top: 18px; }
.mk-link-mono { color: var(--accent); text-decoration: none; }
.mk-link-mono:hover { text-decoration: underline; text-underline-offset: 3px; }

.mk-main .mk-included { padding: 4px 18px; }
.mk-included-row {
  display: grid;
  gap: 2px 16px;
  padding: 12px 0;
  border-top: 1px solid var(--rule);
}
.mk-included-row:first-child { border-top: none; }
@media (min-width: 600px) { .mk-included-row { grid-template-columns: 180px minmax(0, 1fr); align-items: baseline; } }
.mk-included-name { font-family: var(--ds-display); font-weight: 800; font-size: 16px; letter-spacing: -0.2px; }
.mk-included-detail { color: var(--ink-soft); }
.mk-narrow-card { max-width: 760px; }

/* closer ──────────────────────────────────────────────────── */
.mk-closer {
  margin-top: 72px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 14px;
  padding: 40px 22px 32px;
  display: grid;
  gap: 32px;
}
@media (min-width: 860px) {
  .mk-closer { grid-template-columns: minmax(0, 1fr) 340px; align-items: center; gap: 48px; padding: 64px 48px 56px; }
}
.mk-closer .mono-label { color: var(--pencil-light); }
.mk-closer-h { color: var(--paper); margin-top: 14px; max-width: 14ch; }
.mk-closer-h em { color: var(--hot); }
.mk-closer-foot { margin-top: 18px; }
.mk-closer-foot a { color: var(--paper); text-decoration: underline; text-underline-offset: 2px; }
.mk-steps { list-style: none; margin: 0; padding: 0; }
.mk-steps li {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  column-gap: 8px;
  padding: 14px 0;
  border-top: 1px solid var(--ink-soft);
}
.mk-steps li:first-child { border-top: none; padding-top: 0; }
.mk-steps .mono-label { grid-row: span 2; color: var(--hot); padding-top: 4px; }
.mk-steps strong { font-family: var(--ds-display); font-size: 18px; letter-spacing: -0.3px; }
.mk-steps li > span:last-child { color: var(--pencil-light); font-size: 14.5px; }

/* support FAQ ─────────────────────────────────────────────── */
.mk-section-label { margin: 0 0 2px; }
.mk-faq { margin: 0; }
.mk-faq dt {
  font-family: var(--ds-display);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.3px;
  line-height: 1.2;
  margin: 14px 0 0;
}
.mk-faq dd { margin: 4px 0 14px; }
.mk-faq dd + dt { border-top: 1px solid var(--rule); padding-top: 14px; }

/* legal ───────────────────────────────────────────────────── */
.mk-legal { padding-top: 8px; }
.mk-legal .card { margin-top: 20px; padding: 18px 18px 8px; }

/* footer ──────────────────────────────────────────────────── */
.mk-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 48px;
  padding: 18px 0 max(env(safe-area-inset-bottom), 32px);
  border-top: 2px solid var(--ink);
}
.mk-footer-links { display: flex; flex-wrap: wrap; gap: 8px; }
.mk-footer-links a { text-decoration: none; }

/* moved notice (20.12) ────────────────────────────────────────
   Only an old home-screen icon (saved on usehardset.com) sees this:
   the head script sets html.mk-installed in standalone mode. */
.mk-moved { display: none; }
.mk-installed .mk-moved { display: block; }
.mk-installed .mk-wrap { display: none; }
.mk-moved-in {
  max-width: 460px;
  margin: 0 auto;
  padding: max(env(safe-area-inset-top), 24px) 16px max(env(safe-area-inset-bottom), 24px);
}
.mk-moved-eyebrow { margin-top: 32px; }
.mk-moved .mk-h2 { margin-top: 10px; font-size: clamp(34px, 10vw, 46px); }
.mk-moved .mk-body { font-size: 16px; }
.mk-moved-host {
  font-family: var(--ds-mono);
  font-size: 0.9em;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}
.mk-moved-steps { list-style: none; margin: 22px 0 0; padding: 0 16px; }
.mk-moved-steps li { display: flex; gap: 12px; align-items: baseline; padding: 14px 0; font-size: 15px; line-height: 1.45; }
.mk-moved-steps .mono-label { flex: none; }
.mk-moved-cta { margin-top: 18px; text-decoration: none; }
