/* Jotlift web surface: marketing site and signed-in dashboard.
 *
 * Built on the Jot Core design system (assets/css/tokens/, copied unmodified)
 * with Jotlift's APP LAYER re-pointed below to the values the app actually
 * ships, from src/theme/colors.ts, spacing.ts and motion.ts. The token file says
 * an app re-points its own layer and changes nothing else; this is that layer.
 *
 * Rules carried from the app (DESIGN-OVERHAUL.md):
 *  - The ladder steps UPWARD: canvas -> surface -> elevated.
 *  - Content floats: a card is `elevated` + elev-1, radius 16, NO border.
 *    A well recessed into a card steps down to `canvas`. Controls (chips,
 *    secondary buttons, segmented tracks) sit on `surface`.
 *  - Hairlines divide rows INSIDE a card, inset 16px. They never outline one.
 *  - Tint scarcity: the accent marks actionable things only. Success, danger and
 *    record (gold) are signals, never buttons. Gold only ever means a record.
 *  - Decorative ink is for glyphs. Text is `text` or `text-quiet`.
 *  - Section headers sit ABOVE their group: 13px semibold caps, 0.04em, quiet.
 *  - Motion confirms, orients or rewards, never decorates, and honours Reduce
 *    Motion. Press is 0.97 on the instant timing, released on a spring.
 */

@import "tokens/fonts.css";
@import "tokens/colors.css";
@import "tokens/typography.css";
@import "tokens/spacing.css";
@import "tokens/elevation.css";

/* ==================================================== Jotlift's app layer */

/* Light, the default, and the explicit light choice. */
:root,
:root[data-theme="light"] {
  --color-canvas:          #F0EADE;
  --color-surface:         #FAF6EF;
  --color-elevated:        #FFFFFF;
  --color-hairline:        #E4DDCF;
  --color-scrim:           rgba(11, 11, 13, 0.4);

  --color-text:            #211F1B;
  --color-text-quiet:      #635E54;
  --color-text-decorative: #847E70;
  /* The logo's stroke, exactly as the icon ships it. Not the accent (UX-10). */
  --color-brand:           #186E62;

  --color-accent:          #00735F;
  --color-accent-soft:     #D5EFE8;
  --color-on-accent:       #FFFFFF;

  --color-success:         #1F6E33;
  --color-success-soft:    #E2EFE4;
  --color-danger:          #BC3B30;
  --color-danger-soft:     #F8E5E2;
  --color-record:          #8F5B00;
  --color-record-soft:     #F7E7C4;
  --color-destructive-bg:  #BC3B30;
  --color-destructive-fg:  #FFFFFF;

  --elev-1: 0 1px 4px rgba(33, 31, 27, 0.06);
  --elev-2: 0 4px 12px rgba(33, 31, 27, 0.10);
  --elev-3: 0 12px 32px rgba(33, 31, 27, 0.16);
  --glass:  rgba(250, 246, 239, 0.72);
  color-scheme: light;
}

/* Dark: the explicit choice, and the device's setting when nobody has chosen.
   The two blocks carry the same values. */
:root[data-theme="dark"] {
  --color-canvas:          #17181C;
  --color-surface:         #212329;
  --color-elevated:        #262931;
  --color-hairline:        #2E3036;
  --color-scrim:           rgba(11, 11, 13, 0.4);
  --color-text:            #ECEDEF;
  --color-text-quiet:      #9A9DA5;
  --color-text-decorative: #6E727A;
  --color-brand:           #57B3A2;
  --color-accent:          #3FD1B0;
  --color-accent-soft:     #123A31;
  --color-on-accent:       #17181C;
  --color-success:         #5BC46E;
  --color-success-soft:    #17301F;
  --color-danger:          #FF6B60;
  --color-danger-soft:     #371B1A;
  --color-record:          #F5C15A;
  --color-record-soft:     #3A2C10;
  --color-destructive-bg:  #371B1A;
  --color-destructive-fg:  #FF6B60;
  --elev-1: 0 3px 10px rgba(0, 0, 0, 0.34);
  --elev-2: 0 6px 16px rgba(0, 0, 0, 0.44);
  --elev-3: 0 14px 36px rgba(0, 0, 0, 0.52);
  --glass:  rgba(33, 35, 41, 0.66);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-canvas:          #17181C;
    --color-surface:         #212329;
    --color-elevated:        #262931;
    --color-hairline:        #2E3036;
    --color-scrim:           rgba(11, 11, 13, 0.4);
    --color-text:            #ECEDEF;
    --color-text-quiet:      #9A9DA5;
    --color-text-decorative: #6E727A;
    --color-brand:           #57B3A2;
    --color-accent:          #3FD1B0;
    --color-accent-soft:     #123A31;
    --color-on-accent:       #17181C;
    --color-success:         #5BC46E;
    --color-success-soft:    #17301F;
    --color-danger:          #FF6B60;
    --color-danger-soft:     #371B1A;
    --color-record:          #F5C15A;
    --color-record-soft:     #3A2C10;
    --color-destructive-bg:  #371B1A;
    --color-destructive-fg:  #FF6B60;
    --elev-1: 0 3px 10px rgba(0, 0, 0, 0.34);
    --elev-2: 0 6px 16px rgba(0, 0, 0, 0.44);
    --elev-3: 0 14px 36px rgba(0, 0, 0, 0.52);
    --glass:  rgba(33, 35, 41, 0.66);
    color-scheme: dark;
  }
}

/* Motion, from src/theme/motion.ts. The ceiling is 500ms. */
:root {
  --motion-instant:  80ms;
  --motion-quick:    180ms;
  --motion-standard: 320ms;
  --motion-emphasis: 480ms;
  --ease-decel:      cubic-bezier(0, 0, 0.2, 1);   /* chips, ticks, small state */
  --ease-decel-in:   cubic-bezier(0.2, 0, 0, 1);   /* screen push, sheet rise */
  /* The instant spring {24, 600, 1}: back to rest by ~190ms, 0.5% overshoot. */
  --ease-press:      cubic-bezier(0.25, 1.1, 0.4, 1);
  /* The emphasis spring {16, 170, 1}: peak and end moments only. */
  --ease-reward:     cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================================================ reset + ground */

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  background: var(--color-canvas);
  color: var(--color-text);
  font-family: var(--font-text);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* The theme cross-fade. Only the properties that carry the palette. */
.jotx, .jotx * {
  transition: background-color var(--motion-standard) var(--ease-decel-in),
              color var(--motion-standard) var(--ease-decel-in),
              border-color var(--motion-standard) var(--ease-decel-in),
              box-shadow var(--motion-standard) var(--ease-decel-in);
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

img { max-width: 100%; }


.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;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  padding: 12px 18px; border-radius: var(--radius-md);
  background: var(--color-elevated); color: var(--color-text);
  box-shadow: var(--elev-2); font-size: 15px; font-weight: 600;
}
.skip-link:focus { left: 16px; top: 16px; text-decoration: none; }

:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; border-radius: 4px; }
/* A full-bleed row inside a card that clips its corners draws its ring inside. */
.session__toggle:focus-visible, .ex-row:focus-visible, .best-row:focus-visible,
.pick-row:focus-within, .account-row :focus-visible, .routine-open:focus-visible { outline-offset: -2px; }

[hidden] { display: none !important; }

.shell { width: min(1160px, 100%); margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.shell-prose { width: min(760px, 100%); margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.shell-legal { width: min(720px, 100%); margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.shell-pricing { width: min(1000px, 100%); margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.shell-dash { width: min(1160px, 100%); margin: 0 auto; padding-left: 24px; padding-right: 24px; }

/* ==================================================================== header */

/* Chrome floats above content. The solid tone is the foundation; the blur is
   the enhancement, and turning it off changes nothing but how nice it looks. */
.site-header { position: sticky; top: 0; z-index: 40; background: var(--color-canvas); }
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-header {
    background: var(--glass);
    backdrop-filter: saturate(170%) blur(20px);
    -webkit-backdrop-filter: saturate(170%) blur(20px);
  }
}
@media (prefers-reduced-transparency: reduce) {
  .site-header { background: var(--color-canvas); backdrop-filter: none; -webkit-backdrop-filter: none; }
}

.site-header__inner {
  width: min(1160px, 100%); margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; gap: 24px;
}

.wordmark { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.wordmark:hover { text-decoration: none; }
.wordmark__text { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; color: var(--color-text); }
.wordmark__text span { color: var(--color-text-quiet); font-weight: 600; }

.site-nav { flex: 1; display: flex; flex-wrap: wrap; gap: 4px 2px; justify-content: flex-end; align-items: center; }
.site-nav a {
  padding: 7px 12px; border-radius: var(--radius-pill);
  font-size: 15px; font-weight: 500; white-space: nowrap;
  color: var(--color-text-quiet);
}
.site-nav a:hover { color: var(--color-text); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--color-text); font-weight: 600; background: var(--color-surface); }

.theme-toggle {
  flex: 0 0 auto; width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: var(--radius-pill);
  background: var(--color-surface); color: var(--color-text-quiet); cursor: pointer;
}
.theme-toggle:hover { color: var(--color-text); }
.theme-toggle svg { display: block; }
/* One button, two glyphs: the glyph shows what a press gets you. */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme]) .theme-toggle .icon-moon { display: none; }
}

/* ==================================================================== footer */

