/* ============ Stone Dragon Strength Training — styles ============ */
:root {
  --bg: #03060c;
  --bg-2: #060b14;
  --surface: #0b111d;
  --surface-2: #131c33;
  --surface-3: #1e2d4a;
  --surface-elevate: #2a3a5e;
  --border: #3a4a75;
  --border-strong: #4d5f92;
  --text: #e2e8f0;
  --text-soft: #94a3b8;
  --muted: #64748b;
  /* RGB channels drive every accent glow/border via rgba(var(--…-rgb), a).
     A theme only needs to override these + the hex vars below (and surfaces). */
  --primary-rgb: 6, 182, 212;
  --primary-bright-rgb: 34, 211, 238;
  --primary: #06b6d4;
  --primary-bright: #22d3ee;
  --primary-hover: #0891b2;
  --primary-soft: rgba(var(--primary-rgb), 0.15);
  --primary-glow: rgba(var(--primary-rgb), 0.26);
  --accent: #10b981;
  --accent-soft: rgba(16, 185, 129, 0.15);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.18);
  --warn: #f59e0b;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45);
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.75);
  --radius: 10px;
  --radius-lg: 16px;
}

/* ============ Color themes (full recolor) ============
   Each theme retints the dark base + accent. --accent stays green as the
   universal "done/success" signal. Blue (original) is the default :root. */
:root[data-theme="red"] {
  --bg: #0c0405; --bg-2: #150607; --surface: #1c0a0b; --surface-2: #2c1214; --surface-3: #3f1c1e; --surface-elevate: #552628;
  --border: #7a3535; --border-strong: #9e4444;
  --primary-rgb: 239, 68, 68; --primary-bright-rgb: 248, 113, 113;
  --primary: #ef4444; --primary-bright: #f87171; --primary-hover: #dc2626;
}
:root[data-theme="orange"] {
  --bg: #0c0603; --bg-2: #150a04; --surface: #1c0f07; --surface-2: #2c1a0e; --surface-3: #3f2816; --surface-elevate: #55361e;
  --border: #7a4a26; --border-strong: #965d31;
  --primary-rgb: 249, 115, 22; --primary-bright-rgb: 251, 146, 60;
  --primary: #f97316; --primary-bright: #fb923c; --primary-hover: #ea580c;
}
:root[data-theme="green"] {
  --bg: #030c06; --bg-2: #06140d; --surface: #0a1b11; --surface-2: #112a1b; --surface-3: #1a3d27; --surface-elevate: #235231;
  --border: #2f7043; --border-strong: #3d9057;
  --primary-rgb: 37, 211, 102; --primary-bright-rgb: 94, 234, 141;
  --primary: #25d366; --primary-bright: #5eea8d; --primary-hover: #1eb555;
}
:root[data-theme="teal"] {
  --bg: #030c0b; --bg-2: #061412; --surface: #0a1b18; --surface-2: #112a26; --surface-3: #1a3d37; --surface-elevate: #235249;
  --border: #2f6e63; --border-strong: #3d8a7c;
  --primary-rgb: 20, 184, 166; --primary-bright-rgb: 45, 212, 191;
  --primary: #14b8a6; --primary-bright: #2dd4bf; --primary-hover: #0d9488;
}
:root[data-theme="purple"] {
  --bg: #08040d; --bg-2: #0d0616; --surface: #140a20; --surface-2: #1f1132; --surface-3: #2e1a49; --surface-elevate: #3e2357;
  --border: #502f73; --border-strong: #643d8f;
  --primary-rgb: 168, 85, 247; --primary-bright-rgb: 192, 132, 252;
  --primary: #a855f7; --primary-bright: #c084fc; --primary-hover: #9333ea;
}
:root[data-theme="yellow"] {
  --bg: #0c0a03; --bg-2: #141005; --surface: #1b160a; --surface-2: #2a2211; --surface-3: #3d331a; --surface-elevate: #524623;
  --border: #6e5d2f; --border-strong: #8a763d;
  --primary-rgb: 245, 158, 11; --primary-bright-rgb: 251, 191, 36;
  --primary: #f59e0b; --primary-bright: #fbbf24; --primary-hover: #d97706;
}
:root[data-theme="black"] {
  --bg: #050506; --bg-2: #0a0a0c; --surface: #101013; --surface-2: #1a1a20; --surface-3: #26262e; --surface-elevate: #33333d;
  --border: #454550; --border-strong: #5a5a67;
  --primary-rgb: 148, 163, 184; --primary-bright-rgb: 203, 213, 225;
  --primary: #94a3b8; --primary-bright: #cbd5e1; --primary-hover: #64748b;
}
:root[data-theme="pink"] {
  --bg: #0c040a; --bg-2: #150611; --surface: #1c0a16; --surface-2: #2c1123; --surface-3: #3f1a32; --surface-elevate: #552343;
  --border: #732f5d; --border-strong: #8f3e74;
  --primary-rgb: 236, 72, 153; --primary-bright-rgb: 244, 114, 182;
  --primary: #ec4899; --primary-bright: #f472b6; --primary-hover: #db2777;
}
/* White — the one light theme. Inverts the base to a light surface with dark
   ink and slate accents (the light-mode counterpart to the "black" theme).
   Shadows are softened since heavy dark shadows look wrong on light. */
:root[data-theme="white"] {
  --bg: #e7ebf2; --bg-2: #dfe4ee; --surface: #ffffff; --surface-2: #eef2f8; --surface-3: #e1e7f0; --surface-elevate: #d5dde9;
  /* Darker outlines than a typical light theme so cards, inputs and chips
     stay clearly separated on white (they were washing out on mobile). */
  --border: #b4c0d2; --border-strong: #8a99b0;
  --text: #0f172a; --text-soft: #41526a; --muted: #566579;
  --primary-rgb: 30, 41, 59; --primary-bright-rgb: 51, 65, 85;
  --primary: #1e293b; --primary-bright: #334155; --primary-hover: #0f172a;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.12);
  --shadow: 0 6px 20px rgba(15, 23, 42, 0.15);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.22);
}
/* The brand wordmark uses a light gradient that vanishes on a light surface. */
:root[data-theme="white"] .brand h1 {
  background: linear-gradient(180deg, #1e293b 0%, #334155 100%);
  -webkit-background-clip: text; background-clip: text;
}
/* White theme readability fixes:
   (1) the app header + coach nav have HARDCODED dark glass backgrounds that
       don't follow the theme, so on white their (now-dark) text is invisible;
   (2) primary-colored buttons/pills use dark ink (#062131) that assumes a
       BRIGHT primary — but white's primary is near-black, so it's dark-on-dark.
   Repaint the bars light and flip on-primary text to white. */
:root[data-theme="white"] .app-header { background: rgba(255, 255, 255, 0.9); }
:root[data-theme="white"] .coach-nav { background: rgba(255, 255, 255, 0.85); }
:root[data-theme="white"] .btn-primary,
:root[data-theme="white"] #screen-client .tab.active,
:root[data-theme="white"] #screen-client .tab.active .tab-label,
:root[data-theme="white"] .coach-nav-item.active,
:root[data-theme="white"] .ov-hero-cta,
:root[data-theme="white"] .tab-badge { color: #fff; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 20% 0%, rgba(var(--primary-rgb), 0.035) 0%, transparent 38%),
    radial-gradient(circle at 80% 100%, rgba(var(--primary-bright-rgb), 0.02) 0%, transparent 38%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1, h2, h3, h4 { margin: 0 0 0.5em; color: var(--text); }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.4rem; letter-spacing: 0.02em; }
h3 { font-size: 1.1rem; letter-spacing: 0.02em; }

p { margin: 0 0 0.75em; line-height: 1.5; }

.muted { color: var(--muted); font-size: 0.9rem; }
.error { color: var(--danger); font-size: 0.9rem; margin-top: 0.5em; }

/* Password requirement checklist (signup / reset) */
.pw-req-list {
  list-style: none;
  margin: 0.1em 0 0.7em;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.15em 0.9em;
}
.pw-req {
  display: flex;
  align-items: center;
  gap: 0.4em;
  font-size: 0.76rem;
  color: var(--muted);
  transition: color 0.15s ease;
}
.pw-req-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1em;
  font-weight: 700;
}
.pw-req.ok  { color: var(--success, #4ade80); }
.pw-req.bad { color: var(--muted); }
@media (max-width: 420px) {
  .pw-req-list { grid-template-columns: 1fr; }
}

.hidden { display: none !important; }

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  padding: 0.6em 1em;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.05s, box-shadow 0.15s;
  background: var(--surface-3);
  color: var(--text);
  font-family: inherit;
}
.btn:hover { background: var(--surface-elevate); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(180deg, var(--primary-bright), var(--primary));
  color: #062131;
  border-color: var(--primary-hover);
}
.btn-primary:hover {
  background: linear-gradient(180deg, var(--primary), var(--primary-hover));
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }

.btn-danger {
  background: var(--danger-soft);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.3); }

.btn-block { width: 100%; }
.btn-sm { padding: 0.35em 0.7em; font-size: 0.85rem; }

.btn-link {
  background: none;
  border: none;
  color: var(--primary-bright);
  cursor: pointer;
  padding: 0.4em 0;
  font-size: 0.9rem;
  font-family: inherit;
  text-align: left;
}
.btn-link:hover { text-decoration: underline; }

.icon-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  color: var(--text-soft);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ============ Form fields ============ */
label {
  display: block;
  margin-bottom: 0.9em;
  font-size: 0.85rem;
  color: var(--text-soft);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="date"],
textarea,
select {
  width: 100%;
  margin-top: 0.3em;
  padding: 0.65em 0.9em;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface-2);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
}
input::placeholder, textarea::placeholder { color: var(--muted); font-weight: 400; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
  background: var(--surface-3);
}
textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
input[type="date"] { color-scheme: dark; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1em;
}
@media (max-width: 600px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* ============ Login ============ */
#screen-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 18%, rgba(var(--primary-rgb), 0.05) 0%, transparent 58%),
    var(--bg);
  padding-top: max(1.5rem, env(safe-area-inset-top));
  padding-right: max(1.5rem, env(safe-area-inset-right));
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  padding-left: max(1.5rem, env(safe-area-inset-left));
  position: relative;
  overflow: hidden;
}
/* Cyan halo behind the login card */
#screen-login::after {
  content: "";
  position: absolute;
  width: 560px;
  height: 560px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(var(--primary-bright-rgb), 0.06) 0%, rgba(var(--primary-rgb), 0.025) 35%, transparent 62%);
  pointer-events: none;
  z-index: 0;
  animation: heroPulse 6s ease-in-out infinite;
}
.login-card { z-index: 1; }
@keyframes heroPulse {
  0%, 100% { opacity: 0.7; transform: translate(-50%, -50%) scale(1); }
  50%      { opacity: 1;   transform: translate(-50%, -50%) scale(1.08); }
}
.login-card {
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.4rem 2.25rem;
  max-width: 480px;
  width: 100%;
  box-shadow:
    var(--shadow-lg),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 1px 0 rgba(255, 255, 255, 0.06) inset;
}
.brand { text-align: center; margin-bottom: 1.8rem; }
.brand h1 {
  margin: 0.5em 0 0;
  font-size: 2rem;
  letter-spacing: 0.18em;
  font-weight: 900;
  background: linear-gradient(180deg, #ffffff 0%, #c9eaf2 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 4px 18px rgba(var(--primary-bright-rgb), 0.25);
}
.brand .tagline {
  color: var(--primary-bright);
  margin: 0.3em 0 0;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  text-shadow: 0 0 14px rgba(var(--primary-bright-rgb), 0.45);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 240px;
  height: 240px;
  border-radius: 26px;
  background: transparent;
  filter: drop-shadow(0 14px 40px rgba(var(--primary-bright-rgb), 0.55));
}
.brand-mark img { width: 100%; height: 100%; display: block; object-fit: contain; }
.brand-mark.sm { width: 40px; height: 40px; border-radius: 10px; filter: none; }

@media (max-width: 720px) {
  .brand-mark { width: 210px; height: 210px; }
}
@media (max-width: 480px) {
  .brand-mark { width: 180px; height: 180px; }
}

/* ============ App shell ============ */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(10, 16, 25, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-left { display: flex; align-items: center; gap: 0.8em; }
.header-title {
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.header-sub { font-size: 0.8rem; color: var(--text-soft); }
/* Athlete name in the top-left doubles as the Profile link (the Profile tab
   was removed). The ⚙ caret signals it's tappable. */
.header-name-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.header-name-caret { font-size: 0.72em; color: var(--muted); transition: color 0.15s; }
.header-name-btn:hover .header-sub,
.header-name-btn.active .header-sub { color: var(--primary-bright); }
.header-name-btn:hover .header-name-caret,
.header-name-btn.active .header-name-caret { color: var(--primary-bright); }
.header-right { display: flex; gap: 0.4em; align-items: center; }

/* Breadcrumb (shown when inside an athlete) */
.header-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5em;
  font-size: 0.9rem;
}
.header-back-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.3em 0.5em;
  border-radius: 6px;
  font-family: inherit;
  transition: background 0.12s;
}
.header-back-btn:hover { background: var(--primary-soft); }
.breadcrumb-sep { color: var(--muted); font-size: 0.85rem; }
.breadcrumb-athlete { color: var(--text); font-weight: 700; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }

.app-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.view-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.5em;
}

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
}

/* ============ Dashboard stats strip ============ */
.dash-stats-strip {
  display: flex;
  gap: 2rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}
.dash-stat-item .num {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary-bright);
  line-height: 1;
  letter-spacing: -0.02em;
}
.dash-stat-item .lbl {
  font-size: 0.72rem;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-top: 0.2em;
}

/* ============ Client grid ============ */
.client-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}
/* Compact horizontal athlete rows: avatar · name+position · progress. */
.client-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.client-row:hover { border-color: var(--primary); background: var(--surface-2); }
.client-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  color: #06101a;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}
.client-row-main { min-width: 0; flex: 1; }
.client-row-name { font-size: 0.92rem; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-row-sub { font-size: 0.76rem; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 0.1em; }
.client-row-prog { width: 108px; flex-shrink: 0; }
.client-row-prog-top { display: flex; align-items: baseline; justify-content: flex-end; gap: 0.4em; margin-bottom: 0.28em; }
.client-row-prog-top .pct { font-size: 0.9rem; font-weight: 800; color: var(--primary-bright); }
.client-row-prog-top .days { font-size: 0.66rem; color: var(--muted); }
.client-row-prog .progress-track { height: 5px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.client-row-prog .progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary-bright), var(--accent)); border-radius: 999px; transition: width 0.4s ease; }
.client-row-prog.complete .pct { color: var(--accent); }
.client-row-prog.complete .progress-fill { background: var(--accent); }
.client-row-prog.no-data { display: flex; align-items: center; justify-content: flex-end; }
.client-row-prog-status { font-size: 0.72rem; color: var(--muted); font-style: italic; }

/* ============ Coach profile page ============ */
.coach-profile-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.6rem;
}
.coach-profile-id { display: flex; align-items: center; gap: 0.9rem; flex: 1; min-width: 0; }
.coach-profile-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem; font-weight: 800; color: #06101a; flex-shrink: 0; letter-spacing: -0.02em;
}
.coach-profile-idtext { min-width: 0; }
.coach-profile-name { font-size: 1.15rem; font-weight: 800; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coach-profile-email { font-size: 0.85rem; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 0.1em; }
.coach-profile-stat {
  display: flex; flex-direction: column; align-items: center;
  padding-left: 1.1rem; border-left: 1px solid var(--border); flex-shrink: 0;
}
.coach-profile-stat-num { font-size: 1.7rem; font-weight: 800; color: var(--primary-bright); line-height: 1; }
.coach-profile-stat-lbl { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-top: 0.3em; }
.coach-profile-section { margin: 0 0 0.4rem; font-size: 1.05rem; color: var(--text); }

/* ============ Effort / intensity (heat ramp) ============ */
/* Warm left-anchored gradient layered over the card's own surface — strongest
   at the left edge, faded out by ~55% so text stays readable. */
.cex-wrapper.has-effort {
  background: linear-gradient(90deg, rgba(var(--effort-rgb), 0.30), rgba(var(--effort-rgb), 0) 55%), var(--surface);
}
.ex-row-wrapper.has-effort {
  background: linear-gradient(90deg, rgba(var(--effort-rgb), 0.22), rgba(var(--effort-rgb), 0) 55%), var(--surface-2);
}
/* Athlete-card flame + label tag (never color-only) */
.effort-tag {
  display: inline-flex; align-items: center; gap: 0.25em;
  font-size: 0.6rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em;
  color: rgb(var(--effort-rgb));
  background: rgba(var(--effort-rgb), 0.15);
  border: 1px solid rgba(var(--effort-rgb), 0.5);
  padding: 0.12em 0.45em; border-radius: 999px; white-space: nowrap; line-height: 1.4;
}
.effort-tag-flames { font-size: 0.9em; }
/* Coach row button */
.ex-effort-btn { min-width: 0; font-size: 0.78rem; }
.ex-effort-btn:not(.empty) {
  color: rgb(var(--effort-rgb));
  border-color: rgba(var(--effort-rgb), 0.6);
  background: rgba(var(--effort-rgb), 0.14);
}
.ex-effort-btn.empty { color: var(--muted); border-style: dashed; }
/* Picker popover */
.effort-pop { display: flex; flex-direction: column; gap: 0.3rem; padding: 0.4rem; min-width: 156px; }
.effort-opt {
  display: flex; align-items: center; gap: 0.5em;
  padding: 0.42em 0.6em; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-soft); font-size: 0.85rem; cursor: pointer; text-align: left;
}
.effort-opt:hover { border-color: var(--border-strong); }
.effort-opt.on {
  color: rgb(var(--effort-rgb, 148,163,184));
  border-color: rgba(var(--effort-rgb, 148,163,184), 0.7);
  background: rgba(var(--effort-rgb, 148,163,184), 0.14);
  font-weight: 700;
}
.effort-opt-flames { min-width: 3.3em; }
.effort-opt-lbl { flex: 1; }

/* ============ Client detail head ============ */
.client-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1em;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.client-head h2 { margin: 0 0 0.2em; font-weight: 800; }
.client-head-actions { display: flex; gap: 0.5em; flex-wrap: wrap; }

/* ============ Tabs ============ */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* hide the scrollbar; tabs still scroll on overflow */
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  background: none;
  border: none;
  padding: 0.9em 1.2em;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: inherit;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary-bright); border-bottom-color: var(--primary); }

/* Athlete tabs styled exactly like the coach nav: rounded pill cells that
   fill the width evenly (no scroll), icon over label, with a filled active
   pill instead of an underline. */
/* Nav sits FLUSH under the header (no gap) so it pins immediately with no
   pre-scroll jump — that gap is what made it "move at the beginning". Header
   + nav stay pinned while scrolling, like the coach side. */
#screen-client .app-main { padding-top: 0; }
#screen-client .tabs {
  gap: 0.25em;
  overflow-x: hidden;
  border-bottom: 1px solid var(--border); /* separator line, like the coach nav */
  margin-bottom: 1.1rem;
  padding: 0.45rem 1.5rem 0.55rem;
  /* Pinned right under the sticky header. `top` = header height so the nav's
     resting position already equals its stuck position → zero jump. Full-bleed
     side margins + solid bg so content scrolls cleanly underneath. */
  position: sticky;
  top: 63px; /* desktop header height; ≤600px override below */
  z-index: 9;
  background: var(--bg);
  margin-left: -1.5rem;
  margin-right: -1.5rem;
}
@media (max-width: 600px) {
  #screen-client .tabs { top: 59px; } /* mobile header is shorter */
}
@media (max-width: 640px) {
  #screen-client .tabs {
    margin-left: calc(-1 * max(0.85rem, env(safe-area-inset-left)));
    margin-right: calc(-1 * max(0.85rem, env(safe-area-inset-right)));
    padding-left: max(0.85rem, env(safe-area-inset-left));
    padding-right: max(0.85rem, env(safe-area-inset-right));
  }
}
#screen-client .tab {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0.4em 0.15em;
  border: 1px solid transparent;
  border-radius: 12px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
}
#screen-client .tab::after { display: none; } /* remove the underline indicator */
#screen-client .tab:hover { background: var(--surface-2); color: var(--text); }
#screen-client .tab-icon { font-size: 1.25em; line-height: 1; }
#screen-client .tab-label { font-size: 0.6rem; white-space: normal; text-align: center; line-height: 1.1; overflow-wrap: break-word; }
#screen-client .tab.active {
  background: linear-gradient(180deg, var(--primary-bright), var(--primary));
  color: #062131;
  border-color: var(--primary-hover);
  box-shadow: 0 6px 16px rgba(var(--primary-rgb), 0.3);
}
#screen-client .tab.active .tab-label { color: #062131; }
#screen-client .tab-badge { position: absolute; top: 0; right: 2px; margin: 0; }

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

