/* ===== Design tokens ===== */
/* Same selector as Pico's light theme block, not a bare :root. Pico declares its colour
   tokens on `:root:not([data-theme=dark])` (specificity 0,2,0); a plain `:root` loses to
   it, which silently voided every --pico-* colour override below (buttons rendered Pico's
   #0172ad blue). Equal specificity + app.css loading after pico.min.css makes these win. */
:root:not([data-theme="dark"]), [data-theme="light"] {
  --bg:           #f5f4f0;
  --surface:      #ffffff;
  --surface2:     #f9f8f5;
  --border:       #e8e6e0;
  --text:         #1c1b18;
  --text-muted:   #737269;
  --accent:       #0d9488;
  --accent-hover: #0f766e;
  --accent-bg:    #f0fdfa;
  --danger:       #dc2626;
  --danger-bg:    #fef2f2;
  --success:      #16a34a;
  --success-bg:   #f0fdf4;
  --warn:         #d97706;
  --warn-bg:      #fffbeb;
  --info:         #2563eb;
  --info-bg:      #eff6ff;
  --radius:       6px;

  /* Superset group palette (color-coded left bars + labels). Cycles every 5. */
  --color-group-1: #0d9488;
  --color-group-2: #2563eb;
  --color-group-3: #d97706;
  --color-group-4: #db2777;
  --color-group-5: #7c3aed;

  /* Pico overrides */
  --pico-font-family: 'Plus Jakarta Sans', sans-serif;
  --pico-background-color: var(--bg);
  --pico-card-background-color: var(--surface);
  --pico-card-sectioning-background-color: var(--surface2);
  /* Every Pico button variant's colour tokens, not just --pico-primary. Pico paints a
     <button>'s background from its *-background token, so any variant left on Pico's
     defaults (#0172ad blue primary, #525f7a slate secondary, #181c25 near-black
     contrast) leaks off-palette — a bare class="secondary" rendered muted grey text on
     slate. frontend-tests/pico-tokens.test.js fails if one is missing here. */
  --pico-primary: var(--accent);
  --pico-primary-background: var(--accent);
  --pico-primary-border: var(--accent);
  --pico-primary-underline: rgba(13, 148, 136, 0.5);
  --pico-primary-hover: var(--accent-hover);
  --pico-primary-hover-background: var(--accent-hover);
  --pico-primary-hover-border: var(--accent-hover);
  --pico-primary-hover-underline: var(--accent-hover);
  --pico-primary-focus: rgba(13, 148, 136, 0.2);
  --pico-primary-inverse: #ffffff;
  --pico-secondary: var(--text-muted);
  --pico-secondary-background: var(--surface);
  --pico-secondary-border: var(--border);
  --pico-secondary-underline: rgba(115, 114, 105, 0.5);
  --pico-secondary-hover: var(--text);
  --pico-secondary-hover-background: var(--surface2);
  --pico-secondary-hover-border: var(--text-muted);
  --pico-secondary-hover-underline: var(--text);
  --pico-secondary-focus: rgba(115, 114, 105, 0.2);
  --pico-secondary-inverse: var(--text);
  /* "contrast" is this app's destructive variant (see button.contrast below). */
  --pico-contrast: var(--danger);
  --pico-contrast-background: var(--surface);
  --pico-contrast-border: var(--danger);
  --pico-contrast-underline: rgba(220, 38, 38, 0.5);
  --pico-contrast-hover: var(--danger);
  --pico-contrast-hover-background: var(--danger-bg);
  --pico-contrast-hover-border: var(--danger);
  --pico-contrast-hover-underline: var(--danger);
  --pico-contrast-focus: rgba(220, 38, 38, 0.2);
  --pico-contrast-inverse: var(--danger);
  /* Disabled filled (primary) button. Pico only dims a disabled button to 50% opacity, which
     left a pale teal that read as a soft button, not an unavailable one (QA 23). These swap
     the fill to neutral grey; Pico's 0.5 opacity still applies on top. */
  --btn-disabled-background: var(--text-muted);
  --btn-disabled-border: var(--text-muted);
  --btn-disabled-color: #ffffff;
  --pico-color: var(--text);
  --pico-h1-color: var(--text);
  --pico-h2-color: var(--text);
  --pico-h3-color: var(--text);
  --pico-h4-color: var(--text);
  --pico-muted-color: var(--text-muted);
  --pico-muted-border-color: var(--border);
  --pico-border-color: var(--border);
  --pico-form-element-background-color: var(--surface);
  --pico-form-element-border-color: var(--border);
  --pico-form-element-focus-color: var(--accent);
  --pico-form-element-placeholder-color: #b0afa8;
  --pico-border-radius: var(--radius);
  --pico-spacing: 0.85rem;
  --pico-nav-element-spacing-horizontal: 0.75rem;
  --pico-nav-element-spacing-vertical: 0.35rem;
  --pico-nav-link-spacing-horizontal: 0.75rem;
  --pico-nav-link-spacing-vertical: 0.35rem;
}

/* ===== Base ===== */
body {
  background-color: var(--bg);
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--text);
  /* body itself never scrolls — `main` below is the sole scroll container, so
     a scrollbar appearing/disappearing as page content loads only affects
     main's own box, never the viewport width the top nav is laid out
     against. */
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

/* Safety net: no page should ever scroll horizontally on mobile. Root-cause
   width fixes come first; this only guards against stray overflow.
   `overflow-x: hidden` still lets iOS Safari rubber-band/touch-pan a short
   distance horizontally (revealing blank space) if any box, however briefly,
   lays out wider than the viewport, because `hidden` still creates a
   (non-scrollbar-showing) scroll container. `overflow-x: clip` goes further:
   it doesn't create a scroll container at all, so there's nothing to pan —
   this is the real fix for that iOS quirk. Declared after `hidden` so it wins
   in browsers that support it (Safari 16+/Chrome 90+/Firefox 81+) while
   `hidden` remains the fallback for anything older.
   `touch-action: pan-x pan-y` (not `pan-y` alone) disables pinch-zoom and
   Safari double-tap smart-zoom while still allowing nested horizontal pan
   (progress set table, ops day table, Sheets export preview). The used value
   walks ancestors, so a `pan-y`-only root would block those. */
html, body {
  overflow-x: hidden;
  overflow-x: clip;
  touch-action: pan-x pan-y;
}

/* ===== Top navigation ===== */
#app-nav {
  flex-shrink: 0;
}

body > nav:first-of-type {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  padding: 0 1rem;
  min-height: 52px;
}

body > nav:first-of-type ul {
  margin: 0;
  gap: 0;
}

/* ===== Page content (scroll container) =====
   `#page-scroll` — not body/html, and not `main.container` itself — owns the
   scrollbar. It wraps `main.container` rather than being it: `.container` is
   Pico's centered/max-width box, so if *it* were the overflow box, the
   scrollbar would render at the container's inner edge (visibly "in the
   middle of the page" on wide viewports) instead of the browser edge.
   `#page-scroll` has no max-width, so it spans full width and the scrollbar
   sits flush with the viewport edge while `main.container` inside it stays
   centered. `min-height: 0` overrides the flex default of `min-height: auto`,
   which would otherwise let it grow to its content size and push the
   overflow onto body instead of scrolling internally. */
#page-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overflow-x: clip;
  touch-action: pan-x pan-y;
}

nav a.brand {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.4rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: var(--text);
  line-height: 1;
  display: flex;
  align-items: center;
}

.brand-logo {
  height: 28px;
  width: 28px;
  object-fit: contain;
  margin-right: 0.35rem;
}

nav .brand-accent {
  color: var(--accent);
}

nav a:not(.brand) {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

nav a:not(.brand):hover {
  color: var(--text);
}

/* Language selector in nav */
nav select {
  font-size: 16px;
  font-weight: 500;
  padding: 0.25rem 0.4rem;
  min-width: 0;
  width: auto;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  margin: 0;
  cursor: pointer;
}

/* Logout button in nav */
nav form button {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  padding: 0.25rem 0.65rem !important;
  margin: 0 !important;
  border-radius: var(--radius);
}

/* Profile avatar in nav (links to settings) */
nav a.nav-profile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  border-radius: 50%;
}

.nav-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 1px solid var(--border);
  transition: border-color 0.15s, box-shadow 0.15s;
}

nav a.nav-profile:hover .nav-avatar {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

/* Outline comment, no box. A bordered circle read as a second avatar. */
nav button.nav-feedback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  color: var(--text-muted);
  font-size: 1.15rem;
  line-height: 1;
}

nav button.nav-feedback:hover,
nav button.nav-feedback:focus-visible {
  color: var(--accent);
  background: var(--accent-bg);
  border: none;
  box-shadow: none;
}

/* Pico's nav li padding (0.5rem 0.75rem) plus the scope pill already fills a
   390px bar. Zero that padding on the right cluster so the feedback icon and
   avatar stay 32px instead of the avatar collapsing to a sliver. */
@media (max-width: 768px) {
  #app-nav > ul:last-child {
    gap: 0.35rem;
    min-width: 0;
  }

  #app-nav > ul:last-child > li {
    display: flex;
    align-items: center;
    padding-left: 0;
    padding-right: 0;
  }

  #app-nav > ul:last-child > li:not(.scope-switcher) {
    flex-shrink: 0;
  }

  #app-nav > ul:last-child > li.scope-switcher {
    min-width: 0;
    flex: 0 1 auto;
  }

  .scope-switcher > button.scope-trigger {
    max-width: 9.5rem;
    min-width: 0;
  }

  .scope-switcher > button.scope-trigger > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  nav button.nav-feedback,
  nav a.nav-profile {
    flex-shrink: 0;
  }
}

.nav-avatar--fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  border-color: var(--accent);
}

/* Hide main nav links on mobile */
@media (max-width: 768px) {
  .nav-links { display: none !important; }
}

/* Pending-invite count badge (coaching-05) — injected by nav.js onto the
   dashboard entry points (desktop brand link + mobile bottom-bar Dashboard
   tab). */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 0.28rem;
  margin-left: 0.35rem;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-family: system-ui, sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  vertical-align: middle;
}
nav.tab-bar a.tab-item {
  position: relative;
}
/* On the mobile Dashboard tab, pin the badge to the top-right of the icon
   rather than pushing the label sideways. */
nav.tab-bar a.tab-item .nav-badge {
  position: absolute;
  top: 2px;
  left: calc(50% + 8px);
  margin-left: 0;
}

/* ===== Page headings ===== */
hgroup {
  margin-bottom: 0.85rem;
}

hgroup h2 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.6rem;
  letter-spacing: 0.03em;
  margin-bottom: 0.1rem;
  color: var(--text);
}

hgroup p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0;
}

h3 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.15rem;
  letter-spacing: 0.03em;
  color: var(--text);
  margin-bottom: 0.6rem;
}

h4 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.03em;
}

/* ===== Cards / Articles ===== */
article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  padding: 0.7rem 0.85rem !important;
  margin-bottom: 0.55rem !important;
}

article > header {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: none !important;
  border-bottom: 1px solid var(--border) !important;
  margin: -0.7rem -0.85rem 0.7rem !important;
  padding: 0.5rem 0.85rem !important;
  border-radius: var(--radius) var(--radius) 0 0;
}

/* Pico paints article > footer with the sectioning fill and negative margins sized
   for its own 1rem card padding. Modal cards pad more than that, so the footer
   becomes an inset gray slab behind the action buttons. Headers already drop this
   treatment; footers sit on the card surface too.
   `border` stays without !important: the exercise-info sheet draws its own
   border-top, and an !important none here would beat that (importance is sorted
   before specificity). Margin stays !important so it wins over
   .confirm-modal-actions { margin: 0 }, which outranks two elements. */
article > footer {
  background: none !important;
  border: none;
  margin: 1rem 0 0 !important;
  padding: 0 !important;
  border-radius: 0;
}

/* ===== Buttons ===== */
button,
[role="button"],
input[type="submit"],
input[type="button"] {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  border-radius: var(--radius);
  padding: 0.3rem 0.85rem;
  margin-bottom: 0.4rem;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

button.outline {
  background: transparent;
}

/* Pico paints a button from these per-element variables, so a button whose own class sets
   `background` directly keeps its look (and Pico's disabled opacity). Outline, secondary and
   contrast buttons are left to the opacity dim alone. */
:is(button, [type="submit"], [type="button"], [role="button"]):not(.outline, .secondary, .contrast)[disabled] {
  --pico-background-color: var(--btn-disabled-background);
  --pico-border-color: var(--btn-disabled-border);
  --pico-color: var(--btn-disabled-color);
}

button.contrast,
button.outline.contrast {
  color: var(--danger);
  border-color: var(--danger);
}

button.contrast:hover,
button.outline.contrast:hover {
  background: var(--danger-bg);
}

button.secondary,
button.outline.secondary {
  color: var(--text-muted);
  border-color: var(--border);
}

/* ===== Form elements ===== */
label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  display: block;
}

input[type="text"],
input[type="number"],
input[type="datetime-local"],
input[type="email"],
input[type="password"],
input[type="search"],
select,
textarea {
  font-family: 'Plus Jakarta Sans', sans-serif;
  /* 16px: iOS Safari zooms the page on focus when the computed size is smaller. */
  font-size: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.45rem 0.75rem;
  color: var(--text);
  margin-bottom: 0.6rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
  outline: none;
}

textarea {
  min-height: 80px;
  resize: vertical;
}

/* Checkbox label — don't uppercase */
label:has(input[type="checkbox"]) {
  font-size: 0.875rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
}

/* ===== Back links =====
   Shared style for the "back to <parent>" link at the top of every detail
   page. Class-based (not positional) so it renders identically regardless of
   whether other content precedes it inside <main>. The arrow is drawn here so
   translated strings carry only the label text. */
.back-link {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 1rem;
}

.back-link::before {
  content: "\2190"; /* ← */
}

.back-link:hover {
  color: var(--accent);
}

/* ===== Toast ===== */
#toast {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  z-index: 999;
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  max-width: 320px;
}

#toast.show { display: block; }

#toast.toast--error { border-left-color: var(--danger); }

/* A toast with a button (Undo): message left, button right, easy to hit with a thumb. */
#toast.show.toast--action {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#toast .toast__action {
  width: auto;
  margin: 0 -0.5rem 0 auto;
  padding: 0.5rem 0.75rem;
  min-height: 44px;
  background: transparent;
  border: 0;
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
}

/* ===== Update-available banner (nav.js deploy watcher) and the old-host
   "moved" banner (domain-moved.js), which shares its look ===== */
#update-banner,
#moved-banner {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  padding: 0.7rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  max-width: calc(100vw - 2rem);
}

#update-banner .update-banner-text,
#moved-banner .update-banner-text {
  flex: 1 1 auto;
}

#update-banner .update-banner-action,
#moved-banner .update-banner-action {
  flex: 0 0 auto;
  width: auto;
  margin: 0;
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
}

/* The action is a filled accent button — draw its in-flight spinner in the
   button's own text color so it doesn't vanish into the accent background. */
#update-banner .update-banner-action.btn-spinner,
#moved-banner .update-banner-action.btn-spinner {
  justify-content: center; /* the width is pinned to the label's, so centre the spinner in it */
}

#update-banner .update-banner-action .spinner,
#moved-banner .update-banner-action .spinner {
  border-color: color-mix(in srgb, currentColor 30%, transparent);
  border-top-color: currentColor;
}

#update-banner .update-banner-close,
#moved-banner .update-banner-close {
  flex: 0 0 auto;
  width: auto;
  margin: 0;
  padding: 0 0.35rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

#update-banner .update-banner-close:hover,
#moved-banner .update-banner-close:hover {
  color: var(--text);
}

#moved-banner .moved-banner-note {
  display: block;
  margin-top: 0.25rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* The moved banner stays up until dismissed, so unlike the short-lived update
   banner it must never hide a toast (#toast is z-index 999). */
#moved-banner {
  z-index: 998;
}

/* Both banners sit in the same spot; the update banner is short-lived and wins. */
body:has(#update-banner) #moved-banner {
  display: none;
}

/* ===== Error messages ===== */
.error-message {
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: 500;
}

/* ===== Exercise target ===== */
.exercise-target {
  border-top: 1px solid var(--border);
  padding: 0.5rem 0;
  font-size: 0.9rem;
}