.site-footer { background: var(--color-canvas); }
.site-footer__inner {
  width: min(1160px, 100%); margin: 0 auto; padding: 32px 24px 48px;
  display: flex; flex-wrap: wrap; gap: 20px 40px;
  align-items: flex-start; justify-content: space-between;
  border-top: 1px solid var(--color-hairline);
}
.site-footer p { margin: 0; font-size: 14px; color: var(--color-text-quiet); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 14px; }
.site-footer nav a { color: var(--color-text-quiet); }
.site-footer nav a:hover { color: var(--color-text); text-decoration: none; }

/* ================================================================ components */

/* Press (src/ui/Pressable.tsx): 0.97 on the instant timing, released on the
   instant spring. Rows use the highlight press instead: an opacity dip. */
.btn, .chip, .stepper button, .theme-toggle, .oauth, .prg-picker__button,
.routine-card, .cal__nav button, .dash-tabbar button {
  transition: transform 190ms var(--ease-press),
              background-color var(--motion-standard) var(--ease-decel-in),
              color var(--motion-standard) var(--ease-decel-in),
              box-shadow var(--motion-standard) var(--ease-decel-in);
}
.btn:active, .chip:active, .stepper button:active, .theme-toggle:active, .oauth:active,
.prg-picker__button:active, .routine-card:active, .cal__nav button:active, .dash-tabbar button:active {
  transform: scale(0.97); transition-duration: var(--motion-instant); transition-timing-function: linear;
}
.btn[disabled]:active, .stepper button[disabled]:active { transform: none; }

/* Hit areas. A control drawn smaller than 44px still answers a 44px press
   (Pressable.tsx's hitSlop); what is drawn does not change. */
.chip, .segmented button, .btn--sm, .stepper button, .tick, .day--on, .cal__nav button { position: relative; }
.chip::after, .segmented button::after, .btn--sm::after, .stepper button::after { content: ""; position: absolute; inset: -4px 0; }
.tick::after, .day--on::after { content: ""; position: absolute; inset: -6px; }

/* Button (src/ui/Button.tsx). Accent is spent here, sparingly. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 44px; min-height: 46px; padding: 12px 20px;
  font-family: var(--font-text); font-size: 17px; font-weight: 600; line-height: 22px;
  border-radius: var(--radius-md); border: 0;
  background: var(--color-accent); color: var(--color-on-accent);
  cursor: pointer; user-select: none; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { text-decoration: none; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.4; cursor: default; }
.btn--sm { min-height: 36px; padding: 7px 14px; font-size: 15px; line-height: 20px; border-radius: var(--radius-sm); gap: 6px; }
.btn--lg { min-height: 54px; padding: 15px 26px; font-size: 18px; }
/* Secondary is tonal only: a surface fill, ink label, no border. */
.btn--secondary { background: var(--color-surface); color: var(--color-text); }
.btn--text { background: transparent; color: var(--color-accent); padding-left: 4px; padding-right: 4px; }
.btn--full { width: 100%; }
/* The destructive control's pre-resolved pair (D67), and the only red fill. */
.btn--destructive { background: var(--color-destructive-bg); color: var(--color-destructive-fg); }

/* Quiet: a plain ink2 action that sits beside a primary at the same height. */
.btn-quiet {
  min-height: 54px; display: inline-flex; align-items: center; padding: 0 8px;
  font-size: 18px; font-weight: 600; color: var(--color-text-quiet); cursor: pointer;
}
.btn-quiet:hover { color: var(--color-text); text-decoration: none; }

/* Pill: a status SIGNAL, never a button. */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px; border-radius: var(--radius-pill);
  font-family: var(--font-text); font-size: 12px; font-weight: 600; line-height: 16px; white-space: nowrap;
  background: var(--color-surface); color: var(--color-text-quiet);
}
.pill svg { flex: 0 0 auto; }
.pill--success { background: var(--color-success-soft); color: var(--color-success); }
.pill--accent  { background: var(--color-accent-soft);  color: var(--color-accent); }
.pill--danger  { background: var(--color-danger-soft);  color: var(--color-danger); }
.pill--record  { background: var(--color-record-soft);  color: var(--color-record); }

/* TextField: one tone off its ground, and it keeps its hairline (C7). Fields
   live in cards, so they sit on surface; in a canvas well they step up. */
.field { display: flex; flex-direction: column; gap: var(--space-2); width: 100%; }
.field__label { font-size: 15px; font-weight: 600; color: var(--color-text); }
.field__box {
  position: relative; display: flex; align-items: center; gap: var(--space-2);
  background: var(--color-surface); border: 1px solid var(--color-hairline);
  border-radius: var(--radius-md); padding: 0 var(--space-3); min-height: 48px;
  transition: border-color var(--motion-quick) var(--ease-decel);
}
.field__box:focus-within { border-color: var(--color-accent); }
.field__box > svg { flex: 0 0 auto; color: var(--color-text-decorative); }
.field input, .field select {
  flex: 1; min-width: 0; border: none; outline: none; background: transparent;
  font-family: var(--font-text); font-size: 17px; color: var(--color-text);
}
.field input::placeholder { color: var(--color-text-quiet); }
.field__help { font-size: 13px; color: var(--color-text-quiet); }
/* A select draws its own chevron, since the native arrow is unstyleable. */
.field__box:has(select)::after {
  content: ''; position: absolute; right: 15px; top: 50%; width: 8px; height: 8px;
  border-right: 1.8px solid var(--color-text-decorative);
  border-bottom: 1.8px solid var(--color-text-decorative);
  transform: translateY(-70%) rotate(45deg); pointer-events: none;
}
.field select { appearance: none; cursor: pointer; padding-right: 22px; }

/* Search (src/ui/SearchField.tsx): magnifier, tonal fill, no border (D-9b). */
.search {
  display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 12px;
  border-radius: var(--radius-md); background: var(--color-elevated); box-shadow: var(--elev-1);
  color: var(--color-text-decorative);
}
.search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: none;
  font-family: var(--font-text); font-size: 17px; color: var(--color-text);
}
.search input::placeholder { color: var(--color-text-quiet); }
.search input::-webkit-search-cancel-button { filter: grayscale(1); }
.search:focus-within { box-shadow: var(--elev-1), 0 0 0 2px var(--color-accent); }

/* Segmented (src/ui/Segmented.tsx): a surface track, an elevated thumb that
   slides on the quick timing, the chosen label in semibold ink. The thumb is a
   `.seg__thumb` placed by assets/js/segmented.js; with no script, the chosen
   segment carries the same elevated fill itself. */
.segmented {
  position: relative; display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  gap: 2px; padding: 2px; border-radius: var(--radius-md); background: var(--color-surface);
}
.segmented button {
  position: relative; z-index: 1; min-height: 36px; padding: 8px 16px; border: none;
  border-radius: var(--radius-sm); background: transparent;
  color: var(--color-text-quiet); font-family: var(--font-text);
  font-size: 15px; font-weight: 400; line-height: 20px;
  cursor: pointer; white-space: nowrap; -webkit-tap-highlight-color: transparent;
}
.segmented button[aria-selected="true"], .segmented button[aria-pressed="true"] {
  color: var(--color-text); font-weight: 600;
  background: var(--color-elevated); box-shadow: var(--elev-1);
}
.segmented.has-thumb button[aria-selected="true"], .segmented.has-thumb button[aria-pressed="true"] { background: transparent; box-shadow: none; }
.seg__thumb {
  position: absolute; top: 2px; bottom: 2px; left: 0; width: 0; z-index: 0;
  border-radius: var(--radius-sm); background: var(--color-elevated); box-shadow: var(--elev-1);
  transition: transform var(--motion-quick) var(--ease-decel), width var(--motion-quick) var(--ease-decel),
              background-color var(--motion-standard) var(--ease-decel-in);
}

/* Chip (src/ui/Chip.tsx): surface, and when chosen accent-soft with a check. */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 8px 16px;
  border: 0; border-radius: var(--radius-pill); background: var(--color-surface);
  color: var(--color-text); font-family: var(--font-text); font-size: 15px; line-height: 20px;
  cursor: pointer; white-space: nowrap; -webkit-tap-highlight-color: transparent;
}
.chip svg { display: none; flex: 0 0 auto; }
.chip[aria-pressed="true"] { padding-left: 12px; background: var(--color-accent-soft); color: var(--color-accent); font-weight: 600; }
.chip[aria-pressed="true"] svg { display: block; }