/* ============ Card ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.row-end { display: flex; justify-content: flex-end; align-items: center; }
.saved-flag {
  color: var(--accent);
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 0.3s;
  font-weight: 600;
}
.saved-flag.show { opacity: 1; }

/* ============ Profile card ============ */
.profile-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9em;
}
.profile-card-head h3 { margin: 0; }
.profile-card-actions { display: flex; align-items: center; gap: 0.7em; }
.profile-card input[readonly],
.profile-card textarea[readonly] {
  background: var(--surface);
  color: var(--text-soft);
  cursor: default;
}
.profile-card input[readonly]:focus,
.profile-card textarea[readonly]:focus {
  box-shadow: none;
  border-color: var(--border);
}
.profile-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.7fr 1fr 1fr;
  gap: 0 1em;
}
.profile-grid > label { min-width: 0; } /* grid items don't shrink below content's intrinsic width by default — without this, the Name/Height inputs overflow their column and spill past the card edge on mobile's narrower 2-column layout */
@media (max-width: 700px) {
  .profile-grid { grid-template-columns: 1fr 1fr; }
}
.height-input-group {
  display: flex;
  align-items: center;
  gap: 0.4em;
}
.height-input-group input { width: auto; flex: 1; min-width: 0; }
.height-unit {
  color: var(--text-soft);
  font-size: 0.85rem;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
  flex-shrink: 0;
}
.profile-notes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1em;
}
.profile-notes-grid > label { min-width: 0; }
.profile-notes-grid textarea { min-height: 56px; }
@media (max-width: 700px) {
  .profile-notes-grid { grid-template-columns: 1fr; }
}

/* ============ Empty states ============ */
.empty-state {
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-soft);
}
.empty-emoji { font-size: 2.5rem; margin-bottom: 0.5rem; }
.empty-state h3 { color: var(--text); margin-bottom: 0.3em; }
.empty-state p { margin-bottom: 1em; }

/* ============ Program / Weeks ============ */
.program-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5em;
}
.program-actions { display: flex; gap: 0.5em; flex-wrap: wrap; }

.weeks-container { display: flex; flex-direction: column; gap: 0; }

.week-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.week-card.phase-card { border-left: 4px solid var(--primary); }
.week-head {
  background: var(--surface-2);
  padding: 0.9rem 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  user-select: none;
}
.week-card.open .week-head { border-bottom-color: var(--border); }
.week-head h4 { margin: 0; font-weight: 700; }
.week-head .week-info { color: var(--text-soft); font-size: 0.85rem; margin-top: 0.2em; }
.phase-badge {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary-bright);
  padding: 0.15em 0.6em;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-right: 0.5em;
}
.week-head-right { display: flex; align-items: center; gap: 0.5em; }
.week-toggle { color: var(--text-soft); transition: transform 0.2s; font-size: 0.9rem; }
.week-card.open .week-toggle { transform: rotate(180deg); }

.week-body { padding: 1.2rem; display: none; }
.week-card.open .week-body { display: block; }

.week-focus-label {
  font-weight: 600;
  display: block;
  font-size: 0.85rem;
  color: var(--text-soft);
  margin-bottom: 0.3em;
}
.week-focus-input { margin-bottom: 1rem; }

.days-container { display: flex; flex-direction: column; gap: 0.8rem; }

.day-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.day-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
  gap: 0.5em;
  flex-wrap: wrap;
}
.day-head-left { display: flex; align-items: center; gap: 0.5em; flex: 1; min-width: 200px; }
.day-name-input {
  font-weight: 700;
  border: 1px solid transparent !important;
  background: transparent !important;
  margin: 0 !important;
  padding: 0.3em 0.5em !important;
  font-size: 1rem !important;
  text-transform: none !important;
  letter-spacing: normal !important;
}
.day-name-input:hover { border-color: var(--border) !important; background: var(--surface-3) !important; }
.day-name-input:focus { border-color: var(--primary) !important; background: var(--surface-3) !important; }
.day-head-right { display: flex; gap: 0.4em; }

.exercises-list { display: flex; flex-direction: column; gap: 0.7rem; }

.exercise-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.exercise-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.7rem;
  gap: 0.5em;
}
.exercise-name-input {
  flex: 1;
  font-weight: 700 !important;
  font-size: 1rem !important;
  margin: 0 !important;
  border: 1px solid transparent !important;
  background: transparent !important;
  padding: 0.3em 0.5em !important;
  text-transform: none !important;
  letter-spacing: normal !important;
}
.exercise-name-input:hover { border-color: var(--border) !important; }
.exercise-name-input:focus { border-color: var(--primary) !important; }

.exercise-stats-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1.4fr;
  gap: 0.6em;
  margin-bottom: 0.8rem;
}
.exercise-stats-row .stat-block {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5em 0.7em;
}
.exercise-stats-row .stat-block legend {
  display: block;
  font-size: 0.7rem;
  color: var(--text-soft);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.3em;
}
.exercise-stats-row .stat-inputs {
  display: flex;
  align-items: center;
  gap: 0.3em;
}
.exercise-stats-row .stat-inputs input {
  margin: 0 !important;
  padding: 0.35em 0.5em !important;
  font-size: 0.9rem !important;
}
.exercise-stats-row .stat-inputs .x,
.exercise-stats-row .stat-inputs .unit { color: var(--text-soft); font-weight: 600; font-size: 0.85rem; }

@media (max-width: 600px) {
  .exercise-stats-row { grid-template-columns: 1fr; }
}

.exercise-notes label { margin: 0; }
.exercise-notes textarea {
  min-height: 70px;
  font-size: 0.9rem;
}

/* ===== Exercise Library Drawer ===== */
.ex-library-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  justify-content: flex-end;
}
.ex-library-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
}
.ex-library-drawer {
  position: relative;
  width: min(340px, 92vw);
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.ex-library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ex-library-header h3 { margin: 0; font-size: 1rem; }
.ex-library-search {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ex-library-search input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.45rem 0.75rem;
  font-size: 0.9rem;
}
.ex-library-search input:focus { outline: none; border-color: var(--primary); }
.ex-library-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.4rem 0;
}
.ex-cat-header {
  padding: 0.6rem 1rem 0.2rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
  margin-top: 0.2rem;
}
.ex-lib-item {
  padding: 0.5rem 0.75rem 0.5rem 1rem;
  cursor: grab;
  font-size: 0.875rem;
  color: var(--text);
  border-radius: 6px;
  margin: 0 0.4rem;
  transition: background 0.12s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  user-select: none;
}
.ex-lib-item:hover { background: var(--surface-2); }
.ex-lib-item:active { cursor: grabbing; background: var(--surface-3); }
.ex-lib-item::before { content: "⠿"; color: var(--muted); font-size: 0.75rem; flex-shrink: 0; }
.ex-lib-empty { padding: 1.5rem 1rem; color: var(--muted); font-size: 0.9rem; text-align: center; }
.ex-library-hint {
  padding: 0.6rem 1rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Exercise list drop zone */
.exercises-list.drag-over {
  outline: 2px dashed var(--primary);
  outline-offset: 3px;
  border-radius: var(--radius);
  background: var(--primary-soft);
}

/* Exercise drag handle + reorder indicators */
.ex-drag-handle {
  cursor: grab;
  color: var(--muted);
  padding: 0.2rem 0.4rem 0.2rem 0;
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
  touch-action: none;
}
.ex-drag-handle:active { cursor: grabbing; }
.ex-move-btn { display: none; } /* shown in place of the drag handle on mobile — see mobile ex-row rules */
.exercise-card.dragging { opacity: 0.35; }
.exercise-card.drag-above { border-top: 2px solid var(--primary) !important; }
.exercise-card.drag-below { border-bottom: 2px solid var(--primary) !important; }

/* Picker buttons (replace number inputs in exercise cards) */
.picker-btn {
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.35em 0.6em;
  cursor: pointer;
  min-width: 2.8rem;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
  white-space: nowrap;
}
.picker-btn:hover { border-color: var(--primary); background: var(--surface-3); }
.picker-btn:active { background: var(--primary-soft); }
.picker-btn.empty { color: var(--muted); }

/* Finisher (burnout / dropset) — coach row button */
.ex-finisher-btn { min-width: 0; font-size: 0.78rem; }
.ex-finisher-btn:not(.empty) {
  color: #fb923c;
  border-color: rgba(251,146,60,0.55);
  background: rgba(251,146,60,0.12);
}
.ex-finisher-btn.empty { color: var(--muted); border-style: dashed; }

/* Finisher picker popup */
.finisher-pop { min-width: 220px; max-width: 260px; padding: 0.5rem; }
.finisher-sec { margin-bottom: 0.5rem; }
.finisher-sec:last-child { margin-bottom: 0; }
.finisher-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5em;
  width: 100%; text-align: left;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.5em 0.7em; cursor: pointer;
  color: var(--text); font-family: inherit; font-size: 0.86rem; font-weight: 700;
}
.finisher-toggle.on { border-color: rgba(251,146,60,0.6); }
.finisher-toggle-lbl { display: flex; flex-direction: column; gap: 0.1em; }
.finisher-toggle-lbl small { font-weight: 500; font-size: 0.68rem; color: var(--muted); }
.finisher-switch {
  font-size: 0.62rem; font-weight: 800; letter-spacing: 0.06em;
  padding: 0.15em 0.5em; border-radius: 999px;
  background: var(--surface-3); color: var(--muted);
}
.finisher-toggle.on .finisher-switch { background: rgba(251,146,60,0.2); color: #fb923c; }
.finisher-body { padding: 0.5em 0.2em 0.2em; }
.finisher-slot-lbl { font-size: 0.68rem; font-weight: 700; color: var(--text-soft); margin: 0.35em 0 0.2em; }
.finisher-pct-row { display: flex; gap: 0.35em; }
.finisher-pct-btn {
  flex: 1; padding: 0.4em 0; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text-soft);
  font-family: inherit; font-size: 0.8rem; font-weight: 700;
}
.finisher-pct-btn.on { background: rgba(251,146,60,0.16); border-color: #fb923c; color: #fb923c; }

/* Finisher — athlete log rows */
.cex-finisher-wrap { display: flex; flex-direction: column; gap: 0.4em; margin-top: 0.5em; }
.cex-finisher-row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6em;
  background: rgba(251,146,60,0.08);
  border: 1px solid rgba(251,146,60,0.3);
  border-radius: 8px; padding: 0.4em 0.6em;
}
.cex-finisher-lbl { font-size: 0.8rem; font-weight: 700; color: var(--text); }
.cex-finisher-pct { font-weight: 500; color: #fb923c; }
.cex-finisher-input { width: 64px; flex-shrink: 0; text-align: center; }

/* ===== Warm-up sets ===== */
/* Coach row button (cyan accent, distinct from the orange finisher). */
.ex-warmup-btn { min-width: 0; font-size: 0.78rem; }
.ex-warmup-btn:not(.empty) {
  color: #38bdf8;
  border-color: rgba(56,189,248,0.55);
  background: rgba(56,189,248,0.12);
}
.ex-warmup-btn.empty { color: var(--muted); border-style: dashed; }

/* Warm-up picker popup — its own box (not a .grid-picker-pop, so the nested
   weight/reps pickers don't wipe it). */
.warmup-pop {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 32px rgba(0,0,0,0.45);
  padding: 0.6rem;
  min-width: 232px;
  max-width: 280px;
}
.warmup-head {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-soft); font-weight: 700; margin-bottom: 0.45rem; padding: 0 0.1rem;
}
.warmup-seg { display: flex; gap: 0.35em; margin-bottom: 0.5rem; }
.warmup-seg-btn {
  flex: 1; padding: 0.45em 0; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text-soft);
  font-family: inherit; font-size: 0.8rem; font-weight: 700;
}
.warmup-seg-btn.on { background: rgba(56,189,248,0.16); border-color: #38bdf8; color: #38bdf8; }
.warmup-slot { display: flex; align-items: center; gap: 0.4em; padding: 0.3em 0; }
.warmup-slot-lbl { font-size: 0.72rem; font-weight: 800; color: #38bdf8; min-width: 1.9em; }
.warmup-x { color: var(--muted); font-weight: 700; }
.warmup-slot .picker-btn { flex: 1; }

/* Athlete card — warm-up columns rendered before the working sets. */
.cex-warm-col .cex-set-lbl { color: #38bdf8; }
.cex-warm-col .cex-input {
  border-color: rgba(56,189,248,0.4);
  background: rgba(56,189,248,0.06);
}
/* Gap divider after the last warm-up — margin (not padding) so it doesn't
   shrink the column under box-sizing: border-box. */
.cex-warm-last { margin-right: 0.6rem; }

/* ===== Theme picker (coach Appearance / athlete Profile) ===== */
.theme-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.6rem;
  max-width: 470px;
}
.theme-swatch {
  display: flex; align-items: center; gap: 0.55em;
  padding: 0.6em 0.7em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit; font-size: 0.85rem; font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.theme-swatch:hover { border-color: var(--border-strong); }
.theme-swatch-dot {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  background: var(--sw);
  /* Neutral gray ring keeps pure-black and pure-white dots visible on both
     light and dark picker surfaces; soft glow tints in the swatch color. */
  box-shadow: 0 0 0 1px rgba(128, 128, 128, 0.5), 0 0 8px var(--sw);
}
.theme-swatch.on {
  /* Selected-state accents use the active theme's --primary (not the swatch's
     own --sw) so the ring and label stay visible even for the White theme,
     whose --sw is white and would vanish on a light surface. */
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary), var(--shadow);
}
.theme-swatch.on .theme-swatch-name { color: var(--primary); }

/* Athlete profile — invite code chip */
.profile-invite { display: flex; align-items: center; gap: 0.6em; margin-top: 0.3em; }
.profile-invite-label { font-size: 0.8rem; color: var(--text-soft); font-weight: 600; }
.profile-invite-code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 1rem; font-weight: 800; letter-spacing: 0.12em;
  color: var(--primary-bright);
  background: var(--primary-soft);
  border: 1px solid rgba(var(--primary-rgb), 0.35);
  border-radius: 8px; padding: 0.25em 0.7em;
}

/* ===== Drum Picker ===== */
.drum-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.drum-sheet {
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 480px;
  border-top: 1px solid var(--border-strong);
  padding-bottom: env(safe-area-inset-bottom, 0.5rem);
}
.drum-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.drum-sheet-header h4 { margin: 0; font-size: 1rem; color: var(--text); }
.drum-wrap {
  position: relative;
  height: 240px;
  overflow: hidden;
  margin: 0.25rem 0;
}
.drum-selector {
  position: absolute;
  top: 50%;
  left: 1rem; right: 1rem;
  transform: translateY(-50%);
  height: 48px;
  border-radius: 8px;
  background: var(--primary-soft);
  border: 1px solid var(--primary-glow);
  z-index: 1;
  pointer-events: none;
}
.drum-wrap::before, .drum-wrap::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 90px;
  z-index: 2;
  pointer-events: none;
}
.drum-wrap::before { top: 0; background: linear-gradient(to bottom, var(--surface) 20%, transparent); }
.drum-wrap::after  { bottom: 0; background: linear-gradient(to top, var(--surface) 20%, transparent); }
.drum-scroll {
  height: 240px;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.drum-scroll::-webkit-scrollbar { display: none; }
.drum-spacer { height: 96px; flex-shrink: 0; }
.drum-item {
  height: 48px;
  scroll-snap-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--text-soft);
  cursor: pointer;
}
.drum-actions {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem 1rem;
}

/* Add buttons */
.add-inline-btn {
  background: transparent;
  border: 1px dashed var(--border-strong);
  color: var(--primary-bright);
  border-radius: var(--radius);
  padding: 0.6em 1em;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}
.add-inline-btn:hover { background: var(--primary-soft); border-color: var(--primary); }

.btn-delete-mini {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 0.3em 0.6em;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
}
.btn-delete-mini:hover { background: var(--danger-soft); color: #fca5a5; border-color: rgba(239, 68, 68, 0.4); }

/* ============ Diet ============ */
.diet-week-body { padding: 1.2rem; display: none; }
.week-card.open .diet-week-body { display: block; }
.diet-days {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
}
.diet-day-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem;
}
.diet-day-card h5 { margin: 0 0 0.6em; font-size: 0.95rem; color: var(--primary-bright); font-weight: 700; }
.diet-day-card .diet-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4em 0.6em;
}
.diet-day-card .diet-inputs label { margin: 0; font-size: 0.7rem; }
.diet-day-card .diet-inputs input { margin-top: 0.2em; padding: 0.4em 0.6em; font-size: 0.9rem; }

.diet-notes label { margin: 0; }

.diet-week-totals {
  display: flex;
  gap: 1.5em;
  flex-wrap: wrap;
  padding: 0.8em 1em;
  background: var(--primary-soft);
  border-radius: var(--radius);
  margin-top: 0.5em;
  font-size: 0.9rem;
}
.diet-week-totals .total-label { color: var(--text-soft); }
.diet-week-totals strong { color: var(--primary-bright); margin-left: 0.3em; font-weight: 800; }

/* ============ Modal ============ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}
.modal-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-head {
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-head h3 { margin: 0; }
.modal-body { padding: 1.5rem; }
.modal-foot {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.5em;
  background: var(--surface-2);
  flex-wrap: wrap;
}

/* ============ Toast ============ */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #062131;
  padding: 0.7em 1.2em;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  font-size: 0.9rem;
  font-weight: 700;
  animation: toastIn 0.2s ease-out;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ============ Role picker ============ */
.role-btn {
  display: flex;
  align-items: center;
  gap: 1em;
  width: 100%;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1em 1.2em;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  margin-bottom: 0.8em;
  transition: border-color 0.15s, transform 0.05s, box-shadow 0.15s, background 0.15s;
  color: var(--text);
}
.role-btn:hover {
  border-color: var(--primary);
  background: var(--surface-3);
  box-shadow: 0 0 0 3px var(--primary-soft);
  transform: translateY(-1px);
}
.role-btn .role-emoji { font-size: 2rem; }
.role-btn strong { display: block; color: var(--text); font-size: 1rem; margin-bottom: 0.2em; font-weight: 700; }
.role-btn small { color: var(--text-soft); font-size: 0.85rem; }

/* Add-to-Home-Screen button (login screen) + instruction steps (iOS modal) */
.install-app-btn.btn-block {
  margin-top: 0.9rem;
  border: 1px solid rgba(var(--primary-rgb), 0.35);
  color: var(--primary);
}
.install-app-btn.btn-block:hover { background: var(--primary-soft); }
.install-steps {
  margin: 0.6em 0 0.4em;
  padding-left: 1.2em;
  display: flex;
  flex-direction: column;
  gap: 0.55em;
  line-height: 1.4;
}
.install-steps li { padding-left: 0.2em; }

/* ============ Athlete-first login layout ============ */
.login-welcome {
  margin-top: 0.5rem;
  margin-bottom: 0.4em;
  font-size: 1.6rem;
  letter-spacing: 0.02em;
  text-align: center;
}
.login-welcome-sub {
  text-align: center;
  margin-bottom: 1.8em;
  font-size: 0.95rem;
}
.btn-login-main {
  font-size: 1.05rem;
  padding: 1em 1.2em;
  letter-spacing: 0.05em;
  font-weight: 800;
  text-transform: uppercase;
}
.coach-access-footer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.login-footer-links {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7em;
}
.login-coach-link {
  font-size: 0.75rem;
  color: var(--text-soft);
  opacity: 0.55;
  text-align: center;
}
.login-coach-link:hover { opacity: 1; }