.quantity-range-field {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.quantity-range-field label {
  width: 8rem;
  flex-shrink: 0;
  margin-bottom: 0;
}

.quantity-range-field input {
  display: inline-block;
  width: 5.5rem;
  margin-bottom: 0;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.quantity-range-field select {
  width: auto;
  min-width: 6rem;
  margin-bottom: 0;
  font-size: 16px;
  padding: 0.35rem 0.5rem;
}

/* ===== Suggestion (hint) rows ===== */
.set-suggestions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.set-suggestion {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0.75rem;
  background: var(--accent-bg);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  font-size: 0.875rem;
  color: var(--text);
  user-select: none;
}

.set-suggestion:hover {
  background: color-mix(in srgb, var(--accent) 10%, white);
  border-color: var(--accent);
}

.set-suggestion-cta {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ===== Quantity fields ===== */
.quantity-fields {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.75rem;
}

.quantity-field {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.quantity-field input {
  display: inline-block;
  width: 5.5rem;
  margin-bottom: 0;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.quantity-field select {
  width: auto;
  min-width: 6rem;
  margin-bottom: 0;
  font-size: 16px;
  padding: 0.35rem 0.5rem;
}

.amount-stepper {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 0.25rem;
  flex-shrink: 0;
}

.amount-stepper input[type="number"],
.amount-stepper input[inputmode] {
  border: none;
  border-radius: 0;
  box-shadow: none;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  margin-bottom: 0;
  padding: 0.35rem 0.4rem;
  width: 4.5rem;
}

.amount-stepper input[type="number"]:focus,
.amount-stepper input[inputmode]:focus {
  box-shadow: none;
  border-color: var(--border);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  z-index: 1;
  position: relative;
}

.step-btn {
  width: 2.2rem !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: var(--surface2) !important;
  color: var(--accent) !important;
  font-size: 0.75rem !important;
  font-weight: 400 !important;
  line-height: 1 !important;
  flex-shrink: 0;
  letter-spacing: 0;
  font-family: system-ui, sans-serif;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.step-btn:hover {
  background: var(--accent-bg) !important;
}

@media (max-width: 480px) {
  .quantity-field {
    flex-wrap: wrap;
    row-gap: 0.25rem;
  }
}

/* ===== Tables ===== */
table {
  font-size: 0.875rem;
}

th {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ===== Sign-in page ===== */
.signin-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  padding: 2.5rem 2rem;
  text-align: center;
  /* The brand row sizes itself in cqi of this card, so logo + wordmark always fit. */
  container-type: inline-size;
}

/* "WORKOUTCAT" is one unbreakable word ~5.9em wide; at a fixed 3.5rem next to an
   80px logo it ran past the card on every viewport. Sized in cqi, logo (1.3em) +
   gap + wordmark (~6em) take ~90% of the card's content width, capped at the old size. */
.signin-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.2em;
  margin-bottom: 1rem;
  font-size: min(15cqi, 3.5rem);
}

.signin-logo {
  width: 1.3em;
  height: 1.3em;
  flex-shrink: 0;
  object-fit: contain;
}

.signin-card h1 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1em;
  letter-spacing: 0.05em;
  margin-bottom: 0;
  color: var(--text);
  line-height: 1;
}

.signin-card h1 .brand-accent {
  color: var(--accent);
}

/* The not-found page (404.html) reuses this card with a heading under the brand. */
.signin-card h2 {
  text-wrap: balance;
}

.signin-card .tagline {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-wrap: balance;
  margin-bottom: 2rem;
}

.signin-card .signin-btn {
  display: block;
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0.7rem 1.5rem;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  text-decoration: none;
  transition: background-color 0.15s;
  cursor: pointer;
}

.signin-card .signin-btn:hover {
  background: var(--accent-hover);
  color: #fff;
}

/* ===== Template list rows ===== */
.template-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1rem !important;
  margin-bottom: 0.4rem !important;
}

/* Rows whose whole card opens a preview/detail on click (templates, logs).
   A real resting shadow (like the search bar) lifts the white card off the
   near-white page — Pico's default card shadow is too faint, so the cards
   read as flat/grey without it. Hover deepens the shadow for a clearer lift. */
.template-row--clickable {
  cursor: pointer;
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  transition: box-shadow 0.15s ease;
}

.template-row--clickable:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.template-row--clickable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* A cross-list drag persists over two or three sequential requests; dim the row (and swap
   its grip for a spinner) so it is visibly in-flight rather than silently settled. */
.template-row--busy {
  opacity: 0.6;
  pointer-events: none;
}

.template-row-info {
  flex: 1;
  min-width: 0;
}

.template-row-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.template-row-title .template-row-name {
  flex: 0 1 auto;
  min-width: 0;
}

.template-row-name {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

a.template-row-name {
  text-decoration: none;
}

a.template-row-name:hover {
  color: var(--accent);
}

.template-row-meta {
  display: block;
  font-size: 0.78rem;
  margin-top: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.template-row-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.25rem;
}

.template-row-actions {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
  align-items: center;
}

.template-row-actions button,
.template-row-actions [role="button"],
.template-row-actions a.icon-btn {
  margin-bottom: 0 !important;
}

/* ===== Exercise list rows ===== */
article.exercise-card {
  padding: 0.6rem 1rem !important;
  margin-bottom: 0.4rem !important;
}

.exercise-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.exercise-shared-badge {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.05rem 0.35rem;
  margin-left: 0.4rem;
  vertical-align: middle;
}

.dim-chip {
  display: inline-block;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  margin-left: 0.3rem;
  vertical-align: middle;
  cursor: default;
}


.dim-chip--reps     { color: #1d4ed8; background: #dbeafe; }
.dim-chip--weight   { color: #b45309; background: #fef3c7; }
.dim-chip--duration { color: #6d28d9; background: #ede9fe; }
.dim-chip--distance { color: #065f46; background: #d1fae5; }

.dim-chip[data-req="OPTIONAL"] {
  background: transparent;
  border: 1.5px solid currentColor;
  padding: 0 0.25rem;
}

.dim-chip--editable {
  cursor: pointer !important;
  transition: opacity 0.15s, transform 0.1s;
  user-select: none;
}

.dim-chip--editable:hover {
  opacity: 0.8;
  transform: scale(1.05);
}

.dim-chip--add {
  cursor: pointer !important;
  display: inline-block;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  color: var(--text-muted);
  background: transparent;
  border: 1.5px dashed var(--border);
  user-select: none;
  transition: color 0.15s, border-color 0.15s;
  vertical-align: middle;
}

.dim-chip--add:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Companion chip next to an on WEIGHT/DURATION chip: which way counts as progress.
   A separate chip rather than a control nested inside the dimension chip, so both
   stay independently tappable. Quiet by default (the common "more is better") but
   deliberately *solid*, so it doesn't read as an unset "+ dimension" chip; it goes
   into the dimension's own color once flipped to "less is better". */
.dim-chip--direction {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

/* Only the interactive copies carry a real tap target — the read-only "↓" marker in the
   card list stays chip-sized so it sits flush against the dimension chip it belongs to. */
.dim-chip--editable.dim-chip--direction {
  min-height: 28px;
  padding: 0.2rem 0.5rem;
}

.dim-chip--direction.is-lower {
  border-color: transparent;
  font-weight: 700;
}

.dim-chip--direction.is-lower.dim-chip--weight   { color: #b45309; background: #fef3c7; }
.dim-chip--direction.is-lower.dim-chip--duration { color: #6d28d9; background: #ede9fe; }

/* Exercise card headline: the name truncates, but the dimension chips and badges keep
   their own space instead of being pushed out of the row by a long name. */
.exercise-name-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.15rem;
  min-width: 0;
}

.exercise-name-row > .template-row-name {
  flex: 0 1 auto;
  min-width: 0;
}

.dim-chip-spinner {
  margin-left: 4px;
}

/* Dimension editor row in exercise edit grid */
.dim-editor {
  flex-wrap: wrap;
  gap: 0.3rem;
}

/* Exercise header row: name + superset badge + dim chips */
.ex-header-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  row-gap: 0.45rem;
  flex-wrap: wrap;
}

/* View mode: the row is just number, name and ⓘ. Wrapping the row made a long name take a line
   to itself and dropped the ⓘ under it, onto the card's left edge (QA 93). Kept on one line, the
   name wraps inside its own box and the ⓘ stays at the end of the title row. Edit mode keeps the
   wrapping row for its dimension chips. */
header.exercise-card-head .ex-header-row {
  flex-wrap: nowrap;
}

header.exercise-card-head .ex-header-row > .exercise-title {
  min-width: 0;
  overflow-wrap: anywhere;
}

header.exercise-card-head .ex-header-row > .exercise-info-btn {
  flex-shrink: 0;
}

/* Dim chips inside the exercise header (edit mode) */
.dim-chips-inline {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.ex-header-row > .dim-chips-inline {
  margin-left: auto;
}

.dim-chips-form {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
  padding: 0.25rem 0 0.5rem;
}

.dim-chips-section {
  margin-bottom: 0.6rem;
}

.dim-chips-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

/* ===== Dimension states legend (text + small color swatches) ===== */
.dim-states {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin: 0.15rem 0 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.dim-states__label {
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.dim-state {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
}

.dim-state__swatch {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 2px;
  flex-shrink: 0;
}

.dim-state__swatch--required {
  background: #dbeafe;
  border: 1px solid #1d4ed8;
}

.dim-state__swatch--optional {
  background: transparent;
  border: 1.5px solid #b45309;
  border-radius: 3px;
}

.dim-state__swatch--off {
  background: transparent;
  border: 1.5px dashed var(--text-muted);
  border-radius: 3px;
}

.dim-help {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  margin: 0 0 0.55rem;
  line-height: 1.4;
}

/* QA 118: shown under the dimension chips while none is on; the submit is disabled meanwhile. */
.dim-required-hint {
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: 500;
  margin: 0.55rem 0 0;
}

/* ===== Modal section (grouping for Dimensions / Visibility) ===== */
.modal-section {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0.65rem 0 0.7rem;
  margin-top: 0.5rem;
  margin-bottom: 0.85rem;
}

.modal-section:first-of-type {
  border-top: 1px solid var(--border);
  padding-top: 0.7rem;
}

.modal-section .dim-chips-label {
  margin-bottom: 0.35rem;
}

.modal-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

/* ===== Visibility toggle (segmented pill) ===== */
.visibility-toggle {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface, #fff);
  margin: 0.1rem 0 0.3rem;
}

.visibility-toggle__option {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  border-right: 1px solid var(--border, #d1d5db);
  color: var(--text-muted, #6b7280);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 0.45rem 1rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  min-width: 110px;
  box-shadow: none;
  margin: 0;
  height: auto;
  width: auto;
  text-transform: none;
}

.visibility-toggle__option:last-child {
  border-right: none;
}

.visibility-toggle__option:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text, #111);
}

.visibility-toggle__option.is-active {
  background: var(--accent, #0d9488);
  color: #fff;
}

.visibility-toggle__option.is-active:hover {
  background: var(--accent, #0d9488);
  color: #fff;
}

.visibility-section .dim-help {
  margin-top: 0.3rem;
}

@media (max-width: 600px) {
  .visibility-toggle {
    display: flex;
    width: 100%;
  }
  .visibility-toggle__option {
    flex: 1 1 0;
    min-width: 0;
  }
  /* Scoped to the template-detail exercise header this was written for: there the chips are
     pushed right by margin-left:auto and need a full row of their own at phone width. On the
     exercises card (.exercise-name-row) a flex-basis of 100% would force a second line for
     every exercise, which is exactly what that row is structured to avoid. */
  .ex-header-row > .dim-chips-inline {
    margin-left: 0;
    flex-basis: 100%;
  }
}

/* ===== Bottom tab bar (mobile only) ===== */
nav.tab-bar {
  display: none;
  padding: 0;
  margin: 0;
}

@media (max-width: 768px) {
  nav.tab-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 200;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
  }

  body {
    padding-bottom: 68px;
  }

  #toast {
    bottom: calc(60px + 3rem);
  }

  #update-banner,
  #moved-banner {
    bottom: calc(60px + 1rem);
    left: 1rem;
    right: 1rem;
    transform: none;
    max-width: none;
  }
}

nav.tab-bar a.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  text-decoration: none;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  transition: color 0.15s;
  padding: 0.4rem 0;
}

nav.tab-bar a.tab-item:hover {
  color: var(--text);
}

nav.tab-bar a.tab-item[aria-current="page"] {
  color: var(--accent);
}

nav.tab-bar a.tab-item svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 1.75;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ===== Utility ===== */
.secondary {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Strava upload status above the Resume button on a finished log. */
.strava-export-status {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.strava-export-status p {
  margin: 0;
}

small {
  font-size: 0.8rem;
  color: var(--text-muted);
}

hr {
  border-color: var(--border);
  margin: 0.875rem 0;
}

details summary {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
}

/* ===== Icon-only action buttons ===== */
/* a.icon-btn ties Pico's a[role=button]{display:inline-block} on specificity
   (both 0,1,1); app.css loading after pico.min.css breaks the tie in our
   favor. Don't use !important on display here — that would resurrect the
   471eaa8 bug where x-show on a .icon-btn <button> couldn't hide it. */
.icon-btn,
a.icon-btn {
  background: none !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  padding: 0 !important;
  margin: 0 !important;
  width: 2rem !important;
  height: 2rem !important;
  display: inline-flex;
  align-items: center !important;
  justify-content: center !important;
  color: var(--text-muted) !important;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s !important;
  letter-spacing: 0 !important;
  flex-shrink: 0;
  text-decoration: none !important;
  font-size: 0.8rem !important;
}

.icon-btn:hover {
  color: var(--text) !important;
  border-color: var(--text-muted) !important;
  background: var(--surface2) !important;
}

.icon-btn.danger {
  color: var(--danger) !important;
  border-color: color-mix(in srgb, var(--danger) 30%, var(--border)) !important;
}

.icon-btn.danger:hover {
  background: var(--danger-bg) !important;
  border-color: var(--danger) !important;
}

.icon-btn:disabled {
  opacity: 0.35 !important;
  cursor: not-allowed;
  pointer-events: none;
}

/* A 2rem .icon-btn is below the 44px touch minimum. This modifier grows the box to
   44px so a row of icon actions is tappable on a phone. The overrides need
   !important because .icon-btn sets its own width/height with !important. */
.icon-btn--tap {
  width: 2.75rem !important;
  height: 2.75rem !important;
  font-size: 1.15rem !important;
}

/* ===== Alpine cloak ===== */
[x-cloak] { display: none !important; }

/* ===== Scroll offset for sticky nav ===== */
[data-exercise-id] {
  scroll-margin-top: 64px;
}

.superset-group {
  scroll-margin-top: 64px;
}

/* Scroll runway: lets the active exercise (even the last one) scroll up to
   just below the sticky nav instead of being stranded near the bottom. Lives on
   the in-progress finish section so finished (read-only) logs get no dead space. */
#finish-workout-section {
  padding-bottom: 40vh;
}

/* ===== Rest timer strip (fixed above tab bar, pulsing dot) ===== */
.rest-strip {
  position: fixed;
  bottom: 60px;
  left: 0;
  right: 0;
  z-index: 199;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.rest-strip-body {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.15rem 0.6rem;
  min-height: 28px;
}

.rest-strip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: dot-pulse 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  flex-shrink: 0;
}

@keyframes dot-pulse {
  0% { opacity: 0.35; transform: scale(0.7); }
  30% { opacity: 1; transform: scale(1.15); }
  70% { opacity: 1; transform: scale(1.15); }
  100% { opacity: 0.35; transform: scale(0.7); }
}

.rest-strip-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  flex-shrink: 0;
}

.rest-strip-count {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.05rem;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.rest-strip-dismiss {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0.25rem !important;
  margin: 0 0 0 auto !important;
  width: 28px !important;
  height: 28px !important;
  font-size: 0.75rem !important;
  color: var(--text-muted) !important;
  cursor: pointer;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
}

/* QA 123: −15 / +15 on the running rest. Pushes the ✕ along with it to the right. */
.rest-strip-adjust {
  background: none !important;
  border: 1px solid var(--border) !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  width: 28px !important;
  height: 28px !important;
  font-size: 0.7rem !important;
  line-height: 1 !important;
  color: var(--text-muted) !important;
  cursor: pointer;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
  position: relative;
}

/* A bigger tap target than the slim row shows: used mid-set, by thumb. */
.rest-strip-adjust::before {
  content: '';
  position: absolute;
  inset: -8px -4px;
}

.rest-strip-adjust--first {
  margin-left: auto !important;
}

.rest-strip-adjust:hover,
.rest-strip-adjust:active {
  background: var(--surface2) !important;
  color: var(--text) !important;
}

.rest-strip-adjust--first ~ .rest-strip-dismiss {
  margin-left: 0.25rem !important;
}

.rest-strip-dismiss:hover {
  background: var(--surface2) !important;
  color: var(--text) !important;
}

.rest-strip-track {
  height: 2px;
  background: var(--border);
}

.rest-strip-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.4s linear;
}

@media (min-width: 769px) {
  .rest-strip {
    bottom: 0;
  }
}

/* ===== Live workout bar (js/live-workout-bar.js) =====
   One slim row above the tab bar on every page while a workout runs (the viewport bottom on
   desktop, where there is no tab bar). The whole row is the tap target. Body padding keeps it
   clear of the scrolling page, so nothing scrolls underneath it. */
:root {
  --live-workout-height: 46px;
}

a.live-workout-bar,
a.live-workout-bar:hover {
  color: var(--pico-primary-inverse);
  text-decoration: none;
}

a.live-workout-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--live-workout-height);
  z-index: 199;
  display: block;
  background: var(--accent-hover);
  box-shadow: 0 -3px 10px rgba(0, 0, 0, 0.12);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  view-transition-name: live-workout-bar;
}

a.live-workout-bar[hidden] {
  display: none;
}

a.live-workout-bar:active {
  filter: brightness(0.88);
}

.live-workout-track {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: rgba(255, 255, 255, 0.22);
}

.live-workout-fill {
  display: block;
  height: 100%;
  background: #5eead4;
}

.live-workout-inner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  height: 100%;
}

.live-workout-dot {
  position: relative;
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
}

/* Only the ring pulses, so the dot itself never fades out. */
.live-workout-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: currentColor;
  animation: live-workout-ring 1.8s ease-out infinite;
}

@keyframes live-workout-ring {
  0% { transform: scale(1); opacity: 0.6; }
  80%, 100% { transform: scale(2.3); opacity: 0; }
}

.live-workout-bar--stale .live-workout-dot::after {
  display: none;
}

.live-workout-name {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.live-workout-more {
  flex: none;
  font-weight: 700;
  opacity: 0.85;
}

.live-workout-more[hidden] {
  display: none;
}

.live-workout-more + .live-workout-stat {
  margin-left: auto;
}

.live-workout-stat {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 700;
  white-space: nowrap;
}

.live-workout-stat i {
  font-size: 0.74em;
  opacity: 0.85;
}

.live-workout-stat i[hidden] {
  display: none;
}

.live-workout-go {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding-left: 2px;
  border-radius: 50%;
  background: var(--pico-primary-inverse);
  color: var(--accent-hover);
  font-size: 0.74rem;
}

/* A rest takes the name's place: the workout is known, the countdown is what's being watched. */
.live-workout-rest {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  background: #fbbf24;
  color: #1c1917;
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.3;
  white-space: nowrap;
}

.live-workout-rest[hidden] {
  display: none;
}

.live-workout-rest i {
  font-size: 0.65em;
}

.live-workout-bar--resting .live-workout-dot,
.live-workout-bar--resting .live-workout-name,
.live-workout-bar--resting .live-workout-more,
.live-workout-bar--rest-over .live-workout-dot,
.live-workout-bar--rest-over .live-workout-name,
.live-workout-bar--rest-over .live-workout-more {
  display: none;
}

.live-workout-bar--resting .live-workout-fill {
  background: #fbbf24;
  transition: width 1s linear;
}

/* The same white as the play button beside it: go. */
.live-workout-bar--rest-over .live-workout-rest {
  background: var(--pico-primary-inverse);
  color: var(--accent-hover);
  font-size: 0.88rem;
}

.live-workout-bar--rest-over .live-workout-rest i {
  display: none;
}

/* "Unfinished since ..." is long and says nothing about the rest. */
.live-workout-bar--stale.live-workout-bar--resting .live-workout-stat + .live-workout-stat,
.live-workout-bar--stale.live-workout-bar--rest-over .live-workout-stat + .live-workout-stat {
  display: none;
}

/* The longest cue ("Koniec przerwy") doesn't fit beside both stats on the narrowest phones. */
@media (max-width: 360px) {
  .live-workout-bar--rest-over .live-workout-stat + .live-workout-stat {
    display: none;
  }
}

body.has-live-workout {
  padding-bottom: var(--live-workout-height);
}

body.has-live-workout #toast {
  bottom: calc(var(--live-workout-height) + 1rem);
}

body.has-live-workout #update-banner,
body.has-live-workout #moved-banner {
  bottom: calc(var(--live-workout-height) + 1rem);
}

body.has-live-workout .edit-toolbar {
  bottom: var(--live-workout-height);
}

/* A coach can reach a trainee's logger with no scope in the URL (a rest notification), so the bar
   can share that page with the rest strip. */
body.has-live-workout .rest-strip {
  bottom: var(--live-workout-height);
}

@media (max-width: 768px) {
  a.live-workout-bar {
    bottom: 60px;
  }

  body.has-live-workout .edit-toolbar {
    bottom: calc(60px + var(--live-workout-height));
  }

  body.has-live-workout .rest-strip {
    bottom: calc(60px + var(--live-workout-height));
  }

  body.has-live-workout {
    padding-bottom: calc(68px + var(--live-workout-height));
  }

  body.has-live-workout #toast {
    bottom: calc(60px + var(--live-workout-height) + 3rem);
  }

  body.has-live-workout #update-banner,
  body.has-live-workout #moved-banner {
    bottom: calc(60px + var(--live-workout-height) + 1rem);
  }

  body.has-live-workout .create-fab {
    bottom: calc(60px + var(--live-workout-height) + 1rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .live-workout-dot::after {
    animation: none;
    opacity: 0;
  }
}

/* ===== "Back to current exercise" pill (workout log detail) =====
   Floats bottom-center while the active exercise card is scrolled out of
   view. Sits above the tab bar (200) and rest strip (199), below the FAB
   (210) and modals (500); lifts over the rest strip while it's showing. */
.jump-to-active {
  position: fixed;
  left: 50%;
  bottom: calc(60px + 0.9rem);
  transform: translateX(-50%);
  z-index: 205;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  width: auto;
  max-width: calc(100vw - 2rem);
  min-height: 44px;
  margin: 0;
  padding: 0.55rem 1.1rem 0.55rem 0.95rem;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  /* Surface-colored ring separates the pill from card content scrolling under it. */
  box-shadow: 0 0 0 3px var(--surface), 0 4px 16px rgba(13, 148, 136, 0.35);
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, bottom 0.2s ease;
}

.jump-to-active:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 0 3px var(--surface), 0 6px 20px rgba(13, 148, 136, 0.45);
}

.jump-to-active i {
  font-size: 0.8rem;
  flex-shrink: 0;
}

.jump-to-active-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  min-width: 0;
}

.jump-to-active--above-rest {
  bottom: calc(60px + 31px + 0.9rem);
}

.jump-to-active--enter,
.jump-to-active--leave {
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.jump-to-active--hidden {
  opacity: 0;
  transform: translate(-50%, 0.5rem);
}

@media (min-width: 769px) {
  .jump-to-active {
    bottom: 1.25rem;
  }

  .jump-to-active--above-rest {
    bottom: calc(31px + 1.25rem);
  }
}

/* ===== Duration timer panel ===== */
.duration-timer-phase {
  text-align: center;
  padding: 1rem 0;
}

.duration-timer-big {
  font-size: 3rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.duration-timer-label {
  color: var(--text-muted);
  margin: 0.5rem 0 1rem;
}

.duration-timer-hint {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0.25rem 0 1rem;
}

/* ===== Background save status ===== */
.save-status {
  position: fixed;
  top: calc(var(--nav-height, 60px) + 0.5rem);
  right: 1rem;
  z-index: 215;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(13, 148, 136, 0.18);
}

.save-error-banner {
  position: fixed;
  top: calc(var(--nav-height, 60px) + 0.5rem);
  /* Centred like .offline-indicator (QA 22): left: 50% + translate caps a
     shrink-to-fit fixed box at half the viewport, so the longer rejected-save
     message wrapped to five narrow lines over the exercise header (QA 13). */
  left: 1rem;
  right: 1rem;
  margin-inline: auto;
  width: fit-content;
  max-width: 32rem;
  z-index: 230;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem 0.5rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  border-radius: 0.6rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.save-error-banner button {
  margin: 0;
  padding: 0.25rem 0.7rem;
  font-size: 0.8rem;
  white-space: nowrap;
}

/* Persistent "unreachable server, saving locally" indicator (offline-05).
   Deliberately neutral — mid-deploy the user is online, so no error styling. */
.offline-indicator {
  position: fixed;
  top: calc(var(--nav-height, 60px) + 0.5rem);
  /* Centred via left/right + auto margins, not left: 50% + translate: that
     caps a shrink-to-fit fixed box at half the viewport, so at 390px the copy
     wrapped to a tall six-line box over the active exercise card (QA 22). */
  left: 1rem;
  right: 1rem;
  margin-inline: auto;
  width: fit-content;
  max-width: 32rem;
  /* It stays up for the whole offline stretch, so taps must reach the card
     controls it overlaps. */
  pointer-events: none;
  z-index: 220;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-wrap: balance;
  /* Amber tint (the stale-suggestions badge's "heads up" tone), not error red:
     on white surfaces a white pill went unnoticed in a QA run. */
  color: var(--text);
  background: var(--warn-bg);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, var(--border));
  border-radius: 0.6rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.offline-indicator i {
  color: var(--warn);
}

/* ===== Active exercise card ===== */
article.exercise--active {
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.10), 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ===== Superset group ===== */
.superset-group {
  margin-bottom: 0.75rem;
}

.superset-label {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.3rem;
  padding-left: 1rem;
}

.superset-bracket {
  border-left: 3px solid var(--accent);
  padding-left: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.superset-bracket article {
  margin-bottom: 0 !important;
}

/* Per-color overrides. The default (un-colored) `.superset-bracket` /
   `.superset-label` above stays as `var(--accent)` so any unmocked page
   still renders teal. The modifier classes below win on views that
   apply `exerciseGroups().colorIndex` (template + log). */
/* The label's text is the group colour mixed toward --text (QA 120: the raw orange was ~2.9:1 on
   the page background, too faint for small caps); the bracket rule keeps the pure colour. */
.superset-label--color-1 { color: color-mix(in srgb, var(--color-group-1) 70%, var(--text)); }
.superset-label--color-2 { color: color-mix(in srgb, var(--color-group-2) 70%, var(--text)); }
.superset-label--color-3 { color: color-mix(in srgb, var(--color-group-3) 70%, var(--text)); }
.superset-label--color-4 { color: color-mix(in srgb, var(--color-group-4) 70%, var(--text)); }
.superset-label--color-5 { color: color-mix(in srgb, var(--color-group-5) 70%, var(--text)); }

.superset-bracket--color-1 { border-left-color: var(--color-group-1); }
.superset-bracket--color-2 { border-left-color: var(--color-group-2); }
.superset-bracket--color-3 { border-left-color: var(--color-group-3); }
.superset-bracket--color-4 { border-left-color: var(--color-group-4); }
.superset-bracket--color-5 { border-left-color: var(--color-group-5); }

/* ===== Insert-exercise points ("+" affordances between/inside exercise
   cards). Low default opacity keeps them visually non-intrusive; generous
   vertical padding (rather than a taller visible glyph) gives each a
   near-44px tappable strip without looking bulkier, since the padding area
   has no background of its own — important on mobile, which has no :hover
   to fall back on for discoverability. ===== */
.insert-point {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0;
  padding: 0.75rem 0;
  border: none;
  background: none !important;
  color: var(--text-muted);
  opacity: 0.45;
  cursor: pointer;
  font-size: 0.7rem;
  transition: opacity 0.15s, color 0.15s;
}

.insert-point:hover,
.insert-point:focus-visible {
  opacity: 1;
  color: var(--accent);
}

.insert-point--join {
  padding: 0.5rem 0;
}

.insert-point--color-1:hover { color: var(--color-group-1); }
.insert-point--color-2:hover { color: var(--color-group-2); }
.insert-point--color-3:hover { color: var(--color-group-3); }
.insert-point--color-4:hover { color: var(--color-group-4); }
.insert-point--color-5:hover { color: var(--color-group-5); }

.insert-point--end {
  min-height: 2.5rem;
  gap: 0.4rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  opacity: 0.7;
  font-size: 0.85rem;
  margin: 0.5rem 0 0;
  padding: 0.5rem;
}

.insert-point--end:hover,
.insert-point--end:focus-visible {
  opacity: 1;
  border-color: var(--accent);
  background: var(--accent-bg) !important;
}

/* Workout-log seam: a small round "+" centred on the gap above its group,
   taken out of the flow so it costs no vertical space (the template editor's
   full-width rows are fine behind edit mode; the log has no edit mode). The
   circle straddles the 0.75rem group gap and only reaches into the cards'
   padding; the ::after widens the tap target without growing the visual. z-index stays below the ⋯ dropdown (300) and sticky nav (100). */
#log-exercises .superset-group {
  position: relative;
}

.insert-point--overlay {
  position: absolute;
  top: -0.375rem;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  opacity: 1;
  font-size: 0.7rem;
}

/* Tap target ~40x58px: only 7px into the neighbouring cards vertically (their
   padding), wider sideways where there is nothing else to hit. */
.insert-point--overlay::after {
  content: '';
  position: absolute;
  inset: -7px -16px;
}

.insert-point--overlay:hover,
.insert-point--overlay:focus-visible {
  border-color: var(--accent);
}

/* An expanded non-active card is de-emphasised by its head only: opacity or a
   filter on the article would trap (and fade) the ⋯ dropdown in its stacking context. */
article.exercise--inactive .exercise-card-head {
  background: transparent;
}


/* ===== Workout-log exercise card ===== */
.exercise-card-head {
  margin: -0.875rem -1rem 0.75rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface2);
}

.exercise-card-titlerow {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.4rem;
}

/* An open card that isn't the current one folds on a tap on its title row (onCardClick). */
article.exercise--inactive .exercise-card-titlerow {
  cursor: pointer;
}

/* The name yields space so play, fold, and the menu stay on this row. min-width: 0
   overrides the flex item's content-sized minimum, which otherwise wraps the last
   control onto its own line. The ⓘ keeps margin-right: auto and stays next to the name. */
.exercise-card-titlerow > .exercise-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* .icon-btn and .settings-menu already refuse to shrink. The ⓘ sets min-width: 0,
   so without this it collapses with the name. */
.exercise-card-titlerow > .exercise-info-btn,
.exercise-card-titlerow > .exercise-shared-badge,
.exercise-card-titlerow > .spinner {
  flex-shrink: 0;
}

.exercise-alias {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.exercise-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
  margin-right: auto;
}

/* Edit mode: the exercise name IS the replace control. Styled as a soft pill with a
   swap glyph so it reads as "tap to change which exercise this is" — the affordance
   sits on the name instead of hiding as an unlabelled icon in the action row. */
.ex-name-swap {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.2;
  /* The global button rule sets letter-spacing: 0.08em directly on this element, so the
     header reset below cannot reach it — it has to be undone here, or the same exercise
     name renders wider-tracked in edit mode than the read-only .exercise-title beside it. */
  letter-spacing: normal;
  color: var(--text) !important;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  max-width: 100%;
  min-height: 2rem;
  margin: 0 auto 0 0 !important;
  /* Kept tight so the pill sits in the same density scale as the dimension chips
     under it — it is a row control, not a section header. */
  padding: 0.15rem 0.45rem !important;
  text-align: left;
  background: transparent !important;
  border: 1px dashed var(--border) !important;
  border-radius: var(--radius) !important;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  width: auto !important;
}

.ex-name-swap-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* The word carries the meaning the glyph alone never did; it stays small and muted so
   the exercise name keeps the hierarchy. */
.ex-name-swap-cue {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color 0.15s;
}

.ex-name-swap:hover:not(:disabled) {
  background: var(--accent-bg) !important;
  border-color: var(--accent) !important;
  border-style: solid !important;
}

.ex-name-swap:hover:not(:disabled) .ex-name-swap-cue {
  color: var(--accent);
}

.ex-name-swap:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.ex-name-swap:disabled {
  opacity: 0.6;
  cursor: default;
}

.exercise-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.exercise-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.exercise-meta-chip i {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.exercise-meta-chip--rest {
  color: var(--accent);
  background: var(--accent-bg);
  border-color: color-mix(in srgb, var(--accent) 25%, var(--border));
}

.exercise-meta-chip--rest i {
  color: var(--accent);
}

.exercise-meta-chip--done {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.exercise-meta-chip--done i {
  color: #fff;
}

/* More work sets logged than planned: amber, like the other "check this" hints. */
.exercise-meta-chip--over {
  color: #92400e;
  background: var(--warn-bg);
  border-color: color-mix(in srgb, var(--warn) 45%, var(--border));
}

.exercise-meta-chip--over i {
  color: var(--warn);
}

/* Previous-workout strip (top of card) */
.prev-workout {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.25rem 0.45rem;
  margin: 0 0 0.7rem;
  padding: 0.45rem 0.65rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  border-radius: var(--radius);
}

.prev-workout i {
  font-size: 0.72rem;
  color: var(--text-muted);
  align-self: center;
}

.prev-workout-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.prev-workout-values {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.prev-workout-source {
  font-size: 0.75rem;
  color: color-mix(in srgb, var(--text) 40%, var(--text-muted));
}

/* Last time's warmup / back-off sets, under the work sets while the next set goes to that block.
   Last child of the wrapping strip, so it takes its own row, flush with a wrapped source line. */
.prev-workout-sub {
  flex-basis: 100%;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 0.45rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: color-mix(in srgb, var(--text) 55%, var(--text-muted));
  font-variant-numeric: tabular-nums;
}

/* Quieter than the strip's own label, so the two don't compete. */
.prev-workout-sub-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--text-muted) 75%, transparent);
}

/* Per-exercise note */
.exercise-note {
  margin: 0 0 0.7rem;
}

.exercise-note-toggle {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  width: 100%;
  margin: 0;
  padding: 0.45rem 0.65rem;
  text-align: left;
  background: var(--surface2);
  border: 1px dashed color-mix(in srgb, var(--accent) 55%, var(--border));
  border-radius: var(--radius);
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 400;
  transition: border-color 0.15s, background 0.15s;
}

.exercise-note-toggle:hover {
  border-color: var(--accent);
}

.exercise-note-icon {
  font-size: 0.72rem;
  color: var(--accent);
  align-self: center;
}

.exercise-note-text {
  font-size: 0.85rem;
  color: var(--text);
  white-space: pre-wrap;
}

.exercise-note-toggle--empty .exercise-note-add {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.exercise-note-form textarea {
  margin-bottom: 0.5rem;
  width: 100%;
}

.exercise-note-actions {
  display: flex;
  gap: 0.5rem;
}

.exercise-note-actions button {
  margin: 0;
  width: auto;
}

/* Logged-set rows */
.logged-set-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0;
}

.set-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  font-family: 'Bebas Neue', sans-serif;
  font-size: 0.85rem;
  line-height: 1;
  color: var(--text-muted);
}

.logged-set-values {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 0.6rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.logged-set-row .icon-btn {
  margin-left: 0 !important;
}

/* Badge shown on a suggestion grid whose cards came from the offline cache
   rather than a live fetch (offline-stale-suggestions). Inline/per-exercise,
   unlike the page-level fixed .offline-indicator banner. */
.suggestion-stale-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  /* Same amber as .suggestion-tile--down just below — this feature's existing
     "heads up, not current" tone — so it reads as its own signal rather than
     blending into the muted eyebrow labels (prev workout / last note). */
  color: var(--warn);
  margin-bottom: 0.4rem;
}

/* ===== Suggestion grid tiles ===== */
.suggestion-grid {
  display: grid;
  /* auto-fit, not auto-fill: auto-fill keeps the empty tracks, so a lone tile stayed one 76px
     column with the rest of the row blank (QA 68). */
  grid-template-columns: repeat(auto-fit, minmax(76px, 1fr));
  gap: 0.3rem;
  margin: 0.4rem 0;
}

.suggestion-tile {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  /* Values from the top, caption on the bottom: tiles in a row share a height, so a caption
     that wraps to two lines no longer lifts that tile's values above its neighbours'. */
  justify-content: flex-start !important;
  gap: 0.1rem !important;
  padding: 0.35rem 0.35rem 0.5rem !important;
  background: var(--surface2) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  font-family: 'Plus Jakarta Sans', sans-serif !important;
  font-size: 0.68rem !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
  color: var(--text) !important;
  text-align: center;
  min-height: 2.6rem;
  transition: background 0.12s, border-color 0.12s;
  cursor: pointer;
  user-select: none;
  margin-bottom: 0 !important;
}

/* Category-coded tiles: up = improvement (green), down = back-off (amber), same = neutral */
.suggestion-tile--up {
  background: var(--success-bg) !important;
  border-color: color-mix(in srgb, var(--success) 32%, var(--border)) !important;
}
.suggestion-tile--up .suggestion-tile-value--highlight,
.suggestion-tile--up .suggestion-tile-label {
  color: var(--success);
}
.suggestion-tile--up:hover {
  background: color-mix(in srgb, var(--success) 10%, white) !important;
  border-color: var(--success) !important;
}

.suggestion-tile--down {
  background: var(--warn-bg) !important;
  border-color: color-mix(in srgb, var(--warn) 32%, var(--border)) !important;
}
.suggestion-tile--down .suggestion-tile-value--highlight,
.suggestion-tile--down .suggestion-tile-label {
  color: var(--warn);
}
.suggestion-tile--down:hover {
  background: color-mix(in srgb, var(--warn) 10%, white) !important;
  border-color: var(--warn) !important;
}

.suggestion-tile--same {
  background: var(--info-bg) !important;
  border-color: color-mix(in srgb, var(--info) 32%, var(--border)) !important;
}
.suggestion-tile--same .suggestion-tile-label {
  color: var(--info);
}
.suggestion-tile--same:hover {
  background: color-mix(in srgb, var(--info) 10%, white) !important;
  border-color: var(--info) !important;
}

.suggestion-tile-value {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.suggestion-tile-value--highlight {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
}

/* QA 42: a caption longer than the tile ("PUNKT STARTOWY") wraps onto a second line inside
   it. It used to be an inline-flex row whose text, a flex item, kept its one-line width and
   painted past the tile's border. As a centred block with an inline icon, every line centres
   and the icon leads the first one. */
.suggestion-tile-label {
  display: block;
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: center;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: 0.05rem;
  line-height: 1.15;
  max-width: 100%;
  /* Wrap at spaces, never inside a word (QA 68); overflow stays clipped to the tile (QA 42). */
  overflow-wrap: normal;
  overflow: hidden;
}

.suggestion-tile-icon {
  font-size: 0.6rem;
  line-height: 1;
  margin-right: 0.2rem;
}

/* ===== Workout-log card: sections, collapsed row, next-set entry ===== */
/* Small uppercase dividers that split the card into "Today" and "Set N". */
.set-section-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.6rem 0 0.35rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.set-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Set blocks 04: the next set's block ("Warmup" / "Back-off") and the "Skip warmup" link,
   which sits past the divider line at the row's end. */
.set-block-tag {
  padding: 0 0.35rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.set-block-tag--backoff {
  color: var(--accent);
}

/* The next set would go past the plan. */
.set-block-tag--extra {
  color: #92400e;
  background: var(--warn-bg);
  border-color: color-mix(in srgb, var(--warn) 45%, var(--border));
}

.set-section-label::after {
  order: 1;
}

.set-section-label .set-skip-warmup {
  order: 2;
  width: auto;
  margin: 0;
  padding: 0.3rem 0.1rem;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

/* Sets grouped under their blocks. The head only shows on a card with several blocks; it sits
   under "Today" as a child: smaller, lighter and indented behind a thin rule. */
.set-block-head {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin: 0.4rem 0 0;
  padding-left: 0.45rem;
  border-left: 2px solid var(--border);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.set-block:first-child .set-block-head {
  margin-top: 0.1rem;
}

.set-block--backoff .set-block-label {
  color: var(--accent);
}

.set-block-progress {
  font-weight: 600;
  letter-spacing: 0;
}

.set-block-progress--over {
  padding: 0 0.4rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--border));
  background: var(--warn-bg);
  color: #92400e;
}

/* "Extra" on a work set logged past the plan (often one logged twice by mistake). It sits with
   the values, which wrap, so the author pill and pencil keep their column. */
.extra-set-chip {
  align-self: center;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--warn) 30%, var(--border));
  background: var(--warn-bg);
  /* amber-800: the plain --warn is too light for small text on --warn-bg. */
  color: #92400e;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

/* QA 127: "Warm-up?" on a light first set: a one-tap chip in the values, like "Extra", in the
   warm-up marker's dashed outline. The row padding gives it a taller tap area than it shows. */
.warmup-hint-chip {
  align-self: center;
  width: auto !important;
  margin: 0 !important;
  padding: 0.2rem 0.6rem !important;
  border-radius: 999px !important;
  border: 1px dashed var(--accent) !important;
  background: var(--accent-bg) !important;
  box-shadow: none !important;
  color: var(--accent) !important;
  font-size: 0.75rem !important;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  position: relative;
}

/* A taller tap target than the pill shows: it is a one-shot action in a dense row. */
.warmup-hint-chip::before {
  content: '';
  position: absolute;
  inset: -0.6rem -0.25rem;
}

/* A warmup set: dimmed, with its R1/W1 marker in a dashed pill. */
.set-number--warmup {
  width: auto;
  min-width: 1.5rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  border-style: dashed;
}

.logged-set-row--warmup .logged-set-values {
  opacity: 0.75;
  font-weight: 400;
}

/* Context strip: history + notes stacked tightly, read as one block. */
.exercise-context {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.exercise-context .prev-workout,
.exercise-context .exercise-note {
  margin: 0;
}

.exercise-context .prev-workout,
.exercise-context .exercise-note-toggle {
  padding: 0.3rem 0.6rem;
}

/* Collapse/expand: both bodies stay mounted and fold via grid rows, so the
   height animates. The folded one is also visibility:hidden (flipped after the
   fold finishes) so it can't be focused or tapped. Keep the 250ms in step with
   CARD_FOLD_MS in js/pages/workout-log-detail.js. */
.exercise-fold {
  display: grid;
  grid-template-rows: 1fr;
  opacity: 1;
  transition: grid-template-rows 250ms ease, opacity 200ms ease, visibility 0s;
}

.exercise-fold-inner {
  min-height: 0;
  overflow: hidden;
}

.exercise-fold--summary,
article.exercise--collapsed .exercise-fold--body {
  grid-template-rows: 0fr;
  opacity: 0;
  visibility: hidden;
  transition: grid-template-rows 250ms ease, opacity 150ms ease, visibility 0s 250ms;
}

article.exercise--collapsed .exercise-fold--summary {
  grid-template-rows: 1fr;
  opacity: 1;
  visibility: visible;
  transition: grid-template-rows 250ms ease, opacity 200ms ease, visibility 0s;
}

@media (prefers-reduced-motion: reduce) {
  .exercise-fold,
  .exercise-fold--summary,
  article.exercise--collapsed .exercise-fold--body,
  article.exercise--collapsed .exercise-fold--summary {
    transition: none;
  }
}

article.exercise--collapsed {
  cursor: pointer;
}

/* Collapsed (non-active) card: head + one tappable summary line. */
article.exercise--collapsed .exercise-card-head {
  margin-bottom: 0;
  border-bottom: none;
  border-radius: var(--radius);
  background: transparent;
  padding-bottom: 0.2rem;
}

.exercise-collapsed-summary {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  width: 100% !important;
  margin: 0 !important;
  padding: 0.15rem 0 0 !important;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  text-align: left;
  font-family: 'Plus Jakarta Sans', sans-serif !important;
  font-size: 0.85rem !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  color: var(--text) !important;
  cursor: pointer;
}

.exercise-collapsed-label {
  flex-shrink: 0;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.exercise-collapsed-values {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.exercise-collapsed-warmup {
  margin-left: 0.4rem;
  color: var(--text-muted);
}

.exercise-collapsed-warmup-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.set-active-btn {
  color: var(--accent) !important;
}

.exercise-toggle-icon {
  transition: transform 250ms ease;
}

.exercise-toggle-icon--open {
  transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
  .exercise-toggle-icon {
    transition: none;
  }
}

/* Logged-set rows open their editor on tap. */
.logged-set-row {
  cursor: pointer;
  border-radius: var(--radius);
}

/* Hover only where a pointer really hovers: a phone keeps :hover on the last tapped row, which
   left it grey after its editor closed (QA 98). Keyboard focus shows everywhere. */
@media (hover: hover) {
  .logged-set-row:hover {
    background: var(--surface2);
  }
}

.logged-set-row:focus-visible {
  background: var(--surface2);
  outline: none;
}

/* A set another device just logged (livesync-03): a short accent tint that
   fades out, so the viewer notices what the coach/trainee logged. Background
   only — no padding or border change, so the row never shifts. Duration in
   step with REMOTE_FLASH_MS in js/pages/workout-log-detail.js. */
.logged-set-row--remote-new {
  animation: remote-set-flash 2s ease-out;
}

@keyframes remote-set-flash {
  0%,
  35% {
    background: color-mix(in srgb, var(--accent) 15%, transparent);
  }
  100% {
    background: transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  .logged-set-row--remote-new {
    animation: none;
    background: color-mix(in srgb, var(--accent) 12%, transparent);
  }
}

/* Who logged a set, on a log a coach and a trainee both filled in
   (livesync-04). A compact pill that never wraps or grows the row: long names
   ellipsize. "You" stays muted; the other person's sets get the accent, so a
   trainee spots what the coach logged at a glance. */
.logged-set-author {
  flex-shrink: 0;
  max-width: 6.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
}

.logged-set-author--other {
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  background: var(--accent-bg);
  color: var(--accent-hover);
}

/* "Duplicate? · Remove · ✕" on the later of two identical sets two people
   logged within seconds (livesync-05). Amber, like the other "check this"
   hints. It must keep the row on one line at 360 px, so it never wraps, the
   label is the short form (the full sentence is the title), and the row drops
   the author pill and pencil while it shows. */
.duplicate-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
  padding: 0 0 0 0.5rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--warn) 30%, var(--border));
  background: var(--warn-bg);
  /* amber-800: the plain --warn is too light for 11.5px text on --warn-bg. */
  color: #92400e;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: default;
}

/* The row can't grow, so each button's hit area reaches past the chip
   vertically (about 44px tall) without moving the layout. */
.duplicate-chip-btn {
  position: relative;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: auto !important;
  min-height: 1.875rem;
  margin: 0 !important;
  padding: 0 0.35rem !important;
  border: none !important;
  border-radius: 999px !important;
  background: none !important;
  box-shadow: none !important;
  color: #92400e !important;
  font-size: 0.72rem !important;
  font-weight: 700;
  line-height: 1.2;
}

.duplicate-chip-btn::after {
  content: '';
  position: absolute;
  inset: -0.45rem 0;
}

.duplicate-chip-remove {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* 1.75rem wide and flush right, so the ✕ sits in the pencil's column. */
.duplicate-chip-dismiss {
  width: 1.75rem !important;
  padding: 0 !important;
  color: var(--text-muted) !important;
}

.duplicate-chip-btn:hover,
.duplicate-chip-btn:focus-visible {
  background: color-mix(in srgb, var(--warn) 14%, transparent) !important;
}

/* A set the server rejected (QA 13): the rejected-save banner points here. */
.logged-set-row--invalid {
  background: var(--danger-bg);
  box-shadow: inset 3px 0 0 var(--danger);
  padding-left: 0.4rem;
}

.logged-set-invalid {
  color: var(--danger);
  font-size: 0.8rem;
}

.logged-set-edit {
  border-color: transparent !important;
  opacity: 0.6;
}

.set-edit-form {
  padding: 0.5rem;
  margin: 0.2rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface2);
}

.set-edit-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.set-role-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.set-role-toggle input[type="checkbox"] {
  margin: 0;
}

.set-edit-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.set-edit-actions button {
  margin: 0 !important;
  width: auto;
}

.set-edit-actions .icon-btn {
  margin-left: auto !important;
}

/* QA 57: the set form's fields, side by side in two equal columns (a lone or odd last field
   spans the row). Each
   column is increase above the value and decrease below; the small step (single chevron, grey)
   sits left and the big one (double chevron, teal tint) right. The unit sits inside the value
   box ("60 kg") and cycles units on tap when the dimension has more than one. */
.set-steppers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 0.9rem;
}

/* Divs only: the x-for <template> is a sibling too. */
.set-stepper:last-of-type:nth-of-type(odd) {
  grid-column: 1 / -1;
}

.set-stepper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  min-width: 0;
}

.set-stepper-value {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  min-width: 0;
  height: 3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.set-stepper-value input[inputmode] {
  flex: 1 1 0;
  min-width: 0 !important;
  width: 0 !important;
  height: 100% !important;
  margin: 0 !important;
  border: none !important;
  box-shadow: none !important;
  background: none !important;
  padding: 0 0.15rem 0 0.4rem !important;
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* "optional" (QA 92): a hint, not a value, so not bold like the number. Smaller
   so "opcjonalnie" fits a 320px phone; the input itself stays 16px (iOS zoom). */
.set-stepper-value input[inputmode]::placeholder {
  font-weight: 400;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.set-stepper-value input[inputmode]:focus {
  outline: none;
}

/* The focus ring wraps the unit too, so the box reads as one field. */
.set-stepper-value:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.set-stepper-value .unit-suffix {
  padding-right: 0.6rem !important;
}

.step-tap {
  height: 2.75rem;
  width: 100% !important;
  min-width: 0;
  margin: 0 !important;
  padding: 0 !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  box-shadow: none !important;
  background: var(--surface2) !important;
  color: var(--text-muted) !important;
  font-size: 1.3rem !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}

.step-tap--big {
  background: color-mix(in srgb, var(--accent) 10%, var(--surface)) !important;
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border)) !important;
  color: var(--accent) !important;
}

/* A unit with one step size (milliseconds): one button above and below, full width. */
.step-tap--only {
  grid-column: 1 / -1;
}

.step-tap:active {
  background: var(--accent-bg) !important;
}

.unit-suffix {
  flex: none;
  width: auto !important;
  height: 100%;
  margin: 0 !important;
  padding: 0 0.5rem 0 0.2rem !important;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  font-family: 'Plus Jakarta Sans', sans-serif !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  color: var(--accent) !important;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  cursor: pointer;
}

.unit-suffix:disabled {
  color: var(--text-muted) !important;
  text-decoration: none;
  opacity: 1 !important;
  cursor: text;
}

/* Suggestions and own entry are two distinct choices: a captioned tile grid,
   then the entry panel, whose caption runs into a hairline divider. */
.entry-caption {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.entry-caption i {
  font-size: 0.7rem;
  color: var(--accent);
}

.suggestions {
  margin-bottom: 0.7rem;
}

.suggestions .suggestion-grid {
  margin-top: 0.3rem;
}

.suggestion-tile {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.entry-panel-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.75rem;
  margin-bottom: 0.45rem;
}

/* Fixed two-segment mode switch: stays put whichever mode is on. Pico styles
   [role="group"] as a full-width button group, so size it back down here. */
.entry-panel-head::after {
  content: '';
  flex: 1;
  order: 1;
  height: 1px;
  background: var(--border);
}

.entry-panel-head .entry-mode {
  order: 2;
}

.entry-mode {
  display: inline-flex;
  width: auto !important;
  margin: 0 !important;
  box-shadow: none !important;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.entry-mode-btn {
  width: 2.75rem !important;
  height: 2.75rem !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: none !important;
  box-shadow: none !important;
  color: var(--text-muted) !important;
  font-size: 0.85rem !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}

.entry-mode-btn + .entry-mode-btn {
  border-left: 1px solid var(--border) !important;
}

.entry-mode-btn--on {
  background: var(--accent-bg) !important;
  color: var(--accent) !important;
}

.set-entry-submit {
  width: 100%;
  margin: 0 !important;
}

.quick-entry-input {
  margin-bottom: 0.5rem !important;
}

/* The exercise ⋯ menu reuses the settings dropdown shell. */
.settings-dropdown button i {
  width: 1.1rem;
  margin-right: 0.35rem;
  color: var(--text-muted);
  text-align: center;
}

.settings-dropdown button.danger,
.settings-dropdown button.danger i {
  color: var(--danger) !important;
}

.settings-dropdown button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ===== FAB (Floating Action Button) =====
   Named .create-fab, not .fab: Font Awesome's stylesheet (loaded after this one) owns
   .fab as its "brands" icon class and would override display and font-family here. */
.create-fab {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-family: system-ui, sans-serif;
  font-size: 1.75rem;
  font-weight: 300;
  line-height: 1;
  border: none;
  box-shadow: 0 4px 16px rgba(13, 148, 136, 0.35);
  z-index: 210;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  transition: background 0.15s, box-shadow 0.15s;
  cursor: pointer;
  letter-spacing: 0;
}

.create-fab:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 20px rgba(13, 148, 136, 0.45);
}

@media (max-width: 768px) {
  .create-fab {
    bottom: calc(60px + 1rem);
  }

  /* Keeps the last row's buttons clear of the fixed FAB circle — otherwise the FAB can
     sit directly over (and intercept clicks on) whatever row renders last. Desktop has
     no FAB (the button sits in the header), so no clearance there. */
  main.container.fab-clearance {
    padding-bottom: 5rem;
  }
}

/* The .create-fab lives in .page-header-actions and carries its own label: a `+` circle
   pinned above the tab bar on phones (label visually hidden, still the accessible
   name), a labelled pill in the header row on desktop — where desktop eyes start,
   instead of a corner far from the centred content column. One element for both
   layouts keeps each page's testid and handler unambiguous. */
.fab-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.fab-content {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

@media (min-width: 769px) {
  /* Same 2rem height as the .icon-btn neighbours so the header row shares one top and
     bottom edge; colour and the label's display type carry the primary emphasis. */
  .create-fab {
    position: static;
    width: auto;
    height: 2rem;
    padding: 0 0.9rem 0 0.75rem;
    border-radius: 999px;
    gap: 0.35rem;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(13, 148, 136, 0.25);
  }

  .create-fab .fab-icon {
    font-size: 1.2rem;
    font-weight: 400;
    line-height: 1;
  }

  .create-fab .fab-label {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    line-height: 1;
  }
}

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 27, 24, 0.5);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* Top-anchored modal, for a card whose height changes while it is in use (the exercise
   pickers' in-flow search results, see .typeahead--inline). Centred, such a card would
   jump up under the user's finger each time the list opened; anchored, it only grows
   downward — and stays clear of the phone keyboard. */
.modal-backdrop--top {
  align-items: flex-start;
  padding-top: max(1rem, 6vh);
}

.modal-card {
  width: 100%;
  /* 80vw alone stretches into an absurdly wide card on desktop viewports (a
     search box + single-column list spanning 1500px+); cap it so it only
     grows to fill 80vw on narrow/mobile screens. */
  max-width: min(80vw, 34rem);
  max-height: 90vh;
  overflow-y: auto;
  margin: 0 !important;
  /* The generic `article` rule below is tuned for tight, stacked list rows
     (exercise cards) and reads as cramped/edge-to-edge on a centered dialog —
     give modals their own more generous padding. */
  padding: 1.5rem 1.75rem 1.75rem !important;
}

.modal-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* Cancel the card's own padding so the header bar still spans full-bleed
     edge-to-edge (matching `article > header`'s trick), then re-apply it as
     the header's own padding. */
  margin: -1.5rem -1.75rem 1.5rem !important;
  padding: 1rem 1.75rem !important;
}

.modal-close {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  font-family: system-ui, sans-serif !important;
  font-size: 1.25rem !important;
  line-height: 1 !important;
  color: var(--text-muted) !important;
  letter-spacing: 0 !important;
  cursor: pointer;
  width: auto !important;
  height: auto !important;
  min-width: 0 !important;
}

.modal-close:hover {
  color: var(--text) !important;
  background: none !important;
}

/* Vertical rhythm for stacked modal content. Several modals put a control and a
   button back-to-back, and both Pico (form controls) and .typeahead zero out
   their margins — so without an owning gap the two ends up flush against each
   other. Same idea as .add-exercise-form, but not tied to one page. */
.modal-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.modal-stack > button {
  margin-bottom: 0;
}

/* Template-row "options" modal: a vertical action list (duplicate / move up-down /
   archive) plus the "move to program" select, all consolidated here so a template
   row itself only needs start/edit/options buttons — see templates.html. Mirrors
   .settings-dropdown's row look but unpositioned, since this lives inside a
   centered .modal-card instead of an anchored dropdown. */
.options-menu {
  display: flex;
  flex-direction: column;
}

.options-menu-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  text-align: left;
  background: none !important;
  border: none !important;
  border-bottom: 1px solid var(--border) !important;
  border-radius: 0 !important;
  padding: 0.85rem 0.25rem !important;
  margin: 0 !important;
  font-size: 0.9rem !important;
  font-weight: 500 !important;
  color: var(--text) !important;
  cursor: pointer;
}

.options-menu-item:disabled {
  opacity: 0.5;
  cursor: default;
}

.options-menu-item.danger {
  color: var(--danger) !important;
}

.options-menu-item i,
.options-menu-item .spinner {
  flex-shrink: 0;
  width: 1.1rem;
  text-align: center;
}

.options-menu-select {
  display: block;
  padding: 0.85rem 0.25rem !important;
  border-bottom: 1px solid var(--border);
}

.options-menu-select select {
  margin: 0.35rem 0 0 !important;
}

.options-menu :is(.options-menu-item, .options-menu-select):last-child {
  border-bottom: none !important;
}

/* SortableJS drag handles — a grab affordance, not an action button.
   Self-contained reset (no .icon-btn) so Pico's filled button chrome does
   not leak through. display is not !important so Alpine x-show can hide it. */
.drag-handle,
.program-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* Narrower than .icon-btn so the silhouette is a grip rail, not a 4th button. */
  width: 1.5rem;
  min-width: 1.5rem;
  height: 2rem;
  padding: 0 !important;
  margin: 0 0 0 0.45rem !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none !important;
  color: var(--text-muted) !important;
  opacity: 0.5;
  font-size: 1rem !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
  flex-shrink: 0;
  cursor: grab !important;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  appearance: none !important;
  -webkit-appearance: none !important;
  transition: opacity 0.15s, color 0.15s;
}

.drag-handle:hover,
.program-drag-handle:hover,
.drag-handle:focus-visible,
.program-drag-handle:focus-visible {
  color: var(--text) !important;
  opacity: 0.9;
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.drag-handle:focus-visible,
.program-drag-handle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.drag-handle:active,
.program-drag-handle:active {
  cursor: grabbing !important;
}

/* Full-width edit-mode action row: pin the grip to the card's trailing edge. */
.exercise-edit-actions {
  display: flex;
  /* Up to five icon actions (move up/down, link, unlink, remove) plus the drag
     handle can still overflow one line on the narrowest phones — wrap instead of
     squashing the buttons below a comfortable touch target. */
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}

.exercise-edit-actions .drag-handle {
  margin-left: auto !important;
}

/* Placeholder for where the dragged row will land. Now that rows can cross
   between the ungrouped bucket and program lists, the ghost is the drop-target
   cue too — hence the dashed accent outline, not just a fade. */
.sortable-ghost {
  opacity: 0.45;
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
  background: var(--surface2) !important;
}

.sortable-chosen {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
}

.sortable-drag {
  opacity: 1;
}

/* forceFallback preview is position:fixed on <body> with inline opacity 0.8.
   Keep it a solid lifted card so name/grip/actions stay readable while dragging. */
.sortable-fallback.sortable-drag {
  opacity: 1 !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}

/* Template version history modal (coaching-06) */
.version-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.version-item:last-child {
  border-bottom: none;
}

.version-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.version-item-row small {
  color: var(--text-muted);
  margin-left: 0.25rem;
}

.version-item-actions {
  display: flex;
  gap: 0.35rem;
}

.version-item-actions button {
  margin: 0;
  padding: 0.25rem 0.6rem;
  font-size: 0.85rem;
  width: auto;
}

.version-preview {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--card-alt, rgba(128, 128, 128, 0.08));
  border-radius: 0.5rem;
  font-size: 0.9rem;
}

.version-preview ul {
  margin: 0.25rem 0 0;
  padding-left: 1.1rem;
}

.version-preview p {
  margin: 0.25rem 0;
}

/* Confirmation modal (window.showConfirm) — a compact variant of the modal. */
.confirm-modal-card {
  max-width: 420px;
}

.confirm-modal-message {
  margin: 0.5rem 0 1.25rem;
}

/* "How to do it" sheet (js/exercise-info.js, onboarding-05). */
.exercise-info-card {
  max-width: min(92vw, 34rem);
  /* Header and footer stay put; only the instructions scroll, so the YouTube link and the edit
     button are always reachable however long the text is. */
  display: flex;
  flex-direction: column;
  overflow: hidden !important;
  /* Short enough to stay clear of the mobile tab bar when centred. */
  max-height: min(80dvh, 42rem);
}

/* The shared modal header is a small uppercase label; here it carries the exercise name, so it
   reads as the sheet's title instead. */
.exercise-info-card > header span {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
}

.exercise-info-card > header .modal-close {
  min-width: 2.75rem !important;
  min-height: 2.75rem !important;
  margin-right: -0.75rem !important;
}

.exercise-info-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  font-size: 0.95rem;
}

.exercise-info-editor {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.exercise-info-subtitle {
  margin: -0.75rem 0 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.exercise-info-hint {
  margin: 0 0 0.75rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
}

.exercise-info-steps {
  margin: 0;
  padding: 0 0 0.75rem 1.4rem;
}

.exercise-info-steps li {
  margin-bottom: 0.6rem;
  line-height: 1.5;
}

.exercise-info-steps li::marker {
  color: var(--accent);
  font-weight: 700;
}

.exercise-info-text p {
  margin: 0 0 0.6rem;
  line-height: 1.5;
}

.exercise-info-empty {
  margin: 0 0 1rem;
  color: var(--text-muted);
}

.exercise-info-editor textarea {
  width: 100%;
  margin-bottom: 0.75rem;
  resize: none;
}

/* Full-bleed like the header (cancelling the card padding), without Pico's shaded, inset
   `article > footer` box. */
.exercise-info-card > .exercise-info-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0.75rem -1.75rem -1.75rem !important;
  padding: 0.5rem 1.75rem 0.75rem !important;
  background: none !important;
  border-top: 1px solid var(--border) !important;
  border-radius: 0;
}

.exercise-info-youtube {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.exercise-info-youtube .fa-youtube {
  font-size: 1.2rem;
}

.exercise-info-footer .exercise-info-edit {
  margin: 0 0 0 auto;
  width: auto;
}

/* The ⓘ sits beside the name and takes over margin-right: auto, so the fold control and
   menu stay at the right. :has, not "+", because the template title comes from an x-if
   and is not the button's previous sibling. The button must be left out of the DOM
   (x-if): a display:none child still matches :has and drops the title's margin. */
:has(> .exercise-info-btn) > .exercise-title {
  margin-right: 0;
}

.exercise-info-btn {
  position: relative;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 0.2rem !important;
  margin: 0 auto 0 -0.1rem !important;
  width: auto !important;
  min-width: 0;
  height: 2rem;
  color: var(--text-muted) !important;
  opacity: 0.7;
  font-size: 0.95rem;
  cursor: pointer;
}

/* A 44px tap target without spreading the glyph away from the name. */
.exercise-info-btn::after {
  content: '';
  position: absolute;
  inset: 50% auto auto 50%;
  width: 2.75rem;
  height: 2.75rem;
  transform: translate(-50%, -50%);
}

/* On the Exercises list the name row already lays out name, button and chips with a gap. */
.exercise-name-row > .exercise-info-btn {
  margin-right: 0 !important;
  height: 1.75rem;
  min-width: 1.75rem;
}

.exercise-info-btn:hover,
.exercise-info-btn:focus-visible {
  color: var(--accent) !important;
  opacity: 1;
}

.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin: 0;
}

.confirm-modal-actions button {
  width: auto;
  margin: 0;
}

/* Multi-choice modal (window.showChoice) — reuses .confirm-modal-actions but stacks its buttons
   full-width: labels can be longer (embedding a workout template name) and there can be three. */
.choice-modal-actions {
  flex-direction: column;
  align-items: stretch;
}

.choice-modal-actions button {
  width: 100%;
}

.btn-danger {
  --pico-background-color: var(--danger);
  --pico-border-color: var(--danger);
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-danger:hover,
.btn-danger:focus {
  background: color-mix(in srgb, var(--danger) 85%, black);
  border-color: color-mix(in srgb, var(--danger) 85%, black);
  color: #fff;
}

/* ===== Page header (heading + gear) ===== */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.page-header hgroup {
  margin-bottom: 0;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  margin-top: 0.25rem;
}

/* The log header's ⋯ menu opens leftward from the right gutter; its items stay one line each
   ("Export to Google Sheets" with its icon would otherwise wrap at the 200px min-width). */
#log-header .settings-dropdown button {
  white-space: nowrap;
}

/* Holds a header button's place while its action runs (the log page's ⋯ menu during a delete),
   so the row doesn't shift. Same box as .icon-btn--tap. */
.header-spinner-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
}

/* ===== Template detail: read-only view =====
   The preview reuses the workout-log-detail card vocabulary (.exercise-card-head,
   .exercise-title, .exercise-meta-chip) so a template and the workout it produces
   read as the same object. Only the pieces below are template-specific. */
.template-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.template-hero-main {
  flex: 1;
  min-width: 0;
}

.template-hero-title {
  margin-bottom: 0.25rem;
}

.template-hero-desc {
  margin-bottom: 0;
  color: var(--text-muted);
}

.template-hero-meta {
  margin-top: 0.65rem;
}

.template-hero-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  margin-top: 0.25rem;
}

.template-start-btn {
  width: auto !important;
  margin-bottom: 0 !important;
  padding: 0.45rem 0.9rem !important;
  font-size: 0.8rem !important;
  white-space: nowrap;
}

.template-start-btn i {
  font-size: 0.7rem;
}

/* Compact outline sibling of .template-start-btn. An <a> (it navigates), so
   Pico's a[role=button] default size never applies; copy Start's metrics and
   the Bebas chrome that `button` gets from the global rule. Do not !important
   display — Alpine x-show hides this in kiosk. */
a.template-progress-btn {
  width: auto !important;
  margin-bottom: 0 !important;
  padding: 0.45rem 0.9rem !important;
  font-size: 0.8rem !important;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  text-decoration: none !important;
  background: transparent !important;
  color: var(--accent) !important;
  border: 1px solid var(--accent) !important;
  border-radius: var(--radius) !important;
  font-family: 'Bebas Neue', sans-serif;
  letter-spacing: 0.08em;
  line-height: 1.2;
  box-sizing: border-box;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

a.template-progress-btn:hover {
  background: var(--accent-bg) !important;
  color: var(--accent-hover) !important;
  border-color: var(--accent-hover) !important;
}

a.template-progress-btn i {
  font-size: 0.7rem;
}

article.template-exercise-card {
  padding: 0.875rem 1rem !important;
  margin-bottom: 0.5rem !important;
}

/* The card head is a <header> here, so undo the global `article > header` label styling
   that would shout the exercise name. Edit mode reuses the same element and needs the same
   reset, hence the second selector. Only these three properties are worth resetting: the
   chrome (margin/padding/border-bottom/background) is declared `!important` on
   `article > header` above, so it wins over both classes either way — .exercise-card-head's
   own margins and background never actually reach this header. Without the reset the name
   relies on Pico's `button{text-transform:none}` to escape being uppercased, and picks up
   0.08em tracking the read-only .exercise-title does not have — an accident, not a fix. */
header.exercise-card-head,
header.exercise-edit-head {
  letter-spacing: normal;
  text-transform: none;
  color: var(--text);
}

/* The dimension chips sit inside that header and used to inherit their uppercase from the
   `article > header` rule the reset above cancels, so they own it explicitly now. Scoped to
   the header on purpose: .dim-chip in the exercises.html list rows and modals is sentence
   case, and that is not this change's call to make. */
header.exercise-edit-head .dim-chip {
  text-transform: uppercase;
}

/* Position in the template — the thing a printed workout card always shows. */
.tex-order {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: var(--accent-bg);
  color: var(--accent);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
}

/* The prescription: "3 × 5–8 powt. · 60–80 kg" as one scannable line. Each quantity
   carries its unit, so a middle dot is all that separates them. */
.tex-prescription {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.3rem 0.5rem;
}

/* Set blocks 04: a warmup / back-off line next to the work line in view mode. */
.tex-block-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.2rem 0.5rem;
  margin: 0.3rem 0;
}

.tex-block-line[data-kind="warmup"] .tex-sets-count,
.tex-block-line[data-kind="warmup"] .tex-target-value {
  color: var(--text-muted);
}

.tex-block-tag {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.tex-block-tag--backoff {
  color: var(--accent);
}

.tex-block-note {
  flex-basis: 100%;
  margin: 0.05rem 0 0.3rem;
  padding-left: 0.45rem;
  border-left: 2px solid var(--border);
  font-size: 0.78rem;
  font-style: italic;
  color: var(--text-muted);
}


.tex-sets {
  display: inline-flex;
  align-items: baseline;
  gap: 0.1rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.tex-sets-count {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.tex-sets-x {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.tex-target {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  min-width: 0;
}

/* The ↓ pill is a box, not text: baseline-aligning it against the value's baseline hangs
   it low, because its own baseline sits above its bottom padding. Centre it instead. */
.tex-target .dim-chip--direction {
  align-self: center;
}

/* x-for emits the .tex-target spans as direct siblings, so the separator is a pure
   CSS concern — and it never leads or trails the line. */
.tex-target + .tex-target::before {
  content: '·';
  color: var(--text-muted);
  font-weight: 700;
}

.tex-target-value {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.tex-empty {
  margin-bottom: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.tex-note {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin: 0.4rem 0 0;
  font-size: 0.82rem;
  font-style: italic;
  color: var(--text-muted);
}

/* Secondary actions under the read-only view (history / archive). Bottom
   padding keeps the row off the tab bar / page edge — the compact button
   reset below zeroes Pico's last-child margin. */
.template-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  padding-bottom: 1.5rem;
}

.template-actions button {
  width: auto !important;
  margin-bottom: 0 !important;
  padding: 0.4rem 0.8rem !important;
  font-size: 0.78rem !important;
}

@media (max-width: 600px) {
  .template-hero {
    flex-direction: column;
    gap: 0.75rem;
  }

  .template-hero-actions {
    width: 100%;
    margin-top: 0;
  }

  .template-start-btn {
    flex: 1;
  }
}

/* ===== Logged-by coach attribution ===== */
.logged-by-attribution {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.logged-by-attribution i {
  margin-right: 0.25rem;
}

/* ===== Settings gear menu ===== */
/* The gear itself is a plain .icon-btn (see js/settings-menu.js) so it matches
   the sibling icon buttons; this wrapper only anchors the dropdown. */
.settings-menu {
  position: relative;
  flex-shrink: 0;
}

.settings-dropdown {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  z-index: 300;
  overflow: hidden;
}

.settings-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  background: none !important;
  border: none !important;
  border-radius: 0 !important;
  border-bottom: 1px solid var(--border) !important;
  padding: 0.65rem 1rem !important;
  margin: 0 !important;
  font-family: 'Plus Jakarta Sans', sans-serif !important;
  font-size: 0.875rem !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
  color: var(--text) !important;
  cursor: pointer;
  transition: background 0.1s !important;
}

.settings-dropdown button:last-child {
  border-bottom: none !important;
}

.settings-dropdown button:hover {
  background: var(--surface2) !important;
}

/* ===== Exercise card: compact edit mode ===== */
.exercise-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  padding: 0.25rem 0 0.1rem;
  font-size: 0.875rem;
}

.exercise-summary-item {
  white-space: nowrap;
}

/* ===== Exercise edit compact: 2-col grid ===== */
/*
  Label col: auto (fits widest label, all rows align)
  Controls col: 1fr (takes remaining space, controls don't overflow)
*/
.exercise-edit-compact {
  display: grid;
  grid-template-columns: auto 1fr;
  row-gap: 0.45rem;
  column-gap: 0.875rem;
  align-items: center;
  padding: 0.5rem 0 0.25rem;
}

.eef-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  line-height: 1;
}

.eef-label--nested {
  padding-left: 0.85rem;
  position: relative;
  font-size: 0.62rem;
  color: var(--text-muted);
  opacity: 0.85;
}

.eef-label--nested::before {
  content: '↳';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-weight: 700;
  opacity: 0.7;
}

.eef-unit-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  min-width: 1.5rem;
  user-select: none;
}

/* Longer help text under an edit-field row (direction captions). Mirrors
   .dim-help's read-as-help-text styling, minus its block bottom margin so it
   sits inside the label|controls grid without shifting the next row. */
.eef-field-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  font-weight: 400;
  line-height: 1.4;
}

.exercise-summary-item--step {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: var(--surface2);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border));
  color: var(--text-muted);
  font-size: 0.78rem;
}

.exercise-summary-item--step i {
  font-size: 0.7rem;
  color: var(--accent);
  align-self: center;
}

.exercise-summary-item--step strong {
  color: var(--text);
}

.eef-ctrl {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* All inputs & selects inside the edit grid: fixed height, consistent padding */
.exercise-edit-compact input[type="number"],
.exercise-edit-compact input[inputmode],
.exercise-edit-compact select {
  height: 30px !important;
  min-height: 0 !important;
  padding: 0 0.55rem !important;
  margin-bottom: 0 !important;
  font-size: 16px !important;
  line-height: 30px !important;
  box-sizing: border-box !important;
  vertical-align: middle;
}

.exercise-edit-compact input[type="number"],
.exercise-edit-compact input[inputmode] {
  width: 4.5rem !important;
  text-align: center !important;
}

.exercise-edit-compact select {
  width: auto !important;
  min-width: 5.5rem !important;
  padding-right: 2rem !important;
}

/* Set blocks 04: a block other than the work line is a compact sub-row spanning the grid. */
.eef-block,
.eef-block-heading,
.eef-block-note-row,
.eef-block-actions {
  grid-column: 1 / -1;
}

.eef-block {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0.55rem 0.6rem 0.6rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface2);
}

.eef-block[data-kind="backoff"] {
  border-style: solid;
}

.eef-block-head {
  display: flex;
  align-items: center;
  padding-right: 44px;
}

.eef-block-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.eef-block-label--backoff {
  color: var(--accent);
}

.eef-block-heading {
  margin-top: 0.2rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.eef-block-heading .eef-block-label {
  font-weight: 800;
  color: var(--text);
}

.eef-block-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem 0.9rem;
}

/* A 44px hit area pinned over the card's corner, so the header row stays one label tall. */
.eef-block-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 34px;
  height: 34px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-muted);
}

/* The visible × is 34px; its hit area is 44px. */
.eef-block-remove::after {
  content: '';
  position: absolute;
  inset: -5px;
}

.eef-block-field {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
}

.exercise-edit-compact .eef-block-field input[type="number"],
.exercise-edit-compact .eef-block-field input[inputmode] {
  width: 3.6rem !important;
}

.eef-sets-x {
  font-weight: 600;
  color: var(--text-muted);
}

.exercise-edit-compact input.eef-block-note {
  height: 36px;
  min-height: 0;
  margin: 0;
  padding: 0 0.6rem;
  font-size: 16px;
}

.eef-link-btn {
  width: auto;
  min-height: 40px;
  margin: 0;
  padding: 0.4rem 0;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 600;
  text-align: left;
}

.eef-block-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0.35rem 0;
}