/* Stepper (src/ui/Stepper.tsx): accent-soft buttons, the value between them. */
.stepper { display: inline-flex; align-items: center; gap: 8px; }
.stepper button {
  min-width: 44px; min-height: 36px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: var(--radius-sm);
  background: var(--color-accent-soft); color: var(--color-accent);
  font-family: var(--font-text); font-size: 20px; font-weight: 600; line-height: 1; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.stepper button[disabled] { background: var(--color-surface); color: var(--color-text-decorative); cursor: default; }
.stepper__value {
  min-width: 56px; height: 22px; overflow: hidden; text-align: center;
  font-variant-numeric: tabular-nums; font-size: 17px; font-weight: 600; line-height: 22px; color: var(--color-text);
}

/* The digit roll (src/ui/DigitRoll.tsx): a changed number enters from one line
   above or below, by direction, on the quick timing. */
.roll { display: inline-block; animation: roll-up var(--motion-quick) var(--ease-decel); }
.roll--down { animation-name: roll-down; }
@keyframes roll-up { from { transform: translateY(70%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes roll-down { from { transform: translateY(-70%); opacity: 0; } to { transform: none; opacity: 1; } }

/* Card (src/ui/Card.tsx): elevated + elev-1, radius 16, no border. */
.card { background: var(--color-elevated); border-radius: var(--radius-lg); box-shadow: var(--elev-1); }
.card--xl { border-radius: var(--radius-xl); }
.card--pad { padding: 20px; }

/* A recessed tile: a canvas square holding a glyph in decorative ink, so a
   status is never carried by colour alone. */
.tile {
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
  background: var(--color-canvas); color: var(--color-text-decorative);
}
.tile--44 { width: 44px; height: 44px; border-radius: var(--radius-md); }
.tile--32 { width: 32px; height: 32px; border-radius: var(--radius-sm); }

/* A hairline dividing rows inside a card, inset to clear the leading glyph. */
.divider-60 { position: absolute; left: 60px; right: 0; top: 0; height: 1px; background: var(--color-hairline); }

/* Section header (src/ui/SectionHeader.tsx): above its group, never inside it. */
.eyebrow {
  margin: 0 0 8px; font-size: 13px; font-weight: 600; line-height: 18px; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--color-text-quiet);
}

/* Notice: a non-blocking line for an outcome. */
.notice { margin: 0 0 16px; padding: 12px 16px; border-radius: var(--radius-md); font-size: 15px; line-height: 1.5; }
.notice--danger { background: var(--color-danger-soft); color: var(--color-danger); }
.notice--success { background: var(--color-success-soft); color: var(--color-success); }
.notice--success:not([hidden]) { animation: rise-in var(--motion-quick) var(--ease-decel); }

/* Entering content rises 8px and fades in, on the quick timing (listMotion.ts). */
@keyframes rise-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
/* A panel opening in place rises like the app's sheet transition. */
@keyframes sheet-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ============================================================== type helpers */

.display {
  font-family: var(--font-display); font-weight: 700;
  letter-spacing: -0.025em; line-height: 1.12; color: var(--color-text);
  text-wrap: balance;
}
.h-hero    { margin: 0; font-size: clamp(36px, 4.6vw, 56px); line-height: 1.05; letter-spacing: -0.03em; }
.h-page    { margin: 0 0 10px; font-size: clamp(32px, 4vw, 44px); line-height: 1.1; }
.h-legal   { margin: 0 0 6px; font-size: clamp(30px, 4vw, 40px); line-height: 1.14; }
.h-section { margin: 0 0 8px; font-size: clamp(28px, 3vw, 36px); line-height: 1.12; letter-spacing: -0.022em; }
.h-lead    { margin: 0 0 16px; font-size: clamp(28px, 3.4vw, 40px); line-height: 1.12; letter-spacing: -0.024em; }

.lede { margin: 0 0 32px; font-size: 19px; line-height: 1.5; color: var(--color-text-quiet); text-wrap: pretty; }
.quiet { color: var(--color-text-quiet); }

/* ==================================================================== layout */

.section { padding-top: 88px; }
.section--first { padding-top: 64px; }
.grid { display: grid; gap: 16px; }
.grid--240 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid--230 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid--220 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* ====================================================================== home */

.hero {
  padding-top: 48px; padding-bottom: 32px;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 48px; align-items: center;
}
.hero__sub { margin: 20px 0 0; font-size: clamp(17px, 1.6vw, 21px); line-height: 1.5; color: var(--color-text-quiet); max-width: 36ch; }
.hero__cta { margin-top: 32px; display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; }
.hero__price { margin: 20px 0 0; font-size: 15px; line-height: 1.5; color: var(--color-text-quiet); }

/* The phone: a drawn titanium iPhone at the captures' own 1206 x 2622, with
   the status bar drawn over the band the captures had painted out. */
.phone-col { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.phone {
  position: relative; width: min(330px, 76vw); padding: 11px; border-radius: 58px;
  background: #1A1B1F;
  box-shadow: inset 0 0 0 1.5px #3A3C42, inset 0 0 0 4px #121316,
              0 40px 80px -24px rgba(0, 0, 0, 0.45), 0 12px 30px rgba(0, 0, 0, 0.16);
}
/* The side buttons. */
.phone::before { content: ""; position: absolute; right: -3px; top: 23%; width: 3px; height: 13%; border-radius: 0 3px 3px 0; background: #2A2B30; }
.phone::after { content: ""; position: absolute; left: -3px; top: 19%; width: 3px; height: 6.5%; border-radius: 3px 0 0 3px; background: #2A2B30; box-shadow: 0 50px 0 #2A2B30; }
.phone__screen {
  position: relative; aspect-ratio: 1206 / 2622; border-radius: 47px; overflow: hidden;
  background: var(--color-canvas); container-type: inline-size; touch-action: pan-y;
}
.phone__panel { position: absolute; inset: 0; will-change: transform; }
.phone__panel img, .phone__panel picture { display: block; width: 100%; height: 100%; }
.phone__panel img { object-fit: cover; }
.phone__status { position: absolute; z-index: 2; inset: 0 0 auto 0; height: 13.7cqw; color: var(--color-text); pointer-events: none; }
.phone__clock {
  position: absolute; left: 14.6cqw; top: 8.1cqw; transform: translate(-50%, -50%);
  font-size: 4.3cqw; font-weight: 600; line-height: 1; letter-spacing: -0.01em; font-variant-numeric: tabular-nums;
}
.phone__island { position: absolute; left: 50%; top: 3.6cqw; width: 30.5cqw; height: 9cqw; transform: translateX(-50%); border-radius: var(--radius-pill); background: #000; }
.phone__meters { position: absolute; right: 7.4cqw; top: 8.1cqw; transform: translateY(-50%); display: flex; align-items: center; gap: 1.5cqw; }
.phone__meters svg { display: block; height: 3.1cqw; width: auto; }
.phone__caption { margin: 0; min-height: 20px; font-size: 15px; font-weight: 600; line-height: 20px; color: var(--color-text); }
.phone__dots { display: flex; gap: 8px; align-items: center; }
.phone__dots button {
  width: 8px; height: 8px; padding: 0; border: none; border-radius: var(--radius-pill);
  background: var(--color-text-quiet); opacity: 0.5; cursor: pointer;
  transition: width var(--motion-quick) var(--ease-decel), background-color var(--motion-quick) var(--ease-decel);
}
.phone__dots button[aria-current="true"] { width: 22px; background: var(--color-accent); opacity: 1; }
/* The hit area is 44px; the dot is what is drawn. */
.phone__dots button { position: relative; }
.phone__dots { gap: 0; }
.phone__dots button { margin: 0 4px; }
.phone__dots button::after { content: ""; position: absolute; inset: -18px -8px; }
.phone__dots .phone__pause {
  margin: 0 0 0 12px; width: 36px; height: 36px; display: grid; place-items: center; padding: 0; opacity: 1;
  border: 0; border-radius: var(--radius-pill); background: var(--color-surface); color: var(--color-text-quiet); cursor: pointer;
}
.phone__dots .phone__pause::after { inset: -4px; }
.phone__dots .phone__pause:hover { color: var(--color-text); }
.phone__pause svg { display: block; }
.phone__pause .icon-play { display: none; }
.phone__pause[aria-pressed="true"] .icon-play { display: block; }
.phone__pause[aria-pressed="true"] .icon-pause { display: none; }

.feature-card { background: var(--color-elevated); border-radius: var(--radius-lg); box-shadow: var(--elev-1); padding: 20px; }
.feature-card h3 { margin: 0 0 6px; font-size: 17px; font-weight: 600; line-height: 22px; color: var(--color-text); }
.feature-card p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--color-text-quiet); }

.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 48px; align-items: start; }

/* The three rules: one grouped list, hairlines inside the card. */
.rules { overflow: hidden; }
.rule { position: relative; display: flex; gap: 12px; padding: 14px 16px; }
.rule + .rule::before { content: ""; position: absolute; left: 50px; right: 0; top: 0; height: 1px; background: var(--color-hairline); }
.rule > svg { flex: 0 0 auto; margin-top: 1px; color: var(--color-success); }
.rule p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--color-text-quiet); }
.rule strong { color: var(--color-text); font-weight: 600; }

/* The app's exercise card, as it renders in the logger (ExerciseCard.tsx). */
.ex-card { padding: 16px; }
.ex-card__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.ex-card__name { margin: 0; font-size: 20px; font-weight: 600; line-height: 25px; color: var(--color-text); }
.ex-card__meta { font-size: 13px; color: var(--color-text-quiet); }
/* The engine's line: a canvas well, the success arrow, the line in semibold. */
.whyline {
  margin: 12px 0; display: flex; gap: 10px; align-items: center;
  padding: 10px 12px; border-radius: var(--radius-md); background: var(--color-canvas);
}
.whyline > svg { flex: 0 0 auto; color: var(--color-success); }
.whyline__title { margin: 0; flex: 1; min-width: 0; font-size: 15px; font-weight: 600; line-height: 20px; color: var(--color-text); }
/* The progression marks (ProgressionMarks.tsx): never accent. Lit marks are full
   height; while the engine is urging they take the success signal. */
.whyline__marks { flex: 0 0 auto; align-self: center; display: flex; align-items: center; gap: 4px; }
.whyline__marks i { width: 32px; height: 4px; border-radius: var(--radius-pill); background: var(--color-success); }
.setgrid { display: grid; grid-template-columns: 36px minmax(0, 1fr) 80px 64px 44px; row-gap: 4px; align-items: center; }
.setgrid__h { padding: 4px 0; font-size: 13px; color: var(--color-text-quiet); }
.setgrid__h--c { text-align: center; }
.setrow { display: contents; }
.setrow > * { min-height: 40px; display: flex; align-items: center; transition: background-color var(--motion-quick) var(--ease-decel); }
.setrow__n { justify-content: center; font-size: 17px; font-weight: 600; color: var(--color-text); }
.setrow__prev { font-size: 15px; color: var(--color-text-quiet); font-variant-numeric: tabular-nums; }
.setrow__cell { justify-content: center; }
.setrow__cell span {
  width: calc(100% - 8px); padding: 7px 0; border-radius: var(--radius-sm); background: var(--color-canvas);
  font-size: 17px; font-weight: 600; text-align: center; color: var(--color-text); font-variant-numeric: tabular-nums;
}
.setrow--ghost .setrow__cell span { font-weight: 400; color: var(--color-text-quiet); }
.setrow--logged > * { background: var(--color-success-soft); }
.setrow--logged > :first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.setrow--logged > :last-child { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.setrow--logged .setrow__cell span { background: transparent; }
.setrow__tick { justify-content: center; }
.tick {
  width: 32px; height: 32px; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: var(--radius-sm); background: var(--color-canvas); color: var(--color-text-quiet); cursor: pointer;
}
.tick[aria-pressed="true"] { background: var(--color-success); color: var(--color-on-accent); }
/* The tick pop: a reward, so it springs on the emphasis curve. */
.tick.is-popping { animation: tick-pop var(--motion-emphasis) var(--ease-reward); }
@keyframes tick-pop { from { transform: scale(0.7); } to { transform: scale(1); } }

/* The run the engine counted. One grid, three columns sized once, so the
   weights line up down the card instead of per row. */
.run { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 14px; align-items: baseline; padding: 4px 16px; }
.run > span { padding: 11px 0; white-space: nowrap; }
.run > span:nth-child(n + 4) { border-top: 1px solid var(--color-hairline); }
.run__date { font-size: 15px; color: var(--color-text-quiet); }
.run__load { font-size: 17px; font-weight: 600; color: var(--color-text); font-variant-numeric: tabular-nums; }
.run__note { text-align: right; font-size: 14px; font-weight: 600; color: var(--color-text-quiet); }
.run__note--final { color: var(--color-success); }
.run .is-skipped { opacity: 0.6; font-weight: 400; }

.pro-card { background: var(--color-elevated); border-radius: var(--radius-lg); box-shadow: var(--elev-1); padding: 22px; }
.pro-card__n { font-size: 13px; font-weight: 600; color: var(--color-text-quiet); font-variant-numeric: tabular-nums; }
.pro-card h3 { margin: 8px 0 6px; font-size: 19px; font-weight: 600; letter-spacing: -0.01em; color: var(--color-text); }
.pro-card p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--color-text-quiet); }

.compare {
  background: var(--color-elevated); border-radius: var(--radius-xl); box-shadow: var(--elev-1);
  padding: clamp(24px, 3vw, 40px);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: clamp(24px, 3vw, 48px);
}
.compare h3 { margin: 0 0 6px; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; color: var(--color-text); }
.compare__sub { margin: 0 0 16px; font-size: 15px; color: var(--color-text-quiet); }
.compare__list { display: flex; flex-direction: column; font-size: 16px; color: var(--color-text); }
.compare__list span { display: flex; gap: 10px; align-items: center; padding: 9px 0; }
.compare__list span + span { border-top: 1px solid var(--color-hairline); }
.compare__list span { position: relative; padding-left: 26px; }
.compare__list span::before {
  content: ""; position: absolute; left: 0; top: 50%; width: 16px; height: 16px; margin-top: -8px;
  border-radius: var(--radius-pill); background: var(--color-success-soft);
}
.compare__list span::after {
  content: ""; position: absolute; left: 5.5px; top: 50%; width: 3.5px; height: 7px; margin-top: -5px;
  border-right: 2px solid var(--color-success); border-bottom: 2px solid var(--color-success); transform: rotate(45deg);
}

/* ============================================================= prose (how it works, legal) */

.prose { padding: 56px 0 96px; color: var(--color-text); line-height: 1.65; }
.prose h2 { margin: 0 0 10px; font-size: 22px; font-weight: 700; line-height: 1.25; letter-spacing: -0.015em; color: var(--color-text); }
.prose p { margin: 0 0 14px; }
.prose p:last-child { margin-bottom: 0; }
.prose .gap { margin-bottom: 44px; }
.prose strong { color: var(--color-text); font-weight: 600; }
.prose ul { margin: 0 0 16px; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.prose .h2-row { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.prose .h2-row h2 { margin: 0; }
.prose .whyline { margin: 8px 0 24px; }
.effective { margin: 0 0 36px; font-size: 15px; color: var(--color-text-quiet); }

.legal h2 { font-size: 20px; font-weight: 600; letter-spacing: 0; }
.legal p { margin: 0 0 16px; }
.legal .gap { margin-bottom: 32px; }

.faq h2 { margin: 0 0 8px; font-size: 20px; font-weight: 600; color: var(--color-text); }
.faq p { margin: 0 0 36px; color: var(--color-text); }
.faq p:last-child { margin-bottom: 0; }

.support-card { padding: 24px; margin-bottom: 40px; }
.support-card p:first-child { margin: 0 0 4px; font-size: 15px; color: var(--color-text-quiet); }
.support-card__email { margin: 0 0 12px; font-size: 20px; font-weight: 600; }
.support-card p:last-child { margin: 0; font-size: 15px; line-height: 1.6; color: var(--color-text-quiet); }

/* =================================================================== pricing */

.plan-row { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; margin-bottom: 12px; }

.country { position: relative; min-width: min(280px, 100%); }
.country__button {
  width: 100%; min-height: 46px; display: flex; align-items: center; gap: 10px;
  padding: 0 14px; border: none; border-radius: var(--radius-md);
  background: var(--color-surface); cursor: pointer;
  font-family: var(--font-text); font-size: 16px; color: var(--color-text); text-align: left;
}
.country__button > svg { flex: 0 0 auto; color: var(--color-text-decorative); }
.country__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.country__code { flex: 0 0 auto; font-size: 14px; font-weight: 600; color: var(--color-text-quiet); font-variant-numeric: tabular-nums; }
.country__menu {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30;
  background: var(--color-elevated); border-radius: var(--radius-lg); box-shadow: var(--elev-3); overflow: hidden;
  animation: sheet-in var(--motion-quick) var(--ease-decel);
}
.country__search { padding: 10px 10px 8px; }
.country__search .field__box { background: var(--color-canvas); border-color: transparent; min-height: 42px; }
.country__list { max-height: 280px; overflow-y: auto; padding: 0 6px 8px; }
.country__list button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 44px; padding: 0 12px; border: none; border-radius: 10px;
  background: transparent; cursor: pointer; text-align: left;
  font-family: var(--font-text); font-size: 16px; color: var(--color-text);
}
.country__list button:hover { background: var(--color-surface); }
.country__list button[aria-selected="true"] { background: var(--color-accent-soft); color: var(--color-accent); font-weight: 600; }
.country__list button span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.country__list button span:last-child { flex: 0 0 auto; font-size: 13px; font-weight: 600; color: var(--color-text-quiet); }
.country__empty { margin: 0; padding: 12px; font-size: 15px; color: var(--color-text-quiet); }

.price-note { margin: 0 0 6px; font-size: 14px; color: var(--color-text-quiet); }
.price-note--wide { margin: 0 0 28px; max-width: 64ch; font-size: 14px; line-height: 1.55; color: var(--color-text-quiet); }

.price-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 64px; }
.price-card {
  background: var(--color-elevated); border-radius: var(--radius-xl); box-shadow: var(--elev-1);
  padding: 28px; display: flex; flex-direction: column;
}
.price-card--pro { box-shadow: var(--elev-2); }
.price-card h2 { margin: 0 0 6px; font-size: 20px; font-weight: 600; color: var(--color-text); }
.price-card__sub { margin: 0 0 20px; font-size: 15px; color: var(--color-text-quiet); }
.price-card__amount {
  margin: 0 0 4px; height: 46px; overflow: hidden;
  font-family: var(--font-display); font-size: 44px; line-height: 46px;
  font-weight: 700; letter-spacing: -0.03em; color: var(--color-text); font-variant-numeric: tabular-nums;
}
.price-card__per { margin: 0 0 8px; font-size: 15px; color: var(--color-text-quiet); }
.price-card__free-per { margin: 0 0 24px; font-size: 15px; color: var(--color-text-quiet); }
.price-card__derived { margin: 0 0 24px; font-size: 14px; line-height: 1.5; color: var(--color-text-quiet); min-height: 21px; }
.price-card__body { margin: 0; font-size: 15px; line-height: 1.6; color: var(--color-text-quiet); }
.price-card__foot { margin-top: auto; }
.price-card__billed { margin: 12px 0 0; font-size: 14px; color: var(--color-text-quiet); }

.matrix { background: var(--color-elevated); border-radius: var(--radius-xl); box-shadow: var(--elev-1); overflow: hidden; }
.matrix__row { position: relative; display: grid; grid-template-columns: 1fr 84px 84px; gap: 12px; padding: 13px 20px; align-items: center; font-size: 16px; }
.matrix__row + .matrix__row::before { content: ""; position: absolute; left: 20px; right: 0; top: 0; height: 1px; background: var(--color-hairline); }
.matrix__head { font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--color-text-quiet); }
.matrix__head span:not(:first-child) { text-align: center; }
.matrix__yes { display: flex; justify-content: center; color: var(--color-success); }
.matrix__no { display: flex; justify-content: center; color: var(--color-text-decorative); font-size: 15px; }