/* Persistent "Install the app" CTA at the bottom of the login card */
.install-hint {
  margin-top: 1.4rem;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.8em;
  text-align: left;
  padding: 0.85em 1em;
  background: var(--primary-soft);
  border: 1px solid rgba(var(--primary-bright-rgb), 0.35);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.install-hint:hover {
  border-color: var(--primary-bright);
  box-shadow: 0 6px 18px rgba(var(--primary-rgb), 0.2);
  transform: translateY(-1px);
}
.install-hint-icon { font-size: 1.5rem; flex-shrink: 0; line-height: 1; }
.install-hint-text { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.3; }
.install-hint-text strong { font-size: 0.92rem; }
.install-hint-sub { font-size: 0.76rem; color: var(--text-soft); }
.install-hint-arrow { color: var(--primary-bright); font-weight: 800; flex-shrink: 0; font-size: 1.05rem; }
.coach-access-link {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.4em 0.6em;
  font-size: 0.75rem;
  font-family: inherit;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.55;
  transition: opacity 0.15s, color 0.15s;
}
.coach-access-link:hover {
  opacity: 1;
  color: var(--primary-bright);
}
.coach-access-link:focus-visible {
  opacity: 1;
  color: var(--primary-bright);
  outline: 1px dashed var(--border-strong);
  outline-offset: 4px;
  border-radius: 4px;
}

.back-to-role {
  display: inline-block;
  margin-bottom: 1rem;
  padding-top: 0;
}

/* Auth form helpers */
.checkbox-row {
  display: flex;
  align-items: center;
  margin: 0.6em 0 0.8em;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5em;
  font-size: 0.9rem;
  color: var(--text-soft);
  cursor: pointer;
  font-weight: 400;
}
.checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}
.auth-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em 1em;
  margin-top: 0.9em;
  justify-content: space-between;
  align-items: center;
}
.auth-links .btn-link {
  font-size: 0.82rem;
  color: var(--muted);
}
.auth-links .btn-link:hover { color: var(--primary-bright); }
.migrate-notice {
  background: var(--primary-soft);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  padding: 0.65em 0.9em;
  font-size: 0.88rem;
  margin-bottom: 1em;
  line-height: 1.45;
}

#client-code, #import-code-input {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.8rem;
  word-break: break-all;
}

/* ============ Client portal — workout cards ============ */
.client-day-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.8rem;
  overflow: visible;
}
.client-day-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  gap: 0.5em;
  flex-wrap: wrap;
}
.client-day-head h4 { margin: 0; font-weight: 700; }
.day-complete-badge {
  background: var(--accent);
  color: #062a1f;
  padding: 0.25em 0.6em;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.cex-list {
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.client-instructions {
  background: var(--surface-2);
  padding: 0.7em 0.9em;
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--text-soft);
  white-space: pre-wrap;
  margin-bottom: 0.8em;
  line-height: 1.5;
}
.client-instructions:empty { display: none; }

.client-log-form {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8em;
}
.client-log-form-title {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary-bright);
  margin-bottom: 0.6em;
}
.client-log-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5em;
  margin-bottom: 0.5em;
}
.client-log-row label { margin: 0; font-size: 0.7rem; }
.client-log-row input { margin-top: 0.2em; padding: 0.4em 0.6em; font-size: 0.9rem; }
.client-log-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5em;
  margin-top: 0.5em;
}

.client-log-history {
  margin-top: 0.6em;
  font-size: 0.85rem;
  color: var(--text-soft);
}
.client-log-history summary {
  cursor: pointer;
  color: var(--primary-bright);
  font-weight: 600;
  padding: 0.3em 0;
}
.client-log-history-list {
  display: flex;
  flex-direction: column;
  gap: 0.3em;
  margin-top: 0.4em;
}
.client-log-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5em;
  background: var(--surface-2);
  padding: 0.4em 0.7em;
  border-radius: var(--radius);
  font-size: 0.85rem;
}
.client-log-history-item .date { color: var(--muted); }

/* Bodyweight form */
.bw-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.6em;
  align-items: end;
}
.bw-form label { margin: 0; }
.bw-form .btn { height: 38px; }
@media (max-width: 600px) {
  .bw-form { grid-template-columns: 1fr 1fr; }
  .bw-form .btn { grid-column: span 2; }
}

#bw-history { display: flex; flex-direction: column; gap: 0.4em; }
.bw-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.5em 0.8em;
  border-radius: var(--radius);
  font-size: 0.9rem;
}
.bw-entry .date { color: var(--text-soft); }
.bw-entry .delete-bw {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0 0.3em;
  font-family: inherit;
  font-size: 1.1rem;
}
.bw-entry .delete-bw:hover { color: var(--danger); }

.bw-import {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5em 0.9em;
  margin-top: 0.9em;
}
.bw-import .muted { font-size: 0.8rem; }

/* Body-weight list with expandable scale metrics (shared coach + athlete) */
.bw-list { display: flex; flex-direction: column; gap: 0.4em; }
.bw-entry-wrap { display: flex; flex-direction: column; }
.bw-toggle {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.78rem;
  padding: 0 0.25em;
}
.bw-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.35em 0.9em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 0.6em 0.8em;
  font-size: 0.82rem;
}
.bw-metric { display: flex; justify-content: space-between; gap: 0.5em; }
.bw-metric span { color: var(--text-soft); }

/* Link to the website FAQ from the buy-sessions card / modal */
.session-faq-link { margin: 0.9em 0 0; font-size: 0.82rem; text-align: center; }
.session-faq-link a {
  color: var(--primary-bright);
  text-decoration: none;
  font-weight: 600;
}
.session-faq-link a:hover { text-decoration: underline; }

/* Body-composition trend charts (SVG small multiples, shared coach + athlete) */
.bw-charts-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6em;
  margin: 0 0 0.7em;
}
.bw-charts-head h4 { margin: 0; font-size: 0.95rem; }
.bw-range {
  display: inline-flex;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px;
}
.bw-range-btn {
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.74rem;
  padding: 0.2em 0.6em;
  border-radius: calc(var(--radius) - 3px);
  cursor: pointer;
}
.bw-range-btn.on { background: var(--primary); color: #fff; }
.bw-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.7em;
  margin-bottom: 1.1rem;
}
.bw-chart-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6em 0.7em 0.5em;
}
.bw-chart-top { display: flex; align-items: center; justify-content: space-between; gap: 0.4em; }
.bw-chart-title { font-size: 0.78rem; color: var(--text-soft); }
.bw-chart-delta { font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.bw-chart-val { font-size: 1.15rem; font-weight: 700; line-height: 1.1; margin: 0.1em 0 0.35em; }
.bw-chart-unit { font-size: 0.72rem; font-weight: 500; color: var(--muted); margin-left: 0.15em; }
.bw-chart-plot { position: relative; width: 100%; height: 58px; color: var(--primary); touch-action: none; }
.bw-chart-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.bw-dot {
  position: absolute;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 2px var(--surface-2);
  pointer-events: none;
}
.bw-cross {
  position: absolute;
  top: 0; bottom: 0;
  width: 1px;
  background: currentColor;
  opacity: 0.35;
  transform: translateX(-50%);
  pointer-events: none;
}
.bw-chart-tip {
  position: absolute;
  top: -2px;
  transform: translate(-50%, -100%);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 0.3em 0.5em;
  font-size: 0.72rem;
  color: var(--text);
  white-space: nowrap;
  pointer-events: none;
  z-index: 5;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.bw-chart-tip span { color: var(--muted); }

/* Diet on client side */
.client-diet-day {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7em 0.9em;
  display: grid;
  grid-template-columns: 60px 1fr 1fr;
  gap: 0.5em;
  align-items: center;
}
.client-diet-day .day-name { font-weight: 700; color: var(--primary-bright); }
.client-diet-day .target { color: var(--text-soft); font-size: 0.9rem; }
.client-diet-day .target strong { color: var(--text); font-weight: 700; }

/* Code share/import */
.code-textarea {
  width: 100%;
  min-height: 130px;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.75rem;
  word-break: break-all;
  background: var(--surface-2);
}
.code-actions { display: flex; gap: 0.5em; margin-top: 0.6em; flex-wrap: wrap; }

/* Trainer's client logs view */
.log-week-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
  margin-bottom: 1rem;
}
.log-exercise {
  border-top: 1px solid var(--border);
  padding-top: 0.8em;
  margin-top: 0.8em;
}
.log-exercise:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.log-exercise h5 { margin: 0 0 0.4em; font-size: 0.95rem; }
.log-table {
  display: grid;
  grid-template-columns: 1fr 80px 80px 80px;
  gap: 0.3em 0.8em;
  font-size: 0.85rem;
  margin-top: 0.3em;
}
.log-table .lh {
  font-weight: 700; color: var(--primary-bright); font-size: 0.7rem;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.log-table .date { color: var(--text-soft); }
@media (max-width: 600px) {
  .log-table { grid-template-columns: 1fr 1fr 1fr 1fr; font-size: 0.8rem; }
}

.client-feedback-block {
  background: var(--primary-soft);
  border: 1px solid rgba(var(--primary-rgb), 0.3);
  border-radius: var(--radius);
  padding: 0.9em 1em;
  margin-bottom: 1rem;
  white-space: pre-wrap;
  font-size: 0.9rem;
}
.client-feedback-block .feedback-label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary-bright);
  margin-bottom: 0.5em;
}

/* ============ Calendar ============ */
.calendar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 0.5em;
  flex-wrap: wrap;
}
.cal-nav { display: flex; align-items: center; gap: 0.5em; }
.cal-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  min-width: 180px;
  text-align: center;
}

/* ---- Merged Sessions + Calendar tab ---- */
.session-calendar { margin-top: 0.4rem; }
.cal-caption { margin: 0; font-size: 0.8rem; }

/* ===== Athlete Overview dashboard ===== */
.overview-stats { display: flex; flex-direction: column; gap: 0.9rem; margin-bottom: 1.4rem; }
.ov-greeting { font-size: 1.15rem; font-weight: 800; letter-spacing: 0.01em; }

/* Adaptive "up next" hero card (Today / Up next / Rest / All caught up) */
.ov-hero {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--hero-color, var(--primary));
  border-radius: var(--radius-lg);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, transform 0.15s;
}
.ov-hero.is-clickable { cursor: pointer; }
.ov-hero.is-clickable:hover { box-shadow: 0 8px 22px rgba(var(--primary-rgb), 0.16); transform: translateY(-2px); }
.ov-hero-icon {
  width: 46px; height: 46px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem; line-height: 1;
  border-radius: 12px;
  background: var(--hero-soft, var(--primary-soft));
  color: var(--hero-color, var(--primary-bright));
}
.ov-hero-body { flex: 1; min-width: 0; }
.ov-hero-kicker { font-size: 0.62rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-soft); }
.ov-hero-title { font-size: 1.1rem; font-weight: 800; line-height: 1.15; margin: 0.05em 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-hero-sub { font-size: 0.78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-hero-cta {
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--primary-bright), var(--primary));
  color: #062131; font-weight: 800; font-size: 0.8rem;
  padding: 0.5em 0.9em; border-radius: 999px;
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
}

/* Slim horizontal stat strip */
.ov-strip {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.ov-stat {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 0.55rem 0.35rem;
  background: none; border: none; border-right: 1px solid var(--border);
  font-family: inherit; cursor: pointer; color: inherit;
}
.ov-stat:last-child { border-right: none; }
.ov-stat-num { font-size: 1.35rem; font-weight: 900; color: var(--primary-bright); line-height: 1; }
.ov-stat-num.ov-stat-sm { font-size: 0.85rem; font-weight: 800; }
.ov-stat.is-low .ov-stat-num { color: var(--warn); }
.ov-stat-lbl { font-size: 0.62rem; color: var(--text-soft); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
button.ov-stat:hover { background: var(--surface-2); }

/* Weekly progress bar */
.ov-progress-top { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-soft); font-weight: 600; margin-bottom: 0.3em; }
.ov-progress-track { height: 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.ov-progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--primary-bright)); transition: width 0.4s ease; }

/* Mini widgets (bodyweight / top PR) */
.ov-mini-row { display: flex; gap: 0.7rem; }
.ov-mini {
  flex: 1; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.65rem 0.8rem;
}
.ov-mini-top { display: flex; align-items: baseline; gap: 0.3em; }
.ov-mini-val { font-size: 1.1rem; font-weight: 800; }
.ov-mini-trend { font-weight: 800; color: var(--primary-bright); }
.ov-mini-lbl { font-size: 0.66rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; margin-top: 0.15em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Athlete overview: coach announcements inbox ---- */
.ov-messages:empty { display: none; }
.ov-messages { margin-bottom: 1.4rem; }
.ovmsg-card {
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.ovmsg-head { display: flex; align-items: center; gap: 0.4rem; font-weight: 700; font-size: 0.9rem; color: var(--text); }
.ovmsg-icon { font-size: 1.05rem; }
.ovmsg-item { border-top: 1px solid var(--border); padding-top: 0.55rem; }
.ovmsg-item:first-of-type { border-top: none; padding-top: 0; }
.ovmsg-text { color: var(--text); font-size: 0.92rem; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.ovmsg-meta { display: flex; align-items: center; gap: 0.45rem; margin-top: 0.3em; font-size: 0.72rem; color: var(--muted); }
.ovmsg-new {
  background: var(--primary);
  color: #062131;
  font-weight: 700;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.1em 0.45em;
  border-radius: 999px;
}
:root[data-theme="white"] .ovmsg-new { color: #fff; }

/* ---- Coach messaging view ---- */
.msg-compose {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 640px;
}
.msg-compose-field { display: flex; flex-direction: column; gap: 0.5rem; }
.msg-label { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-soft); }
.msg-recip-row { display: flex; align-items: center; gap: 0.5rem; }
.msg-recip-all { padding: 0.2em 0.7em; font-size: 0.78rem; }
.msg-recip-count { font-size: 0.78rem; margin-left: auto; }
.msg-recipients { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.msg-recip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35em 0.7em;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.msg-recip:hover { border-color: var(--primary); }
.msg-recip.is-on {
  background: linear-gradient(180deg, var(--primary-bright), var(--primary));
  border-color: var(--primary);
  color: #062131;
  font-weight: 600;
}
:root[data-theme="white"] .msg-recip.is-on { color: #fff; }
.msg-recip-check { width: 0.9em; text-align: center; font-weight: 800; }
.msg-textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  padding: 0.65em 0.75em;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.45;
}
.msg-textarea:focus { outline: none; border-color: var(--primary); }
.msg-compose-actions { display: flex; align-items: center; justify-content: flex-end; gap: 0.75rem; }
.msg-compose-actions .muted { margin-right: auto; font-size: 0.8rem; }
.msg-history-head { margin: 1.6rem 0 0.7rem; font-size: 0.95rem; color: var(--text-soft); }
.msg-history { display: flex; flex-direction: column; gap: 0.55rem; max-width: 640px; }
.msg-hist-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0.65rem 0.8rem;
}
.msg-hist-text { color: var(--text); font-size: 0.9rem; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.msg-hist-meta { margin-top: 0.35em; font-size: 0.72rem; color: var(--muted); }
.msg-duration { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; }
.msg-select {
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  padding: 0.3em 0.5em;
  font: inherit;
  font-size: 0.85rem;
}

/* ---- Coach bulletin board (on the coach Overview) ---- */
.bulletin-compose { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.6rem; }
.bulletin-compose-row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.bulletin-active { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.9rem; }
.bulletin-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 0.6rem 0.75rem;
}
.bulletin-item-body { flex: 1; min-width: 0; }
.bulletin-item-text { color: var(--text); font-size: 0.9rem; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.bulletin-item-meta { margin-top: 0.3em; font-size: 0.72rem; color: var(--muted); }
.bulletin-remove { flex-shrink: 0; color: var(--danger); }

/* Athlete-side bulletin card accent (distinct from the 📣 messages card) */
.ovmsg-bulletin { border-left-color: var(--accent); }

/* ---- Single-day editor (full page) ---- */
.day-editor-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 0.75rem 1rem;
  margin-bottom: 1.1rem;
}
.day-editor-meta label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.85rem; color: var(--text-soft); font-weight: 600; }
.day-editor-meta input,
.day-editor-meta textarea {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  padding: 0.55em 0.7em;
  font: inherit;
  font-size: 0.92rem;
}
.day-editor-meta textarea { resize: vertical; line-height: 1.4; }
.day-editor-meta input:focus,
.day-editor-meta textarea:focus { outline: none; border-color: var(--primary); }
@media (max-width: 620px) {
  .day-editor-meta { grid-template-columns: 1fr; }
}

.session-manage {
  margin-top: 1.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.session-manage > summary {
  cursor: pointer;
  padding: 0.75em 1em;
  font-weight: 700;
  font-size: 0.92rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5em;
}
.session-manage > summary::-webkit-details-marker { display: none; }
.session-manage > summary::before {
  content: "▸";
  color: var(--text-soft);
  transition: transform 0.15s;
}
.session-manage[open] > summary::before { transform: rotate(90deg); }
.session-manage > summary:hover { color: var(--primary-bright); }
.session-manage-note { margin: 0 1em 0.6em; font-size: 0.83rem; }
.session-manage-actions { padding: 0 1em 0.4em; display: flex; gap: 0.5em; flex-wrap: wrap; }
.session-manage > #session-bank-container,
.session-manage > #athlete-session-container { display: block; padding: 0 1em 1em; }
.cal-legend {
  display: flex;
  gap: 0.8em;
  font-size: 0.75rem;
  color: var(--text-soft);
  flex-wrap: wrap;
}
.cal-legend .swatch {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 3px;
  margin-right: 0.3em;
  vertical-align: middle;
}
.cal-legend .sw-sched { background: var(--primary); }
.cal-legend .sw-done { background: var(--accent); }
.cal-legend .sw-missed { background: var(--danger); }
.cal-legend .sw-partial {
  background: linear-gradient(90deg, var(--primary) 50%, var(--surface-3) 50%);
}
.cal-legend .sw-rest { background: var(--surface-3); border: 1px solid var(--border-strong); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.6rem;
}
.cal-dow {
  text-align: center;
  padding: 0.4em 0;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
}
.cal-day {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 80px;
  padding: 0.4em 0.5em;
  display: flex;
  flex-direction: column;
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}
.cal-day:hover { border-color: var(--primary); background: var(--surface-3); }
.cal-day.outside {
  opacity: 0.35;
  cursor: default;
  background: transparent;
  border-color: transparent;
}
.cal-day.outside:hover { border-color: transparent; background: transparent; }
.cal-day.today {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
}
.cal-date-num {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 0.2em;
}
.cal-day.today .cal-date-num {
  color: var(--primary-bright);
}
.cal-day-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--primary-bright);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.2;
  margin-bottom: 0.2em;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-day-status {
  font-size: 0.7rem;
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 0.2em;
  font-weight: 700;
}
.cal-day.done {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.cal-day.done .cal-day-status { color: var(--accent); }
.cal-day.partial {
  background: var(--primary-soft);
  border-color: var(--primary);
}
.cal-day.partial .cal-day-status { color: var(--primary-bright); }
.cal-day.missed {
  background: var(--danger-soft);
  border-color: var(--danger);
}
.cal-day.missed .cal-day-status { color: var(--danger); }
.cal-day.rest {
  background: var(--surface-3);
  border-style: dashed;
}
.cal-day.rest .cal-day-label { color: var(--muted); }

/* Color-coded workout log pill on calendar cells */
.cal-day-pill {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.18em 0.45em;
  border-radius: 4px;
  border: 1px solid var(--day-color, var(--border));
  background: var(--day-color-soft, var(--surface-3));
  color: var(--day-color, var(--text-soft));
  margin-top: 0.25em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: block;
}
.cal-day-pill-rest {
  border-color: var(--border);
  background: var(--surface-3);
  color: var(--muted);
}
/* Upcoming booked session (from the coach's Setmore calendar) */
.cal-booked-pill {
  border-color: rgba(var(--primary-bright-rgb), 0.5);
  background: var(--primary-soft);
  color: var(--primary-bright);
}
/* Session-token pill — a paid session was redeemed that day */
.cal-day-pill-token {
  border-color: rgba(245, 158, 11, 0.55);
  background: rgba(245, 158, 11, 0.14);
  color: #fbbf24;
  margin-top: 2px;
}
.cal-day.has-log { cursor: pointer; }
.cal-day.has-log:hover { border-color: var(--day-color, var(--primary)); }

/* Token balance chip in the athlete calendar header */
.cal-token-balance {
  font-size: 0.78rem;
  font-weight: 700;
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.1);
  padding: 0.3em 0.75em;
  border-radius: 999px;
  white-space: nowrap;
}

/* Redemption details modal */
.redemption-note-list { margin: 0.6em 0 0; padding-left: 1.2em; }
.redemption-note-list li { margin-bottom: 0.35em; font-size: 0.9rem; }

/* Packages tracker (all athletes) */
#packages-requests-container .card { margin-bottom: 1rem; }
.pkg-track-row {
  display: flex;
  align-items: center;
  gap: 0.7em;
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.12s;
}
.pkg-track-row:hover { background: var(--surface-2); }
.pkg-track-row:last-child { border-bottom: none; }
.pkg-track-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.pkg-track-info .muted { font-size: 0.78rem; }
.pkg-track-pending {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--primary-bright);
  background: var(--primary-soft);
  border: 1px solid rgba(var(--primary-bright-rgb), 0.35);
  padding: 0.2em 0.6em;
  border-radius: 999px;
  white-space: nowrap;
}

/* Page transitions — content area only; header and side nav stay put.
   display:none → visible restarts the animation, so this fires on every
   view/tab switch without any JS. */
.view { animation: view-in 0.22s ease-out; }
.tab-panel.active { animation: view-in 0.22s ease-out; }
@keyframes view-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .view, .tab-panel.active { animation: none; }
}