.eef-block-add {
  flex: 1 1 0;
  min-width: 9rem;
  min-height: 44px;
  margin: 0;
  padding: 0.3rem 0.8rem;
  font-size: 0.85rem;
}

/* Stepper: keep its own border/radius, fix child sizes */
.eef-stepper {
  margin-bottom: 0 !important;
  flex-shrink: 0;
}

.eef-stepper input[type="number"],
.eef-stepper input[inputmode] {
  width: 3.5rem !important;
}

.eef-stepper .step-btn {
  width: 1.75rem !important;
  height: 30px !important;
}

.eef-sep {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
  user-select: none;
}

/* On narrow screens the two fixed-width controls per row can't fit the 1fr
   column, forcing horizontal scroll. Stack the label above its controls and
   let the controls wrap so nothing overflows the viewport. */
@media (max-width: 600px) {
  .exercise-edit-compact {
    grid-template-columns: 1fr;
    row-gap: 0.15rem;
  }

  .eef-label {
    margin-top: 0.4rem;
  }

  .eef-label:first-child {
    margin-top: 0;
  }

  .eef-ctrl {
    flex-wrap: wrap;
    min-width: 0;
    margin-bottom: 0.15rem;
  }

  .exercise-edit-compact input[type="number"],
  .exercise-edit-compact input[inputmode] {
    width: 4rem !important;
  }

  .exercise-edit-compact select {
    min-width: 4.5rem !important;
    padding-right: 1.6rem !important;
  }
}