/* ================================================================= dashboard */

.dash-gate { padding-top: 56px; padding-bottom: 96px; }

.signin { width: min(460px, 100%); margin: 0 auto; padding: 64px 24px 96px; }
.signin__card {
  background: var(--color-elevated); border-radius: var(--radius-xl); box-shadow: var(--elev-1);
  padding: 24px; display: flex; flex-direction: column; gap: 16px;
}
.signin__or { display: flex; align-items: center; gap: 12px; }
.signin__or span:first-child, .signin__or span:last-child { flex: 1; height: 1px; background: var(--color-hairline); }
.signin__or span:nth-child(2) { font-size: 13px; color: var(--color-text-quiet); }
.oauth {
  min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  border: 0; border-radius: var(--radius-md);
  background: var(--color-surface); color: var(--color-text);
  font-family: var(--font-text); font-size: 16px; font-weight: 600; cursor: pointer;
}
.signin__foot { margin: 0; font-size: 14px; line-height: 1.55; color: var(--color-text-quiet); }

/* Loading is row placeholders shaped like the content. Never a spinner. */
.skeleton__line { height: 14px; width: 120px; border-radius: var(--radius-pill); background: var(--color-surface); }
.skeleton__title { height: 34px; width: 220px; border-radius: var(--radius-sm); background: var(--color-surface); margin-top: 14px; }
.skeleton__rows { margin-top: 32px; display: flex; flex-direction: column; gap: 12px; }
.skeleton__row { height: 70px; border-radius: var(--radius-lg); background: var(--color-elevated); box-shadow: var(--elev-1); }
.skeleton__rows .skeleton__row:nth-child(2) { opacity: 0.75; }
.skeleton__rows .skeleton__row:nth-child(3) { opacity: 0.5; }
.skeleton__rows .skeleton__row:nth-child(4) { opacity: 0.3; }