/* Cardio log */
.cardio-row {
  display: flex;
  align-items: center;
  gap: 0.7em;
  padding: 0.6rem 0.4rem;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.12s;
}
.cardio-row:hover { background: var(--surface-2); }
.cardio-row:last-child { border-bottom: none; }
.cardio-row-readonly { cursor: default; }
.cardio-row-readonly:hover { background: transparent; }
.cardio-row-icon { font-size: 1.3rem; flex-shrink: 0; }
.cardio-row-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.05rem; }
.cardio-row-info .muted { font-size: 0.75rem; }
.cardio-min { font-weight: 800; color: var(--primary-bright); white-space: nowrap; font-size: 0.9rem; }
.cardio-intensity {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.25em 0.6em;
  border-radius: 999px;
  border: 1px solid;
  white-space: nowrap;
}
.cardio-intensity-low { color: var(--accent); border-color: rgba(16, 185, 129, 0.45); background: var(--accent-soft); }
.cardio-intensity-moderate { color: var(--warn); border-color: rgba(245, 158, 11, 0.45); background: rgba(245, 158, 11, 0.12); }
.cardio-intensity-high { color: var(--danger); border-color: rgba(239, 68, 68, 0.45); background: var(--danger-soft); }

/* Cardio modal pickers */
.cardio-type-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.45em;
  margin-bottom: 0.9em;
}
.cardio-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15em;
  padding: 0.55em 0.2em;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-soft);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.cardio-type-btn:hover { border-color: var(--primary); }
.cardio-type-btn.selected { border-color: var(--primary); background: var(--primary-soft); color: var(--text); }
.cardio-type-icon { font-size: 1.25rem; }
.cardio-type-name { font-size: 0.62rem; font-weight: 700; }
.cardio-int-row { display: flex; gap: 0.45em; margin-bottom: 0.9em; }
.cardio-int-btn {
  flex: 1;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.78rem;
  padding: 0.55em 0.3em;
  border-radius: 999px;
  background: var(--surface-2);
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.12s, transform 0.1s;
}
.cardio-int-btn.selected { opacity: 1; transform: scale(1.03); }

/* Booked-session rows in the dashboard day modal */
.dash-booked-row .breakdown-sets { display: flex; align-items: center; gap: 0.5em; }
.dash-booked-linked {
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.12s;
}
.dash-booked-linked:hover { background: var(--surface-2); }
.dash-booked-arrow { color: var(--muted); font-size: 1.1rem; line-height: 1; }
.btn-unlink-setmore {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-soft);
  border-radius: 999px;
  padding: 0.2em 0.7em;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.btn-unlink-setmore:hover { color: #fca5a5; border-color: rgba(239, 68, 68, 0.5); background: var(--danger-soft); }
.booked-balance-chip {
  display: inline-block;
  margin-left: 0.5em;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.1);
  padding: 0.15em 0.55em;
  border-radius: 999px;
  white-space: nowrap;
  vertical-align: middle;
}
.booked-balance-chip.low {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.5);
  background: var(--danger-soft);
}

/* Athlete day log / plan modal */
.day-log-picker { display: flex; flex-direction: column; gap: 0.9rem; }
.day-log-week-chips { margin-bottom: 0; }
.day-log-day-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem;
  max-height: 45vh; overflow-y: auto; padding-right: 2px;
}
@media (max-width: 480px) {
  .day-log-day-grid { grid-template-columns: 1fr; }
}
.day-log-opt {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 0.7rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-left: 3px solid var(--day-color, var(--border));
  border-radius: var(--radius); cursor: pointer; text-align: left;
  font-family: inherit; transition: border-color 0.15s, background 0.15s, transform 0.12s;
  width: 100%;
}
.day-log-opt:hover, .day-log-opt.selected {
  border-color: var(--day-color, var(--primary));
  background: var(--day-color-soft, var(--surface-3));
}
.day-log-opt:active { transform: scale(0.97); }
.day-log-icon {
  font-size: 1.25rem; width: 36px; height: 36px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: var(--day-color-soft, var(--surface-3));
  border: 1px solid var(--day-color, var(--border));
}
.day-log-icon-rest { background: var(--surface-3); border-color: var(--border); }
.day-log-name {
  font-weight: 600; font-size: 0.85rem; color: var(--text); flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.day-log-rest { margin-bottom: 0.1rem; }

/* Dashboard overview calendar */
.dash-cal-grid {
  grid-template-rows: auto;
}
.dash-cal-day {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.45em 0.5em;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  cursor: default;
  transition: border-color 0.15s, background 0.15s;
}
.dash-cal-day.outside { opacity: 0.25; pointer-events: none; }
.dash-cal-day.today { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.dash-cal-day.has-log { cursor: pointer; }
.dash-cal-day.has-log:hover { border-color: var(--primary); background: var(--surface-3); }
.dash-cal-date { font-size: 0.75rem; font-weight: 700; color: var(--text-soft); margin-bottom: 0.15rem; }
.dash-cal-day.today .dash-cal-date { color: var(--primary-bright); }
.dash-cal-pill {
  display: flex; align-items: center; gap: 0.28rem;
  font-size: 0.6rem; font-weight: 700;
  padding: 0.18em 0.35em;
  border-radius: 4px;
  border: 1px solid var(--day-color, var(--border));
  background: var(--day-color-soft, var(--surface-3));
  color: var(--day-color, var(--text-soft));
  overflow: hidden; white-space: nowrap; max-width: 100%;
}
.dash-cal-pill-rest {
  border-color: var(--border); background: var(--surface-3); color: var(--muted);
}
.dash-cal-pill-booked {
  border-color: var(--primary); background: var(--primary-soft); color: var(--primary-bright);
  justify-content: center; font-weight: 800;
}
.dash-cal-initials {
  font-size: 0.55rem; font-weight: 900; letter-spacing: 0.01em;
  background: var(--day-color, var(--muted));
  color: #000;
  border-radius: 3px;
  padding: 0.05em 0.22em;
  flex-shrink: 0;
}
.dash-cal-pill-rest .dash-cal-initials { background: var(--muted); }
.dash-cal-day-name { overflow: hidden; text-overflow: ellipsis; flex: 1; }
.dash-cal-more { font-size: 0.6rem; color: var(--muted); padding: 0 0.2em; }

/* Mobile: the whole month fits on screen — every cell an equal square with
   just the date and a client/booking count badge (pills hide, badge shows) */
.dash-cal-count { display: none; }
@media (max-width: 600px) {
  .dash-cal-day {
    min-height: 0;
    aspect-ratio: 1;
    padding: 0.15em 0.1em;
    gap: 2px;
    align-items: center;
    justify-content: flex-start;
  }
  .dash-cal-day .dash-cal-pill,
  .dash-cal-day .dash-cal-more { display: none; }
  .dash-cal-date { margin-bottom: 0; font-size: 0.7rem; }
  .dash-cal-count {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 1.6em;
    height: 1.6em;
    padding: 0 0.3em;
    border-radius: 999px;
    background: var(--primary-soft);
    border: 1px solid var(--primary);
    color: var(--primary-bright);
    font-size: 0.68rem;
    font-weight: 800;
  }
}

/* Dashboard breakdown modal — multiple clients */
.dash-breakdown-client { padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
.dash-breakdown-client:last-child { border-bottom: none; }
.dash-breakdown-header {
  display: flex; align-items: center; gap: 0.6rem;
  margin-bottom: 0.5rem;
}
.dash-breakdown-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}

/* Coach breakdown modal */
.breakdown-ex { padding: 0.6rem 0; border-bottom: 1px solid var(--border); }
.breakdown-ex:last-child { border-bottom: none; }
.breakdown-ex-name { font-weight: 700; font-size: 0.9rem; margin-bottom: 0.35rem; }
.breakdown-sets { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.breakdown-set-pill {
  background: var(--surface-2); border-radius: var(--radius);
  padding: 0.2em 0.65em; font-size: 0.82rem; font-weight: 600; color: var(--text);
}
.breakdown-note { margin-top: 1rem; padding: 0.75rem; background: var(--surface-2); border-radius: var(--radius); }
.breakdown-note-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-soft); font-weight: 700; }
.breakdown-note p { margin: 0.3rem 0 0; font-size: 0.9rem; }

@media (max-width: 600px) {
  .cal-day { min-height: 60px; padding: 0.3em; font-size: 0.7rem; }
  .cal-date-num { font-size: 0.8rem; }
  .cal-day-label { font-size: 0.65rem; }
  .cal-day-status { font-size: 0.6rem; }
}

/* Schedule modal */
.sched-options {
  display: flex;
  flex-direction: column;
  gap: 0.4em;
  margin-bottom: 1em;
}
.sched-options select { margin-top: 0; }

/* Template scaffolding modal */
.template-info {
  background: var(--primary-soft);
  border-radius: var(--radius);
  padding: 0.9em 1em;
  margin-bottom: 1em;
  border: 1px solid rgba(var(--primary-rgb), 0.25);
  font-size: 0.9rem;
  color: var(--text-soft);
}
.template-info strong { color: var(--primary-bright); }
.template-phase-list {
  margin: 0.6em 0 0;
  padding-left: 1.2em;
}
.template-phase-list li { margin-bottom: 0.3em; }
.template-phase-list strong { color: var(--primary-bright); }

/* ============ Video / YouTube ============ */
.exercise-video { margin-top: 0.7em; }
.exercise-video label { margin: 0; }
.video-url-input {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.85rem;
}
.video-status { margin-top: 0.4em; }
.video-preview-btn {
  text-decoration: none;
}
.video-warn { color: var(--warn); font-size: 0.8rem; font-weight: 500; }

.client-video-row { margin-bottom: 0.7em; }
.video-btn {
  background: linear-gradient(180deg, var(--primary-bright), var(--primary));
  border-color: var(--primary-hover);
  color: #062131;
  text-decoration: none;
  font-weight: 700;
}
.video-btn:hover {
  background: linear-gradient(180deg, var(--primary), var(--primary-hover));
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* Watch button on calendar day cells */
.cal-day-video {
  position: absolute;
  top: 4px;
  right: 4px;
  background: linear-gradient(180deg, var(--primary-bright), var(--primary));
  color: #062131;
  border: none;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 0.65rem;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  z-index: 2;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  letter-spacing: 0.04em;
}
.cal-day-video:hover {
  background: linear-gradient(180deg, #67e8f9, var(--primary-bright));
  box-shadow: 0 0 0 2px var(--primary-soft), 0 1px 4px rgba(0, 0, 0, 0.4);
}
.cal-day.done .cal-day-video,
.cal-day.partial .cal-day-video,
.cal-day.missed .cal-day-video {
  /* Keep visible but slightly tucked when cell has color */
  opacity: 0.95;
}

@media (max-width: 600px) {
  .cal-day-video {
    padding: 1px 5px;
    font-size: 0.55rem;
  }
}

.video-pick-list { display: flex; flex-direction: column; gap: 0.4em; }
.video-pick-btn {
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.7em 0.9em;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  transition: border-color 0.15s, background 0.15s;
}
.video-pick-btn:hover {
  border-color: var(--primary);
  background: var(--surface-3);
}
.video-pick-btn .video-pick-icon {
  color: var(--primary-bright);
  margin-right: 0.4em;
  font-weight: 800;
}

/* ============ Weekly progress bar ============ */
.week-progress {
  display: flex;
  align-items: center;
  gap: 0.8em;
  margin-bottom: 1em;
  padding: 0.7em 0.9em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.week-progress.complete {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.week-progress-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  min-width: 110px;
}
.week-progress.complete .week-progress-label { color: var(--accent); }
.week-progress-track {
  flex: 1;
  height: 10px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border);
}
.week-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-bright), var(--accent));
  transition: width 0.4s ease;
  border-radius: 999px;
  box-shadow: 0 0 8px var(--primary-glow);
}
.week-progress.complete .week-progress-fill {
  background: linear-gradient(90deg, #34d399, var(--accent));
}
.week-progress-pct {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--primary-bright);
  min-width: 36px;
  text-align: right;
}
.week-progress.complete .week-progress-pct { color: var(--accent); }

/* ============ Day check toggle ============ */
.day-head-left-flex {
  display: flex;
  align-items: center;
  gap: 0.7em;
  flex: 1;
  min-width: 200px;
}
.day-head-stats {
  display: flex;
  align-items: center;
  gap: 0.6em;
  flex-wrap: wrap;
}
.day-check-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: transparent;
  color: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 900;
  transition: all 0.15s;
  flex-shrink: 0;
  padding: 0;
}
.day-check-toggle:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.day-check-toggle.checked {
  background: var(--accent);
  border-color: var(--accent);
  color: #062a1f;
}
.client-day-card.day-checked {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--accent-soft), var(--surface-2));
}

/* Coach side: per-week completion summary */
.log-week-row {
  display: flex;
  align-items: center;
  gap: 0.8em;
  padding: 0.6em 0;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.log-week-row:first-of-type { border-top: 0; }
.log-week-row-label {
  display: flex;
  align-items: center;
  gap: 0.5em;
  flex-wrap: wrap;
  min-width: 200px;
}

/* ============ Personal Records ============ */
.pr-exercise-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.2rem;
  margin-bottom: 1rem;
}
.pr-exercise-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.7em;
  flex-wrap: wrap;
  margin-bottom: 0.7em;
  padding-bottom: 0.7em;
  border-bottom: 1px solid var(--border);
}
.pr-exercise-name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
}
.pr-best {
  background: linear-gradient(180deg, var(--primary-bright), var(--primary));
  color: #062131;
  padding: 0.3em 0.9em;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 0 12px var(--primary-glow);
}
.pr-best .pr-best-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-right: 0.4em;
  opacity: 0.7;
}
.pr-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  gap: 0.5em 1em;
  align-items: center;
  font-size: 0.9rem;
  padding: 0.5em 0;
  border-top: 1px solid var(--surface-3);
}
.pr-row:first-of-type { border-top: 0; }
.pr-placeholder-hint { color: var(--muted); font-size: 0.78rem; font-style: italic; display: block; padding: 0.4em 0; }
.pr-row.is-best { background: var(--primary-soft); padding: 0.5em 0.6em; border-radius: var(--radius); border-top: 0; margin-top: 0.3em; }
.pr-row .pr-weight { font-weight: 800; color: var(--primary-bright); font-size: 1rem; }
.pr-row .pr-reps { color: var(--text-soft); }
.pr-row .pr-date { color: var(--muted); font-size: 0.85rem; }
.pr-row .pr-author {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15em 0.55em;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.pr-row .pr-author.coach { background: var(--primary-soft); color: var(--primary-bright); }
.pr-row .pr-author.athlete { background: var(--accent-soft); color: var(--accent); }
.pr-row .pr-delete {
  background: transparent; border: none; color: var(--muted);
  cursor: pointer; padding: 0 0.3em; font-size: 1.1rem; font-family: inherit;
}
.pr-row .pr-delete:hover { color: var(--danger); }
.pr-row .pr-notes {
  grid-column: 1 / -1;
  color: var(--text-soft);
  font-size: 0.85rem;
  font-style: italic;
  padding-top: 0.2em;
}

@media (max-width: 600px) {
  .pr-row { grid-template-columns: 1fr 1fr; }
  .pr-row .pr-author { grid-column: 1; }
  .pr-row .pr-delete { grid-column: 2; justify-self: end; }
}

/* PR inline edit cards (coach side) */
.pr-edit-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
}
.pr-edit-card.is-editing { border-color: var(--primary); }
.pr-edit-card.pr-athlete-only { opacity: 0.75; }
.pr-edit-card.pr-dragging { opacity: 0.35; }
.pr-edit-card.pr-drag-over { border-color: var(--primary) !important; box-shadow: 0 0 0 2px var(--primary-soft); }
.pr-drag-handle {
  height: 12px; margin-bottom: 0.6rem;
  background-image: radial-gradient(circle, var(--muted) 1.5px, transparent 1.5px);
  background-size: 6px 6px;
  background-position: center;
  background-repeat: repeat-x;
  opacity: 0.35; cursor: grab;
  transition: opacity 0.15s;
}
.pr-edit-card:hover .pr-drag-handle { opacity: 0.8; }
.pr-edit-card[draggable="true"] { cursor: default; }
.pr-edit-name { font-weight: 700; font-size: 1rem; color: var(--text); margin-bottom: 0.75rem; }
.pr-edit-name-row { margin-bottom: 0.75rem; }
.pr-name-input {
  width: 100%; font-weight: 700; font-size: 1rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.45em 0.6em; color: var(--text);
}
.pr-edit-fields {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem; margin-bottom: 0.75rem;
}
/* Keep all three PRs in one row on mobile, just compact — the date is now a
   short mm/dd/yy text field so it fits. minmax(0,1fr) lets the columns shrink. */
@media (max-width: 600px) {
  .pr-edit-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.4rem; }
  .pr-field-group { gap: 0.25rem; }
  .pr-field-label { font-size: 0.58rem; letter-spacing: 0.01em; }
  .pr-edit-fields input { font-size: 0.82rem; padding: 0.35em 0.3em; }
  .pr-date-input { font-size: 0.72rem; padding: 0.35em 0.15em; text-align: center; }
  .pr-lock-btn { padding: 0.2em 0.4em; font-size: 0.85rem; }
}
.pr-field-group { display: flex; flex-direction: column; gap: 0.3rem; }
.pr-field-label {
  font-size: 0.72rem; font-weight: 700; color: var(--text-soft);
  text-transform: uppercase; letter-spacing: 0.05em;
}
/* Per-PR date + lock */
.pr-date-input { font-size: 0.74rem; padding: 0.32em 0.4em; }
.pr-field-group input[readonly] {
  background: var(--surface-2);
  color: var(--text-soft);
  cursor: default;
  border-style: dashed;
}
.pr-lock-btn {
  align-self: center;
  margin-top: 0.1em;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0.25em 0.55em;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.pr-lock-btn:hover { border-color: var(--primary); }
.pr-lock-btn.is-locked { border-color: var(--accent); background: var(--accent-soft); }
.pr-name-input:focus { outline: none; border-color: var(--primary); }
.pr-edit-actions { display: flex; justify-content: flex-end; gap: 0.5rem; }
.pr-view-header {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 0.35rem;
}
.pr-exercise-name { margin: 0; font-size: 1rem; font-weight: 700; }
.pr-view-btns { display: flex; align-items: center; gap: 0.25rem; }
.pr-view-value { font-size: 1.05rem; }
.pr-view-value .pr-weight { font-weight: 800; color: var(--primary-bright); }
.pr-view-value .pr-reps { color: var(--text-soft); }
.pr-view-value .pr-date { font-size: 0.78rem; color: var(--muted); margin-left: 0.6em; }
.pr-delete-btn {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 1.2rem; line-height: 1;
  padding: 0 0.2rem; transition: color 0.12s;
}
.pr-delete-btn:hover { color: var(--danger); }
.pr-rm-row {
  display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.1rem;
}
.pr-rm-pill {
  display: flex; align-items: baseline; gap: 0.35em;
  background: var(--surface-2); border-radius: var(--radius);
  padding: 0.35em 0.75em; font-size: 0.95rem; font-weight: 700;
  color: var(--primary-bright);
}
.pr-rm-pill.pr-rm-empty { color: var(--muted); font-weight: 400; }
.pr-rm-label {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-soft); margin-right: 0.1em;
}
.pr-rm-empty .pr-rm-label { color: var(--muted); }
.pr-weight-input, .pr-reps-input, .pr-1rm-input, .pr-2rm-input, .pr-3rm-input {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.5em 0.6em;
  color: var(--text); font-size: 1rem; width: 100%;
}
.pr-1rm-input:focus, .pr-2rm-input:focus, .pr-3rm-input:focus { outline: none; border-color: var(--primary); }
.pr-athlete-row {
  margin-top: 0.5rem; padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.82rem; color: var(--text-soft);
  display: flex; align-items: center; gap: 0.5rem;
}
.pr-add-lift-btn {
  width: 100%; margin-top: 0.25rem;
  border: 2px dashed var(--border) !important;
  color: var(--text-soft); grid-column: 1 / -1;
}
.pr-add-lift-btn:hover { border-color: var(--primary) !important; color: var(--primary); }
#coach-pr-container, #athlete-pr-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  align-items: start;
}
#coach-pr-container .pr-edit-card, #athlete-pr-container .pr-edit-card { margin-bottom: 0; }
@media (max-width: 700px) {
  #coach-pr-container, #athlete-pr-container { grid-template-columns: 1fr; }
}