/* ===== Sticky edit toolbar ===== */
.edit-toolbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 2px solid var(--accent);
  padding: 0.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  z-index: 150;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
}

.edit-toolbar-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  align-items: center;
}

.edit-toolbar-actions button {
  margin-bottom: 0;
}

@media (max-width: 768px) {
  .edit-toolbar {
    bottom: 60px;
  }
}

/* ===== Loading spinner (shared primitive) ===== */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}

.spinner--sm { width: 0.85em; height: 0.85em; }
.spinner--lg { width: 2rem; height: 2rem; border-width: 3px; }

.loading-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.btn-spinner {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* "Choose from Google Drive" picker button (sheets connect) — the primary
   connect action, with the Drive logo and its label centered. */
.drive-picker-btn {
  width: 100%;
}

.drive-picker-btn__label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
}

.drive-picker-btn__glyph {
  flex: 0 0 auto;
}

/* "— or paste a link —" divider between the picker button and the paste form. */
.picker-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.9rem 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.picker-divider::before,
.picker-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.list-search {
  margin-bottom: 1rem;
}

/* Search box + chip row (show-archived, exercises, new-program). On a phone the
   four controls can't share one line, so rather than letting them wrap into a
   ragged split that squeezes the search box, stack deliberately: search on its
   own full-width row, chips on the next, each chip growing to share the width. */