/* Lapsed: a neutral notice. Gold only ever means a record in this app. */
.dash-banner {
  margin: 24px 0 0; background: var(--color-elevated); border-radius: var(--radius-lg); box-shadow: var(--elev-1);
  padding: 16px 20px; display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: flex-start;
}
.dash-banner > svg { flex: 0 0 auto; color: var(--color-text-quiet); margin-top: 1px; }
.dash-banner div { flex: 1; min-width: 220px; }
.dash-banner p { margin: 0; font-size: 16px; font-weight: 600; color: var(--color-text); }
.dash-banner p + p { margin: 4px 0 0; font-size: 15px; font-weight: 400; line-height: 1.5; color: var(--color-text-quiet); }

.dash-head { padding: 0 0 20px; display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; justify-content: space-between; }
.dash-head > div { min-width: 0; }
.dash-head h1 { margin: 0; font-family: var(--font-display); font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: -0.02em; color: var(--color-text); }
.dash-head__email { margin: 0 0 2px; font-size: 13px; line-height: 18px; color: var(--color-text-quiet); }

.dash-body { display: flex; gap: 36px; align-items: flex-start; padding-top: 28px; }
.dash-rail { flex: 0 0 208px; position: sticky; top: 84px; display: flex; flex-direction: column; gap: 2px; }
.dash-rail button {
  min-height: 44px; display: flex; align-items: center; gap: 12px; padding: 0 12px;
  border: none; border-radius: var(--radius-md); background: transparent;
  font-family: var(--font-text); font-size: 16px; font-weight: 500;
  color: var(--color-text-quiet); cursor: pointer; text-align: left;
}
.dash-rail button:hover { color: var(--color-text); }
.dash-rail button:active { opacity: 0.6; }
.dash-rail button[aria-current="true"] { background: var(--color-elevated); box-shadow: var(--elev-1); color: var(--color-text); font-weight: 600; }
.dash-rail button[aria-current="true"] svg { color: var(--color-accent); }
.dash-main { flex: 1; min-width: 0; }

/* Below 900px the rail becomes the app's floating capsule. Solid first; glass
   only where the browser blurs. */
.dash-tabbar {
  position: fixed; z-index: 40; left: 12px; right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  display: none; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 2px;
  max-width: 560px; margin: 0 auto; padding: 6px; border-radius: var(--radius-pill);
  background: var(--color-elevated); box-shadow: var(--elev-2);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .dash-tabbar { background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); }
}
@media (prefers-reduced-transparency: reduce) {
  .dash-tabbar { background: var(--color-elevated); backdrop-filter: none; -webkit-backdrop-filter: none; }
}
.dash-tabbar button {
  min-width: 0; min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 4px 0; border: none; border-radius: var(--radius-pill); background: transparent; cursor: pointer;
  font-family: var(--font-text); font-size: 10px; font-weight: 500; line-height: 12px; color: var(--color-text);
  -webkit-tap-highlight-color: transparent;
}
.dash-tabbar button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-tabbar button[aria-current="true"] { background: var(--color-surface); color: var(--color-accent); font-weight: 600; }

.tab-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.tab-head h2 { margin: 0; font-size: 20px; font-weight: 600; color: var(--color-text); }
.tab-head .prg-picker { margin: 0; }
.tab-head__meta { font-size: 15px; color: var(--color-text-quiet); font-variant-numeric: tabular-nums; }
.tab-intro { margin: -4px 0 16px; max-width: 62ch; font-size: 15px; line-height: 1.55; color: var(--color-text-quiet); }
.tab-title { margin: 0 0 8px; font-size: 20px; font-weight: 600; line-height: 25px; color: var(--color-text); }

/* History: the month calendar and its totals beside the month's workouts. */
.hist { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 24px; align-items: start; }
.hist__side { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 12px; }
.cal { padding: 16px; }
.cal__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
.cal__title { margin: 0; font-size: 17px; font-weight: 600; line-height: 22px; color: var(--color-text); }
.cal__totals { margin: 2px 0 0; display: flex; flex-wrap: wrap; gap: 0 10px; font-size: 13px; line-height: 18px; color: var(--color-text-quiet); font-variant-numeric: tabular-nums; }
.cal__nav { display: flex; gap: 2px; margin: -6px -6px 0 0; }
.cal__nav button {
  width: 44px; height: 44px; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: var(--radius-pill); background: none; color: var(--color-accent); cursor: pointer;
}
.cal__nav button[disabled] { color: var(--color-text-decorative); opacity: 0.5; cursor: default; }
.cal__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); row-gap: 12px; justify-items: center; }
.cal__dow { font-size: 12px; line-height: 16px; color: var(--color-text-quiet); }
.day {
  width: 32px; height: 32px; display: grid; place-items: center; padding: 0; border: 0; border-radius: var(--radius-pill);
  background: none; font-family: var(--font-text); font-size: 15px; line-height: 1; color: var(--color-text-quiet);
  font-variant-numeric: tabular-nums;
}
/* Trained is a SHAPE (the ink disc), so colour is never the only signal; a
   record adds the gold ring and says so in the day's label. */
.day--on { background: var(--color-text); color: var(--color-canvas); font-weight: 600; cursor: pointer; }
.day--on:active { opacity: 0.6; }
.day--rec { box-shadow: 0 0 0 2px var(--color-elevated), 0 0 0 4px var(--color-record); }
.day--today { color: var(--color-text); font-weight: 600; }
.stats { display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; }
.stat { padding: 14px 16px; min-width: 0; }
.stat:nth-child(odd) { border-right: 1px solid var(--color-hairline); }
.stat:nth-child(n + 3) { border-top: 1px solid var(--color-hairline); }
.stat__value { display: block; font-size: 22px; font-weight: 700; line-height: 28px; letter-spacing: -0.01em; color: var(--color-text); font-variant-numeric: tabular-nums; }
.stat__label { font-size: 13px; line-height: 18px; color: var(--color-text-quiet); }

.week + .week { padding-top: 20px; }
.week > h3 { margin: 0 0 8px; padding-left: 4px; font-size: 13px; font-weight: 600; line-height: 18px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--color-text-quiet); }
.week__list { background: var(--color-elevated); border-radius: var(--radius-lg); box-shadow: var(--elev-1); overflow: hidden; }

/* A workout row (SessionRow.tsx): the date block, the name, structured
   metadata, the gold chip, and the volume right-aligned into a column. */