/* Dashboard client card weekly progress */
.client-card .week-progress-mini {
  margin-top: 0.6em;
  padding-top: 0.6em;
  border-top: 1px solid var(--border);
}
.client-card .week-progress-mini .progress-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-soft);
  margin-bottom: 0.3em;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.client-card .week-progress-mini .progress-label .pct {
  color: var(--primary-bright);
  font-size: 0.85rem;
}
.client-card .week-progress-mini .progress-track {
  height: 6px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
}
.client-card .week-progress-mini .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-bright), var(--accent));
  transition: width 0.4s ease;
  border-radius: 999px;
}
.client-card .week-progress-mini.complete .progress-fill {
  background: var(--accent);
}
.client-card .week-progress-mini.complete .pct { color: var(--accent); }
.client-card .week-progress-mini.no-data {
  color: var(--muted);
  font-size: 0.8rem;
  font-style: italic;
}

/* ============ Invite code ============ */
.invite-code-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.9rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 0.75rem;
}
.invite-code-bar-label {
  font-size: 0.78rem;
  color: var(--text-soft);
  white-space: nowrap;
  flex-shrink: 0;
}
.invite-code-display {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary-bright);
  letter-spacing: 0.12em;
  user-select: all;
  flex: 1;
  text-align: center;
}

#invite-code-input {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 1.2rem;
  letter-spacing: 0.16em;
  text-align: center;
  text-transform: uppercase;
  font-weight: 800;
}
.long-code-fallback {
  margin-top: 1.2em;
  border-top: 1px solid var(--border);
  padding-top: 1em;
}
.long-code-fallback summary {
  cursor: pointer;
  color: var(--primary-bright);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.3em 0;
}
.long-code-fallback summary:hover { text-decoration: underline; }

/* Athlete portal: invite code chip */
.athlete-invite-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.3em 0.7em;
  border-radius: 999px;
  font-size: 0.8rem;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-weight: 700;
  color: var(--primary-bright);
  letter-spacing: 0.1em;
}
.athlete-invite-chip .label {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text-soft);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.video-frame-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
}
.video-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Make modal wider when it contains a video frame */
#modal .modal-card:has(.video-frame-wrap) { max-width: 720px; }

/* ============================================================
   SESSIONS / PACKAGE TRACKING
   ============================================================ */
.session-balance-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  flex-wrap: wrap;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid rgba(var(--primary-bright-rgb), 0.25);
}
.session-balance {
  display: flex;
  flex-direction: column;
  gap: 0.1em;
}
.session-balance-num {
  font-size: 3.2rem;
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(180deg, var(--primary-bright), var(--primary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
}
.session-balance-label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
}
.session-balance-stats {
  display: flex;
  gap: 1.2em;
  flex-wrap: wrap;
}
.session-balance-stats > div {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 64px;
}
.session-stat-num { font-size: 1.4rem; font-weight: 800; color: var(--text); }
.session-stat-lbl {
  font-size: 0.7rem; color: var(--text-soft); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
}

.pkg-size-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6em;
  margin: 0.6em 0 0.9em;
}
.pkg-size-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2em;
  padding: 1.1em 0.6em;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s, transform 0.1s, box-shadow 0.15s;
}
.pkg-size-btn:hover {
  border-color: var(--primary);
  background: var(--surface-3);
  box-shadow: 0 4px 16px var(--primary-glow);
  transform: translateY(-2px);
}
.pkg-size-btn:active { transform: scale(0.97); }
.pkg-size-btn.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.pkg-size-num {
  font-size: 2rem;
  font-weight: 900;
  color: var(--primary-bright);
  line-height: 1;
}
.pkg-size-lbl {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
}
.pkg-size-price {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--accent);
  margin-top: 0.2em;
}

.pending-request-row,
.session-pkg-row,
.session-redeem-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7em;
  padding: 0.6em 0;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.pending-request-row:first-of-type,
.session-pkg-row:first-of-type,
.session-redeem-row:first-of-type { border-top: 0; }
.pending-request-actions { display: flex; gap: 0.4em; }
.session-pkg-row-right { display: flex; align-items: center; gap: 0.5em; }

.status-pill {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2em 0.65em;
  border-radius: 999px;
}
.status-paid { background: var(--accent-soft); color: var(--accent); }
.status-pending { background: rgba(245, 158, 11, 0.2); color: var(--warn); }
.status-cancelled { background: var(--surface-3); color: var(--muted); }
.status-gift { background: rgba(236, 72, 153, 0.18); color: #f472b6; }
.status-open { background: var(--primary-soft); color: var(--primary-bright); }
.status-claimed { background: rgba(245, 158, 11, 0.2); color: var(--warn); }

/* Open slots (coach Overview + athlete Sessions) */
.open-slot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--border);
}
.open-slot-info { min-width: 0; }
.open-slot-info strong { display: block; }
.open-slot-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.open-slots-athlete-card { border-color: rgba(var(--primary-rgb), 0.35); }
.open-slots-athlete-card h4 { color: var(--primary-bright); }
.open-slot-optout { margin-top: 0.9rem; }
.open-slot-optout > summary {
  color: var(--muted); font-size: 0.82rem; cursor: pointer; list-style: none;
  padding: 0.3rem 0;
}
.open-slot-optout > summary::-webkit-details-marker { display: none; }
.open-slot-optout-list {
  display: flex; flex-direction: column; gap: 0.15rem;
  margin-top: 0.4rem; padding-left: 0.2rem;
}
.open-slot-optout-item {
  display: flex; align-items: center; gap: 0.55rem;
  font-size: 0.88rem; color: var(--text-soft); cursor: pointer;
}
.open-slot-optout-item input { width: auto; margin: 0; }
.open-slot-pref-row {
  display: flex; align-items: center; gap: 0.6rem;
  font-size: 0.92rem; font-weight: 600; color: var(--text); cursor: pointer; margin: 0;
}
.open-slot-pref-row input { width: auto; margin: 0; flex-shrink: 0; }

/* Nav-tab badge (athlete Sessions open-slot count) */
.tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.15em; height: 1.15em; padding: 0 0.35em; margin-left: 0.4em;
  border-radius: 999px; background: var(--primary); color: #041318;
  font-size: 0.62rem; font-weight: 800; vertical-align: middle;
}

/* Athlete gift-sessions card — subtle accent so it reads as a nice surprise */
.gift-card { border-color: rgba(236, 72, 153, 0.35); }
.gift-card h4 { color: #f472b6; }

/* Single-value diet (coach edit + athlete display) */
.diet-single {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7em 1em;
  margin-bottom: 1em;
}
@media (max-width: 480px) {
  .diet-single { grid-template-columns: 1fr; }
}
.client-diet-targets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7em;
}
@media (max-width: 480px) {
  .client-diet-targets { grid-template-columns: 1fr; }
}
.client-diet-target {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9em 1em;
  text-align: center;
}
.client-diet-target .target-num {
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(180deg, var(--primary-bright), var(--primary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.client-diet-target .target-lbl {
  margin-top: 0.3em;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
}

/* ============ Nutrition plan (standing targets + macro donut) ============ */
.nutrition-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7em 1em;
  margin-bottom: 0.6em;
}
@media (max-width: 480px) { .nutrition-form { grid-template-columns: 1fr; } }
.nutrition-form label span.muted { font-weight: 400; text-transform: none; letter-spacing: 0; }
.nutrition-plan-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6em;
  margin-bottom: 0.7em;
}
.nutrition-history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6em;
  padding: 0.55rem 0.2rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.nutrition-history-row:last-child { border-bottom: none; }

/* Percentage → kcal → grams calculator */
.macro-calc {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5em 0.8em;
  margin-top: 0.7em;
  font-variant-numeric: tabular-nums;
}
.macro-calc-row {
  display: grid;
  grid-template-columns: 14px 1fr auto auto auto;
  align-items: center;
  gap: 0.7em;
  padding: 0.28em 0;
  font-size: 0.85rem;
}
.macro-calc-name { font-weight: 700; color: var(--text); }
.macro-calc-pct { color: var(--text-soft); font-weight: 700; min-width: 3ch; text-align: right; }
.macro-calc-kcal { color: var(--text-soft); min-width: 8ch; text-align: right; }
.macro-calc-g { color: var(--primary-bright); font-weight: 700; min-width: 4ch; text-align: right; }
.macro-calc-total {
  border-top: 1px solid var(--border);
  margin-top: 0.2em;
  padding-top: 0.4em;
  font-size: 0.9rem;
}
.macro-calc-total .macro-calc-name { font-weight: 800; }
.macro-calc-ok { color: var(--accent); font-weight: 800; text-align: right; }
.macro-calc-warn { color: var(--warn); font-weight: 800; text-align: right; }

.macro-chart {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
  margin-top: 0.6em;
}
.macro-donut { width: 180px; height: 180px; flex-shrink: 0; }
.macro-donut path { stroke: var(--surface); stroke-width: 1.5; }
.macro-center-num { font-size: 30px; font-weight: 800; fill: var(--text); }
.macro-center-lbl {
  font-size: 11px; font-weight: 700; fill: var(--text-soft);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.macro-legend { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 0.5em; }
.macro-legend-row { display: flex; align-items: center; gap: 0.5em; font-size: 0.85rem; }
.macro-dot { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.macro-name { font-weight: 700; color: var(--text); }
.macro-detail { color: var(--text-soft); font-size: 0.8rem; margin-left: auto; white-space: nowrap; }
.macro-mismatch { font-size: 0.78rem; margin: 0.6em 0 0; color: var(--warn); }
@media (max-width: 480px) {
  .macro-chart { justify-content: center; }
  .macro-detail { margin-left: 0.6em; }
}

/* ============ Mobile/desktop visibility utilities ============ */
.mobile-only { display: none; }
.desktop-only { display: inline; }
@media (max-width: 720px) {
  .mobile-only { display: inline; }
  .desktop-only { display: none; }
}

/* ============ Mobile-friendly defaults (all sizes) ============ */
html, body {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  /* clip (not hidden): hidden turns body into a scroll container on mobile,
     which silently kills every position:sticky descendant — that's why the
     coach header/nav weren't pinning on phones. clip clips the same without
     creating a scroll container. */
  overflow-x: clip;
}
button, a, [role="button"] { -webkit-tap-highlight-color: transparent; }

/* iOS safe-area aware sticky elements */
.app-header {
  padding-top: max(0.9rem, env(safe-area-inset-top));
  padding-left: max(1.5rem, env(safe-area-inset-left));
  padding-right: max(1.5rem, env(safe-area-inset-right));
}

/* ============ Mobile (≤ 720px) ============ */
@media (max-width: 720px) {
  /* Prevent iOS zoom on focus (needs >= 16px font-size on the input itself) */
  input[type="text"],
  input[type="number"],
  input[type="password"],
  input[type="date"],
  textarea,
  select {
    font-size: 16px;
  }

  /* Compress headings */
  h1 { font-size: 1.4rem; }
  h2 { font-size: 1.15rem; }
  h3 { font-size: 0.98rem; }

  /* App header gets tighter — but still respect notch / Dynamic Island */
  .app-header {
    padding-top: max(0.7rem, env(safe-area-inset-top));
    padding-right: max(0.85rem, env(safe-area-inset-right));
    padding-bottom: 0.7rem;
    padding-left: max(0.85rem, env(safe-area-inset-left));
  }
  /* Hide brand title on mobile — logo + user name is enough */
  .app-header .header-title { display: none; }
  .app-header .header-sub {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0;
    text-transform: none;
  }
  .brand-mark.sm { width: 34px; height: 34px; border-radius: 9px; }
  .header-left { gap: 0.55em; }
  .header-right { gap: 0.3em; }
  .header-right .btn.btn-sm,
  .header-right .btn {
    padding: 0.4em 0.65em;
    font-size: 0.78rem;
    white-space: nowrap;
    min-height: 36px;
  }
  /* Invite chip shows in profile/progress tab instead of header on mobile */
  .athlete-invite-chip { display: none; }

  /* Main content padding */
  .app-main {
    padding: 1.1rem max(0.85rem, env(safe-area-inset-left)) 4.5rem max(0.85rem, env(safe-area-inset-right));
  }
  .view-head { margin-bottom: 1rem; gap: 0.5em; }

  /* Login card tighter */
  .login-card { padding: 1.4rem 1.1rem; }
  .brand h1 { font-size: 1.35rem; letter-spacing: 0.14em; }
  .brand .tagline { font-size: 0.72rem; letter-spacing: 0.2em; }
  .role-btn { padding: 0.95em 1em; }
  .role-btn .role-emoji { font-size: 1.6rem; }
  .role-btn strong { font-size: 0.95rem; }
  .role-btn small { font-size: 0.78rem; }

  /* Form labels and inputs */
  label { font-size: 0.78rem; margin-bottom: 0.7em; }
  input[type="text"],
  input[type="number"],
  input[type="password"],
  input[type="date"],
  textarea,
  select {
    padding: 0.7em 0.8em;
  }

  /* Buttons — bigger tap targets */
  .btn {
    min-height: 42px;
    padding: 0.6em 0.9em;
    font-size: 0.9rem;
  }
  .btn-sm { min-height: 34px; padding: 0.4em 0.7em; font-size: 0.78rem; }

  /* Client grid: one column */
  .client-grid { grid-template-columns: 1fr; gap: 0.5rem; }
  .template-grid { grid-template-columns: 1fr; gap: 0.7rem; }
  .library-head-actions { width: 100%; }
  .library-head-actions .btn { flex: 1; }
  .coach-main { padding: 1rem 0.85rem 4rem; }
  .client-card h3 { font-size: 1.05rem; }

  /* Thin athlete-list cards: the stats strip, per-card week/exercise counts,
     progress bar, and quick-action buttons all get dropped in favor of a
     single compact line (current week/day) so ~5 athletes fit on screen
     at once. Tapping anywhere on the card still opens their profile (see
     the existing card click handler in app.js). */
  .dash-stats-strip { display: none; }
  .client-card { padding: 0.6em 0.85em; }
  .client-card-top { margin-bottom: 0; gap: 0.6rem; }
  .client-avatar { width: 34px; height: 34px; font-size: 0.8rem; }
  .client-card-info h3 { font-size: 0.92rem; margin-bottom: 0.05em; }
  .client-card-info .meta { display: none; }
  .client-card-mobile-progress {
    display: block;
    color: var(--text-soft);
    font-size: 0.76rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .client-card .stats,
  .client-card .week-progress-mini,
  .card-quick-actions { display: none; }

  /* Client head actions: wrap to 2 columns */
  .client-head { gap: 0.8em; }
  .client-head h2 { font-size: 1.25rem; }
  .client-head-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4em;
  }
  .client-head-actions .btn {
    flex: unset;
    font-size: 0.8rem;
    padding: 0.55em 0.5em;
    min-height: 40px;
    white-space: nowrap;
  }

  /* Tabs — bigger, more scrollable, fade edges hidden by scroll */
  .tabs {
    margin-left: -0.25rem;
    margin-right: -0.25rem;
    padding: 0 0.25rem;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab {
    padding: 0.75em 0.9em;
    font-size: 0.75rem;
    min-height: 44px;
  }
  /* Athlete tab bar (5 tabs) fills the width evenly with NO side-scroll,
     like the coach nav. Scoped to #screen-client so the coach's wider
     per-athlete tab set is untouched. The long "Nutrition/Cardio" wraps at
     its <wbr> after the slash. */
  /* Athlete tabs use the same compact pill styling at every width (see the
     base #screen-client .tab rules) — nothing extra needed on mobile. */

  /* Cards */
  .card { padding: 1rem; margin-bottom: 1rem; }

  /* Weeks/days/exercises tighter */
  .week-head { padding: 0.8rem 0.95rem; }
  .week-head h4 { font-size: 0.95rem; }
  .week-info { font-size: 0.78rem; }
  .week-body { padding: 0.9rem; }
  .phase-badge { font-size: 0.6rem; padding: 0.15em 0.55em; }

  .client-day-head h4, .day-head .day-name-input { font-size: 0.95rem; }
  .cex-row { padding: 0.45rem 0.75rem; min-height: 44px; }

  /* Day check toggle — easier to tap */
  .day-check-toggle { width: 32px; height: 32px; font-size: 1rem; }

  /* Program head wraps */
  .program-head { gap: 0.4em; }
  .program-actions { width: 100%; gap: 0.4em; }
  .program-actions .btn { flex: 1; }

  /* Calendar — very compact */
  .calendar-head { gap: 0.4em; }
  .cal-grid { padding: 0.3rem; gap: 3px; }
  /* Even, uncramped grid: every day is the same square, content centered. */
  .cal-day {
    aspect-ratio: 1;
    min-height: 0;
    padding: 0.25em 0.15em;
    font-size: 0.72rem;
    overflow: hidden;
    align-items: center;
  }
  .cal-date-num { font-size: 0.74rem; margin-bottom: 0.1em; align-self: flex-start; }
  .cal-day .cal-day-pill { font-size: 0.5rem; padding: 0.1em 0.32em; margin-top: 0.1em; align-self: center; text-align: center; }
  .cal-day .cal-day-pill-token { font-size: 0.72rem; border: none; background: none; padding: 0; }
  .cal-day-label { font-size: 0.55rem; line-height: 1.15; }
  .cal-day-status { font-size: 0.55rem; }
  .cal-day-video {
    top: 2px;
    right: 2px;
    padding: 1px 4px;
    font-size: 0.55rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
  }
  .cal-dow { font-size: 0.6rem; padding: 0.25em 0; letter-spacing: 0.04em; }
  .cal-title { font-size: 0.95rem; min-width: 0; flex: 1; text-align: center; }
  .cal-nav .btn { min-height: 34px; padding: 0.3em 0.65em; }
  .cal-legend {
    width: 100%;
    font-size: 0.65rem;
    gap: 0.5em;
    justify-content: flex-start;
  }
  .cal-legend .swatch { width: 9px; height: 9px; }

  /* PR list */
  .pr-exercise-group { padding: 0.95rem; }
  .pr-exercise-name { font-size: 1rem; }
  .pr-best { font-size: 0.8rem; padding: 0.25em 0.7em; }
  .pr-best .pr-best-label { font-size: 0.6rem; }
  .pr-row { font-size: 0.85rem; }

  /* Bodyweight + diet rows */
  .bw-entry, .client-diet-day { font-size: 0.85rem; }
  .client-diet-day {
    grid-template-columns: 48px 1fr 1fr;
    padding: 0.55em 0.7em;
    gap: 0.4em;
  }

  /* Modal — near-full-screen sheet */
  .modal { padding: 0.5rem; align-items: flex-end; }
  .modal-card {
    border-radius: 18px 18px 14px 14px;
    max-height: 92vh;
    width: 100%;
  }
  .modal-head { padding: 1rem 1.1rem; }
  .modal-body { padding: 1.1rem; }
  .modal-foot { padding: 0.85rem 1.1rem; gap: 0.4em; }
  .modal-foot .btn { flex: 1; min-width: 0; }
  /* drag handle hint */
  .modal-head::before {
    content: "";
    position: absolute;
    top: 0.45em; left: 50%;
    transform: translateX(-50%);
    width: 36px; height: 4px;
    border-radius: 999px;
    background: var(--border-strong);
    opacity: 0.6;
  }
  .modal-head { position: relative; padding-top: 1.4rem; }

  /* Toast: lift above home-bar */
  .toast {
    bottom: calc(1rem + env(safe-area-inset-bottom));
    font-size: 0.85rem;
    padding: 0.6em 1em;
    max-width: calc(100vw - 1.5rem);
    text-align: center;
  }

  /* Weekly progress bar */
  .week-progress {
    padding: 0.6em 0.7em;
    gap: 0.6em;
    flex-wrap: wrap;
  }
  .week-progress-label { min-width: 0; font-size: 0.8rem; }
  .week-progress-pct { font-size: 0.8rem; }
  .week-progress-track { order: 3; width: 100%; flex-basis: 100%; }

  /* Log table on coach side stays 4-col responsive (already handled) */

}

/* ============ Very small phones (≤ 340px) ============ */
@media (max-width: 340px) {
  .client-head-actions { grid-template-columns: 1fr; }
  .client-head-actions .btn { font-size: 0.85rem; }
  .cal-day { min-height: 48px; }
  .cal-day-label { font-size: 0.5rem; }
  .cal-legend { font-size: 0.6rem; gap: 0.4em; }
  .tab { padding: 0.65em 0.7em; font-size: 0.7rem; }
}

/* ============================================================
   HIGH-TECH ANIMATIONS & FX
   ============================================================ */

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* -------- Animated background grid (subtle HUD vibe) -------- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(transparent calc(100% - 1px), rgba(140, 160, 190, 0.035) calc(100% - 1px)),
    linear-gradient(90deg, transparent calc(100% - 1px), rgba(140, 160, 190, 0.035) calc(100% - 1px));
  background-size: 56px 56px;
  pointer-events: none;
  z-index: 0;
  animation: gridDrift 40s linear infinite;
  mask-image: radial-gradient(ellipse at center, rgba(0,0,0,1) 30%, rgba(0,0,0,0.2) 75%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse at center, rgba(0,0,0,1) 30%, rgba(0,0,0,0.2) 75%, transparent 100%);
}
@keyframes gridDrift {
  to { background-position: 56px 56px; }
}
/* Layer screens above the body::before HUD grid. NOTE: .app-header must NOT
   be in this rule — position:relative here silently overrode the header's
   position:sticky, which is why headers never pinned while scrolling. The
   header's own z-index:10 already stacks it above the grid. */
.screen { position: relative; z-index: 1; }

/* -------- Logo entrance animation -------- */
@keyframes logoZoom {
  0%   { transform: scale(0.2) rotate(-15deg); opacity: 0; filter: brightness(2.5) drop-shadow(0 0 0 var(--primary-bright)); }
  35%  { transform: scale(1.18) rotate(4deg); opacity: 1; filter: brightness(1.7) drop-shadow(0 0 40px var(--primary-bright)); }
  60%  { transform: scale(0.94) rotate(-2deg); filter: brightness(1.3) drop-shadow(0 0 28px var(--primary)); }
  80%  { transform: scale(1.04) rotate(1deg); }
  100% { transform: scale(1) rotate(0); filter: drop-shadow(0 8px 24px rgba(var(--primary-rgb), 0.45)); }
}
@keyframes logoBreathe {
  0%, 100% { filter: drop-shadow(0 8px 24px rgba(var(--primary-rgb), 0.35)); transform: translateY(0) scale(1); }
  50%      { filter: drop-shadow(0 14px 36px rgba(var(--primary-bright-rgb), 0.7)); transform: translateY(-3px) scale(1.02); }
}
@keyframes ringPulse {
  0%   { transform: translate(-50%, -50%) scale(0.6); opacity: 0.9; }
  100% { transform: translate(-50%, -50%) scale(2.3); opacity: 0; }
}
@keyframes scanRing {
  0%   { transform: translate(-50%, -50%) scale(0.9) rotate(0deg); opacity: 0.85; }
  100% { transform: translate(-50%, -50%) scale(1.7) rotate(180deg); opacity: 0; }
}

#screen-login .brand { position: relative; }
#screen-login .brand-mark {
  animation: logoZoom 1.3s cubic-bezier(0.34, 1.56, 0.64, 1) 0.05s both,
             logoBreathe 4s ease-in-out 1.5s infinite;
  position: relative;
}
#screen-login .brand-mark::before,
#screen-login .brand-mark::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 100%; height: 100%;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1);
}
#screen-login .brand-mark::before {
  border: 2px solid var(--primary-bright);
  animation: ringPulse 1.6s ease-out 0.4s both;
}
#screen-login .brand-mark::after {
  border: 1px dashed var(--primary);
  animation: scanRing 2.4s linear 0.9s both;
}