.list-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.list-toolbar .list-search {
  margin-bottom: 0;
}

.list-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

/* flex-basis 0 (not auto) so the chips end up the same width instead of each
   keeping its label width and only sharing the leftover space — three chips of
   visibly different widths read as an accident, not a row. min-content still
   floors them, so a long label can't be clipped. */
.list-toolbar-actions > .archived-toggle {
  flex: 1 1 0;
  justify-content: center;
}

/* Wide enough for all four on one line — back to the original single row, with
   the chips at their natural width and the search taking the slack. */
@media (min-width: 700px) {
  .list-toolbar {
    flex-direction: row;
    align-items: center;
  }

  .list-toolbar .list-search {
    flex: 1 1 12rem;
  }

  .list-toolbar-actions > .archived-toggle {
    flex: 0 0 auto;
  }
}

.archived-toggle {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  width: auto;
  margin-bottom: 0;
  padding: 0.4rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}

.archived-toggle:hover {
  color: var(--text);
  border-color: var(--text-muted);
  background: var(--surface2);
}

/* Pico rings every :focus (so a plain click leaves a stray blue halo on the chip,
   which also fights the teal --on state). Keyboard focus still needs a marker, so
   swap it for an accent outline and drop the pointer-triggered one. */
.archived-toggle:focus {
  box-shadow: none;
}

.archived-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* The :hover pair is what makes the on-state actually visible: bare
   .archived-toggle--on loses to .archived-toggle:hover on specificity, so the
   pressed chip rendered plain grey-on-white for as long as the pointer stayed on
   it — which on a touch device is until you tap somewhere else, i.e. exactly
   when you're looking at what you just toggled. */
.archived-toggle--on,
.archived-toggle--on:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-bg);
}

/* Lets the x-if action groups flow into the flex .template-row-actions parent */
.row-actions-group {
  display: contents;
}

/* Training / Library tab switcher (coach content library).
   Segmented control (same idea as .visibility-toggle): a single bordered track
   so inactive options don't float as near-invisible white pills on --bg. */
.content-kind-tabs {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  margin: 0 0 1rem;
  padding: 0.2rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(28, 27, 24, 0.06);
  max-width: 100%;
}
.content-kind-tab {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  padding: 0.45rem 1.1rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: none;
  height: auto;
  width: auto;
  min-width: 0;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.content-kind-tab:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--text);
}
.content-kind-tab--active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(13, 148, 136, 0.35);
}
.content-kind-tab--active:hover {
  background: var(--accent-hover);
  color: #fff;
}
@media (max-width: 600px) {
  .content-kind-tabs {
    display: flex;
    width: 100%;
  }
  .content-kind-tab {
    flex: 1 1 0;
    text-align: center;
  }
}

/* ===== Program sections (templates page) =====
   A tinted, bordered wrapper around the header + its member rows so a program
   reads as one grouped unit rather than a left-indent on otherwise-identical
   cards (visual-qa: grouping was too subtle with indent alone). */
.program-section {
  margin-bottom: 1.25rem;
  padding: 0.5rem 0.5rem 0.75rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* No flex-wrap / space-between here: the actions live in their own
   .template-row-actions flex box (like a .template-row), so the name gets all
   remaining width instead of being squeezed to a few characters by a row of
   individually space-between'd buttons. */
.program-section-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1rem !important;
  margin-bottom: 0.5rem !important;
}

/* Only strip the card look when nested inside the tinted .program-section
   wrapper — the standalone archived-program-row (no wrapper) keeps its own
   card boundary, matching the archived template rows next to it. */
.program-section .program-section-header {
  padding: 0.4rem 0.5rem !important;
  margin-bottom: 0.4rem !important;
  background: transparent !important;
  border: none !important;
}

/* Truncates rather than wrapping, matching .template-row-meta — a long next-workout
   name would otherwise make the header two or three lines taller than its siblings. */
.program-next-workout {
  font-size: 0.78rem;
  margin-top: 0.2rem;
  margin-bottom: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== Dashboard: this week (one slim row under the start section head) ===== */
.week-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: -0.15rem 0 0.6rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: var(--accent-bg);
  font-size: 0.85rem;
}

.week-row--reached {
  background: var(--success-bg);
}

.week-row-count {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  /* A floor so the dots don't jump between "1 workout" and "3 workouts"; a longer label
     ("5 treningów") takes its own width. */
  min-width: 5.75em;
  font-weight: 600;
  color: var(--accent-hover);
  white-space: nowrap;
}

.week-row-count .fa-fire {
  color: var(--warn);
}

.week-row--reached .week-row-count {
  color: var(--success);
}

/* Centred in the space left over, so the dots don't shift as the count label changes. */
.week-row-days {
  display: inline-flex;
  flex: 1;
  min-width: 0;
  justify-content: center;
  align-items: center;
  gap: 0.2rem;
}

/* A day initial in a small circle. Missed (past, nothing logged): pale solid. */
.week-row-day {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--text-muted) 26%, var(--surface));
  color: color-mix(in srgb, var(--text-muted) 80%, var(--text));
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1;
}

/* Upcoming: hollow ring. Full-strength muted letter (QA 120: at 70% it was ~2.7:1 on the pill). */
.week-row-day--future {
  background: transparent;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text-muted) 55%, transparent);
  color: var(--text-muted);
}

.week-row-day--today {
  background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--accent);
  color: var(--accent);
}

.week-row-day--done {
  background: var(--accent);
  box-shadow: none;
  color: #fff;
}

.week-row--reached .week-row-day--done {
  background: var(--success);
}

/* A digit or initial in a small circle: flex centring centres the font's
   ascent/descent box, not the glyph, so the set number, nav badge and avatar
   initial sat up to ~1.5px high (how far depends on the font and the engine).
   Trim the line to cap height..baseline and pad that into the middle instead:
   padding-top = (height - top+bottom border - 1cap) / 2. Browsers without
   text-box keep the base rules' flex centring. Inline-block, not flex: the
   trim does not reach the text's anonymous flex item. Keep this after all
   five base rules, or their own display: inline-flex wins on source order. */
@supports (text-box: trim-both cap alphabetic) {
  .set-number,
  .nav-badge,
  .tex-order,
  .week-row-day,
  .nav-avatar--fallback {
    display: inline-block;
    text-align: center;
    white-space: nowrap;
    text-box: trim-both cap alphabetic;
  }

  .set-number { padding-top: calc((1.5rem - 2px - 1cap) / 2); }
  .tex-order { padding-top: calc((1.4rem - 1cap) / 2); }
  .week-row-day { padding-top: calc((1.05rem - 1cap) / 2); }
  .nav-badge { padding-top: calc((1.05rem - 1cap) / 2); }
  .nav-avatar--fallback { padding-top: calc((32px - 2px - 1cap) / 2); }
}

.week-row-goal {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.week-row-goal-count {
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.week-row--reached .week-row-goal-count {
  color: var(--success);
}

/* A fixed width whatever the goal (QA 133: up to 7 segments), so the row never outgrows the
   pill; the segments share it. */
.week-row-bar {
  display: inline-flex;
  width: 2.8rem;
  gap: 0.15rem;
}

.week-row-segment {
  flex: 1;
  min-width: 0;
  height: 0.4rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 32%, var(--surface));
}

.week-row-segment--filled {
  background: var(--accent);
}

.week-row--reached .week-row-segment--filled {
  background: var(--success);
}

/* QA 133: the row opens the week sheet. A small sliders glyph at the end says so. */
/* Pico and the shared button rule paint [role=button] as a CTA (border, Bebas caps, button
   padding); the row keeps its quiet pill look. !important: Pico's [role=button] is 0,1,1. */
.week-row--tappable[role="button"] {
  display: flex !important;
  width: auto !important;
  height: auto !important;
  margin: -0.15rem 0 0.6rem !important;
  padding: 0.45rem 0.85rem 0.45rem 0.75rem !important;
  border: none !important;
  border-radius: 999px !important;
  background: var(--accent-bg) !important;
  box-shadow: none !important;
  color: inherit !important;
  font: inherit !important;
  font-size: 0.85rem !important;
  letter-spacing: normal !important;
  text-transform: none !important;
  text-align: inherit !important;
  cursor: pointer;
}

.week-row--tappable.week-row--reached[role="button"] {
  background: var(--success-bg) !important;
}

.week-row--tappable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.week-row-cue {
  flex-shrink: 0;
  margin-left: 0.15rem;
  font-size: 0.85rem;
  color: var(--accent);
}

.week-row--reached .week-row-cue {
  color: color-mix(in srgb, var(--success) 70%, var(--text-muted));
}

/* QA 133: "2×" before the name of a program day done more than once a week (Plans page). */
.times-per-week-badge {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.3;
  vertical-align: 0.1em;
}

/* ===== Week sheet (dashboard) and the program modal's times-per-week list ===== */
.week-sheet-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 0;
}

.week-sheet-section {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.week-sheet-heading {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.times-per-week-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.times-per-week-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0.3rem 0.4rem 0.3rem 0.75rem;
  list-style: none;
  border-bottom: 1px solid var(--border);
}

.times-per-week-row:last-child {
  border-bottom: none;
}

/* Up to two lines, then an ellipsis: a day name is the row's point. */
.times-per-week-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  line-height: 1.25;
  overflow-wrap: anywhere;
  font-weight: 600;
  color: var(--text);
}

.times-per-week-stepper {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
  flex-shrink: 0;
}

.times-per-week-value {
  min-width: 2rem;
  text-align: center;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.45rem;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.times-per-week-stepper .stepper-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface2);
  color: var(--accent);
  box-shadow: none;
  font-size: 0.85rem;
}

.times-per-week-stepper .stepper-btn:disabled {
  opacity: 1;
  background: var(--surface);
  color: color-mix(in srgb, var(--text-muted) 45%, var(--surface));
}

.times-per-week-total {
  background: var(--accent-bg);
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
  border-radius: 0 0 var(--radius) var(--radius);
}

.times-per-week-total .times-per-week-name {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--accent-hover);
}

.times-per-week-total .times-per-week-value {
  /* Lines up with the counts above: the stepper's right button is 2.5rem + gap. */
  margin-right: 2.6rem;
}

/* The "×" after a count: body font, on the numeral's baseline. */
.times-per-week-unit {
  margin-left: 0.05em;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  vertical-align: baseline;
}

/* In the program modal the list sits between the form fields and Save. */
.program-times-per-week {
  margin-bottom: 1rem;
}

/* Same look as the modal's Name / Description labels (the base label rule). */
.program-times-per-week-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.week-start-toggle {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.week-start-toggle .week-start-option {
  margin: 0;
  min-height: 3rem;
  padding: 0.4rem 0.2rem 0.6rem;
  border: none;
  border-right: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.week-start-toggle .week-start-option:last-child {
  border-right: none;
}

.week-start-toggle .week-start-option.is-active {
  background: var(--accent);
  color: #fff;
}

/* Today: a dot under the label, so "start a fresh week today" is one obvious tap. */
.week-start-toggle .week-start-option {
  position: relative;
}

.week-start-toggle .week-start-option.is-today::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 0.3rem;
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 50%;
  background: var(--accent);
  transform: translateX(-50%);
}

.week-start-toggle .week-start-option.is-today.is-active::after {
  background: #fff;
}

.week-sheet-hint {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.4;
  color: color-mix(in srgb, var(--text-muted) 70%, var(--text));
}

.program-section .template-row {
  margin-left: 0.5rem;
  margin-right: 0.5rem;
}

/* Templates can be dragged into a program, so an empty program still needs a
   droppable area — without a min-height its list box is 0px tall and there is
   nothing to aim at. Sized above a tap target because landing a drag is harder
   than landing a tap. The ungrouped bucket gets the same treatment, but only once
   a program exists (--droppable) — with no programs there is nothing to drag out of. */
.program-template-list,
.ungrouped-list--droppable {
  min-height: 3.5rem;
}

.program-template-list:not(:has(.template-row)),
.ungrouped-list--droppable:not(:has(.template-row)) {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0.5rem 0.5rem;
  border: 1px dashed transparent;
  border-radius: var(--radius);
}

/* The dashed drop-zone outline only while a template is being dragged (templates.js
   setDraggingTemplate) — at rest an empty program reads "No templates yet." above its
   "+ Add template" footer, not a third dashed box next to the "+ New program" row. */
body.is-dragging-template .program-template-list:not(:has(.template-row)),
body.is-dragging-template .ungrouped-list--droppable:not(:has(.template-row)) {
  border-color: var(--accent);
  background: var(--surface);
}

.program-section-footer {
  margin: 0.25rem 0.5rem 0;
}

.program-add-template-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  width: auto;
  min-height: 2.5rem;
  margin: 0;
  padding: 0.35rem 0.75rem;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: none;
}

.program-add-template-btn:hover,
.program-add-template-btn:focus-visible {
  background: var(--surface);
  color: var(--accent-hover);
}

.new-program-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  width: 100%;
  min-height: 3rem;
  margin: 0 0 1.25rem;
  padding: 0.6rem 1rem;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  box-shadow: none;
  text-align: center;
}

.new-program-row:hover,
.new-program-row:focus-visible {
  background: var(--surface);
  border-color: var(--accent);
}

.new-program-row-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
}

/* A full sentence, so the body font rather than the Bebas display type buttons inherit. */
.new-program-row-hint {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.82rem;
  letter-spacing: normal;
  color: var(--text-muted);
}

/* A just-created program (templates.js revealNewProgram): an accent ring that fades out,
   so the eye lands on the new section and its "+ Add template" footer. */
.program-section--new {
  animation: program-section-new 2.4s ease-out;
}

.program-section--new .program-add-template-btn {
  background: var(--surface);
}

@keyframes program-section-new {
  0%, 40% {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.25);
  }
  100% {
    border-color: var(--border);
    box-shadow: 0 0 0 0 rgba(13, 148, 136, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .program-section--new {
    animation: none;
    border-color: var(--accent);
  }
}

/* The hint text is a pseudo-element, never a child — see the templates.html comment:
   Sortable's oldIndex/newIndex count every element sibling in the list. */
.program-template-list:not(:has(.template-row))::before,
.ungrouped-list--droppable:not(:has(.template-row))::before {
  content: attr(data-drop-hint);
  padding: 0 0.75rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* QA 85: the plan and workout cards' icon buttons stay 2rem to the eye (the row is compact) but
   get a 44px hit area through ::after. The 0.75rem gap makes the 2rem boxes sit 44px apart, so
   neighbouring hit areas meet without overlapping. */
.program-list .template-row-actions,
.ungrouped-list .template-row-actions {
  gap: 0.75rem;
}

.program-list .template-row-actions .icon-btn,
.ungrouped-list .template-row-actions .icon-btn,
.program-list :is(.template-row, .program-section-header) > .drag-handle,
.ungrouped-list .template-row > .drag-handle {
  position: relative;
}

.program-list .template-row-actions .icon-btn::after,
.ungrouped-list .template-row-actions .icon-btn::after,
.program-list :is(.template-row, .program-section-header) > .drag-handle::after,
.ungrouped-list .template-row > .drag-handle::after {
  content: '';
  position: absolute;
  inset: 50% auto auto 50%;
  width: 2.75rem;
  height: 2.75rem;
  transform: translate(-50%, -50%);
}

/* QA 115: the grip leads the row (grip, name, then edit / options / play at the right edge), so a
   tap in the middle of a card can never land on the play button. The grip is a direct child of the
   row, before the name; the row's own gap spaces it, and a negative right margin tightens that gap (the 44px
   hit area above is a ::after, so it still takes taps 10px either side of it). The play button is
   last, as on the Dashboard plan cards. */
.program-list :is(.template-row, .program-section-header) > .drag-handle,
.ungrouped-list .template-row > .drag-handle {
  margin: 0 -0.4rem 0 0 !important;
}

.program-list .program-section-header > .drag-handle {
  margin-right: -0.2rem !important;
}

/* QA 80: on a phone the floating + sits over the right end of the empty bucket's one-line hint.
   Right padding the width of the + (and its margin) wraps the hint into the space left of it. */
@media (max-width: 768px) {
  .ungrouped-list--droppable:not(:has(.template-row))::before {
    padding-right: 4.5rem;
  }
}

.ungrouped-heading {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 1rem 0 0.5rem;
}

/* Archived-template banner on the detail page */
.archived-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.6rem 0 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.archived-banner i {
  color: var(--accent);
}

/* QA 76: a deleted log reads as a record, not a live editor (its list is also inert). */
.log-deleted-banner {
  margin-bottom: 0.6rem;
}

.log-deleted-banner button {
  flex-shrink: 0;
  width: auto;
  margin: 0 0 0 auto;
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
}

.log-exercises--deleted {
  opacity: 0.7;
}

.list-load-more {
  display: block;
  margin: 1rem auto 0;
}

/* ===== Typeahead (search combobox) =====
   Shared across the "Select a template" and "Select an exercise" pickers.
   The input itself stays a regular Pico input (consistent with the rest of
   the form); only the dropdown panel + its rows get custom sizing so the
   picker doesn't feel as tall as a full Pico form field. */
.typeahead {
  position: relative;
}

/* Workout-log add-exercise form: full-width button stacked under the search box,
   with real spacing between the error message / input / button rows. */
.add-exercise-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* QA 122: the added exercise's rest, one compact row under the search. 16px controls in 40px
   boxes: iOS zooms on focus below 16px. */
.add-exercise-rest {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.add-exercise-rest__label {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  margin: 0;
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text-muted);
}

/* The label gives way to the fields: at most two short lines, never clipped. */
.add-exercise-rest__label > span {
  min-width: 0;
  line-height: 1.25;
}

.add-exercise-rest input[inputmode],
.add-exercise-rest select {
  flex: none;
  height: 40px;
  min-height: 0;
  margin: 0;
  font-size: 16px;
}

.add-exercise-rest input[inputmode] {
  width: 4.5rem;
  padding: 0 0.5rem;
  text-align: center;
}

.add-exercise-rest select {
  width: auto;
  min-width: 5rem;
  padding: 0 1.75rem 0 0.5rem;
}

/* The flex gap owns the spacing; drop the button's default bottom margin so the
   card padding below it stays even. */
.add-exercise-form > button {
  margin-bottom: 0;
}

.add-exercise-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 0.75rem;
}

.add-exercise-actions > button {
  margin: 0;
  width: auto;
}

.manage-exercises-link {
  margin-left: auto;
  font-size: 0.9rem;
}

.typeahead input[type="search"] {
  margin: 0;
  /* Pico sets the search input's "X" via -webkit-search-cancel-button; leave
     room on the right for it AND the loading spinner if both ever show. */
  padding-right: 2.25rem;
}

.typeahead-spinner {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  display: inline-flex;
  align-items: center;
}

/* position: fixed (not absolute) — its top/left/width are computed in JS
   from the input's bounding rect (see typeahead.js's updatePosition()) so the
   panel escapes any scrollable ancestor's overflow box. A typeahead nested in
   a modal would otherwise force the whole modal-card to grow a scrollbar
   just to reveal a dropdown that only extends a few hundred pixels below
   the input. A picker with its own controls under the input opts out with
   .typeahead--inline (below) — an overlay would cover them. */
.typeahead-results {
  z-index: 20;
  list-style: none;
  margin: 0;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 16rem;
  overflow-y: auto;
  background: var(--surface);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.typeahead-results li {
  padding: 0.45rem 0.65rem;
  font-size: 0.875rem;
  line-height: 1.35;
  border-radius: 5px;
  cursor: pointer;
  color: var(--text);
  transition: background-color 0.1s, color 0.1s;
}

.typeahead-results li:hover,
.typeahead-results li:focus-visible {
  background: var(--accent-bg);
  color: var(--accent-hover);
  outline: none;
}

.typeahead-results li.typeahead-empty {
  color: var(--text-muted);
  cursor: default;
  font-style: italic;
}

.typeahead-results li.typeahead-empty:hover {
  background: transparent;
  color: var(--text-muted);
}

/* On small screens the panel becomes a tight sheet directly under the input;
   no extra margins, no shadow over the form, the row hit target grows to
   meet the iOS 44px guideline. */
@media (max-width: 480px) {
  .typeahead-results {
    box-shadow: none;
    max-height: 14rem;
  }
  .typeahead-results li {
    padding: 0.65rem 0.75rem;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
}

/* In-flow results for the exercise pickers (template-detail, workout-log-detail). Their
   modal has a submit button and "define new exercise" under the input, which the fixed
   overlay covered on a phone (QA 07) — so the list takes its place in the card instead,
   pushing those controls down where they stay reachable mid-search. The page leaves out
   the :style="panelStyle" binding so the fixed coordinates never apply. The background
   is the classic scroll-shadow trick: the two `local` covers scroll with the content and
   hide the two `scroll` shadows at either end, so a shade shows only on the edge that
   still has rows past it — the cue that the list scrolls. */
/* The spinner centres on its positioned ancestor; with the list in flow that is no
   longer the input's height, so the inline pickers wrap input + spinner in their own box. */
.typeahead-field {
  position: relative;
}

.typeahead--inline .typeahead-results {
  position: static;
  margin-top: 0.35rem;
  max-height: min(16rem, 40vh);
  overscroll-behavior: contain;
  box-shadow: none;
  background:
    linear-gradient(var(--surface) 30%, rgba(255, 255, 255, 0)),
    linear-gradient(rgba(255, 255, 255, 0), var(--surface) 70%) 0 100%,
    linear-gradient(rgba(28, 27, 24, 0.1), rgba(28, 27, 24, 0)),
    linear-gradient(rgba(28, 27, 24, 0), rgba(28, 27, 24, 0.1)) 0 100%;
  background-color: var(--surface);
  background-repeat: no-repeat;
  background-size: 100% 2.5rem, 100% 2.5rem, 100% 1.25rem, 100% 1.25rem;
  background-attachment: local, local, scroll, scroll;
}

/* ===== Dashboard ===== */
.dashboard-section {
  margin-bottom: 1.75rem;
}

.dashboard-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.dashboard-section-head h3 {
  margin-bottom: 0;
}

/* Gym-door Continue: slightly stronger surface so it reads as the primary action. */
.dashboard-continue-card {
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  background: var(--accent-bg);
}

/* Collapsible coaching (and similar) section headers */
.dashboard-section-head--toggle {
  align-items: center;
}

.dashboard-collapse-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  width: auto;
  box-shadow: none;
}

.dashboard-collapse-toggle:hover,
.dashboard-collapse-toggle:focus {
  background: transparent;
  box-shadow: none;
}

.dashboard-collapse-toggle h3 {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
  color: var(--text-muted);
}

.dashboard-collapse-chevron {
  font-size: 0.7rem;
  transition: transform 0.15s ease;
  color: var(--text-muted);
}

.dashboard-collapse-chevron--open {
  transform: rotate(90deg);
}

/* Dashboard reuses .program-section from the templates page; keep spacing tight. */
.dashboard-program-section {
  margin-bottom: 0;
}

.view-all-link {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s;
}

.view-all-link:hover {
  color: var(--accent);
}

/* Status pill on workout cards */
.status-pill {
  display: inline-flex;
  align-items: center;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  border-radius: 999px;
  padding: 0.08rem 0.45rem;
  flex-shrink: 0;
}

.status-pill--done {
  color: var(--success);
  background: var(--success-bg);
  border: 1px solid color-mix(in srgb, var(--success) 30%, var(--border));
}

.status-pill--active {
  color: var(--accent);
  background: var(--accent-bg);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
}

/* Status icon on workout-log rows/cards: a check (finished) or a pulsing dot (in progress).
   Replaces the text pill so the workout name keeps its width on a phone; the word stays as
   the accessible name (role="img" + aria-label/title). */
.status-icon {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 1.625rem;
  height: 1.625rem;
  border-radius: 50%;
  font-size: 0.78rem;
}

/* Sit next to the row's action buttons (8px) rather than a full row gap (1rem) away. */
.template-row > .status-icon {
  margin-right: -0.5rem;
}

.status-icon--done {
  color: var(--success);
  background: var(--success-bg);
  border: 1px solid color-mix(in srgb, var(--success) 30%, var(--border));
}

.status-icon--active {
  color: var(--accent);
  background: var(--accent-bg);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
}

.status-icon--active::before {
  content: '';
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
  animation: status-icon-pulse 1.6s ease-in-out infinite;
}

@keyframes status-icon-pulse {
  50% { opacity: 0.5; }
}

@media (prefers-reduced-motion: reduce) {
  .status-icon--active::before { animation: none; }
}

/* Day-of-week badge on workout cards/rows */
.day-badge {
  display: inline-flex;
  align-items: center;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  border-radius: 999px;
  padding: 0.08rem 0.45rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.dashboard-empty {
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 0.5rem 0;
}

.dashboard-empty a {
  color: var(--accent);
  font-weight: 500;
}

.dashboard-empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-top: 0.5rem;
}

/* First-run card (onboarding-01): the one thing a brand-new user sees under the header. */
.first-run-card {
  padding: 1.1rem 1rem 1rem;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.first-run-card h3 {
  font-size: 1.45rem;
  margin-bottom: 0.25rem;
}

.first-run-intro {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 1rem;
}

.first-run-goal label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 0.35rem;
}

.first-run-goal textarea {
  width: 100%;
  /* 16px from the shared rule — keep it (iOS focus zoom). */
  margin-bottom: 0.5rem;
}

.first-run-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

/* Gym-floor thumbs: taller than the assist modal's pills. */
.first-run-examples .notes-import-candidate {
  min-height: 40px;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
}

.first-run-hint {
  font-size: 0.8rem;
  margin-bottom: 0.75rem;
}

.first-run-goal button[type="submit"] {
  width: 100%;
  margin-bottom: 0;
}

.first-run-goal button[type="submit"] i {
  margin-right: 0.4rem;
}

.first-run-alt {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
}

.first-run-alt .dashboard-empty-actions {
  margin-top: 0.25rem;
  gap: 0 1.25rem;
}

.first-run-alt a,
.first-run-alt .link-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--accent);
  font-size: inherit;
  font-weight: 500;
}