.session { position: relative; scroll-margin-top: 96px; }
.session + .session::before { content: ""; position: absolute; left: 16px; right: 0; top: 0; height: 1px; background: var(--color-hairline); }
.session__toggle {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto 14px; gap: 14px; align-items: center;
  width: 100%; min-height: 64px; padding: 12px 16px; border: none; background: transparent;
  cursor: pointer; text-align: left; font-family: var(--font-text); color: var(--color-text);
}
.session__toggle:active { opacity: 0.6; }
.session__date { text-align: center; }
.session__day { display: block; font-size: 22px; font-weight: 700; line-height: 26px; font-variant-numeric: tabular-nums; }
.session__month { display: block; font-size: 11px; font-weight: 600; line-height: 14px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--color-text-quiet); }
.session__main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.session__name { font-size: 17px; font-weight: 600; line-height: 22px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session__meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 13px; line-height: 18px; color: var(--color-text-quiet); font-variant-numeric: tabular-nums; }
.session__volume { text-align: right; font-size: 17px; font-weight: 600; line-height: 22px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.session__unit { display: block; font-size: 12px; font-weight: 400; line-height: 16px; color: var(--color-text-quiet); }
.session__caret { display: inline-flex; color: var(--color-text-decorative); transition: transform var(--motion-quick) var(--ease-decel); }
.session__toggle[aria-expanded="true"] .session__caret { transform: rotate(90deg); }
.session__detail { padding: 0 16px 16px 70px; display: flex; flex-direction: column; gap: 10px; animation: sheet-in var(--motion-standard) var(--ease-decel-in); }
/* Each exercise is a well recessed into the card. */
.session__exercise { padding: 12px; border-radius: var(--radius-md); background: var(--color-canvas); }
.session__exercise-head { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.session__exercise-head h4 { margin: 0 4px 0 0; font-size: 17px; font-weight: 600; line-height: 22px; color: var(--color-text); }
.session__perside { margin: 6px 0 0; font-size: 13px; color: var(--color-text-quiet); }
.session__sets { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; column-gap: 10px; align-items: baseline; margin-top: 6px; }
.session__set-n { font-size: 13px; line-height: 26px; color: var(--color-text-quiet); text-align: center; font-variant-numeric: tabular-nums; }
.session__set-v { font-size: 17px; font-weight: 600; line-height: 26px; color: var(--color-text); font-variant-numeric: tabular-nums; }
.session__set-v .x { font-weight: 400; color: var(--color-text-quiet); }
.session__set-t { font-size: 13px; line-height: 26px; color: var(--color-text-quiet); text-align: right; }
.session__set-t--record { color: var(--color-record); font-weight: 600; }
.session__hint { margin: 0; font-size: 14px; color: var(--color-text-quiet); }

/* Progress */
.prg-picker { position: relative; margin-bottom: 16px; }
.prg-picker__button {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; min-height: 44px; max-width: 100%;
  border: none; border-radius: var(--radius-pill); background: var(--color-surface); cursor: pointer; font-family: var(--font-text);
  color: var(--color-text);
}
.prg-picker__name { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prg-picker__button > svg { color: var(--color-text-decorative); }
.prg-picker__menu {
  position: absolute; z-index: 5; top: calc(100% + 6px); left: 0; min-width: 260px; max-width: calc(100vw - 32px);
  max-height: 320px; overflow-y: auto; padding: 6px;
  background: var(--color-elevated); border-radius: var(--radius-lg); box-shadow: var(--elev-3);
  animation: sheet-in var(--motion-quick) var(--ease-decel);
}
.prg-picker__menu button {
  display: flex; align-items: center; width: 100%; padding: 10px 12px; min-height: 44px;
  border: none; border-radius: 10px; background: transparent; cursor: pointer; text-align: left;
  font-family: var(--font-text); font-size: 16px; color: var(--color-text);
}
.prg-picker__menu button:hover { background: var(--color-surface); }
.prg-picker__menu button[aria-selected="true"] { color: var(--color-accent); background: var(--color-accent-soft); font-weight: 600; }

.chart-card { background: var(--color-elevated); border-radius: var(--radius-lg); box-shadow: var(--elev-1); padding: 16px; margin-bottom: 24px; }
.chart-card .segmented { margin-bottom: 4px; }
.chart-readout { margin: 12px 0 2px; min-height: 19px; font-size: 13px; color: var(--color-text-quiet); font-variant-numeric: tabular-nums; }
.chart-frame { position: relative; padding: 6px 0 0 44px; }
.chart-scroll {
  overflow-x: auto; overflow-y: hidden; padding: 0 24px 8px 18px;
  /* The platform scrollbar is a grey slab that belongs to no palette. This one
     is drawn from the tokens, so it recedes in both modes. */
  scrollbar-width: thin;
  scrollbar-color: var(--color-hairline) transparent;
}
.chart-scroll::-webkit-scrollbar { height: 8px; }
.chart-scroll::-webkit-scrollbar-track { background: transparent; }
.chart-scroll::-webkit-scrollbar-thumb { background: var(--color-hairline); border-radius: var(--radius-pill); }
.chart-scroll:hover::-webkit-scrollbar-thumb { background: var(--color-text-decorative); }
.chart-plot { position: relative; height: 200px; }
.chart-plot svg { display: block; overflow: visible; }
.chart-guide { position: absolute; top: 0; height: 176px; width: 1px; background: var(--color-text); opacity: 0.3; }
/* Every session is a 3px accent point; the picked one gets the 8px halo. */
.chart-point { position: absolute; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: var(--radius-pill); background: var(--color-accent); pointer-events: none; }
/* A record is a gold diamond (ProgressChart.tsx). */
.chart-point--record { width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 1.5px; background: var(--color-record); transform: rotate(45deg); }
.chart-dot {
  position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: var(--radius-pill);
  background: var(--color-accent); box-shadow: 0 0 0 8px color-mix(in srgb, var(--color-accent) 20%, transparent); pointer-events: none;
}
.chart-dot--last { box-shadow: none; }
.chart-lastlabel { position: absolute; padding-right: 8px; font-size: 12px; font-weight: 600; color: var(--color-text); font-variant-numeric: tabular-nums; white-space: nowrap; pointer-events: none; }
.chart-hit { position: absolute; top: 0; height: 176px; width: 32px; transform: translateX(-50%); border: none; background: transparent; padding: 0; cursor: pointer; }
.chart-xtick { position: absolute; top: 184px; transform: translateX(-50%); font-size: 11px; color: var(--color-text-quiet); white-space: nowrap; }
.chart-ytick { position: absolute; left: 0; width: 34px; text-align: right; transform: translateY(-50%); font-size: 11px; color: var(--color-text-quiet); font-variant-numeric: tabular-nums; }
.chart-key { margin: 10px 0 0; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--color-text-quiet); }
.chart-key::before { content: ""; width: 8px; height: 8px; border-radius: 1px; background: var(--color-record); transform: rotate(45deg); }

.bests { background: var(--color-elevated); border-radius: var(--radius-lg); box-shadow: var(--elev-1); overflow: hidden; }
.best-row { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 52px; }
.best-row__label { flex: 1; min-width: 0; font-size: 15px; color: var(--color-text-quiet); }
.best-row__value { flex: 0 0 auto; font-size: 17px; font-weight: 600; color: var(--color-text); font-variant-numeric: tabular-nums; }
.best-row__value--absent { font-size: 15px; font-weight: 400; color: var(--color-text-quiet); }
.bests-note { margin: 14px 0 0; max-width: 62ch; font-size: 14px; line-height: 1.55; color: var(--color-text-quiet); }

/* A link that behaves like one but is a button, so it is reachable and honest. */
.linkish {
  background: none; border: none; padding: 0; cursor: pointer;
  font-family: var(--font-text); font-size: inherit; font-weight: 600;
  color: var(--color-accent);
}

/* A small square control inside a row: reorder, remove. */
.icon-btn {
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: var(--radius-sm); background: transparent;
  color: var(--color-text-decorative); cursor: pointer;
}
.icon-btn:hover { background: var(--color-canvas); color: var(--color-text); }
.icon-btn[disabled] { opacity: 0.32; cursor: default; }
.icon-btn--danger:hover { color: var(--color-danger); }
/* Remove is the plus turned into a cross. */
.icon-btn[data-routine-remove] svg,
.icon-btn[data-routine-set-remove] svg { transform: rotate(45deg); }

/* Exercises */
.ex-tools { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.ex-tools .search { max-width: 420px; }
.ex-group { margin-bottom: 24px; }
.ex-group > h3 { margin: 0 0 8px; padding-left: 4px; font-size: 13px; font-weight: 600; line-height: 18px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--color-text-quiet); }
.ex-list { background: var(--color-elevated); border-radius: var(--radius-lg); box-shadow: var(--elev-1); overflow: hidden; }
.ex-row {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 16px; min-height: 56px; border: none; background: transparent;
  cursor: pointer; text-align: left; font-family: var(--font-text);
}
.ex-row:active { opacity: 0.6; }
.ex-row + .ex-row::before, .ex-panel + .ex-row::before { content: ""; position: absolute; left: 16px; right: 0; top: 0; height: 1px; background: var(--color-hairline); }
.ex-row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ex-row__name { font-size: 17px; line-height: 22px; color: var(--color-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-row[aria-expanded="true"] .ex-row__name { font-weight: 600; }
.ex-row__own { font-size: 13px; line-height: 18px; color: var(--color-text-quiet); }
.ex-row__best { flex: 0 0 auto; font-size: 15px; font-weight: 600; color: var(--color-text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ex-row__last { flex: 0 0 auto; min-width: 56px; text-align: right; font-size: 14px; color: var(--color-text-quiet); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ex-row__chevron { display: inline-flex; color: var(--color-text-decorative); transition: transform var(--motion-quick) var(--ease-decel); }
.ex-row[aria-expanded="true"] .ex-row__chevron { transform: rotate(90deg); }
.ex-empty { margin: 0 0 20px; padding: 24px; background: var(--color-elevated); border-radius: var(--radius-lg); box-shadow: var(--elev-1); font-size: 16px; color: var(--color-text-quiet); text-align: center; }

/* The editor opens UNDER the row it belongs to, inside the same card, as a well
   recessed into it, so what is being edited is never away from what opened it. */
.ex-panel { background: var(--color-canvas); padding: 20px 16px 22px; animation: fade-in var(--motion-quick) var(--ease-decel); }
.ex-panel .field__box { background: var(--color-elevated); }
.ex-panel--create {
  background: var(--color-elevated); border-radius: var(--radius-lg); box-shadow: var(--elev-2);
  padding: 24px; margin-bottom: 20px; animation: sheet-in var(--motion-standard) var(--ease-decel-in);
}
.ex-panel__note { margin: 14px 0 0; font-size: 14px; line-height: 1.55; color: var(--color-text-quiet); max-width: 62ch; }
.ex-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 18px 24px; margin-bottom: 18px; }
.ex-facts p:first-child { margin: 0 0 2px; font-size: 13px; color: var(--color-text-quiet); }
.ex-facts p:last-child { margin: 0; font-size: 16px; color: var(--color-text); }
.ex-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.ex-actions { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.ex-actions__left { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.danger-link { min-height: 44px; font-size: 15px; color: var(--color-danger); font-weight: 600; cursor: pointer; background: none; border: none; font-family: var(--font-text); padding: 0 4px; }

/* The destructive confirm. A native <dialog> in the top layer: a real
   ::backdrop, an inert page, Escape and focus for free. */
.confirm {
  border: none; padding: 0; background: none; max-width: min(420px, calc(100vw - 32px));
  color: var(--color-text);
}
.confirm[open] { animation: sheet-in var(--motion-standard) var(--ease-decel-in); }
.confirm::backdrop { background: var(--color-scrim); }
.confirm__panel { background: var(--color-elevated); border-radius: var(--radius-xl); box-shadow: var(--elev-3); padding: 24px; }
.confirm__title { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.25; color: var(--color-text); }
.confirm__body { margin: 10px 0 0; font-size: 15px; line-height: 1.55; color: var(--color-text-quiet); }
/* The arms pair with the escape leading, so they never read as twins. */
.confirm__arms { display: flex; gap: 12px; margin-top: 24px; }
.confirm__arms .btn { flex: 1; }
/* Past the width the pair fits, they stack, destructive on top. The LAYOUT
   changes, never the type. */
@media (max-width: 380px) {
  .confirm__arms { flex-direction: column-reverse; }
  .confirm__arms .btn { flex: 0 0 auto; }
}

/* Routines */
.routine-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 20px; }
.routine-card {
  display: flex; flex-direction: column; gap: 10px; padding: 16px; width: 100%;
  border: none; border-radius: var(--radius-lg); box-shadow: var(--elev-1);
  background: var(--color-elevated); cursor: pointer; text-align: left; font-family: var(--font-text);
}
.routine-card[aria-selected="true"] { background: var(--color-accent-soft); box-shadow: none; }
.routine-card[aria-selected="true"] .routine-card__name { color: var(--color-accent); }
.routine-card__name { font-size: 17px; font-weight: 600; line-height: 22px; color: var(--color-text); }
.routine-card__detail { font-size: 13px; color: var(--color-text-quiet); font-variant-numeric: tabular-nums; }
.routine-card__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.routine-card[aria-selected="true"] .pill { background: var(--color-elevated); }

.routine-detail { background: var(--color-elevated); border-radius: var(--radius-lg); box-shadow: var(--elev-1); padding: 20px; }
.routine-detail__head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; }
.routine-detail__head h3 { margin: 0; font-size: 20px; font-weight: 600; color: var(--color-text); }
.routine-detail__counts { margin: 6px 0 0; display: flex; gap: 10px; font-size: 13px; color: var(--color-text-quiet); font-variant-numeric: tabular-nums; }
.routine-detail__hint { font-size: 14px; color: var(--color-text-quiet); }
.routine-table { border-radius: var(--radius-md); overflow: hidden; background: var(--color-surface); }
.routine-table__row { display: grid; grid-template-columns: 30px 22px minmax(0, 1fr) 72px 100px 40px; gap: 10px; padding: 10px 16px; font-size: 16px; align-items: center; min-height: 48px; }
.routine-table__head + [data-routine-rows] .routine-block:first-child,
.routine-block + .routine-block { border-top: 1px solid var(--color-hairline); }
.routine-table__head { min-height: 0; padding: 10px 16px; font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--color-text-quiet); }
.routine-table__n { color: var(--color-text-quiet); font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 600; }
.routine-table__name { min-width: 0; color: var(--color-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.routine-table__sets { text-align: right; color: var(--color-text); font-variant-numeric: tabular-nums; }
.routine-table__reps { text-align: right; font-variant-numeric: tabular-nums; color: var(--color-text); }
.routine-table__reps--any { color: var(--color-text-quiet); }
.routine-table__grip { display: flex; }
.routine-table__tools { display: flex; justify-content: flex-end; }

/* One exercise: its row, and the plan that opens under it inside the same card.
   The plan opens HERE, so the chevron points down and turns, never forward. */
.routine-item { background: var(--color-surface); }
.routine-open {
  display: flex; align-items: center; gap: 8px; min-width: 0; width: 100%; min-height: 36px;
  padding: 0; border: none; background: none; text-align: left;
  font-family: var(--font-text); font-size: 16px; color: var(--color-text);
}
button.routine-open { cursor: pointer; }
.routine-open__main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.routine-table__mode { font-size: 12px; color: var(--color-text-quiet); }

/* A superset recesses toward canvas inside the card, one grouped well. The
   handle is the GROUP's: a member cannot move on its own. */
.routine-superset { margin: 10px 12px; border-radius: var(--radius-md); background: var(--color-canvas); overflow: hidden; }
.routine-superset__head { display: flex; align-items: center; gap: 6px; padding: 8px 12px 4px 8px; font-size: 13px; font-weight: 600; color: var(--color-text-quiet); }
.routine-superset .routine-item { background: transparent; }
.routine-superset .routine-item + .routine-item { border-top: 1px solid var(--color-hairline); }
.routine-superset .routine-plan { background: transparent; }
.routine-superset .cell-input, .routine-superset .cell-select { background: var(--color-surface); }
.routine-open__chevron { display: inline-flex; flex: 0 0 auto; color: var(--color-text-decorative); transition: transform var(--motion-quick) var(--ease-decel); }
.routine-open[aria-expanded="true"] .routine-open__chevron { transform: rotate(180deg); }

/* The handle. Six dots, and a real button: the arrow keys move the row for
   anyone not using a pointer. `touch-action` lets a touch drag move the row. */
.grip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 36px; margin-left: -6px; padding: 0;
  border: none; border-radius: var(--radius-sm); background: transparent;
  color: var(--color-text-decorative); cursor: grab; touch-action: none;
}
.grip:hover { color: var(--color-text); background: var(--color-canvas); }
.grip:active { cursor: grabbing; }

/* The block being dragged rides above the ones it passes, and those settle
   back on the quick timing rather than snapping. */
.routine-block.is-dragging {
  position: relative; z-index: 2; border-radius: var(--radius-md);
  background: var(--color-elevated); box-shadow: var(--elev-2); cursor: grabbing;
}
.routine-block.is-dragging .grip { color: var(--color-text); }
.is-reordering .routine-block:not(.is-dragging) { transition: transform var(--motion-quick) var(--ease-decel); }
.is-reordering { user-select: none; }

/* The plan: one row per set, recessed under the exercise it belongs to. */
.routine-plan { padding: 4px 16px 16px 60px; background: var(--color-canvas); animation: fade-in var(--motion-quick) var(--ease-decel); }
.routine-plan__note { margin: 12px 0 0; max-width: 60ch; font-size: 14px; line-height: 1.55; color: var(--color-text-quiet); }
.routine-plan__add {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 10px;
  min-height: 40px; padding: 0 10px 0 4px;
  border: none; border-radius: var(--radius-sm); background: transparent;
  font-family: var(--font-text); font-size: 15px; font-weight: 600;
  color: var(--color-accent); cursor: pointer;
}
.routine-plan__add:active { opacity: 0.6; }

/* Per side and the superset actions belong to the exercise, so they head its
   own panel. Quiet: neither is a primary path. */
.plan-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding: 10px 0 4px; font-size: 14px; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; cursor: pointer; color: var(--color-text); }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--color-accent); cursor: pointer; }
.plan-tools .linkish {
  font-size: 14px; font-weight: 500; color: var(--color-text-quiet); text-decoration: underline;
  text-underline-offset: 3px; text-decoration-color: var(--color-hairline);
}
.plan-tools .linkish:hover { color: var(--color-text); text-decoration-color: currentColor; }

.pick-list { background: var(--color-surface); border-radius: var(--radius-md); overflow: hidden; }
.pick-row { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 48px; font-size: 16px; color: var(--color-text); cursor: pointer; }
.pick-row + .pick-row::before { content: ""; position: absolute; left: 46px; right: 0; top: 0; height: 1px; background: var(--color-hairline); }
.pick-row input { width: 18px; height: 18px; margin: 0; accent-color: var(--color-accent); cursor: pointer; }
.pick-row__name { flex: 1; min-width: 0; }
.pick-row__meta { font-size: 14px; color: var(--color-text-quiet); font-variant-numeric: tabular-nums; }

.rsets { display: flex; flex-direction: column; }
.rset { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 10px 0; }
.rset + .rset { border-top: 1px solid var(--color-hairline); }
.rset__badge { flex: 0 0 auto; align-self: center; min-width: 26px; text-align: center; font-size: 15px; font-weight: 600; color: var(--color-text); font-variant-numeric: tabular-nums; }
/* A warmup, a drop or a back-off set carries its letter instead of a number. */
.rset__badge--tag { color: var(--color-text-quiet); }
.rset__field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rset__field--type { flex: 0 1 168px; }
.rset__label { font-size: 12px; color: var(--color-text-quiet); }
.rset__box { position: relative; display: flex; align-items: center; }
.rset__field .cell-input { width: 84px; text-align: left; }
.rset__field .cell-input[data-set-field="weight"] { width: 104px; padding-right: 34px; }
.rset__unit { position: absolute; right: 10px; font-size: 13px; color: var(--color-text-quiet); pointer-events: none; }
.rset__remove { align-self: center; margin-left: auto; }
.rset__read { font-size: 15px; color: var(--color-text-quiet); }
.rset__read--values { margin-left: auto; color: var(--color-text); font-variant-numeric: tabular-nums; }

/* Number cells (numberCell.ts): one tone off the well, radius 8. */
.cell-select, .cell-input {
  width: 100%; min-width: 0; height: 38px; padding: 0 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--color-elevated); color: var(--color-text);
  font-family: var(--font-text); font-size: 16px;
  transition: border-color var(--motion-quick) var(--ease-decel);
}
.cell-select { padding-right: 26px; appearance: none; cursor: pointer; }
.cell-input { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.cell-select:focus, .cell-input:focus { outline: none; border-color: var(--color-accent); }
.cell-input::placeholder { color: var(--color-text-quiet); font-weight: 400; }
.rset__box:has(.cell-select)::after {
  content: ''; position: absolute; right: 11px; top: 50%; width: 7px; height: 7px;
  border-right: 1.8px solid var(--color-text-decorative);
  border-bottom: 1.8px solid var(--color-text-decorative);
  transform: translateY(-70%) rotate(45deg); pointer-events: none;
}
/* The spinners fight the alignment and add nothing here. */
.cell-input::-webkit-outer-spin-button,
.cell-input::-webkit-inner-spin-button { appearance: none; margin: 0; }
.cell-input[type="number"] { appearance: textfield; }

.routine-add { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }

/* Export */
.export-card { background: var(--color-elevated); border-radius: var(--radius-lg); box-shadow: var(--elev-1); padding: 20px; max-width: 560px; }
.export-dates { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 22px; }
.export-dates input { color-scheme: inherit; }
.export-label { margin: 0 0 8px; font-size: 15px; font-weight: 600; color: var(--color-text); }
.export-formats { margin-bottom: 22px; }
.export-foot { border-top: 1px solid var(--color-hairline); padding-top: 18px; display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; }
.export-count { font-size: 15px; color: var(--color-text-quiet); font-variant-numeric: tabular-nums; }

/* Account: grouped lists under section headers, the app's Settings pattern. */
.account-list { background: var(--color-elevated); border-radius: var(--radius-lg); box-shadow: var(--elev-1); overflow: hidden; margin-bottom: 8px; }
.account-row { position: relative; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 12px 16px; min-height: 52px; }
.account-row + .account-row::before { content: ""; position: absolute; left: 16px; right: 0; top: 0; height: 1px; background: var(--color-hairline); }
.account-row__key { font-size: 17px; color: var(--color-text); }
.account-row__val { font-size: 17px; color: var(--color-text-quiet); min-width: 0; overflow-wrap: anywhere; }
.account-row__val--num { font-variant-numeric: tabular-nums; }
.account-note { margin: 0 0 28px; padding: 0 4px; max-width: 64ch; font-size: 13px; line-height: 18px; color: var(--color-text-quiet); }
.account-card { background: var(--color-elevated); border-radius: var(--radius-lg); box-shadow: var(--elev-1); padding: 16px; margin-bottom: 28px; }
.account-card__head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.account-card__head h3 { margin: 0; font-size: 17px; font-weight: 600; color: var(--color-text); }
.account-card p { margin: 0 0 6px; font-size: 15px; line-height: 1.5; color: var(--color-text-quiet); }
.account-card p:last-child { margin-bottom: 0; }
.account-links { display: flex; flex-wrap: wrap; gap: 6px 20px; align-items: center; margin-top: 12px; }
.account-links a { min-height: 44px; display: inline-flex; align-items: center; font-size: 15px; font-weight: 600; color: var(--color-text-quiet); }
.account-links a.danger-link { color: var(--color-danger); }
.signout { min-height: 44px; margin: 4px 0 0; font-size: 15px; font-weight: 600; color: var(--color-text-quiet); background: none; border: none; padding: 0 4px; font-family: var(--font-text); cursor: pointer; }
.signout:hover { color: var(--color-text); }

.empty-card { background: var(--color-elevated); border-radius: var(--radius-xl); box-shadow: var(--elev-1); padding: 32px; text-align: center; }
.empty-card > span { display: inline-flex; color: var(--color-text-decorative); }
.empty-card h1 { margin: 16px 0 8px; font-size: 22px; font-weight: 700; letter-spacing: -0.015em; color: var(--color-text); }
.empty-card p { margin: 0 0 22px; color: var(--color-text-quiet); line-height: 1.6; }

.gate-list { display: flex; flex-direction: column; }
.gate-item { position: relative; display: flex; gap: 14px; padding: 14px 0; }
.gate-item + .gate-item::before { content: ""; position: absolute; left: 34px; right: 0; top: 0; height: 1px; background: var(--color-hairline); }
.gate-item__n { flex: 0 0 auto; width: 20px; font-size: 14px; font-weight: 600; line-height: 1.55; color: var(--color-text-quiet); font-variant-numeric: tabular-nums; }
.gate-item p { margin: 0; font-size: 16px; line-height: 1.55; color: var(--color-text-quiet); }
.gate-item strong { color: var(--color-text); font-weight: 600; }

/* =============================================================== breakpoints */

@media (max-width: 1080px) {
  .hist { grid-template-columns: minmax(0, 1fr); }
  .hist__side { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: start; }
}

@media (max-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 40px; }
}

/* The rail becomes the capsule tab bar below 900px. */
@media (max-width: 899px) {
  .dash-rail { display: none; }
  .dash-tabbar { display: grid; }
  .dash-body { display: block; }
  .dash-wrap { padding-bottom: 32px !important; }
  body:has(.dash-tabbar) { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
}

/* Below 720px the nav takes a row of its own, scrolling sideways if it has to,
   so every page stays one tap away. */
@media (max-width: 719px) {
  .site-header__inner { flex-wrap: wrap; gap: 8px 16px; padding: 10px 16px; }
  .wordmark { order: 1; flex: 1 1 auto; }
  .theme-toggle { order: 2; }
  .site-nav {
    order: 3; flex: 1 0 100%; justify-content: flex-start;
    flex-wrap: nowrap; overflow-x: auto; gap: 2px; margin: 0 -16px; padding: 0 12px;
    scrollbar-width: none; -ms-overflow-style: none;
  }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-footer__inner { padding: 28px 16px 40px; }
  .shell, .shell-prose, .shell-legal, .shell-pricing, .shell-dash { padding-left: 16px; padding-right: 16px; }
  .dash-head h1 { font-size: 30px; line-height: 36px; }
}

@media (max-width: 639px) {
  /* The handle stays, on a phone most of all: dragging is how rows move. The
     numbers drop to a second line rather than starving the name. */
  .routine-table__row {
    grid-template-columns: 30px 22px minmax(0, 1fr) 64px 36px;
    grid-template-areas:
      "grip n    name name tools"
      "sets sets sets reps reps";
    gap: 8px;
  }
  .routine-table__grip { grid-area: grip; }
  .routine-table__n { grid-area: n; }
  .routine-open { grid-area: name; }
  .routine-table__row > .routine-table__name { grid-area: name; }
  .routine-table__sets { grid-area: sets; justify-self: end; width: 64px; }
  .routine-table__reps { grid-area: reps; }
  .routine-table__tools { grid-area: tools; }
  .routine-plan { padding-left: 16px; }
  .rset {
    display: grid; align-items: end; gap: 8px 10px;
    grid-template-columns: 26px minmax(0, 1fr) minmax(0, 1fr) 36px;
    grid-template-areas:
      "badge type type   remove"
      "badge reps weight .";
  }
  .rset__badge { grid-area: badge; }
  .rset__field--type { grid-area: type; }
  .rset__field--reps { grid-area: reps; }
  .rset__field--weight { grid-area: weight; }
  .rset__remove { grid-area: remove; margin-left: 0; }
  .rset__field .cell-input,
  .rset__field .cell-input[data-set-field="weight"] { width: 100%; }
  /* The column head stops describing the layout once the row wraps, and each
     cell already carries its own label for a screen reader. */
  .routine-table__head { display: none; }
  .ex-row__best { display: none; }
  .matrix__row { grid-template-columns: 1fr 56px 56px; padding: 13px 16px; }
  .session__detail { padding-left: 16px; }
  .session__toggle { grid-template-columns: 36px minmax(0, 1fr) auto 12px; gap: 12px; }
  .hero { padding-top: 28px; }
  .setgrid { grid-template-columns: 30px minmax(0, 1fr) 68px 56px 40px; }
}

@media (max-width: 400px) {
  .dash-tabbar { left: 8px; right: 8px; padding: 4px; }
  .setrow__prev { font-size: 13px; }
  .whyline__marks i { width: 18px; }
}

/* Reduce Motion: slides and springs become a 160ms cross-fade, and nothing
   moves (motion.ts reducedMotionFallback). */
@media (prefers-reduced-motion: reduce) {
  *:not(.phone__panel), *::before, *::after { transition-duration: 0s !important; }
  *, *::before, *::after { animation-duration: 160ms !important; animation-timing-function: linear !important; }
  .roll, .roll--down, .notice--success:not([hidden]), .ex-panel, .ex-panel--create,
  .routine-plan, .session__detail, .confirm[open], .country__menu, .prg-picker__menu { animation-name: fade-in !important; }
  .tick.is-popping { animation: none !important; }
  .btn:active, .chip:active, .stepper button:active, .theme-toggle:active, .oauth:active,
  .prg-picker__button:active, .routine-card:active, .cal__nav button:active, .dash-tabbar button:active { transform: none; opacity: 0.6; }
  .phone__panel { transition: opacity 160ms linear !important; }
  .seg__thumb { transition: none !important; }
}