/* Brand text reveal */
@keyframes wordmarkSlide {
  0%   { opacity: 0; transform: translateY(14px); letter-spacing: 0.4em; filter: blur(6px); }
  60%  { opacity: 1; filter: blur(0); letter-spacing: 0.22em; }
  100% { transform: translateY(0); letter-spacing: 0.18em; }
}
@keyframes taglineFade {
  0%   { opacity: 0; transform: translateY(6px); letter-spacing: 0.5em; }
  100% { opacity: 1; transform: translateY(0); letter-spacing: 0.25em; }
}
#screen-login .brand h1 {
  animation: wordmarkSlide 1s cubic-bezier(0.22, 0.85, 0.34, 1) 0.55s both;
}
#screen-login .brand .tagline {
  animation: taglineFade 1s cubic-bezier(0.22, 0.85, 0.34, 1) 1s both;
  position: relative;
  display: inline-block;
}
#screen-login .brand .tagline::after {
  content: "";
  position: absolute;
  left: 50%; right: 50%; bottom: -4px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary-bright), transparent);
  animation: tagUnderline 1.1s ease-out 1.3s forwards;
}
@keyframes tagUnderline {
  to { left: 0; right: 0; }
}

/* Login card fade-up */
@keyframes cardRise {
  0%   { opacity: 0; transform: translateY(30px) scale(0.98); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.login-card {
  animation: cardRise 0.8s cubic-bezier(0.22, 0.85, 0.34, 1) 0.05s both;
  position: relative;
}

/* -------- Login success flash -------- */
body.login-success::after {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at center, rgba(var(--primary-bright-rgb), 0.55) 0%, rgba(var(--primary-rgb), 0.2) 25%, transparent 55%),
    radial-gradient(circle at center, rgba(255, 255, 255, 0.25) 0%, transparent 12%);
  pointer-events: none;
  z-index: 9999;
  animation: loginFlash 1s cubic-bezier(0.22, 0.85, 0.34, 1) forwards;
  mix-blend-mode: screen;
}
@keyframes loginFlash {
  0%   { opacity: 0; transform: scale(0.2); }
  25%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(2.6); }
}
@keyframes screenWake {
  0%   { opacity: 0; transform: scale(0.985); filter: blur(8px); }
  100% { opacity: 1; transform: scale(1); filter: blur(0); }
}
body.login-success #screen-app,
body.login-success #screen-client {
  animation: screenWake 0.7s cubic-bezier(0.22, 0.85, 0.34, 1) 0.15s both;
}

/* -------- Buttons: tactile press + glow -------- */
.btn { will-change: transform; }
.btn:active { transform: scale(0.95); }

.btn-primary {
  box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn-primary:hover {
  box-shadow: 0 10px 32px rgba(var(--primary-rgb), 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 0 0 3px var(--primary-soft);
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: scale(0.96) translateY(0);
  box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.5), inset 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Sheen sweep on primary buttons */
.btn-primary::after {
  content: "";
  position: absolute;
  top: 0; left: -120%;
  width: 60%; height: 100%;
  background: linear-gradient(115deg, transparent, rgba(255,255,255,0.45), transparent);
  transform: skewX(-20deg);
  pointer-events: none;
}
.btn-primary:hover::after { animation: sheen 0.9s ease-out; }
@keyframes sheen { to { left: 130%; } }
.btn-primary { position: relative; overflow: hidden; }

/* Pressed pulse ring for any button */
@keyframes pressPulse {
  0%   { box-shadow: 0 0 0 0 var(--primary-glow); }
  100% { box-shadow: 0 0 0 12px transparent; }
}
.btn:focus-visible { animation: pressPulse 0.45s ease-out; outline: none; }

/* -------- Cards: hover lift, glow trim -------- */
.client-card { position: relative; overflow: hidden; }
.client-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, transparent 30%, rgba(var(--primary-bright-rgb), 0.12) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.7s cubic-bezier(0.22, 0.85, 0.34, 1);
  pointer-events: none;
}
.client-card:hover::after { transform: translateX(100%); }
.client-card:hover {
  box-shadow: 0 18px 42px rgba(var(--primary-rgb), 0.28), 0 0 0 1px rgba(var(--primary-bright-rgb), 0.4);
}

/* -------- Tabs: animated active underline -------- */
.tab {
  position: relative;
  border-bottom: 2px solid transparent;
  transition: color 0.25s;
}
.tab::after {
  content: "";
  position: absolute;
  bottom: -1px; left: 50%; right: 50%;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--primary-bright));
  border-radius: 2px;
  transition: left 0.35s cubic-bezier(0.22, 0.85, 0.34, 1), right 0.35s cubic-bezier(0.22, 0.85, 0.34, 1);
  box-shadow: 0 0 8px var(--primary);
}
.tab.active::after { left: 0.5em; right: 0.5em; }
.tab.active { border-bottom-color: transparent; }

/* Tab panel fade-in */
@keyframes panelFade {
  0%   { opacity: 0; transform: translateY(6px); }
  100% { opacity: 1; transform: translateY(0); }
}
.tab-panel.active { animation: panelFade 0.35s ease-out; }

/* -------- Inputs: glowing focus -------- */
input:focus, textarea:focus, select:focus {
  box-shadow: 0 0 0 3px var(--primary-soft), 0 0 18px rgba(var(--primary-bright-rgb), 0.25);
}

/* -------- Day check satisfaction burst -------- */
@keyframes checkPop {
  0%   { transform: scale(0.4) rotate(-20deg); }
  50%  { transform: scale(1.35) rotate(8deg); }
  100% { transform: scale(1) rotate(0); }
}
@keyframes checkBurst {
  0%   { transform: scale(0.7); opacity: 0.9; }
  100% { transform: scale(2.4); opacity: 0; }
}
.day-check-toggle.checked {
  animation: checkPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}
.day-check-toggle.checked::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: checkBurst 0.6s ease-out forwards;
  pointer-events: none;
}

/* -------- Calendar cells: today breath, done pulse, tap pop -------- */
@keyframes todayBreath {
  0%, 100% { box-shadow: 0 0 0 2px var(--primary-soft), 0 0 16px rgba(var(--primary-bright-rgb), 0.15); }
  50%      { box-shadow: 0 0 0 3px var(--primary), 0 0 28px rgba(var(--primary-bright-rgb), 0.45); }
}
.cal-day.today { animation: todayBreath 3s ease-in-out infinite; }

@keyframes donePulse {
  0%, 100% { box-shadow: 0 0 0 1px var(--accent), 0 0 0 transparent; }
  50%      { box-shadow: 0 0 0 1px var(--accent), 0 0 16px rgba(16, 185, 129, 0.45); }
}
.cal-day.done { animation: donePulse 4s ease-in-out infinite; }

.cal-day { transition: transform 0.12s, border-color 0.18s, background 0.18s; }
.cal-day:hover:not(.outside) { transform: translateY(-2px) scale(1.03); }
.cal-day:active:not(.outside) { transform: scale(0.96); }

/* Video badge on calendar gets a continuous tiny breathing glow */
@keyframes videoBadgeGlow {
  0%, 100% { box-shadow: 0 1px 3px rgba(0,0,0,0.4), 0 0 0 transparent; }
  50%      { box-shadow: 0 1px 3px rgba(0,0,0,0.4), 0 0 10px rgba(var(--primary-bright-rgb), 0.75); }
}
.cal-day-video { animation: videoBadgeGlow 2.5s ease-in-out infinite; }

/* -------- Toast: spicier entrance -------- */
@keyframes toastIn {
  0%   { opacity: 0; transform: translateX(-50%) translateY(28px) scale(0.85); }
  55%  { transform: translateX(-50%) translateY(-6px) scale(1.06); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
.toast { animation: toastIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }

/* -------- PR best badge: subtle continuous glow -------- */
@keyframes prGlow {
  0%, 100% { box-shadow: 0 0 10px var(--primary-glow); }
  50%      { box-shadow: 0 0 24px rgba(var(--primary-bright-rgb), 0.85); }
}
.pr-best { animation: prGlow 3s ease-in-out infinite; }

/* -------- Phase badge subtle shimmer -------- */
.phase-badge {
  background-image: linear-gradient(90deg, var(--primary-soft) 30%, rgba(var(--primary-bright-rgb), 0.45) 50%, var(--primary-soft) 70%);
  background-size: 200% 100%;
  animation: shimmer 4s linear infinite;
}
@keyframes shimmer { to { background-position: 200% 0; } }

/* -------- Role pick buttons: hover lift + glow -------- */
.role-btn {
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.15s, background 0.15s;
}
.role-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(var(--primary-rgb), 0.22), 0 0 0 3px var(--primary-soft);
}
.role-btn:active { transform: translateY(0) scale(0.99); }
.role-btn .role-emoji {
  display: inline-block;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.role-btn:hover .role-emoji { transform: scale(1.2) rotate(-8deg); }

/* -------- Modal: pop entrance -------- */
@keyframes modalCardIn {
  0%   { opacity: 0; transform: translateY(40px) scale(0.92); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes backdropIn {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}
.modal:not(.hidden) .modal-card { animation: modalCardIn 0.32s cubic-bezier(0.34, 1.56, 0.64, 1); }
.modal:not(.hidden) .modal-backdrop { animation: backdropIn 0.2s ease-out; }

/* -------- Progress bar: fill has subtle stripe motion when in progress -------- */
.week-progress:not(.complete) .week-progress-fill {
  background-image:
    linear-gradient(90deg, var(--primary-bright), var(--accent)),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.18) 0 8px, transparent 8px 16px);
  background-blend-mode: overlay;
  background-size: 100% 100%, 32px 32px;
  animation: progressStripes 1.4s linear infinite;
}
@keyframes progressStripes {
  to { background-position: 0 0, 32px 0; }
}

/* -------- "PR saved" celebration class (toggled briefly) -------- */
@keyframes prCelebrate {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.08) rotate(1deg); }
  60%  { transform: scale(0.97) rotate(-1deg); }
  100% { transform: scale(1) rotate(0); }
}
.pr-celebrate {
  animation: prCelebrate 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}
.pr-celebrate::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--primary-bright);
  animation: prRing 0.9s ease-out forwards;
  pointer-events: none;
}
@keyframes prRing {
  0%   { transform: scale(0.85); opacity: 0.9; }
  100% { transform: scale(1.15); opacity: 0; }
}


/* ============================================================
   COACH DESKTOP-STYLE LAYOUT (sidebar + main)
   ============================================================ */
.coach-layout {
  display: flex;
  flex-direction: column; /* mobile: stack nav above main; desktop overrides to row */
  min-height: calc(100vh - 56px);
}
.coach-nav {
  display: flex;
  flex-direction: row;
  gap: 0.4em;
  padding: 0.6rem max(0.85rem, env(safe-area-inset-left)) 0.6rem max(0.85rem, env(safe-area-inset-right));
  background: rgba(10, 16, 25, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  position: sticky;
  top: 56px;
  z-index: 9;
}
.coach-nav::-webkit-scrollbar { display: none; }
.coach-nav-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-soft);
  cursor: pointer;
  padding: 0.55em 0.95em;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.2s;
}
.coach-nav-item:hover { color: var(--text); background: var(--surface-2); }
.coach-nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5em;
  height: 1.5em;
  padding: 0 0.35em;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
}
.coach-nav-item:active { transform: scale(0.97); }
.coach-nav-item.active {
  background: linear-gradient(180deg, var(--primary-bright), var(--primary));
  color: #062131;
  border-color: var(--primary-hover);
  box-shadow: 0 6px 16px rgba(var(--primary-rgb), 0.32);
}
.coach-nav-icon { font-size: 1.1em; }
.coach-main {
  flex: 1;
  min-width: 0;
  width: 100%; /* mobile: .coach-layout is column-direction, so this is the cross-axis size — without it, wide descendants (e.g. unwrapped rows) stretch this wider than the viewport instead of being constrained and wrapping */
  padding: 1.2rem max(0.85rem, env(safe-area-inset-left)) 3rem max(0.85rem, env(safe-area-inset-right));
}
.view-sub {
  margin: 0;
  font-size: 0.9rem;
}
.view-head > div:first-child { min-width: 0; flex: 1; }

/* Wide screens: turn nav into a left sidebar */
@media (min-width: 900px) {
  .coach-layout { flex-direction: row; }
  .coach-nav {
    flex-direction: column;
    gap: 0.3em;
    width: 240px;
    min-width: 240px;
    border-bottom: 0;
    border-right: 1px solid var(--border);
    padding: 1.4rem 0.9rem 1.4rem 1.2rem;
    position: sticky;
    top: 64px;
    align-self: flex-start;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    overflow-x: visible;
  }
  .coach-nav-item {
    width: 100%;
    justify-content: flex-start;
    border-radius: 12px;
    padding: 0.7em 0.9em;
    font-size: 0.95rem;
  }
  .coach-nav-item.active { box-shadow: 0 10px 24px rgba(var(--primary-rgb), 0.35); }
  .coach-main { padding-left: 0.5rem; }
}

/* Phones: fit every nav choice on one row (no side-scroll) by stacking the
   icon over a small label and letting each item flex-fill the width evenly. */
@media (max-width: 640px) {
  .coach-nav {
    gap: 0.2em;
    padding: 0.4rem max(0.35rem, env(safe-area-inset-left)) 0.4rem max(0.35rem, env(safe-area-inset-right));
    overflow-x: hidden;
  }
  .coach-nav-item {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
    padding: 0.45em 0.15em;
    border-radius: 12px;
    font-size: 0.6rem;
  }
  .coach-nav-icon { font-size: 1.3em; }
  .coach-nav-label {
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1;
  }
  /* Badge floats in the corner so it doesn't widen the cell. */
  .coach-nav-badge { position: absolute; top: 3px; right: calc(50% - 1.5em); min-width: 1.25em; height: 1.25em; }
}

/* ============================================================
   COACH WORKOUT LIBRARY
   ============================================================ */
.library-head-actions { display: flex; gap: 0.5em; flex-wrap: wrap; }

/* Recommended templates picker modal */
.rec-cat-chips {
  display: flex;
  gap: 0.4em;
  flex-wrap: wrap;
  margin-bottom: 1em;
  padding-bottom: 0.6em;
  border-bottom: 1px solid var(--border);
}
.rec-cat-chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-soft);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.4em 0.85em;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
}
.rec-cat-chip:hover { color: var(--text); border-color: var(--border-strong); }
.rec-cat-chip.active {
  background: linear-gradient(180deg, var(--primary-bright), var(--primary));
  color: #062131;
  border-color: var(--primary-hover);
}
.rec-reroll {
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
  margin-left: 0.15em;
  padding: 0.1em 0.55em;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.rec-reroll:hover { border-color: var(--primary); background: var(--surface-3); }
.rec-gen-badge {
  display: inline-block;
  margin-left: 0.35em;
  padding: 0.05em 0.5em;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
}
.rec-ex-item { display: inline; white-space: normal; }
.rec-fin { color: var(--warn); font-weight: 700; font-size: 0.78rem; }
.rec-ex-item .mod-chip { font-size: 0.62rem; padding: 0.02em 0.4em; margin-left: 0.15em; }
.rec-surprise-actions { margin-top: 0.6em; }
.rec-add-all {
  width: 100%;
  padding: 0.55em 1em;
  border: 1px dashed var(--primary);
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
}
.rec-add-all:hover:not(:disabled) { background: var(--surface-3); }
.rec-add-all:disabled { opacity: 0.7; cursor: default; border-style: solid; }
.rec-list { display: flex; flex-direction: column; gap: 0.6em; max-height: 60vh; overflow-y: auto; padding-right: 0.4em; }
.rec-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85em 1em;
  display: flex;
  flex-direction: column;
  gap: 0.4em;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.rec-card:hover { border-color: var(--primary); background: var(--surface-3); }
.rec-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.6em;
}
.rec-card h5 { margin: 0; font-size: 0.98rem; font-weight: 700; color: var(--text); }
.rec-card .rec-meta { font-size: 0.78rem; color: var(--text-soft); }
.rec-card .rec-add {
  background: linear-gradient(180deg, var(--primary-bright), var(--primary));
  color: #062131;
  border: 1px solid var(--primary-hover);
  border-radius: 999px;
  padding: 0.4em 0.9em;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.1s, box-shadow 0.15s;
}
.rec-card .rec-add:hover { box-shadow: 0 4px 14px var(--primary-glow); }
.rec-card .rec-add:active { transform: scale(0.95); }
.rec-card .rec-add.added { background: var(--accent); border-color: var(--accent); color: #062a1f; }
.rec-card .rec-ex-list {
  font-size: 0.82rem;
  color: var(--text-soft);
  line-height: 1.5;
}
.rec-card .rec-ex-list strong { color: var(--text); font-weight: 600; }

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.template-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.2s;
  animation: workoutCardIn 0.45s cubic-bezier(0.22, 0.85, 0.34, 1) both;
}
.template-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(var(--primary-bright-rgb), 0.13) 50%, transparent 65%);
  transform: translateX(-110%);
  transition: transform 0.7s cubic-bezier(0.22, 0.85, 0.34, 1);
  pointer-events: none;
}
.template-card:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 14px 28px rgba(var(--primary-rgb), 0.22), 0 0 0 1px rgba(var(--primary-bright-rgb), 0.3);
}
.template-card:hover::before { transform: translateX(120%); }
.template-card-head {
  display: flex;
  align-items: flex-start;
  gap: 0.7em;
  margin-bottom: 0.5em;
}
.template-card-icon {
  font-size: 1.7rem;
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.template-card h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
}
.template-card .template-focus {
  color: var(--text-soft);
  font-size: 0.85rem;
  margin: 0.15em 0 0;
}
.template-card .template-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35em;
  margin-top: 0.85em;
  padding-top: 0.85em;
  border-top: 1px solid var(--border);
}
.template-card .template-actions {
  display: flex;
  gap: 0.4em;
  margin-top: 0.75em;
  flex-wrap: wrap;
}
.template-card .template-actions .btn { flex: 1; min-width: 0; }