/* A button that reads like the links next to it (first-run "start an empty workout"). */
.link-button {
  width: auto;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  text-transform: none;
  letter-spacing: normal;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  cursor: pointer;
}

.link-button:hover,
.link-button:focus-visible {
  background: none;
  color: var(--accent-hover, var(--accent));
}

/* onboarding-03: the first thing on an empty workout's page. */
.empty-workout-start {
  margin: 0.5rem 0 1rem;
  padding: 1.25rem 1rem;
  border: 1.5px dashed color-mix(in srgb, var(--text-muted) 55%, var(--border));
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
}

.empty-workout-start h4 {
  margin-bottom: 0.35rem;
}

.empty-workout-start p {
  margin-bottom: 1rem;
}

.empty-workout-start button {
  width: 100%;
  min-height: 48px;
  margin-bottom: 0;
}

/* The finished-log actions stack full-width at one height, Resume included when it is alone
   (QA 05: an auto-width Resume read as a stray small button). */
#resume-workout-section [data-testid="save-as-plan"],
#resume-workout-section [data-testid="update-plan"],
#resume-workout-section [data-testid="resume-workout"] {
  display: block;
  width: 100%;
  min-height: 48px;
}

#resume-workout-section [data-testid="save-as-plan"],
#resume-workout-section [data-testid="update-plan"] {
  margin-bottom: 0.75rem;
}

/* fun-01: the total-volume card where the Finish button was. */
.finish-celebration {
  position: relative;
  margin: 0 0 1.25rem;
  padding: 1rem 1rem 1.125rem;
  border: 1px solid rgba(13, 148, 136, 0.25);
  border-radius: 12px;
  background: var(--accent-bg);
  text-align: center;
  animation: finish-celebration-in 0.3s ease-out;
}

.finish-celebration p {
  margin: 0;
}

.finish-celebration__close {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.75rem;
  line-height: 1;
}

.finish-celebration__close:hover,
.finish-celebration__close:focus-visible {
  background: transparent;
  color: var(--text);
}

.finish-celebration__heading {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.finish-celebration__total {
  margin-top: 0.125rem;
  color: var(--accent-hover);
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

/* Hidden while the number counts, then fade in. */
.finish-celebration__lines {
  margin-top: 0.625rem;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.finish-celebration__lines.is-shown {
  opacity: 1;
  transform: none;
}

.finish-celebration__animal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
}

.finish-celebration__emoji {
  font-size: 3rem;
  line-height: 1.1;
}

.finish-celebration .finish-celebration__cat {
  margin-top: 0.25rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

/* onboarding-06a/c: stats line, records and progress link on the finish card. */
.finish-celebration .finish-celebration__stats {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0.25rem 2.75rem 0.875rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.finish-celebration .finish-celebration__loading {
  margin-top: 0.75rem;
  font-size: 0.875rem;
}

.finish-records {
  margin-top: 0.875rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(13, 148, 136, 0.2);
  text-align: left;
}

.finish-celebration .finish-records__heading {
  margin-bottom: 0.125rem;
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.finish-records__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.finish-records__row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.5rem;
  margin: 0;
  padding: 0.375rem 0 0.125rem;
  list-style: none;
}

.finish-records__name {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text);
  font-weight: 600;
}

.finish-records__best {
  color: var(--accent-hover);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.finish-records__previous {
  flex-basis: 100%;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.finish-celebration__progress {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 44px;
  margin-top: 0.5rem;
  font-weight: 600;
}

/* fun-02: × folds the card to one line; the whole bar unfolds it. */
.finish-celebration--collapsed {
  padding: 0;
  text-align: left;
}

.finish-celebration__bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 12px;
  background: transparent;
  box-shadow: none;
  color: var(--text-muted);
  /* The stats line as on the open card, not the Bebas button face. */
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  font-variant-numeric: tabular-nums;
  text-align: left;
}

.finish-celebration__bar:hover,
.finish-celebration__bar:focus,
.finish-celebration__bar:active {
  background: transparent;
  box-shadow: none;
  color: var(--text);
}

.finish-celebration__bar-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finish-celebration__bar-icon,
.finish-celebration__chevron {
  flex: 0 0 1.25rem;
  color: inherit;
  font-size: 0.875rem;
  /* A solid glyph reads darker than the thin text beside it. */
  opacity: 0.75;
  text-align: center;
}

.finish-celebration__chevron {
  font-size: 0.75rem;
}

.finish-celebration__stats .fa-stopwatch {
  font-size: 0.8125rem;
  opacity: 0.75;
}

/* fun-03: share the card as an image. Top-left, mirroring × on the open card; at the end of the
   folded bar. */
.finish-celebration__share {
  position: absolute;
  top: 0.25rem;
  left: 0.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  color: var(--accent-hover);
  font-size: 1.125rem;
  line-height: 1;
}

.finish-celebration__share:hover,
.finish-celebration__share:focus,
.finish-celebration__share:focus-visible,
.finish-celebration__share:active {
  background: transparent;
  box-shadow: none;
  color: var(--accent);
}

.finish-celebration__share--bar {
  top: 0;
  right: 0;
  left: auto;
}

.finish-celebration--collapsed.finish-celebration--shareable .finish-celebration__bar {
  padding-right: 44px;
}

@keyframes finish-celebration-in {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .finish-celebration { animation: none; }
  .finish-celebration__lines { transition: none; }
}

/* onboarding-04: one tickable row per change the workout would make to its plan. */
.plan-update-list {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
}

.plan-update-list li {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
}

.plan-update-list li:last-child {
  border-bottom: 1px solid var(--border);
}

.plan-update-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 0;
  padding: 0.75rem 0;
  min-height: 48px;
  cursor: pointer;
}

.plan-update-item input[type="checkbox"] {
  flex: none;
  margin: 0.15rem 0 0;
}

.plan-update-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.plan-update-text small {
  font-size: 0.8125rem;
}

.exercise-meta--editable {
  cursor: pointer;
}

/* Says the chip row opens "Fix plan"; the whole row is the tap target (a card's head row). */
.exercise-meta-chip--edit {
  padding: 0.18rem 0.5rem;
  color: var(--text-muted);
  background: transparent;
  border-style: dashed;
}

.plan-fix-sheet {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0;
}

/* "Measured by" (js/exercise-measures.js) on top of the pencil / Measures sheet: one chip per
   dimension, in its colour — solid while required, outlined while optional, dashed "+" while not
   tracked. Thumb-sized, unlike the template editor's inline chips: this is tapped mid-set. */
.measures {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.measures-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Two equal columns: the sheet is narrow on a phone, and four in a row broke the labels
   mid-word ("Czas trwania", "Powtórzenia"). */
.measure-chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
}

.measure-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  width: 100%;
  min-height: 36px;
  margin: 0;
  padding: 0.25rem 0.6rem;
  border: 1.5px solid transparent;
  border-radius: 999px;
  /* Body font, not the buttons' all-caps display face. */
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
  min-width: 0;
  box-shadow: none;
}

.measure-chip[data-req="OPTIONAL"] {
  background: transparent;
  border-color: currentColor;
}

.measure-chip[data-req="NONE"] {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px dashed var(--border);
}

.measures-hint {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
}

.measure-chip:disabled {
  opacity: 0.6;
}

.measure-chip .fa-plus {
  flex: none;
  font-size: 0.7rem;
}

.measure-copy {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
  padding: 0.6rem 0.65rem;
  border-radius: var(--radius);
  background: var(--surface2);
}

.measure-copy-lead {
  margin: 0;
  font-size: 0.8rem;
}

.measure-copy label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0;
}

.measure-copy input {
  margin: 0;
}

.measure-copy-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.measure-copy-actions button {
  width: 100%;
  min-height: 44px;
  margin: 0;
}

.measure-copy-actions button[type="submit"] {
  grid-column: 1 / -1;
}

/* ⋯ → Replace exercise (js/replace-exercise.js). */
.replace-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 0;
}

.replace-hint {
  margin: 0;
  font-size: 0.8rem;
}

.replace-warning {
  display: flex;
  gap: 0.4rem;
  align-items: baseline;
  margin: 0;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius);
  background: var(--warn-bg);
  color: var(--text);
  font-size: 0.85rem;
}

.replace-warning .fa-triangle-exclamation {
  color: var(--warn);
}

.replace-sets {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0;
  padding: 0.6rem 0.65rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface2);
}

.replace-sets legend {
  /* Floated, so it sits inside the box rather than on its border. */
  float: left;
  width: 100%;
  margin: 0 0 0.1rem;
  padding: 0;
}

/* Sentences, not the uppercase field-label style every <label> gets. */
.replace-sets label,
.replace-plan {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  min-height: 44px;
  margin: 0;
  padding: 0.3rem 0;
  font-size: 0.9rem;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text);
}

.replace-sets label:has(input:disabled) {
  color: var(--text-muted);
}

.replace-sets input,
.replace-plan input {
  flex: none;
  margin: 0;
}

.replace-form .confirm-modal-actions {
  margin-top: 0.2rem;
}

.plan-fix-block {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.55rem 0.65rem 0.65rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface2);
}

.plan-fix-block[data-kind="work"],
.plan-fix-block[data-kind="backoff"] {
  border-style: solid;
}

.plan-fix-block-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 40px;
}

/* One colour for every block label here; the border tells a warmup (dashed) apart. */
.plan-fix-block-label {
  flex: 1 1 auto;
  color: var(--text);
}

.plan-fix-sets {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
}

.plan-fix-sheet .plan-fix-sets input[type="number"] {
  flex: none;
  width: 3.75rem;
}

.plan-fix-block-remove {
  flex: none;
  width: 40px;
  height: 40px;
  min-height: 0;
  margin: 0 -0.35rem 0 0;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-muted);
}

.plan-fix-fields {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.plan-fix-field {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
}

.plan-fix-field > .plan-fix-field-label {
  flex: 0 0 3.5rem;
}

.plan-fix-block-remove--slot {
  visibility: hidden;
}

.plan-fix-rest {
  flex-wrap: wrap;
}

.plan-fix-rest > .plan-fix-field-label {
  flex: 1 1 100%;
}

.plan-fix-field-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text-muted);
}

.plan-fix-range {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

/* Min and max share what the row has left, so a 16px pair never overflows a 390px card. */
.plan-fix-range input[inputmode] {
  flex: 1 1 0;
  min-width: 0;
}

/* 16px text in 40px controls: iOS zooms on focus below 16px. */
.plan-fix-sheet input[type="number"],
.plan-fix-sheet input[inputmode],
.plan-fix-sheet select {
  width: 4.25rem;
  height: 40px;
  min-height: 0;
  margin: 0;
  padding: 0 0.5rem;
  font-size: 16px;
  text-align: center;
}

.plan-fix-sheet select {
  flex: none;
  width: auto;
  min-width: 5rem;
  padding-right: 1.75rem;
  text-align: left;
}

.plan-fix-sheet .eef-unit-hint {
  flex: 0 0 2.25rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.plan-fix-rest .plan-fix-range input[inputmode] {
  flex: 0 0 5rem;
}

.plan-fix-add {
  display: flex;
  gap: 0.5rem;
}

.plan-fix-add button {
  flex: 1 1 0;
  min-height: 44px;
  margin: 0;
  padding: 0.3rem 0.6rem;
  font-size: 0.85rem;
}

.plan-fix-notes {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0 0 0.5rem;
}

.plan-fix-notes textarea {
  margin: 0;
  font-size: 16px;
}

.save-plan-name {
  margin-bottom: 1.25rem;
}

/* onboarding-03: the start modal's "no plan" alternative, under the plan picker. */
.start-empty-alt {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.start-empty-alt p {
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  text-wrap: balance;
}

.start-empty-alt button {
  width: 100%;
  margin-bottom: 0;
}

/* onboarding-03: "Start empty workout" under the dashboard's template list. */
.dashboard-start-empty {
  width: 100%;
  margin-top: 0.75rem;
  min-height: 44px;
}

.notes-import-empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0.75rem 0 1.25rem;
}

.notes-import-empty-actions button {
  flex: 1 1 10rem;
}

.notes-import-modal textarea {
  min-height: 10rem;
}

.notes-import-disclosure {
  margin-bottom: 0.75rem;
}

.notes-import-program {
  margin-bottom: 1rem;
}

.notes-import-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  background: var(--surface2);
}

/* An excluded day stays readable (the user may re-include it) but visibly steps
   back, so "which days am I actually importing" is answerable at a glance. */
.notes-import-section.is-excluded {
  opacity: 0.5;
}

.notes-import-section-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

/* The bare checkbox is a ~16px hit target; the label pads it out to 44px without
   changing how the control itself looks. */
.notes-import-section-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
  margin: 0 -0.5rem 0 -0.35rem;
  cursor: pointer;
}

.notes-import-section-toggle input {
  margin: 0;
}

.notes-import-section-name {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-weight: 600;
}

.notes-import-section-count {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.notes-import-group {
  margin-bottom: 0.5rem;
}

.notes-import-group:last-child {
  margin-bottom: 0;
}

/* Solo rows sit at the same indent as a superset's members so the bracket reads
   as an addition to the list, not a shift of it. */
.notes-import-solo {
  padding-left: calc(0.75rem + 3px);
}

.notes-import-row {
  padding: 0.4rem 0;
}

.notes-import-row-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* The name owns its own line: the badge lives in the chip row below, so the only
   thing competing with it here is the icon pair. break-word (not `anywhere`) so a
   long name wraps between words — `anywhere` shatters names mid-token as soon as
   the column gets narrow. */
.notes-import-name {
  flex: 1;
  min-width: 0;
  overflow-wrap: break-word;
}

/* Rides on .exercise-meta-chip so matched-or-new reads as one of the row's facts
   rather than a second, unrelated badge system. */
.notes-import-badge {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* A new definition is the one thing on this row the import cannot undo cheaply,
   so it is the only badge that carries colour. */
.notes-import-badge--new {
  color: var(--accent);
  background: var(--accent-bg);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
}

.notes-import-row-actions {
  display: inline-flex;
  gap: 0.15rem;
  flex-shrink: 0;
  margin-right: -0.4rem;
}

.notes-import-meta {
  margin-top: 0.35rem;
}

.notes-import-blocks {
  display: contents;
}

/* QA 121: the rest chip holds an editable seconds field. 16px text (iOS focus-zoom), so the chip
   grows a little taller than its neighbours rather than shrinking the font. */
.notes-import-rest {
  padding-top: 0.08rem;
  padding-bottom: 0.08rem;
  cursor: text;
}

.notes-import-rest .notes-import-rest-input {
  box-sizing: border-box;
  width: 4.5ch;
  height: 1.5rem;
  min-height: 0;
  margin: 0;
  padding: 0 0.15rem;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--text);
  background: transparent;
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--border));
  border-radius: 0.3rem;
  box-shadow: none;
}

.notes-import-rest .notes-import-rest-input:focus {
  border-style: solid;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent);
}

.notes-import-note,
.notes-import-raw {
  margin: 0.3rem 0 0;
  font-size: 0.78rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.notes-import-no-targets {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.75rem;
}

.notes-import-note {
  color: var(--text);
}

/* The source line is the verification anchor, so it stays visible — but subdued
   and monospaced, so the eye lands on the parsed result above it and reads this
   only when checking. */
.notes-import-raw {
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
}

.notes-import-summary {
  margin: 0.25rem 0 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.notes-import-summary-new {
  color: var(--accent);
}

.notes-import-summary-review {
  color: var(--warn);
}

/* Badge + resolved name are one line of the meta row, so the name never detaches
   from the badge it qualifies when it is too long to sit beside it. */
.notes-import-match {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-basis: 100%;
  min-width: 0;
}

/* Where the name resolved to, next to the Existing badge. The row headline keeps
   the wording the notes used, so a "bench" that landed on Smith Machine Bench
   Press is visible here before confirm rather than after opening the template. */
.notes-import-matched {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}

.notes-import-matched i {
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* The matcher found several equally-good catalog rows and refused to pick one.
   Chips rather than a select: on a phone this is a one-tap decision, and the
   whole point is that all the options are readable at once. */
.notes-import-candidates {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.45rem;
}

.notes-import-candidates-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.notes-import-candidate {
  width: auto;
  margin: 0;
  min-height: 32px;
  padding: 0.25rem 0.6rem;
  /* Body font, not the Bebas Neue the button rule sets: these pills carry exercise names, and
     Bebas has no lowercase, so "Dumbbell Bicep Curl" would shout. Matches how the same names
     read in the rematch typeahead and on the matched-name line. */
  font-family: 'Plus Jakarta Sans', sans-serif;
  letter-spacing: normal;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  border-radius: 999px;
  background: var(--accent-bg);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}

.notes-import-candidate:hover {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}

/* Undoing a pick is not the same kind of action as making one, so it drops the
   accent and reads as the neutral way back. */
.notes-import-candidate--new {
  border-color: var(--border);
  background: transparent;
  color: var(--text-muted);
}

.notes-import-rematch {
  margin-top: 0.5rem;
}

/* In-flow under the search box (not position:fixed). A viewport-fixed panel
   here covers the modal footer and clips the last row; keeping the list in
   the card lets Back/Create stay reachable and the card scroll if needed.
   The bottom margin matters more than it looks: in flow, the list's last row
   would otherwise butt straight up against the next exercise in the preview,
   leaving no visual boundary between "matches you can pick" and "the next
   exercise". */
.notes-import-rematch-results {
  position: static;
  max-height: 12rem;
  box-shadow: none;
  margin: 0.35rem 0 0.85rem;
}

.notes-import-confirm-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

.notes-import-confirm-actions button {
  width: auto;
  margin: 0;
}

/* ===== Settings ===== */
.settings-user {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.settings-user-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.settings-user-avatar--fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.6rem;
  letter-spacing: 0.04em;
  border-color: var(--accent);
}

.settings-user-name {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.4rem;
  letter-spacing: 0.03em;
  line-height: 1.1;
  color: var(--text);
}

.settings-user-email {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0.1rem 0 0;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.settings-row label {
  margin-bottom: 0;
}

.settings-row select {
  margin-bottom: 0;
  width: auto;
  min-width: 6rem;
}

.settings-row form {
  margin: 0;
}

.settings-row form button {
  margin-bottom: 0;
}

/* ===== Admin ops dashboard ===== */
.ops-week-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

/* Prev, the week, and next stay one group. Download sits on the right. */
.ops-week-cluster {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.ops-week-nav > button[data-testid="ops-download-feedback"] {
  margin-left: auto;
  flex: 0 0 auto;
}

.feedback-kinds {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.feedback-kinds button {
  flex: 1 1 0;
  margin-bottom: 0;
}

.feedback-counter {
  margin: -0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: right;
}

.feedback-counter--over {
  color: var(--pico-del-color, var(--danger));
}

.ops-week-cluster .ops-week-label {
  flex: 0 1 auto;
  min-width: 0;
}

.ops-week-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.15rem;
  flex: 1;
  min-width: 10rem;
}

.ops-week-label .secondary {
  font-size: 0.8rem;
}

.ops-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

@media (min-width: 640px) {
  .ops-cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.ops-card {
  margin: 0;
  padding: 1rem;
  text-align: center;
}

.ops-card-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}

.ops-card-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.ops-metric-hint {
  font-size: 0.8rem;
  margin-bottom: 1rem;
}

.ops-day-table-wrap {
  overflow-x: auto;
}

.ops-day-table {
  width: 100%;
  font-size: 0.9rem;
}

.ops-day-table th,
.ops-day-table td {
  text-align: right;
  white-space: nowrap;
}

.ops-day-table th:first-child,
.ops-day-table td:first-child {
  text-align: left;
}


/* ============================================================
   Coach scope — the "acting as coach" treatment (coaching-05)
   Warm amber (reuses --warn/--warn-bg) deliberately contrasts the
   teal personal chrome so acting-as-someone-else is unmistakable.
   ============================================================ */
:root {
  --coach:      #b45309; /* amber-700 */
  --coach-bg:   #fffbeb; /* amber-50  */
  --coach-line: #fcd34d; /* amber-300 */
}

/* ----- Scope switcher pill (in the top nav) ----- */
.scope-switcher {
  position: relative;
  display: inline-flex;
}
.scope-switcher > button.scope-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0.3rem 0.7rem;
  width: auto;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.scope-switcher > button.scope-trigger:hover {
  border-color: var(--coach-line);
}
.scope-switcher > button.scope-trigger .fa-chevron-down {
  font-size: 0.6rem;
  opacity: 0.6;
}
/* Amber-filled while a trainee is actually in scope */
body.coach-scope .scope-switcher > button.scope-trigger {
  background: var(--coach);
  border-color: var(--coach);
  color: #fff;
}

/* ----- Scope dropdown ----- */
.scope-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 0.35rem;
  z-index: 300;
}
.scope-menu .scope-menu-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.35rem 0.6rem 0.2rem;
}
.scope-menu a.scope-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.6rem;
  border-radius: 5px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
}
.scope-menu a.scope-item:hover {
  background: var(--surface2);
}
.scope-menu a.scope-item[aria-current="true"] {
  color: var(--coach);
  font-weight: 700;
}
.scope-menu a.scope-item.scope-item--self[aria-current="true"] {
  color: var(--accent);
}
.scope-menu a.scope-item .scope-item-icon {
  width: 1.1rem;
  text-align: center;
  opacity: 0.7;
}
.scope-menu hr {
  margin: 0.35rem 0.3rem;
  border: 0;
  border-top: 1px solid var(--border);
}
.scope-menu a.scope-item--manage {
  color: var(--accent);
  font-weight: 600;
}

/* ----- "Acting as coach" banner (under the nav, all scoped pages) ----- */
/* One navBar() for both banner rows; the wrapper adds no box of its own. */
.coach-banners { display: contents; }
.coach-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--coach-bg);
  border-bottom: 1px solid var(--coach-line);
  color: var(--coach);
  padding: 0.55rem 1rem;
  font-size: 0.9rem;
}
.coach-banner .coach-banner-icon { font-size: 1rem; }
.coach-banner strong { font-weight: 700; }
.coach-banner .coach-banner-hint { color: #92400e; opacity: 0.85; }
.coach-banner .coach-banner-exit {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--coach);
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--coach-line);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  white-space: nowrap;
}
.coach-banner .coach-banner-exit:hover { background: #fff; }
/* Old scoped link opened after the coaching ended (QA 08): same slim row,
   neutral colours — nothing here acts as coach any more. */
.coach-banner.coach-banner--ended {
  background: var(--surface2);
  border-bottom-color: var(--border);
  color: var(--text);
}
.coach-banner.coach-banner--ended .coach-banner-icon { color: var(--text-muted); }
.coach-banner.coach-banner--ended .coach-banner-exit {
  color: var(--text);
  border-color: var(--border);
  min-height: 44px; /* tap target */
}
.coach-banner.coach-banner--ended .coach-banner-exit:hover { background: var(--surface); }
/* Accent the top nav's underline while scoped */
body.coach-scope > nav:first-of-type {
  border-bottom: 2px solid var(--coach-line);
}

/* ============================================================
   Dashboard coaching hub (coaching-05)
   ============================================================ */
/* Inbound invites needing action — surfaced near the top, actionable. */
.invite-notice {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--accent-bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.6rem;
}
.invite-notice .invite-notice-text { flex: 1; min-width: 0; font-size: 0.92rem; }
.invite-notice .invite-notice-text strong { font-weight: 700; }
.invite-notice .invite-notice-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}
.invite-notice .invite-notice-actions button {
  margin: 0;
  padding: 0.3rem 0.8rem;
  width: auto;
  font-size: 0.85rem;
}

/* Quiet, low-priority hub at the very bottom of the dashboard. */
.coaching-hub {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.coaching-hub > .dashboard-section-head h3 { color: var(--text-muted); }
.coaching-hub .coaching-hub-sub {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin: -0.2rem 0 1rem;
}
.coach-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
}
.coach-row + .coach-row { border-top: 1px solid var(--border); }
.coach-row .coach-row-name {
  font-weight: 600;
  min-width: 0;
  flex-shrink: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.coach-row .coach-row-meta { color: var(--text-muted); font-size: 0.85rem; }
.coach-row .coach-row-spacer { margin-left: auto; }
.coach-invite-forms {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}
@media (max-width: 640px) {
  .coach-invite-forms { grid-template-columns: 1fr; }
}
.coach-invite-forms .coach-invite-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem;
}
.coach-invite-forms .coach-invite-card h4 {
  margin: 0 0 0.15rem;
  font-size: 0.95rem;
}
.coach-invite-forms .coach-invite-card p {
  margin: 0 0 0.7rem;
  color: var(--text-muted);
  font-size: 0.83rem;
}
.coach-invite-forms .coach-invite-card input { margin-bottom: 0.5rem; }
.coach-invite-forms .coach-invite-card button { margin: 0; }
/* Invites I sent that wait for an answer (QA 28): a quiet list under the form, set off by a rule. */
.coach-invite-forms .coach-invite-card .coach-row--sent {
  margin-top: 0.75rem;
  padding-bottom: 0;
  border-top: 1px solid var(--border);
}
.coach-invite-forms .coach-invite-card .coach-row--sent + .coach-row--sent { margin-top: 0; }
.coach-row--sent .coach-row-name { font-weight: 400; font-size: 0.9rem; color: var(--text-muted); }
.coach-row--sent .coach-row-meta { margin-left: auto; flex-shrink: 0; }

/* ===== Manage-trainees roster (coaching-05 §1/§2) ===== */
.trainee-roster {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

/* Card + its End button sit side by side; the card takes the remaining width. */
.trainee-card-wrap {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
}

a.trainee-card {
  flex: 1;
  min-width: 0;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
a.trainee-card:hover {
  border-color: var(--accent);
  background: var(--surface2);
}
a.trainee-card .template-row-name { color: var(--text); }

/* Let the summary (last workout · shared count) wrap instead of truncating on narrow screens. */
.trainee-card .template-row-meta {
  white-space: normal;
  overflow: visible;
}

.trainee-card-chevron {
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Fixed action rail. .trainee-action-slot reserves an .icon-btn-sized gap for
   the kiosk-link button, which only exists for account-less trainees — without
   it the End button sits at a different x on every other row. */
.trainee-card-actions {
  display: flex;
  align-items: center;
  align-self: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.trainee-action-slot {
  width: 2rem; /* matches .icon-btn */
  display: inline-flex;
  justify-content: center;
  flex-shrink: 0;
}

.dot-sep { margin: 0 0.35rem; opacity: 0.6; }

.kiosk-warning {
  color: var(--warn);
  background: var(--warn-bg);
  border-left: 4px solid var(--warn);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin: 1rem 0;
}

.needs-attention-badge {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--coach);
  background: var(--coach-bg);
  border: 1px solid var(--coach-line);
  border-radius: 3px;
  padding: 0.05rem 0.35rem;
  margin-left: 0.4rem;
  flex-shrink: 0;
  white-space: nowrap;
}

.roster-subhead {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 1rem 0 0.5rem;
}

.roster-invite { margin-top: 1.5rem; }

/* ===== Cross-document view transitions =====
   Progressive enhancement: same-origin MPA navigations crossfade instead of
   hard-cutting. Chromium-based engines animate; Safari/Firefox ignore the
   at-rule and navigate exactly as before. Presentational only — no change to
   navigation semantics, URLs, or load work.

   NOTE ON TESTS: cross-document VT stalls the new document's first paint in
   chromium-headless-shell (Playwright's engine), which hangs post-navigation
   actions to timeout. `@media (prefers-reduced-motion)` can NOT gate it off for
   tests — headless-shell ignores Playwright's reducedMotion emulation for the
   media query AND doesn't honor `@view-transition` nested in `@media`. So the
   e2e disable is done in JS instead: js/chrome.js injects
   `@view-transition { navigation: none }` whenever `navigator.webdriver` is
   true (automation only), overriding the opt-in below. Real users are never
   `navigator.webdriver`, so production is unaffected. */
@view-transition { navigation: auto; }

/* Hold the persistent chrome stable (morph in place) instead of crossfading it
   with the page content. Each name is a single instance per page, so it stays
   unique per snapshot (a duplicate name silently aborts the transition). Inert
   unless a transition is actually running. The .page-header is intentionally
   left in the root crossfade — its heading text changes per page, so a content
   crossfade reads better than a size-morph. */
#app-nav      { view-transition-name: app-nav; }
nav.tab-bar   { view-transition-name: tab-bar; }
.coach-banner { view-transition-name: coach-banner; }
.coach-banner.coach-banner--ended { view-transition-name: coach-banner-ended; }

/* Respect reduced motion: no transition at all for real users who ask for it.
   The nested `navigation: none` is honored by real Chrome (which is exactly the
   engine that would run a transition); `animation: none` is the widely-supported
   fallback that at least removes the motion where nesting isn't supported. */
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation: none !important; }
}

/* Keep the crossfade fast and understated — this is a utility app, and a long
   animation makes navigation feel slower than the hard cut it replaced. */
::view-transition-old(root),
::view-transition-new(root) { animation-duration: 150ms; }

/* Exercise typeahead: name + provenance badge on one line, secondary PL/alias line
   under them. The name takes the slack and wraps inside its own box, so the badge
   stays pinned right on the name's line instead of dropping onto a line of its own
   in a narrow phone modal. A hairline separates rows: two-line rows read as one
   block without it. */
.typeahead-result-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.5rem;
  cursor: pointer;
}
.typeahead-result-row + .typeahead-result-row {
  border-top: 1px solid var(--border);
  border-radius: 0;
}
.typeahead-result-name {
  flex: 1 1 0;
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 600;
}
.typeahead-result-row > .exercise-shared-badge {
  flex: 0 0 auto;
  margin-left: 0;
  white-space: nowrap;
}
.typeahead-result-secondary {
  flex-basis: 100%;
  font-size: 0.85em;
}
/* Add-to-program picker: listed before any search (QA 48), so the rows need to read as
   picks, not as a second input — a trailing "+" and a label above the list. */
.add-to-program-heading {
  margin: 1rem 0 0.25rem;
}
.typeahead--inline .add-to-program-results {
  border: none;
  border-top: 1px solid var(--border);
  border-radius: 0;
  padding: 0;
}
.add-to-program-results .typeahead-result-row {
  align-items: center;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}
.add-to-program-results .typeahead-result-row + .typeahead-result-row {
  border-top: none;
}
.add-to-program-icon {
  flex: 0 0 auto;
  color: var(--accent);
}
.catalog-conflict {
  border-left: 3px solid var(--pico-del-color, #c62828);
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
  background: var(--pico-card-background-color, #1a1a1a);
}
.catalog-conflict__title {
  font-weight: 600;
  margin: 0 0 0.5rem;
}
.catalog-conflict__list {
  margin: 0 0 0.75rem;
  padding-left: 1.2rem;
}
.catalog-conflict__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.exercise-advanced-names {
  margin: 0.5rem 0 1rem;
}

/* Replace-exercise picker: the "what about the workouts already logged here" answer.
   Only rendered when the slot actually has logs, so it must not reserve space. */
.replace-past-scope {
  margin: 0 0 var(--space-3, 0.75rem);
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--pico-form-element-border-color);
  border-radius: var(--pico-border-radius);
}

.replace-past-scope legend {
  padding: 0 0.35rem;
  font-size: 0.85rem;
}

.replace-past-scope label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  /* Pico's default radio margin leaves the rows too far apart to read as one group. */
  margin-bottom: 0;
  /* The whole label is the tap target (native <label> behaviour), so give the row the
     height to match — the text alone is well under 44px on a one-line option. */
  min-height: 2.75rem;
  padding: 0.15rem 0.25rem;
  font-size: 0.9rem;
  /* An option sentence, not a field caption: undo the global uppercase label look
     (same as label:has(checkbox)). */
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  cursor: pointer;
}

/* Without this the radio is a flex item that shrinks horizontally while keeping its
   height, rendering as a vertical oval instead of a circle. */
.replace-past-scope input[type='radio'] {
  flex: 0 0 auto;
  width: 1.25em;
  height: 1.25em;
  margin: 0;
}

.replace-past-option--blocked {
  opacity: 0.55;
}

.replace-past-blocked,
.replace-past-loading {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
}

.replace-past-loading {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 var(--space-3, 0.75rem);
}

/* ---------------------------------------------------------------------------
   Template progress page

   Dense by design: the point is to read every exercise's direction on one phone
   screen, so rows are compact and the verdict lives on the same line as the name.
   Every trend carries an icon and a number as well as a colour — colour alone is
   not a signal for a red/green-colourblind reader, which is exactly the pairing
   this page leans on.
   --------------------------------------------------------------------------- */

.progress-header {
  margin-bottom: 0.5rem;
}

.progress-header hgroup {
  margin-bottom: 0.4rem;
}

.progress-header hgroup h2 {
  font-size: 1.15rem;
  margin-bottom: 0.05rem;
}

.progress-header hgroup p {
  margin: 0;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.progress-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
}

.trend-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border: 1px solid transparent;
}

.trend-pill--up    { color: var(--success); background: var(--success-bg); border-color: color-mix(in srgb, var(--success) 30%, var(--border)); }
.trend-pill--down  { color: var(--danger);  background: var(--danger-bg);  border-color: color-mix(in srgb, var(--danger) 30%, var(--border)); }
.trend-pill--mixed { color: var(--warn);    background: var(--warn-bg);    border-color: color-mix(in srgb, var(--warn) 30%, var(--border)); }
.trend-pill--flat  { color: var(--text-muted); background: var(--surface2); border-color: var(--border); }
.trend-pill--new   { color: var(--info);    background: var(--info-bg);    border-color: color-mix(in srgb, var(--info) 30%, var(--border)); }

.progress-note {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.35rem;
  padding: 0.3rem 0.5rem;
  border-left: 3px solid var(--warn);
  background: var(--warn-bg);
  border-radius: var(--radius);
  font-size: 0.74rem;
  color: var(--text-muted);
}