/* Template editor modal */
.template-editor-section { margin-bottom: 1rem; }
.template-editor-section h4 {
  margin: 0 0 0.5em;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary-bright);
}
.template-exercises {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.template-ex-row {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7em;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.4em;
}
.template-ex-row .row-grid {
  display: grid;
  grid-template-columns: 60px 80px 100px auto;
  gap: 0.4em;
  align-items: center;
}
.template-ex-row .row-grid input { padding: 0.4em 0.55em; font-size: 0.85rem; margin: 0; }
.template-ex-row label { margin: 0; font-size: 0.7rem; }
.template-ex-row .row-name input { font-weight: 700; }
.template-ex-row .row-delete {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0.35em 0.55em;
  border-radius: var(--radius);
  font-family: inherit;
  justify-self: end;
}
.template-ex-row .row-delete:hover { background: var(--danger-soft); color: #fca5a5; }
@media (max-width: 600px) {
  .template-ex-row .row-grid { grid-template-columns: 1fr; }
}

/* Day-card load-template button on coach program editor */
.day-tools {
  display: flex;
  gap: 0.4em;
  flex-wrap: wrap;
  margin-bottom: 0.7em;
}
.btn-load-template {
  background: var(--primary-soft);
  border: 1px solid rgba(var(--primary-bright-rgb), 0.35);
  color: var(--primary-bright);
  padding: 0.35em 0.7em;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.btn-load-template:hover {
  background: rgba(var(--primary-bright-rgb), 0.2);
  color: var(--primary-bright);
}

/* ============================================================
   ATHLETE WORKOUT PICKER + WORKOUT DETAIL
   ============================================================ */
.workout-picker { position: relative; }
/* The workout picker now uses the standard .program-head layout (like the
   Diet / PRs tabs) instead of a bespoke bordered card, so it reads as part
   of the same page family. */
.picker-heading h3 { margin: 0; }
.picker-sub {
  margin: 0.25em 0 0;
  color: var(--text-soft);
  font-size: 0.85rem;
}
.picker-logged {
  color: var(--text-soft);
  font-size: 0.85rem;
  white-space: nowrap;
  padding-top: 0.2em;
}
.picker-logged strong {
  color: var(--primary-bright);
  font-weight: 800;
}

/* ---- Week chip selector ---- */
.week-chips {
  display: flex;
  gap: 0.45em;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
}
.week-chip {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-soft);
  padding: 0.5em 0.85em;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  transition: transform 0.15s, background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.2s;
  min-height: 34px;
  line-height: 1.1;
  white-space: nowrap;
}
.week-chip:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  color: var(--text);
}
.week-chip.active {
  background: linear-gradient(180deg, var(--primary-bright), var(--primary));
  color: #062131;
  border-color: var(--primary-hover);
  box-shadow: 0 6px 16px rgba(var(--primary-rgb), 0.4);
}
.week-chip .chip-phase {
  display: block;
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
  margin-bottom: 1px;
}
.week-chip:not(.has-phase) .chip-phase { display: none; }

/* ---- Workout day cards ---- */
.workout-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.7rem;
}
@media (min-width: 640px) {
  .workout-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1000px) {
  .workout-grid { grid-template-columns: 1fr 1fr 1fr; }
}

.workout-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--day-color, var(--border));
  border-radius: 14px;
  padding: 0.95rem 1rem;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
              border-color 0.15s, box-shadow 0.2s, background 0.15s;
  overflow: hidden;
  animation: workoutCardIn 0.45s cubic-bezier(0.22, 0.85, 0.34, 1) both;
}
@keyframes workoutCardIn {
  0%   { opacity: 0; transform: translateY(12px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.workout-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(var(--primary-bright-rgb), 0.14) 50%, transparent 65%);
  transform: translateX(-110%);
  transition: transform 0.7s cubic-bezier(0.22, 0.85, 0.34, 1);
  pointer-events: none;
}
.workout-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: 0 16px 30px rgba(var(--primary-rgb), 0.22), 0 0 0 1px rgba(var(--primary-bright-rgb), 0.35);
}
.workout-card:hover::before { transform: translateX(120%); }
.workout-card:active { transform: translateY(-1px) scale(0.98); }
.workout-card.is-partial {
  border-color: rgba(var(--primary-bright-rgb), 0.4);
}
.workout-card.is-partial::after {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--primary-bright);
  box-shadow: 0 0 12px var(--primary-bright);
}
.workout-card.is-done {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--accent-soft) 0%, var(--surface) 70%);
}
.workout-card.is-done::after {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent);
}
.workout-card-icon {
  font-size: 1.9rem;
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: var(--day-color-soft, var(--surface-2));
  border: 1px solid var(--day-color, var(--border));
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.workout-card:hover .workout-card-icon { transform: rotate(-6deg) scale(1.06); }
.workout-card-body { flex: 1; min-width: 0; }
.workout-card-title {
  margin: 0 0 0.25em;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  /* Wrap to two lines instead of clipping ("Upper Body" was becoming "Upper …") */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.workout-card-meta {
  display: flex;
  gap: 0.35em;
  flex-wrap: wrap;
}
.meta-pill {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.2em 0.55em;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-soft);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.meta-done   { background: var(--accent-soft); color: var(--accent); border-color: rgba(16, 185, 129, 0.4); }
.meta-progress { background: var(--primary-soft); color: var(--primary-bright); border-color: rgba(var(--primary-bright-rgb), 0.35); }
.meta-todo   { background: rgba(245, 158, 11, 0.13); color: var(--warn); border-color: rgba(245, 158, 11, 0.3); }
.workout-card-chevron {
  font-size: 1.6rem;
  color: var(--muted);
  margin-left: 0.3em;
  transition: transform 0.2s, color 0.15s;
}
.workout-card:hover .workout-card-chevron {
  color: var(--primary-bright);
  transform: translateX(4px);
}

/* "See all weeks" fallback collapsed by default — keeps existing UI accessible */
.all-weeks-fallback {
  margin-top: 1.5rem;
  border-top: 1px dashed var(--border-strong);
  padding-top: 1rem;
}
.all-weeks-fallback > summary {
  list-style: none;
  cursor: pointer;
  color: var(--text-soft);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.5em 0;
}
.all-weeks-fallback > summary::-webkit-details-marker { display: none; }
.all-weeks-fallback > summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform 0.2s;
}
.all-weeks-fallback[open] > summary::before { content: "▾ "; }

/* ---- Workout detail view ---- */
.workout-detail { animation: detailIn 0.35s cubic-bezier(0.22, 0.85, 0.34, 1); }
@keyframes detailIn {
  0%   { opacity: 0; transform: translateX(20px); }
  100% { opacity: 1; transform: translateX(0); }
}
.workout-detail .back-link {
  margin-bottom: 1rem;
}
.workout-detail-head {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.65rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.workout-detail-head::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 100% 0%, var(--primary-soft) 0%, transparent 40%);
  pointer-events: none;
}
.workout-detail-head > * { position: relative; z-index: 1; }
.detail-head-top {
  display: flex;
  gap: 0.55em;
  align-items: center;
  margin-bottom: 0.6em;
  flex-wrap: wrap;
  font-size: 0.85rem;
}
.detail-head-main {
  display: flex;
  align-items: center;
  gap: 0.85em;
  margin-bottom: 0.6em;
}
.detail-head-main h2 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 800;
}
.detail-head-main .detail-log-date {
  width: auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-soft);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3em 0.5em;
  margin-top: 0;
  color-scheme: dark;
}
.detail-head-stats {
  display: flex;
  gap: 0.4em;
  flex-wrap: wrap;
}

.workout-detail-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  background: var(--border);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  gap: 1px;
}

/* ── Compact client exercise rows ── */
.cex-wrapper {
  background: var(--surface);
}

.cex-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  min-height: 46px;
}

.cex-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.cex-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.cex-circle.done {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.cex-name-block {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.cex-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}
.cex-wrapper.logged > .cex-row .cex-name { color: var(--text-soft); }

.cex-rx {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  overflow: hidden;
}
.cex-rx-main {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cex-last-log {
  font-size: 0.67rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
}

/* ── Panel ── */
.cex-panel {
  padding: 0.5rem 0.85rem 0.75rem;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.cex-goal {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
}

.cex-coach-note {
  font-size: 0.78rem;
  color: var(--text-soft);
  font-style: italic;
  padding: 0.45rem 0.65rem;
  border-left: 2px solid var(--primary);
  border-radius: 0 4px 4px 0;
  background: var(--primary-soft);
  line-height: 1.45;
}

.cex-log-form {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

/* set table replaces old cex-inputs */
.cex-set-table {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  align-items: flex-start;
  align-self: flex-start;
}
.cex-set-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  /* Shrinkable so many columns (warm-ups + working sets + dropset) compress
     to fit before wrapping/scrolling, instead of jamming. */
  flex: 0 1 54px;
  min-width: 44px;
  /* Query container so the input/label font scales with the column width —
     text shrinks right along with the columns. */
  container-type: inline-size;
}
/* Weight or reps input with a ▲ button above it and a ▼ button below it,
   spaced equally from the box. */
.cex-set-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.cex-set-field .cex-input { margin: 0; }
/* Extra room between the weight field and the reps field so the reps ▲ and
   the weight ▼ (which sit right next to each other) aren't easy to mis-tap. */
.cex-set-field + .cex-set-field { margin-top: 0.3rem; }
.cex-set-lbl {
  font-size: clamp(0.55rem, 28cqw, 0.75rem); /* scales with column width */
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-soft);
  text-align: center;
}
.cex-no-sets {
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
  margin: 0;
  padding: 0.3rem 0;
}
/* Lock / Edit control pinned to the top-right of the exercise title row. */
.cex-lock-slot {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.cex-lock-btn { padding: 0.35em 0.6em; font-size: 0.9rem; line-height: 1; }
/* The ▲ / ▼ buttons above and below each weight/reps box (weight ±2.5 lb,
   reps ±1). Full width of the field, short height. */
.cex-step {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.2em 0;
  font-size: 0.6rem;
  line-height: 1;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text-soft);
  cursor: pointer;
  font-family: inherit;
  -webkit-user-select: none;
  user-select: none;
}
.cex-step:hover { border-color: var(--accent); color: var(--accent); }
.cex-step:active { background: var(--accent); border-color: var(--accent); color: #04120c; }
.cex-step:disabled { opacity: 0.4; cursor: default; }
.cex-edit-btn {
  background: none;
  border: none;
  color: var(--text-soft);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.3em 0.2em;
  font-family: inherit;
}
.cex-edit-btn:hover { color: var(--primary); }
@media (max-width: 600px) {
  /* Shrink set columns so 5-6 sets fit on one row instead of wrapping
     and growing the card's height. */
  .cex-set-table { gap: 0.3rem 0.22rem; flex-wrap: nowrap; overflow-x: auto; }
  /* Columns shrink to fit more sets on screen (down to a usable min), then
     scroll only once they can't shrink further. */
  .cex-set-col { flex: 0 1 36px; min-width: 30px; width: auto; }
  /* Font now scales with column width via container queries (see base rules),
     so no fixed mobile font-size override — just tighten the input padding. */
  .cex-set-col .cex-input { padding: 0.3em 0.05em; }
  /* Tighter vertical gaps so the taller stacked fields don't balloon the row. */
  .cex-set-col { gap: 0.35rem; }
  .cex-set-field { gap: 2px; }
  /* The "See all weeks" cards sit one level deeper (inside .week-body),
     which eats extra horizontal space the workout-detail cards don't
     lose — trim that padding and shrink columns a bit more so all 6
     sets are visible without needing to scroll. */
  .week-body { padding: 0.6rem; }
  .client-day-card .cex-set-col { width: 36px; }
}
.cex-log-bottom {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.cex-log-bottom .cex-field { flex: 1; }
.cex-log-btn { flex-shrink: 0; white-space: nowrap; }

.cex-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.cex-field > span {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}
.cex-set-col .cex-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: clamp(0.72rem, 37cqw, 1rem); /* scales with column width */
  font-weight: 700;
  padding: 0.38em 0.05em; /* minimal side padding so 3-digit numbers have room */
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  text-align: center;
}
.cex-input:focus {
  outline: none;
  border-color: var(--primary);
}
.cex-set-col .cex-input[readonly] {
  background: var(--surface-2);
  color: var(--text-soft);
  cursor: default;
}
.cex-set-col .cex-input[readonly]:focus { box-shadow: none; border-color: var(--border); }
/* Placeholder = coach-prescribed target to attempt today — must read clearly at a glance. */
.cex-input::placeholder {
  color: var(--primary-bright);
  font-weight: 700;
  opacity: 1;
}


.cex-hist {
  border-top: 1px solid var(--border);
  padding-top: 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.cex-hist-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: var(--text-soft);
}
.cex-hist-date {
  color: var(--muted);
  flex-shrink: 0;
  min-width: 80px;
}
.cex-hist-sets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  flex: 1;
}
.cex-hist-set {
  background: var(--surface-2);
  border-radius: 4px;
  padding: 0.1em 0.45em;
  font-size: 0.7rem;
  white-space: nowrap;
}
.cex-hist-set em {
  font-style: normal;
  color: var(--muted);
  margin-right: 0.2em;
}
.cex-del-log {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  margin-left: auto;
  padding: 0 0.25em;
  opacity: 0.6;
  flex-shrink: 0;
}
.cex-del-log:hover { opacity: 1; color: var(--danger); }

/* ===== Day note block (athlete) ===== */
.day-note-block {
  margin: 0.6rem 0 0.2rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.day-note-toggle {
  display: flex;
  align-items: center;
  gap: 0.5em;
  width: 100%;
  background: var(--surface-2);
  border: none;
  padding: 0.7em 1em;
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}
.day-note-toggle:hover { background: var(--surface-3); color: var(--text); }
.day-note-toggle.has-note { color: var(--primary-bright); background: var(--primary-soft); }
.day-note-icon { font-size: 0.9rem; }
.day-note-label { flex: 1; }
.day-note-chevron { font-size: 1rem; color: var(--muted); margin-left: auto; }
.day-note-area {
  padding: 0.7rem;
  background: var(--bg);
}
.day-note-area.hidden { display: none; }
.day-note-ta {
  width: 100%;
  box-sizing: border-box;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.85rem;
  padding: 0.6em 0.75em;
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
}
.day-note-ta:focus { outline: none; border-color: var(--primary); }

/* ===== Day note coach view ===== */
.day-note-coach-row {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
}
.day-note-coach-row:last-child { border-bottom: none; }
.day-note-coach-day {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.2em;
}
.day-note-coach-text {
  font-size: 0.88rem;
  color: var(--text);
  white-space: pre-wrap;
}

/* Mobile tweaks */
@media (max-width: 720px) {
  .workout-detail-list {
    grid-template-columns: 1fr;
    gap: 0.7rem;
    background: transparent;
    border: none;
  }
  .cex-wrapper {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
  }
  .workout-card { padding: 0.75rem 0.85rem; gap: 0.7rem; }
  .workout-card-icon { width: 44px; height: 44px; font-size: 1.55rem; border-radius: 12px; }
  .workout-card-title { font-size: 0.9rem; }
  .meta-pill { font-size: 0.6rem; padding: 0.18em 0.5em; }
  .week-chip { padding: 0.45em 0.75em; font-size: 0.72rem; }
  .detail-head-main h2 { font-size: 1.15rem; }
  .workout-detail-head { padding: 0.9rem 1rem; border-radius: 12px; }
  .cex-panel { padding: 0.65rem 0.85rem 0.85rem; }
}

/* ===== Coach week tabs ===== */
.coach-week-tab-strip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  margin-bottom: 0;
  padding: 0 0.3rem;
  background: var(--surface);
}
.coach-week-tab-strip::-webkit-scrollbar { display: none; }
/* Fade hint on the right edge so an overflowing tab strip reads as
   "scroll for more" rather than looking like clipped/cut-off content. */
.coach-week-tab-strip::after {
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 22px;
  background: linear-gradient(to right, transparent, var(--surface));
  pointer-events: none;
}

.coach-week-tab {
  display: flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.55em 0.85em;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--text-soft);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.12s, border-color 0.12s;
}
.coach-week-tab:hover { color: var(--text); }
.coach-week-tab.active {
  color: var(--primary-bright);
  border-bottom-color: var(--primary);
}

.coach-week-tab-lbl { pointer-events: none; }

.coach-week-tab-del,
.coach-week-tab-dup {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1;
  padding: 0 0.1em;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s, color 0.12s;
  flex-shrink: 0;
}
.coach-week-tab:hover .coach-week-tab-del,
.coach-week-tab.active .coach-week-tab-del,
.coach-week-tab:hover .coach-week-tab-dup,
.coach-week-tab.active .coach-week-tab-dup { opacity: 1; }
.coach-week-tab-del:hover { color: var(--danger) !important; }
.coach-week-tab-dup:hover { color: var(--primary) !important; }

.coach-week-tab-add {
  font-size: 1rem;
  padding: 0.45em 0.8em;
  color: var(--muted);
  border-bottom-color: transparent !important;
}
.coach-week-tab-add:hover { color: var(--primary); }

.coach-week-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding-bottom: 0.5rem;
}

/* ===== Load Program Modal ===== */
.load-prog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.7rem;
  margin-top: 0.25rem;
}
.load-prog-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.load-prog-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}
.load-prog-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
}
.load-prog-desc {
  font-size: 0.78rem;
  color: var(--text-soft);
  line-height: 1.4;
}
.load-prog-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3em;
  margin-top: 0.1rem;
}

/* ===== Assign-to-athlete picker ===== */
.assign-athlete-grid {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.25rem;
}
.assign-athlete-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0.75rem 1rem;
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.12s;
  user-select: none;
}
.assign-athlete-card:hover { border-color: var(--primary); background: var(--surface); }
.assign-athlete-card.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.assign-athlete-name { font-weight: 700; font-size: 0.92rem; color: var(--text); }
.assign-athlete-meta { font-size: 0.75rem; color: var(--muted); }

/* ===== Program Archive ===== */
#archive-container,
#client-archive-container {
  margin-top: 1.5rem;
}

.archive-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
}

.archive-summary {
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.9rem 1.1rem;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
  color: var(--text);
  background: var(--surface-2);
  border-bottom: 1px solid transparent;
}
.archive-section[open] .archive-summary {
  border-bottom-color: var(--border);
}
.archive-summary::-webkit-details-marker { display: none; }
.archive-summary::before {
  content: "▸";
  color: var(--muted);
  font-size: 0.8rem;
  transition: transform 0.18s;
  display: inline-block;
  flex-shrink: 0;
}
.archive-section[open] .archive-summary::before { transform: rotate(90deg); }

.archive-prog-card {
  border-bottom: 1px solid var(--border);
}
.archive-prog-card:last-child { border-bottom: none; }

.archive-prog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.8rem 1.1rem;
  flex-wrap: wrap;
}
.archive-prog-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.archive-prog-label {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text);
}
.archive-prog-meta {
  font-size: 0.72rem;
  color: var(--muted);
}
.archive-prog-actions {
  display: flex;
  gap: 0.4em;
  flex-shrink: 0;
}

.archive-prog-body {
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: 0.75rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.archive-prog-body.hidden { display: none; }

.archive-week-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.archive-week-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5em;
  padding: 0.6rem 0.85rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  flex-wrap: wrap;
}
.archive-week-label { font-weight: 700; color: var(--text); }
.archive-week-meta { font-size: 0.7rem; color: var(--muted); flex-shrink: 0; }

.archive-day {
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 0.85rem 0.6rem;
}
.archive-day:last-child { border-bottom: none; }