.progress-rows {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.progress-row {
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

/* The left bar repeats the verdict, so a row's direction is legible while scanning
   the column even before the badge is read. */
.progress-row--up    { border-left-color: var(--success); }
.progress-row--down  { border-left-color: var(--danger); }
.progress-row--mixed { border-left-color: var(--warn); }
.progress-row--flat  { border-left-color: var(--border); }
.progress-row--new   { border-left-color: var(--info); }

.progress-row-main {
  /* Pico paints [role=button] as a primary CTA (teal fill, white text, button padding).
     This row is a disclosure control, not a button — same class of reset as .icon-btn.
     !important is required: Pico's [role=button] is 0,1,1 and beats a single class. */
  display: block !important;
  padding: 0.5rem 0.7rem !important;
  cursor: pointer;
  min-height: 44px;
  background: transparent !important;
  background-color: transparent !important;
  color: inherit !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  text-align: inherit !important;
  width: 100% !important;
  height: auto !important;
  margin: 0 !important;
  font: inherit !important;
  font-weight: inherit !important;
  font-size: inherit !important;
  line-height: inherit !important;
  letter-spacing: inherit !important;
  text-decoration: none !important;
  user-select: auto !important;
  -webkit-user-select: auto !important;
}

.progress-row-main:hover {
  background: var(--surface2) !important;
  color: inherit !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

.progress-row-main:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.progress-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.progress-row-name {
  font-weight: 600;
  font-size: 0.86rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trend-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.trend-badge--up    { color: var(--success); }
.trend-badge--down  { color: var(--danger); }
.trend-badge--mixed { color: var(--warn); }
.trend-badge--flat  { color: var(--text-muted); }
.trend-badge--new   { color: var(--info); }

.trend-badge-label,
.trend-badge-metric {
  font-weight: 600;
  font-size: 0.72rem;
}

/* Pull the "·" in from the badge's flex gap so number, dot and label read as one unit. */
.trend-badge-metric {
  margin-left: -0.1rem;
}

.progress-row-body {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.1rem;
}

/* Two stats, each with its own label: the wider column gap separates them, so the row reads
   right on one line or wrapped (a "·" item would dangle at a line end). */
.progress-row-value {
  display: flex;
  align-items: baseline;
  gap: 0.1rem 0.9rem;
  flex-wrap: wrap;
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  flex: 1;
  min-width: 0;
}

.progress-row-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  white-space: nowrap;
}

.progress-row-metric {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.progress-row-chevron {
  font-size: 0.7rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Only present on exceptional rows (off plan, removed, assisted, multi-slot, mixed units), so
   an ordinary row costs no extra line. */
.progress-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.2rem;
}

.progress-row-meta:empty {
  display: none;
}

.progress-chip {
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface2);
  font-size: 0.68rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Declared after .progress-chip on purpose: same specificity, so order decides. This is the one
   chip that changes how a number should be read, so it is tinted rather than neutral. */
.progress-chip--direction {
  color: var(--info);
  background: var(--info-bg);
  border-color: color-mix(in srgb, var(--info) 30%, var(--border));
}

/* Chart series switcher (progress header + expanded row + exercise-history sheet).
   One line that scrolls sideways: a row usually offers two to four series (more when
   it logs several dimensions) and the header up to ten, which a wrapping or
   equal-width segmented control cannot fit on a phone. */
.chart-kind-chips {
  display: flex;
  gap: 0.35rem;
  margin: 0.2rem 0 0.6rem;
  padding: 0.1rem 0 0.2rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.chart-kind-chips::-webkit-scrollbar {
  display: none;
}

.chart-kind-chips--row {
  margin: 0;
  padding: 0.55rem 0.7rem 0.15rem;
  background: var(--surface);
}

.chart-kind-chip {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  margin: 0;
  min-height: 40px;
  width: auto;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.chart-kind-chip:hover {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  color: var(--text);
}

.chart-kind-chip--active,
.chart-kind-chip--active:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Every row is plotted over the same session axis, so two sparklines can be
   compared by eye even when one exercise was only added recently. */
.sparkline {
  flex-shrink: 0;
  overflow: visible;
}

.sparkline-line {
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.75;
}

.sparkline-dot {
  fill: currentColor;
}

.sparkline-area {
  fill: currentColor;
  opacity: 0.14;
}

.progress-row--up .sparkline,
.progress-row--up .progress-chart-svg    { color: var(--success); }
.progress-row--down .sparkline,
.progress-row--down .progress-chart-svg  { color: var(--danger); }
.progress-row--mixed .sparkline,
.progress-row--mixed .progress-chart-svg { color: var(--warn); }
.progress-row--flat .sparkline,
.progress-row--flat .progress-chart-svg  { color: var(--text-muted); }
.progress-row--new .sparkline,
.progress-row--new .progress-chart-svg   { color: var(--info); }

.progress-divider {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.6rem 0 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.progress-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.progress-sessions {
  border-top: 1px solid var(--border);
  background: var(--surface2);
  /* Keeps the set table above the tab bar when toggleRow scrolls the panel into view. */
  scroll-margin-bottom: 68px;
}

.progress-chart {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  padding: 0.65rem 0.7rem 0.45rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.progress-chart-scale {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  min-width: 3.6rem;
  text-align: right;
  line-height: 1.2;
}

.progress-chart-plot {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  height: 96px;
}

.progress-chart-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.progress-chart-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.progress-row--up .progress-chart-plot    { color: var(--success); }
.progress-row--down .progress-chart-plot  { color: var(--danger); }
.progress-row--mixed .progress-chart-plot { color: var(--warn); }
.progress-row--flat .progress-chart-plot  { color: var(--text-muted); }
.progress-row--new .progress-chart-plot   { color: var(--info); }

.progress-set-table-wrap {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--text-muted) 45%, transparent) transparent;
}

.progress-set-table-wrap::-webkit-scrollbar {
  height: 8px;
}

.progress-set-table-wrap::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text-muted) 45%, transparent);
  border-radius: 99px;
}

.progress-set-table {
  /* max-content so set columns keep a readable width and the wrap scrolls, instead of
     shrinking cell 2 into a clipped stub at 390px. */
  width: max-content !important;
  min-width: 100%;
  margin: 0;
  border-collapse: collapse;
  table-layout: auto;
  font-size: 0.78rem;
}

.progress-set-table th,
.progress-set-table td {
  padding: 0.55rem 0.55rem;
  border-bottom: 1px solid var(--border);
  vertical-align: baseline;
  background: var(--surface2);
}

.progress-set-table tbody tr:last-child th,
.progress-set-table tbody tr:last-child td {
  border-bottom: none;
}

.progress-set-table th {
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.progress-set-date-col {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 4.2rem;
  box-shadow: 1px 0 0 var(--border);
}

.progress-set-metric-col {
  min-width: 4.8rem;
  white-space: nowrap;
}

.progress-set-col,
.progress-set-cell {
  min-width: 5.2rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.progress-session--skipped {
  opacity: 0.6;
}

.progress-session-date {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--accent) !important;
  text-decoration: underline;
  text-underline-offset: 0.12em;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

.progress-session-date:hover {
  text-decoration-color: var(--accent);
}

.progress-session-values {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  flex-wrap: nowrap;
}

.progress-session-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.progress-session-delta {
  font-size: 0.7rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.progress-session-delta--up   { color: var(--success); }
.progress-session-delta--down { color: var(--danger); }
.progress-session-delta--flat { color: var(--text-muted); }

.progress-session-skipped {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.progress-set-delta {
  display: block;
  margin-left: 0;
  font-size: 0.68rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.progress-set-delta--up   { color: var(--success); }
.progress-set-delta--down { color: var(--danger); }
.progress-set-delta--flat { color: var(--text-muted); }

/* ---- Template "Ask AI" (js/template-assist.js) ---------------------------------------- */

.exercises-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.exercises-heading h3 {
  margin-bottom: 0;
}

.assist-open-btn {
  width: auto;
  margin: 0;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

/* Empty template: the one place the assistant is the obvious next step, so it gets a
   full-width card rather than a toolbar button. Dashed like the add-exercise point. */
.assist-empty-cta {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  width: 100%;
  margin: 0.5rem 0 0.75rem;
  padding: 0.85rem 1rem;
  text-align: left;
  font-family: 'Plus Jakarta Sans', sans-serif;
  letter-spacing: normal;
  background: var(--accent-bg);
  color: var(--text);
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--border));
  border-radius: var(--radius);
  cursor: pointer;
}

.assist-empty-cta > i {
  color: var(--accent);
  font-size: 1.2rem;
  margin-top: 0.1rem;
}

.assist-empty-cta strong {
  display: block;
  font-size: 0.95rem;
  color: var(--accent-hover);
}

.assist-empty-cta .secondary {
  display: block;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.assist-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: -0.25rem 0 0.75rem;
}

.assist-hint {
  font-size: 0.78rem;
  margin-bottom: 0.75rem;
}

.assist-running {
  text-align: center;
}

.assist-running .secondary {
  font-size: 0.85rem;
}

.assist-summary {
  margin: 0 0 0.6rem;
  font-size: 0.9rem;
}

.assist-rename {
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.assist-rename i {
  font-size: 0.7rem;
  margin-right: 0.25rem;
}

.assist-rows {
  list-style: none;
  margin: 0 0 0.6rem;
  padding: 0;
  max-height: 55vh;
  overflow-y: auto;
}

.assist-row {
  list-style: none;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.assist-row:last-child {
  border-bottom: none;
}

/* Unchanged rows are context, not news: present but quiet. */
.assist-row--kept .assist-row-name,
.assist-row--kept .assist-row-targets {
  color: var(--text-muted);
}

.assist-row--dropped .assist-row-name,
.assist-row--dropped .assist-row-targets {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Badge and the leave-out toggle share a slim top line; the name gets the full width
   below, so a long name never wraps against them. */
.assist-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  min-height: 1.5rem;
}

.assist-row-name {
  margin: 0.15rem 0 0;
  font-weight: 600;
  font-size: 0.9rem;
  overflow-wrap: break-word;
}

/* Plan preview: the name and its remove control share one row, so a row with no
   "new" badge does not leave the × on a line of its own. icon-btn--tap is the 44px hit area. */
.plan-exercise-title {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* The shared header close is a bare glyph (~17px); the AI sheets get the same 44px hit area as
   the exercise info and bottom sheets. */
.assist-modal > header .modal-close {
  min-width: 2.75rem !important;
  min-height: 2.75rem !important;
  margin-right: -0.75rem !important;
}

/* The 44px close adds height; take it back out of the header's own padding. */
.assist-modal > header {
  padding-top: 0.5rem !important;
  padding-bottom: 0.5rem !important;
}

/* A 3-day preview is taller than the card. Keep Save on screen; scroll the days. */
.assist-modal:has(.plan-assist-preview) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.plan-assist-preview {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.plan-assist-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.plan-assist-preview .assist-actions {
  flex: 0 0 auto;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.plan-exercise-title .assist-row-name {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.assist-row-drop {
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  margin: -0.7rem -0.6rem -0.7rem 0;
}

.assist-row-targets,
.assist-row-note {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: pre-line;
}

.assist-row-note {
  color: var(--text);
}

.assist-row-note--removed {
  color: var(--text-muted);
  font-style: italic;
}

.assist-row-note--removed i {
  font-size: 0.7rem;
  margin-right: 0.25rem;
}

.assist-badge {
  flex-shrink: 0;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface2);
}

.assist-badge--added {
  color: var(--success);
  background: var(--success-bg);
  border-color: color-mix(in srgb, var(--success) 30%, var(--border));
}

.assist-badge--changed,
.assist-badge--replaced {
  color: var(--info);
  background: var(--info-bg);
  border-color: color-mix(in srgb, var(--info) 30%, var(--border));
}

.assist-badge--new {
  color: var(--warn);
  background: var(--warn-bg);
  border-color: color-mix(in srgb, var(--warn) 30%, var(--border));
}

.assist-badge--removed {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: color-mix(in srgb, var(--danger) 30%, var(--border));
}

.assist-removed {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.6rem;
  font-size: 0.8rem;
}

.assist-removed-name {
  text-decoration: line-through;
  color: var(--text-muted);
}

.assist-actions {
  display: flex;
  gap: 0.5rem;
}

/* Catalog-copy dialog (template-detail): a non-admin's dimension chip on a catalog exercise.
   Two alternatives — find a catalog variant, or make a copy — split by a rule. */
.catalog-copy-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.catalog-copy-form p {
  margin: 0;
}

.catalog-copy-message {
  font-size: 0.95rem;
  line-height: 1.45;
}

.catalog-copy-form > button {
  width: 100%;
  margin: 0.35rem 0 0;
}

.catalog-copy-or {
  margin-top: 0.4rem !important;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  margin-bottom: 0.25rem !important;
}

.catalog-copy-form input[type="text"] {
  margin-bottom: 0;
}

.catalog-copy-form .replace-past-scope {
  margin: 0;
}

.catalog-copy-modal .catalog-conflict__list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.catalog-copy-use-match {
  width: auto;
  margin: 0;
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
}

.catalog-copy-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.catalog-copy-actions button {
  margin: 0;
}

/* The primary action takes the room so its label stays on one line. */
.catalog-copy-actions button[type="submit"] {
  flex: 1;
}

.catalog-copy-actions button[type="button"] {
  flex: 0 0 auto;
  width: auto;
}

.assist-actions button {
  flex: 1;
  margin: 0;
}

/* ===== Bottom sheet (exercise history on the workout page) =====
   Anchored to the bottom so it is a thumb's reach away and the workout stays visible above it.
   Same layer as .modal-backdrop; only the body scrolls. */
.bottom-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(28, 27, 24, 0.45);
}

.bottom-sheet {
  display: flex;
  flex-direction: column;
  width: 100%;
  /* Pico gives <section> a bottom margin, which would float the sheet off the screen edge. */
  margin: 0;
  max-width: 34rem;
  max-height: 75dvh;
  background: var(--surface);
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -6px 24px rgba(28, 27, 24, 0.18);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  animation: bottom-sheet-up 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes bottom-sheet-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .bottom-sheet { animation: none; }
}

/* Grab handle; a button so the sheet also closes with a tap on it. */
.bottom-sheet-handle {
  position: relative;
  align-self: center;
  width: 3rem !important;
  height: 1.1rem !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  background: none !important;
  box-shadow: none !important;
  cursor: pointer;
}

.bottom-sheet-handle::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2.25rem;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  transform: translate(-50%, -50%);
}

.bottom-sheet-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 1rem 0.6rem;
  border-bottom: 1px solid var(--border);
}

.bottom-sheet-titles {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
}

.bottom-sheet-eyebrow {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.bottom-sheet-eyebrow i {
  font-size: 0.6rem;
}

.bottom-sheet-title {
  margin: 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bottom-sheet-header .modal-close {
  width: 2.75rem !important;
  height: 2.75rem !important;
  margin-right: -0.6rem !important;
  flex-shrink: 0;
}

.bottom-sheet-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.75rem 1rem 1rem;
}

/* The running rest, mirrored from the (now dimmed) rest strip. */
.history-rest-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--accent-bg);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.history-chart-kinds {
  margin: 0.5rem 0 0.1rem;
}

.history-summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.history-summary-stats {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
  min-width: 0;
}

.history-summary-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* "+3% vs last time" beside the headline value; the tone is today's own change. */
.history-vs-last {
  font-size: 0.8rem;
  font-weight: 700;
}

.history-vs-last--up   { color: var(--success); }
.history-vs-last--down { color: var(--danger); }
.history-vs-last--flat { color: var(--text-muted); }

.history-list {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
}

.history-item {
  list-style: none;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.history-item:last-child {
  border-bottom: none;
}

.history-item--today {
  margin: 0;
  padding: 0.5rem 0.75rem;
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--border));
  border-radius: var(--radius);
  background: var(--accent-bg);
}

.history-item--today + .history-item {
  margin-top: 0.2rem;
}

.history-item-head {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  min-width: 0;
}

.history-item-date {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.history-item--today .history-item-date {
  color: var(--accent);
}

.history-item-workout {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
  color: color-mix(in srgb, var(--text) 65%, var(--text-muted));
}

.history-item-delta {
  margin-left: auto;
  font-size: 0.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.history-item-delta--up   { color: var(--success); }
.history-item-delta--down { color: var(--danger); }
.history-item-delta--flat { color: var(--text-muted); }

.history-item-sets {
  margin-top: 0.1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.history-item-note {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  margin-top: 0.15rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.history-item-note i {
  font-size: 0.7rem;
}

.history-more {
  display: block;
  width: 100%;
  margin: 0.6rem 0 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text) !important;
}

.history-empty,
.history-error p {
  margin: 0.5rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.history-error button {
  width: auto;
  margin: 0;
}

/* The "Last time" line opens the history sheet. */
.prev-workout--link {
  cursor: pointer;
}

.prev-workout--link:hover,
.prev-workout--link:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.prev-workout-more {
  margin-left: auto;
  font-size: 0.75rem !important;
  color: var(--accent) !important;
}

/* ===== Watch emulator (/watch-emulator.html, watchemu-03) =====
   A phone-width column: status and controls are ordinary cards, the workout
   sits in a dark round-cornered "watch" frame between them. */
/* No tab bar on this page, so no room kept for one at the bottom. */
body.watch-emu-page {
  padding-bottom: 0;
}

.watch-emu {
  max-width: 440px;
  padding-bottom: 2rem;
}

.watch-emu-head {
  margin: 1rem 0 0.75rem;
}

.watch-emu-head h2 {
  margin-bottom: 0.15rem;
}

.watch-emu-notice {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: var(--warn-bg);
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--border));
}

.watch-emu-body {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.watch-emu-card {
  margin: 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  box-shadow: none;
}

.watch-emu-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.watch-emu-status-line {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
}

.watch-emu-status-line .fa-link {
  color: var(--accent);
}

.watch-emu-muted {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 0.5rem 0 0;
}

/* Small-text buttons that still give a 44 px tap target. */
.watch-emu-btn-sm {
  width: auto;
  margin: 0;
  padding: 0.3rem 0.85rem;
  font-size: 0.85rem;
  min-height: 2.75rem;
}

.watch-emu-link {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.watch-emu-switch {
  display: flex;
  flex-direction: row-reverse;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-weight: 600;
}

.watch-emu-switch input {
  margin: 0;
}

.watch-emu-delay {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0;
  font-weight: 600;
}

.watch-emu-delay select {
  width: auto;
  min-width: 9rem;
  margin: 0;
}

.watch-emu-reach {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  font-weight: 600;
}

.watch-emu-reach.is-ok {
  color: var(--success);
}

.watch-emu-reach.is-off {
  color: var(--warn);
}

.watch-emu-mock {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  padding: 0.6rem 0.75rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.watch-emu-mock .watch-emu-muted {
  grid-column: 1 / -1;
  margin: 0;
}

.watch-emu-mock .watch-emu-btn-sm {
  width: 100%;
  padding: 0.3rem 0.5rem;
}

/* The watch itself: a ~400 px squircle with a bezel. The screen inside is a
   flex child with its own scroll, faded at both ends so a card never meets the
   rounded edge as a hard cut. */
.watch-emu-watch {
  display: flex;
  flex-direction: column;
  width: min(100%, 400px);
  aspect-ratio: 1 / 1;
  /* aspect-ratio's automatic minimum would let the content stretch the frame. */
  min-height: 0;
  margin: 0 auto;
  padding: 8% 12%;
  border-radius: 30%;
  background: var(--text);
  color: var(--surface);
  border: 8px solid color-mix(in srgb, var(--text) 75%, var(--text-muted));
  box-shadow: 0 0 0 2px var(--border), 0 6px 18px color-mix(in srgb, var(--text) 25%, transparent);
  overflow: hidden;
}

.watch-emu-watch.is-off {
  border-color: var(--warn);
}

.watch-emu-screen {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.9rem 0 1.4rem;
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--surface);
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 0.9rem, #000 calc(100% - 1.6rem), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 0.9rem, #000 calc(100% - 1.6rem), transparent 100%);
}

/* Pico colours paragraphs and lists itself; on the dark face everything
   inherits the light text unless a rule below dims it on purpose. */
.watch-emu-screen :where(p, li, strong, span, ol, i) {
  color: inherit;
}

.watch-emu-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0;
  text-align: center;
  font-size: 0.95rem;
}

.watch-emu-empty i {
  font-size: 1.6rem;
  color: var(--accent);
}

.watch-emu-clock {
  margin: 0 0 0.45rem;
  text-align: center;
  font-size: 0.75rem;
  color: color-mix(in srgb, var(--surface) 80%, var(--text));
}

.watch-emu-offline,
.watch-emu-rest,
.watch-emu-peer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin: 0 0 0.45rem;
  padding: 0.3rem 0.7rem;
  border-radius: 1rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
}

.watch-emu-screen .watch-emu-offline {
  background: var(--warn);
  color: var(--text);
}

.watch-emu-screen .watch-emu-rest {
  background: var(--accent);
  color: var(--surface);
}

.watch-emu-rest strong {
  font-variant-numeric: tabular-nums;
}

/* The rest screen's footer: the watch's next sets, as the real rest screen lists them. */
.watch-emu-up-next {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 0.6rem;
  margin: 0.15rem 0 0.6rem;
  font-size: 0.78rem;
}

/* The screen sets its own light-on-dark colour: inherit it, dim only the label. */
.watch-emu-up-next > span:first-child {
  opacity: 0.75;
}

.watch-emu-up-next-row {
  white-space: nowrap;
  font-weight: 600;
}

/* The watch picker's suggestion cards above the Log set fields: the values
   first, the card kind as a caption; tapping one fills the fields. */
.watch-emu-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.watch-emu-cards-label {
  grid-column: 1 / -1;
  margin: 0;
}

.watch-emu-card-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  width: 100%;
  margin: 0;
  padding: 0.4rem 0.7rem;
  min-height: 2.75rem;
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
}

.watch-emu-card-values {
  font-size: 0.9rem;
  font-weight: 600;
}

.watch-emu-card-kind {
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.watch-emu-screen .watch-emu-peer {
  display: block;
  background: color-mix(in srgb, var(--info) 55%, var(--text));
  color: var(--surface);
}

.watch-emu-peer i {
  margin-right: 0.3rem;
}

.watch-emu-peer-part {
  white-space: nowrap;
}

.watch-emu-peer-part + .watch-emu-peer-part::before {
  content: ' · ';
}

.watch-emu-ex {
  margin: 0 0 0.45rem;
  padding: 0.5rem 0.7rem;
  border-radius: 0.8rem;
  background: color-mix(in srgb, var(--surface) 12%, var(--text));
  border: 1px solid transparent;
  cursor: pointer;
}

.watch-emu-ex.is-selected {
  border-color: var(--accent);
}

.watch-emu-ex-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.watch-emu-screen .watch-emu-ex-head .fa-thumbtack {
  color: var(--accent);
}

.watch-emu-screen .watch-emu-meta {
  margin: 0.1rem 0 0;
  font-size: 0.74rem;
  color: color-mix(in srgb, var(--surface) 78%, var(--text));
}

.watch-emu-block.is-skipped span:first-child {
  text-decoration: line-through;
}

.watch-emu-sets {
  margin: 0.3rem 0 0;
  padding: 0;
}

.watch-emu-sets li {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0.15rem 0;
  list-style: none;
}

.watch-emu-set-text {
  flex: 1 1 auto;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

.watch-emu-screen .watch-emu-role {
  font-size: 0.7rem;
  color: color-mix(in srgb, var(--surface) 75%, var(--text));
}

.watch-emu-badge {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  padding: 0 0.45rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

.watch-emu-badge.is-synced {
  color: var(--success);
  background: var(--success-bg);
}

.watch-emu-badge.is-unsynced {
  color: var(--warn);
  background: var(--warn-bg);
}

/* On the dark face the pills are tinted, not white. */
.watch-emu-screen .watch-emu-badge.is-synced {
  color: var(--surface);
  background: color-mix(in srgb, var(--success) 75%, var(--text));
}

.watch-emu-screen .watch-emu-badge.is-unsynced {
  color: var(--text);
  background: var(--warn);
}

.watch-emu-screen .watch-emu-next {
  margin: 0.3rem 0 0;
  font-size: 0.74rem;
  color: color-mix(in srgb, var(--accent) 45%, var(--surface));
}

/* Controls below the watch */
.watch-emu-controls label {
  margin-bottom: 0.5rem;
}

.watch-emu-controls select {
  margin-top: 0.2rem;
  margin-bottom: 0;
}

.watch-emu-controls h4 {
  margin: 0.9rem 0 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 1rem;
}

.watch-emu-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
  gap: 0.5rem;
}

.watch-emu-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.watch-emu-field input {
  margin: 0;
}

.watch-emu-log-btn {
  width: 100%;
  margin: 0.4rem 0 0;
}

.watch-emu-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.watch-emu-actions > button {
  flex: 1 1 0;
}

.watch-emu-rest-row {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.watch-emu-rest-row .watch-emu-field {
  flex: 1 1 auto;
  margin: 0;
}

.watch-emu-rest-row input,
.watch-emu-rest-row button {
  height: 3rem;
}

.watch-emu-rest-row button {
  width: auto;
  margin: 0;
  padding-top: 0;
  padding-bottom: 0;
  white-space: nowrap;
}

.watch-emu-rest-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.6rem;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
}

.watch-emu-rest-controls .watch-emu-btn-sm {
  min-width: 3.5rem;
  padding: 0.3rem 0.9rem;
}

.watch-emu-rest-controls strong {
  color: var(--accent);
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
  margin-right: auto;
}

.watch-emu-set-list {
  margin: 0;
  padding: 0;
}

.watch-emu-set-list li {
  list-style: none;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}

.watch-emu-set-list li:last-child {
  border-bottom: none;
}

.watch-emu-set-list .watch-emu-row {
  flex-wrap: nowrap;
  justify-content: flex-start;
}

.watch-emu-set-list .watch-emu-badge {
  margin-left: 0;
}

.watch-emu-row-actions {
  display: flex;
  gap: 0.35rem;
  margin-left: auto;
}

.watch-emu-icon-btn {
  width: 2.75rem;
  height: 2.75rem;
  margin: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.watch-emu-edit .watch-emu-actions {
  margin-top: 0.5rem;
}

/* Raw log */
.watch-emu-log {
  margin: 0;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  min-width: 0;
}

.watch-emu-log summary {
  font-weight: 600;
}

.watch-emu-log ol {
  margin: 0.5rem 0 0;
  padding: 0;
}

.watch-emu-log li {
  list-style: none;
  min-width: 0;
  padding: 0.65rem 0.6rem;
  border-top: 1px solid var(--border);
}

.watch-emu-log li.is-invalid {
  background: var(--danger-bg);
  box-shadow: inset 3px 0 0 var(--danger);
}

.watch-emu-log-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.15rem 0.5rem;
  font-size: 0.78rem;
}

.watch-emu-log-head code {
  grid-column: 1 / -1;
  justify-self: start;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 0.75rem;
}

.watch-emu-log-time {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.watch-emu-dir {
  font-weight: 700;
  color: var(--accent);
}

.watch-emu-invalid {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0.35rem 0 0;
  color: var(--danger);
  font-size: 0.8rem;
  font-weight: 600;
}

.watch-emu-log pre {
  margin: 0.4rem 0 0;
  max-width: 100%;
  /* Whole lines, so a scrolled pre never ends on half a line. */
  max-height: calc(14 * 1.5em + 0.9rem);
  line-height: 1.5;
  overflow: auto;
  font-size: 0.72rem;
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius);
  background: var(--bg);
}

.watch-emu-log li.is-invalid pre {
  background: color-mix(in srgb, var(--danger-bg) 60%, var(--surface));
}

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

/* Dashboard program rows: when a workout was last logged, and which ones are done this week.
   Only a hint: a done row stays fully usable, so its play button keeps normal contrast. */
[data-testid="dashboard-recent-templates"] .dashboard-list .exercise-meta-chip {
  padding-inline: 0.4rem;
}

/* Three chips and two buttons don't fit one line here; when a workout was last done matters more
   than how many times, and a wrapped line would make every row taller. */
@media (max-width: 380px) {
  .dashboard-execution-chip {
    display: none !important;
  }
}

.last-logged-chip--never {
  color: var(--text-muted);
  border: 1px dashed var(--text-muted);
}

.last-logged-chip--done {
  color: var(--success);
  border-color: var(--success);
}

.template-row--clickable.template-row--done-week {
  background: var(--surface2);
  box-shadow: none;
  border: 1px solid var(--border);
}

.template-row--done-week .template-row-name {
  color: var(--text-muted);
  font-weight: 500;
}

.template-row--done-week .exercise-meta-chip:not(.last-logged-chip--done) {
  color: var(--text-muted);
  background: transparent;
}

.template-row--done-week a.icon-btn {
  color: var(--text-muted);
}

/* mcp-01b: Settings → Connected AI apps */
.settings-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}

.settings-note:last-child {
  margin: 0.75rem 0 0;
}

.ai-apps-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ai-app-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--border);
  list-style: none;
}

.ai-app-row:first-child {
  border-top: 0;
}

.ai-app-icon {
  color: var(--accent);
  background: var(--accent-bg);
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ai-app-text {
  flex: 1;
  min-width: 0;
}

.ai-app-meta {
  display: block;
  line-height: 1.35;
}

.ai-app-name {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
}

.ai-app-name strong {
  overflow-wrap: anywhere;
}

.ai-app-access {
  font-size: 0.75rem;
  color: var(--accent);
  background: var(--accent-bg);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  white-space: nowrap;
}

.ai-app-revoke {
  margin: 0;
  width: 40px;
  height: 40px;
  padding: 0;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* QA 138: the how-to state of connect-ai.html, and the "bring your history" hint on the first-run card */
.connect-ai-steps {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

.connect-ai-steps li {
  margin-bottom: 0.5rem;
}

.connect-ai-url {
  display: block;
  margin-top: 0.25rem;
  overflow-wrap: anywhere;
  user-select: all;
}

/* mcp-01b: the consent page (connect-ai.html) */
.connect-ai {
  max-width: 34rem;
}

.connect-ai-card {
  margin-top: 1rem;
}

.connect-ai-card h2 {
  font-size: 1.35rem;
  margin-bottom: 1rem;
  text-wrap: balance;
}

.connect-ai-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-bg);
  color: var(--accent);
  font-size: 1.3rem;
  margin-bottom: 0.75rem;
}

.connect-ai-icon--error {
  background: var(--danger-bg);
  color: var(--danger);
}

.connect-ai-facts {
  margin: 0 0 0.5rem;
}

.connect-ai-facts dt {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-top: 0.6rem;
}

.connect-ai-facts dd {
  margin: 0.1rem 0 0;
  overflow-wrap: anywhere;
}

.connect-ai-redirect i {
  color: var(--text-muted);
  margin-right: 0.3rem;
}

.connect-ai-unverified {
  display: block;
  font-size: 0.8rem;
  color: #b45309;
}

/* The redirect host is the phishing defence: it must stand out. */
.connect-ai-redirect {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.25rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent-bg);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

.connect-ai-card > a[role="button"] {
  display: block;
  width: 100%;
  min-height: 44px;
}

.connect-ai-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.connect-ai-access {
  margin-bottom: 0.75rem;
}

.connect-ai-access legend {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.connect-ai-option {
  /* The global label rule is a small uppercase caption; these are readable choices. */
  text-transform: none;
  letter-spacing: normal;
  font-size: 1rem;
  color: var(--text);
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  cursor: pointer;
}

.connect-ai-option.is-selected {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.connect-ai-option input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.connect-ai-option-title {
  display: block;
  font-weight: 600;
}

.connect-ai-option-title i {
  color: var(--accent);
  margin-right: 0.3rem;
}

.connect-ai-option small {
  display: block;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.35;
  margin-top: 0.15rem;
}

.connect-ai-option input[type="radio"] {
  accent-color: var(--accent);
}

.connect-ai-actions {
  display: flex;
  gap: 0.75rem;
}

.connect-ai-actions button {
  flex: 1;
  margin-bottom: 0;
  min-height: 44px;
}