.archive-day-name {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.archive-ex-row {
  display: flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.25rem 0;
  font-size: 0.82rem;
  color: var(--text-soft);
  border-bottom: 1px solid var(--border);
}
.archive-ex-row:last-child { border-bottom: none; }
.archive-ex-chips { display: flex; gap: 2px; flex-shrink: 0; }
.archive-ex-name { flex: 1; font-weight: 600; color: var(--text); }
.archive-ex-rx { font-size: 0.7rem; color: var(--muted); flex-shrink: 0; }

/* ===== Program Template List ===== */
/* Compact rows — 4-5 programs visible per screen */
.program-template-grid {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.program-tpl-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--warn); /* in-progress accent; ready overrides to green */
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.3rem;
  display: flex;
  align-items: center;
  gap: 1.1rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.program-tpl-card:hover {
  border-top-color: var(--border-strong);
  border-right-color: var(--border-strong);
  border-bottom-color: var(--border-strong);
  box-shadow: 0 8px 24px rgba(var(--primary-rgb), 0.16);
  transform: translateY(-2px);
}
.program-tpl-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.program-tpl-card h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.program-tpl-card .desc {
  color: var(--text-soft);
  font-size: 0.82rem;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.program-tpl-meta { display: flex; flex-wrap: wrap; gap: 0.4em; margin-top: 0.1rem; }
.tpl-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-soft);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2em 0.62em;
}
.program-tpl-actions {
  display: flex;
  align-items: center;
  gap: 0.45em;
  flex-shrink: 0;
}
.program-tpl-actions .btn { font-size: 0.78rem; padding: 0.5em 0.9em; }
@media (max-width: 600px) {
  /* Stack the card so the program name reads in full up top, then the meta
     chips, then the action buttons along the bottom. */
  .program-tpl-card {
    flex-direction: column;
    align-items: stretch;
    gap: 0.8rem;
    padding: 1rem 1.05rem;
  }
  .program-tpl-card h3 {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    font-size: 1.05rem;
    line-height: 1.25;
  }
  .program-tpl-card .desc {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }
  .program-tpl-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0.5em;
    padding-top: 0.15rem;
    border-top: 1px solid var(--border);
  }
  .program-tpl-actions .btn { flex: 1 1 auto; padding: 0.6em 0.7em; font-size: 0.8rem; }
  .program-tpl-actions .btn-delete-mini { flex: 0 0 auto; }
}

/* In progress / Ready-to-assign split */
.program-section { margin-bottom: 2.1rem; }
.program-section-head {
  display: flex; align-items: center; gap: 0.5em;
  margin: 0 0 0.6rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}
.program-section-title {
  font-size: 0.78rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--text-soft);
}
.program-section-count {
  font-size: 0.7rem; font-weight: 700;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 0.05em 0.55em;
}
.program-section-empty { font-size: 0.8rem; padding: 0.2rem 0 0.4rem; }
.program-template-grid-inner { display: flex; flex-direction: column; gap: 0.8rem; }
/* Ready programs get a green left accent so the two buckets read at a glance */
.program-tpl-card.is-ready { border-left-color: #22c55e; }
#btn-toggle-program-status.is-ready { color: #22c55e; border-color: rgba(34,197,94,0.5); }

/* ===== Program Editor ===== */
.program-editor-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5em 1em;
  margin-bottom: 1.5rem;
}
.program-editor-head .back-link {
  flex: 0 0 100%; /* own row, like the old standalone element above .view-head */
  margin-bottom: 0; /* row gap replaces the old fixed margin-bottom */
  order: 0;
}
.program-editor-fields {
  flex: 1 1 auto;
  min-width: 0;
  order: 1;
}
#btn-assign-program { order: 2; flex-shrink: 0; }

/* Mobile: back-link + assign button share the top row; name/description
   move below as their own full-width row instead of sitting to the side. */
@media (max-width: 600px) {
  .program-editor-head .back-link { flex: 0 1 auto; }
  #btn-assign-program { order: 1; margin-left: auto; }
  .program-editor-fields { flex: 1 1 100%; order: 2; }
}

.program-editor-name-input {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--border);
  color: var(--text);
  font-size: 1.4rem;
  font-weight: 800;
  font-family: inherit;
  padding: 0.1em 0;
  margin-bottom: 0.4rem;
  outline: none;
  transition: border-color 0.15s;
}
.program-editor-name-input:focus { border-color: var(--primary); }
.program-editor-desc-input {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-soft);
  font-size: 0.9rem;
  font-family: inherit;
  padding: 0;
  outline: none;
}
.program-editor-desc-input::placeholder { color: var(--muted); }

/* ===== Compact Program Builder ===== */

/* Week head — now with chevron icon */
.week-head-left { display: flex; align-items: center; gap: 0.6em; }
.week-toggle-icon {
  color: var(--text-soft);
  font-size: 0.85rem;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.week-card.open .week-toggle-icon { transform: rotate(90deg); }
.btn-icon-mini {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.25em 0.4em;
  border-radius: 4px;
  font-size: 0.8rem;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}
.btn-icon-mini:hover { color: var(--danger); background: rgba(239,68,68,0.1); }

/* Focus bar */
.week-focus-bar { padding: 0.5rem 1.2rem; border-bottom: 1px solid var(--border); }
.week-focus-compact {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-soft);
  font-size: 0.83rem;
  font-family: inherit;
  padding: 0;
  outline: none;
}
.week-focus-compact::placeholder { color: var(--muted); }
.week-focus-compact:focus { color: var(--text); }

/* Day tab strip */
.day-tab-strip {
  display: flex;
  align-items: flex-end;
  gap: 0.1rem;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border);
  padding: 0.7rem 1rem 0;
  background: rgba(0, 0, 0, 0.18);
}
.day-tab-strip::-webkit-scrollbar { display: none; }
.day-tab {
  flex-shrink: 0;
  padding: 0.55em 1em;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-soft);
  font-size: 0.83rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.day-tab:hover { color: var(--text); }
.day-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.day-tab-add { color: var(--muted); font-weight: 400; font-size: 0.78rem; }
.day-tab-add:hover { color: var(--primary); }
.day-tab-import { color: var(--primary); }
.day-tab-import:hover { color: var(--primary); background: var(--surface-2); }
.day-tab[draggable="true"] { cursor: grab; }
.day-tab-dragging { opacity: 0.45; }
.day-tab-dragover { border-bottom-color: var(--primary); background: var(--surface-2); }

/* Day content area */
.day-content-area { padding: 0; }
.day-content { display: flex; flex-direction: column; }

/* Day action bar */
.day-action-bar {
  display: flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--border);
}
/* `input.` prefix needed so this beats the base `input[type="text"]` rule
   (same specificity, wins by source order) — otherwise the day name renders
   as a chunky default box instead of this subtle inline field. */
input.day-name-compact {
  background: transparent;
  border: none;
  border-bottom: 1px dashed var(--border);
  border-radius: 0;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  padding: 0.15em 0.15em;
  outline: none;
  min-width: 80px;
  cursor: text;
  transition: border-color 0.15s;
}
input.day-name-compact::placeholder { color: var(--muted); font-weight: 400; }
input.day-name-compact:hover { border-bottom-color: var(--text-soft); }
input.day-name-compact:focus { background: transparent; border-bottom: 1px solid var(--primary); box-shadow: none; }
.day-name-wrap { display: flex; align-items: center; gap: 0.35em; }
.day-icon-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.3em 0.45em;
  flex-shrink: 0;
  transition: border-color 0.12s, background 0.12s;
}
.day-icon-btn:hover { border-color: var(--primary); background: var(--surface-3); }
.grid-picker-pop-icon { min-width: 300px; max-width: 320px; }
.icon-picker-grid { grid-template-columns: repeat(6, 1fr); max-height: 240px; }
.icon-picker-cell { font-size: 1.3rem; padding: 0.4em 0.15em; }
/* Custom SVG equipment icons: inherit box font-size + text color */
.day-icon-btn svg,
.icon-picker-cell svg,
.day-log-icon svg,
.workout-card-icon svg {
  width: 1.05em; height: 1.05em;
  display: inline-block; vertical-align: middle;
}
.btn.btn-xs {
  font-size: 0.72rem;
  padding: 0.28em 0.6em;
  border-radius: 4px;
}

/* Exercise table header */
.ex-table-head {
  display: grid;
  grid-template-columns: 22px 1fr 46px 190px 190px 58px;
  gap: 4px;
  padding: 0.3rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.ex-th-cur, .ex-th-goal { padding-left: 4px; }

/* Exercise rows */
.ex-compact-list {
  display: flex;
  flex-direction: column;
  min-height: 2rem;
  gap: 0.4rem;
  padding: 0.4rem 0;
}
.ex-compact-list.drag-over { background: var(--primary-soft); outline: 2px dashed var(--primary); outline-offset: -2px; }

/* Superset block — groups exercises done back-to-back (coach editor + athlete) */
.superset-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.45rem 0.5rem 0.55rem;
  border: 1px solid rgba(var(--primary-rgb), 0.3);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  background: rgba(var(--primary-rgb), 0.05);
}
.superset-head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0 0.1rem 0.1rem;
}
.superset-badge {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary-bright);
}
.superset-hint { font-size: 0.72rem; }
.ex-ss-btn.active { color: var(--primary); }

.ex-row-wrapper {
  background: var(--surface-2);
  border-radius: var(--radius);
}
.ex-row-wrapper.drag-above { border-top: 2px solid var(--primary); }
.ex-row-wrapper.drag-below { border-bottom: 2px solid var(--primary); }
.ex-row-wrapper.dragging { opacity: 0.35; }

.ex-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.5em 1rem;
  min-height: 44px;
  transition: background 0.12s;
}
.ex-row:hover { background: var(--surface-2); }

.ex-name-compact {
  flex: 1;
  min-width: 80px;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  padding: 0.2em 0.3em;
  border-radius: 4px;
  outline: none;
  transition: background 0.12s;
}
.ex-name-compact:focus { background: var(--surface-3); }
.ex-name-compact::placeholder { color: var(--muted); }

.picker-btn-sm {
  font-size: 0.78rem !important;
  padding: 0.25em 0.5em !important;
  min-width: 44px;
  text-align: center;
  flex-shrink: 0;
}

.ex-row-sep {
  color: var(--muted);
  font-size: 0.75rem;
  flex-shrink: 0;
  user-select: none;
}
.ex-arrow { font-size: 0.85rem; color: var(--primary); opacity: 0.7; }

.ex-expand-btn, .ex-del-btn {
  flex-shrink: 0;
  opacity: 0.4;
  transition: opacity 0.15s, color 0.15s;
}
.ex-expand-btn:hover { opacity: 1; color: var(--primary); }
.ex-del-btn:hover { opacity: 1; color: var(--danger); }
.ex-expand-btn.active { opacity: 1; color: var(--primary); }
.ex-save-btn { flex-shrink: 0; opacity: 0.55; color: #34d399; transition: opacity 0.15s; }
.ex-save-btn:hover { opacity: 1; }
.ex-edit-btn { flex-shrink: 0; opacity: 0.45; color: var(--primary-bright); transition: opacity 0.15s; }
.ex-edit-btn:hover { opacity: 1; }
.ex-locked .picker-btn { opacity: 0.65; cursor: default; }
.ex-locked input[type="text"] { opacity: 0.65; }
.ex-locked .mod-add-btn { opacity: 0.3; pointer-events: none; }

/* Expandable detail panel */
.ex-detail-panel {
  padding: 0.5rem 1rem 0.6rem calc(1rem + 22px + 4px);
  display: flex;
  gap: 0.5rem;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}
.ex-notes-compact {
  flex: 2;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.8rem;
  padding: 0.4em 0.6em;
  resize: vertical;
  min-height: 44px;
}
.ex-video-compact {
  flex: 1;
  min-width: 0;
  font-size: 0.78rem;
}
.add-ex-btn {
  margin: 0.5rem 1rem;
  align-self: flex-start;
}

.ex-metrics-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Exercise rows on mobile: the fixed-width flex row (drag handle, name,
   sets/weight/reps pickers, notes/edit/delete buttons) needs ~550-600px
   and there's no horizontal scroll on the page — wrap it onto multiple
   lines instead. Also swap the drag handle (native HTML5 drag doesn't
   work on touch) for tap-based move-up/move-down buttons. */
@media (max-width: 600px) {
  .ex-table-head { display: none; } /* fixed-width grid header doesn't apply once rows wrap */
  .ex-row {
    flex-wrap: wrap;
    padding: 0.65rem 0.6rem;
  }
  .ex-name-compact {
    flex: 1 1 100%;
    min-width: 0;
  }
  .mod-chips-before, .mod-chips-after { flex-wrap: wrap; }
  /* Safety net: let the sets cluster wrap rather than run off a tiny screen. */
  .ex-metrics-group { flex-wrap: wrap; }
  .ex-drag-handle { display: none; }
  .ex-move-btn { display: inline-flex; }
  .ex-detail-panel { padding-left: 0.6rem; }

  /* Day action bar (name, icon, Library button, delete-day) has the same
     no-wrap problem — the "📖 Library" button (the only working way to add
     an exercise on touch, since drag-and-drop doesn't work there) was
     sitting off-screen to the right on real phone widths. */
  .day-action-bar {
    flex-wrap: wrap;
    row-gap: 0.4em;
  }

  /* These "drag exercises here" hints are dead weight on mobile — drag
     doesn't work on touch, and the "📖 Library" button in the day action
     bar above is the real way to add exercises there. */
  .ex-list-empty-drop,
  .ex-list-drop-hint {
    display: none;
  }
}

/* ===== Persistent Exercise Library Sidebar ===== */
.ex-lib-sidebar {
  display: none; /* hidden by default; shown via .show-lib-sidebar on parent */
  flex-direction: column;
  width: 270px;
  min-width: 270px;
  border-left: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 64px;
  align-self: flex-start; /* don't stretch to the content column's height, or
                             sticky has no room to move and just scrolls away */
  height: calc(100vh - 64px);
  overflow: hidden;
  flex-shrink: 0;
}

/* Show sidebar when parent has the class */
.coach-layout.show-lib-sidebar .ex-lib-sidebar { display: flex; }

/* On mobile: hide the sidebar entirely rather than stacking it below —
   it's a drag-only source and drag-and-drop doesn't work on touch, so a
   visible-but-non-functional sidebar just confuses things. Mobile adds
   exercises via the per-day "📖 Library" button, which opens a tap-to-add
   modal instead (see .ex-lib-mobile-btn below). */
@media (max-width: 899px) {
  .coach-layout.show-lib-sidebar .ex-lib-sidebar { display: none; }
}

.ex-lib-sb-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0.75rem 1rem 0.4rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ex-lib-sb-title {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-soft);
}
.ex-lib-sb-hint {
  font-size: 0.7rem;
  color: var(--muted);
}

.ex-lib-sb-search {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ex-lib-sb-search input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  padding: 0.4em 0.6em;
  outline: none;
}
.ex-lib-sb-search input:focus { border-color: var(--primary); }

.ex-lib-sb-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.25rem 0;
}
.ex-lib-sb-cat {
  padding: 0.5rem 0.75rem 0.2rem;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.ex-lib-sb-item {
  display: block;
  padding: 0.42rem 0.75rem;
  font-size: 0.82rem;
  color: var(--text-soft);
  cursor: grab;
  border-radius: 4px;
  transition: background 0.1s, color 0.1s;
  user-select: none;
}
.ex-lib-sb-item:hover { background: var(--primary-soft); color: var(--text); }
.ex-lib-sb-item:active { cursor: grabbing; }
.ex-lib-sb-item.dragging-active { opacity: 0.4; }

/* Hide the mobile library button on desktop where the sidebar is visible */
@media (min-width: 900px) {
  .coach-layout.show-lib-sidebar .ex-lib-mobile-btn { display: none; }
}

/* ===== Exercise Modifier Chips ===== */
.mod-chips-before,
.mod-chips-after {
  display: flex;
  gap: 3px;
  align-items: center;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.mod-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.15em 0.45em;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  background: var(--mb);
  color: var(--mc);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: opacity 0.12s;
  line-height: 1.4;
}
.mod-chip:hover { opacity: 0.65; }

.mod-add-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.18em 0.5em;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.mod-add-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

/* ===== Modifier Picker Popover ===== */
.mod-picker-pop {
  position: fixed;
  z-index: 2000;
  width: 260px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.55);
  padding: 0.65rem 0.75rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.mod-picker-grp { display: flex; flex-direction: column; gap: 0.3rem; }
.mod-picker-lbl {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.mod-picker-row { display: flex; flex-wrap: wrap; gap: 5px; }
.mod-picker-btn {
  padding: 0.3em 0.65em;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.mod-picker-btn:hover { border-color: var(--primary); color: var(--text); }
.mod-picker-btn.on {
  background: var(--mb);
  color: var(--mc);
  border-color: var(--mc);
}

/* -------- Grid Picker -------- */
.grid-picker-pop {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 32px rgba(0,0,0,0.45);
  padding: 0.55rem;
  min-width: 210px;
}
.grid-picker-pop-weight { min-width: 270px; }
.grid-picker-head {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-soft);
  font-weight: 700;
  margin-bottom: 0.4rem;
  padding: 0 0.1rem;
}
.grid-picker-tabs {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  margin-bottom: 0.45rem;
}
.grid-picker-tab {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-soft);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.22em 0.55em;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.grid-picker-tab:hover { border-color: var(--primary); color: var(--text); }
.grid-picker-tab.active {
  border-color: var(--primary);
  color: var(--primary-bright);
  background: var(--primary-soft);
}
.grid-picker-grid {
  display: grid;
  gap: 0.22rem;
  max-height: 200px;
  overflow-y: auto;
}
.grid-picker-cell {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.38em 0.15em;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  white-space: nowrap;
  transition: border-color 0.1s, background 0.1s, color 0.1s;
}
.grid-picker-cell:hover {
  border-color: var(--primary);
  background: var(--surface);
  color: var(--primary-bright);
}
.grid-picker-cell.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-bright);
}

/* Empty day drop zone */
.ex-list-empty-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 6rem;
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  margin: 0.75rem 1rem;
  pointer-events: none;
  transition: border-color 0.15s, color 0.15s;
}
.ex-compact-list.drag-over .ex-list-empty-drop {
  border-color: var(--primary);
  color: var(--primary);
}

.library-section-title {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

/* Slim drop hint shown below existing exercises */
.ex-list-drop-hint {
  padding: 0.45rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.72rem;
  border-top: 1px dashed var(--border);
  pointer-events: none;
  transition: color 0.15s, border-color 0.15s;
}
.ex-compact-list.drag-over .ex-list-drop-hint {
  color: var(--primary);
  border-color: var(--primary);
}

/* -------- Coach "View as athlete" preview -------- */
.preview-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75em;
  flex-wrap: wrap;
  padding: 0.6em 1em;
  background: rgba(245, 158, 11, 0.14);
  border-bottom: 1px solid var(--warn);
  color: var(--text);
  font-size: 0.9rem;
}
.preview-banner-msg { color: var(--text-soft); }
.preview-banner-msg strong { color: var(--warn); }
.preview-banner .btn {
  background: var(--warn);
  border: none;
  color: #1a1205;
  font-weight: 600;
  white-space: nowrap;
}
/* Read-only: block ALL interaction inside the portal body, then re-enable
   ONLY navigation (tabs, week chips, day cards, back link, calendar nav).
   Blocking at the container also defeats the <label>-wrapped toggle gotcha
   (the label itself becomes inert), and covers every athlete-side action
   button — sessions, PRs, cardio, nutrition — without an allow-list per tab.
   The athlete can't type in reps/weight, log, claim slots, or toggle prefs. */
body.preview-mode #screen-client .app-main { pointer-events: none; }
/* Dim data-entry fields + every button so it's obvious nothing on the
   athlete's side is live... */
body.preview-mode #screen-client input,
body.preview-mode #screen-client textarea,
body.preview-mode #screen-client select,
body.preview-mode #screen-client .app-main button {
  opacity: 0.45;
}
/* ...then re-enable AND un-dim only the navigation controls. */
body.preview-mode #screen-client .tab,
body.preview-mode #screen-client .week-chip,
body.preview-mode #screen-client .workout-card,
body.preview-mode #screen-client .back-link,
body.preview-mode #screen-client #ccal-prev,
body.preview-mode #screen-client #ccal-next,
body.preview-mode #screen-client #ccal-today {
  pointer-events: auto;
  opacity: 1;
}
/* Header Exit/Install would sign the coach out — hide during preview. */
body.preview-mode #screen-client .header-right { display: none; }
