/* client/styles.css
   CGPT design system - bold, modern, tactile. Orange identity with a full
   light/dark theme driven entirely by CSS custom properties. Every colour,
   shadow and gradient is a token so [data-theme] swaps the whole app at once.
   Hand-written (no build step available offline). */

:root {
  color-scheme: light;
  /* Surfaces & text */
  --color-bg: #F6F5F3;
  --color-bg-accent: #FDF3EC;      /* warm wash used in the ambient backdrop */
  --color-surface: #FFFFFF;
  --color-surface-2: #FBFAF9;      /* slightly recessed panels */
  --color-glass: rgba(255,255,255,0.72);
  --color-border: #E7E3DF;
  --color-border-strong: #D8D2CC;
  --color-text: #1B1714;
  --color-text-muted: #7A716A;
  --color-input-bg: #FFFFFF;

  /* Brand */
  --color-primary: #F97316;
  --color-primary-dark: #C2410C;
  --color-primary-light: #FFEDD5;
  --color-primary-tint: rgba(249,115,22,0.10);

  /* Status */
  --color-green: #15803D;  --color-green-bg: #DCFCE7;
  --color-amber: #B45309;  --color-amber-bg: #FEF3C7;
  --color-red: #DC2626;    --color-red-bg: #FEE2E2;
  --color-blue: #2563EB;   --color-blue-bg: #DBEAFE;

  /* Gradients */
  --grad-primary: linear-gradient(135deg, #FDBA74 0%, #F97316 48%, #EA580C 100%);
  --grad-brand: linear-gradient(135deg, #FB923C, #F97316 60%, #DB2777);
  --grad-hero: linear-gradient(120deg, #FFF6EE 0%, #FFE9D6 45%, #FFF6EE 100%);
  --grad-sheen: linear-gradient(180deg, rgba(255,255,255,0.6), rgba(255,255,255,0));

  /* Chart colours (consumed by inline SVG) */
  --chart-grid: #ECE8E4;
  --chart-axis: #C9C2BB;
  --chart-label: #8B837B;

  /* Toast (fixed dark chip regardless of theme in light mode) */
  --toast-bg: #201B18;
  --toast-text: #FFFFFF;

  /* Shape & depth */
  --radius-sm: 9px;
  --radius: 13px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(24,20,17,0.05), 0 1px 1px rgba(24,20,17,0.03);
  --shadow-md: 0 6px 18px -6px rgba(24,20,17,0.14), 0 2px 6px -2px rgba(24,20,17,0.08);
  --shadow-lg: 0 22px 48px -18px rgba(24,20,17,0.28), 0 8px 20px -12px rgba(24,20,17,0.16);
  --shadow-glow: 0 8px 22px -6px rgba(249,115,22,0.45);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --color-bg: #100D0B;
  --color-bg-accent: #1A130D;
  --color-surface: #1B1613;
  --color-surface-2: #221C18;
  --color-glass: rgba(30,24,20,0.68);
  --color-border: #322A24;
  --color-border-strong: #40362F;
  --color-text: #F4EFEA;
  --color-text-muted: #A69C93;
  --color-input-bg: #241D19;

  --color-primary: #FB8A3C;
  --color-primary-dark: #FDBA74;
  --color-primary-light: #3A2415;
  --color-primary-tint: rgba(251,146,60,0.16);

  --color-green: #4ADE80;  --color-green-bg: rgba(34,197,94,0.16);
  --color-amber: #FBBF24;  --color-amber-bg: rgba(217,119,6,0.18);
  --color-red: #F87171;    --color-red-bg: rgba(220,38,38,0.20);
  --color-blue: #60A5FA;   --color-blue-bg: rgba(37,99,235,0.20);

  --grad-hero: linear-gradient(120deg, #241812 0%, #2E1D12 45%, #1E1610 100%);
  --grad-sheen: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0));

  --chart-grid: #2C2521;
  --chart-axis: #453B34;
  --chart-label: #9C938B;

  --toast-bg: #2E2622;
  --toast-text: #F4EFEA;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.45);
  --shadow-md: 0 8px 22px -8px rgba(0,0,0,0.6), 0 2px 6px -2px rgba(0,0,0,0.5);
  --shadow-lg: 0 26px 55px -20px rgba(0,0,0,0.75), 0 10px 24px -14px rgba(0,0,0,0.6);
  --shadow-glow: 0 8px 26px -6px rgba(251,138,60,0.5);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}
/* Ambient brand glow behind everything for depth. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(680px 420px at 100% -8%, var(--color-bg-accent), transparent 60%),
    radial-gradient(560px 380px at -6% 108%, var(--color-primary-tint), transparent 55%);
  opacity: 0.9;
}

a { color: var(--color-primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 4px 0; font-weight: 750; letter-spacing: -0.02em; }
h1 { font-size: 27px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0 0 8px 0; }
::selection { background: var(--color-primary); color: #fff; }

#root { min-height: 100vh; }

/* ---------- Layout ---------- */
.app-shell { display: flex; min-height: 100vh; }

/* ---- "View as client" read-only preview banner ----
   Fixed to the top across the full width so a coach can never forget they're
   acting as the client. Fixed positioning keeps it out of the flex flow; the
   .previewing modifiers shift the sticky sidebar / mobile bar down to clear it. */
.preview-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 300;
  height: 46px; display: flex; align-items: center;
  background: var(--grad-brand); color: #fff;
  box-shadow: 0 6px 18px -8px rgba(24,20,17,0.5);
}
.preview-banner-inner {
  display: flex; align-items: center; gap: 12px;
  width: 100%; max-width: 1220px; margin: 0 auto; padding: 0 18px;
}
.preview-banner-eye { display: inline-flex; flex-shrink: 0; opacity: 0.95; }
.preview-banner-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.preview-banner-text strong { font-size: 13.5px; font-weight: 800; }
.preview-banner-sub { font-size: 11.5px; opacity: 0.9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-banner-exit {
  margin-left: auto; flex-shrink: 0;
  background: rgba(255,255,255,0.18); color: #fff;
  border: 1px solid rgba(255,255,255,0.55); font-weight: 700;
}
.preview-banner-exit:hover { background: rgba(255,255,255,0.28); }
.app-shell.previewing { padding-top: 46px; }
.app-shell.previewing .sidebar { top: 46px; height: calc(100vh - 46px); }

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 20px 8px;
  font-weight: 850;
  font-size: 19px;
  letter-spacing: -0.02em;
}
.sidebar-brand .logo-dot {
  width: 32px; height: 32px; border-radius: 10px;
  background: var(--grad-primary);
  color: white; display: flex; align-items: center; justify-content: center;
  font-weight: 850; font-size: 15px;
  box-shadow: var(--shadow-glow);
}
/* flex:1 + min-height:0 + overflow lets the nav scroll on short windows while
   the footer (theme toggle, profile, Sign out) stays pinned and always visible. */
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; }
.nav-list::-webkit-scrollbar { display: none; }
/* Grouped-nav section label (Clients / Programming / Insights). */
.nav-section {
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--color-text-muted); padding: 14px 13px 4px; opacity: 0.8;
}
.nav-list .nav-section:first-child { padding-top: 4px; }
/* Settings link pinned in the sidebar footer. */
.footer-nav-link {
  display: flex; align-items: center; padding: 9px 13px; border-radius: 10px;
  color: var(--color-text); font-weight: 600; font-size: 13.5px; margin-bottom: 4px;
  transition: background 0.18s var(--ease), transform 0.18s var(--ease);
}
.footer-nav-link:hover { background: var(--color-primary-tint); text-decoration: none; transform: translateX(2px); }
.footer-nav-link.active { background: var(--grad-primary); color: #fff; box-shadow: var(--shadow-glow); }
.sidebar-footer { flex-shrink: 0; }
.nav-item a {
  display: flex; align-items: center;
  padding: 10px 13px;
  border-radius: 10px;
  color: var(--color-text);
  font-weight: 600;
  font-size: 13.5px;
  position: relative;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), transform 0.18s var(--ease);
}
.nav-item a:hover { background: var(--color-primary-tint); text-decoration: none; transform: translateX(2px); }
.nav-item.active a {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: var(--shadow-glow);
}
.nav-item.active a::before {
  content: ""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 20px; border-radius: 0 4px 4px 0; background: var(--color-primary);
}
.sidebar-footer { border-top: 1px solid var(--color-border); padding-top: 12px; margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--grad-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 750; font-size: 12.5px; flex-shrink: 0;
  box-shadow: var(--shadow-glow);
}
.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 58px; border-bottom: 1px solid var(--color-border); background: var(--color-glass);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px; flex-shrink: 0;
}
.page { padding: 28px; max-width: 1220px; width: 100%; margin: 0 auto; animation: pageIn 0.4s var(--ease); }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Bold hero page header */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
  position: relative; padding-left: 16px;
}
.page-header::before {
  content: ""; position: absolute; left: 0; top: 3px; bottom: 3px;
  width: 5px; border-radius: 999px; background: var(--grad-primary);
}
.page-header h1 { line-height: 1.15; }

/* Theme toggle */
.theme-toggle {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 12px; border-radius: 10px;
  background: var(--color-surface-2); border: 1px solid var(--color-border);
  color: var(--color-text-muted); font-weight: 600; font-size: 12.5px; cursor: pointer;
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease), background 0.18s var(--ease);
}
.theme-toggle:hover { border-color: var(--color-primary); color: var(--color-text); }
.theme-toggle .ico { font-size: 15px; }

/* ---------- Grid ---------- */
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ---------- Card ---------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: box-shadow 0.22s var(--ease), border-color 0.22s var(--ease), transform 0.22s var(--ease);
}
.card:hover { box-shadow: var(--shadow-md); }
.card.table-row-link:hover, a .card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--color-border-strong); }
.card-title { font-weight: 750; font-size: 12px; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px; }
.kpi-value {
  font-size: 30px; font-weight: 850; letter-spacing: -0.03em; line-height: 1.1;
  background: var(--grad-primary);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  width: fit-content;
}
.kpi-label { color: var(--color-text-muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 10px; border: 1px solid transparent; padding: 9px 16px;
  font-size: 13.5px; font-weight: 650; cursor: pointer; font-family: var(--font);
  transition: transform 0.12s var(--ease), box-shadow 0.18s var(--ease), background 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(0.985); }
.btn-primary { background: var(--grad-primary); color: #fff; box-shadow: var(--shadow-glow); }
.btn-primary:hover { filter: brightness(1.04); box-shadow: 0 10px 26px -6px rgba(249,115,22,0.6); }
.btn-secondary { background: var(--color-surface); border-color: var(--color-border-strong); color: var(--color-text); }
.btn-secondary:hover { background: var(--color-surface-2); border-color: var(--color-primary); }
.btn-ghost { background: transparent; color: var(--color-text-muted); }
.btn-ghost:hover { background: var(--color-primary-tint); color: var(--color-text); }
.btn-danger { background: var(--color-red); color: white; }
.btn-danger:hover { filter: brightness(0.95); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 650; font-size: 12px; margin-bottom: 5px; color: var(--color-text-muted); }
input, select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--color-border-strong); border-radius: 9px;
  font-family: var(--font); font-size: 13.5px; background: var(--color-input-bg); color: var(--color-text);
  accent-color: var(--color-primary);
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
input[type="range"], input[type="checkbox"], input[type="radio"] { width: auto; }
input::placeholder, textarea::placeholder { color: var(--color-text-muted); opacity: 0.7; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-tint); }
.field { margin-bottom: 15px; }
.field-row { display: flex; gap: 12px; }
.field-row > .field { flex: 1; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }
input[type="file"] { padding: 7px; font-size: 12.5px; cursor: pointer; }
input[type="file"]::file-selector-button {
  border: 1px solid var(--color-border-strong); background: var(--color-surface-2);
  color: var(--color-text); border-radius: 7px; padding: 6px 12px; margin-right: 10px;
  font-weight: 600; font-size: 12.5px; cursor: pointer; font-family: var(--font);
}

/* ---------- Badges / chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: 0.03em;
}
.badge-green { background: var(--color-green-bg); color: var(--color-green); }
.badge-amber { background: var(--color-amber-bg); color: var(--color-amber); }
.badge-red { background: var(--color-red-bg); color: var(--color-red); }
.badge-gray { background: var(--color-surface-2); color: var(--color-text-muted); border: 1px solid var(--color-border); }
.badge-primary { background: var(--color-primary-tint); color: var(--color-primary-dark); }
.badge-purple { background: color-mix(in srgb, #7C3AED 15%, var(--color-surface)); color: #6D28D9; border: 1px solid color-mix(in srgb, #7C3AED 30%, transparent); }
/* Clickable progression-model chip in the programme header. */
.prog-model-chip { cursor: pointer; border: 1px solid var(--color-border); transition: filter 0.15s var(--ease), transform 0.15s var(--ease); }
.prog-model-chip:hover { filter: brightness(0.97); transform: translateY(-1px); }
.prog-model-chip:active { transform: translateY(0); }

/* Volume-target calibration banner (goal + experience + recent training). */
.target-caption {
  display: flex; gap: 8px; align-items: flex-start;
  background: var(--color-primary-tint); border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); padding: 8px 11px; margin-bottom: 10px;
  font-size: 12.5px; line-height: 1.4; color: var(--color-text);
}
.target-caption-ico { color: var(--color-primary); font-size: 14px; line-height: 1.3; flex-shrink: 0; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 9px; background: var(--color-surface-2); border: 1px solid var(--color-border); font-size: 12.5px; font-weight: 600; }
/* #63 toggle chip (goal picker): a clickable chip that highlights when selected */
button.chip { cursor: pointer; color: var(--color-text); transition: background .15s, border-color .15s; }
.chip-active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.chip-active span { color: #fff; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-muted); padding: 9px 11px; border-bottom: 1px solid var(--color-border); }
td { padding: 11px; border-bottom: 1px solid var(--color-border); font-size: 13.5px; }
tr:last-child td { border-bottom: none; }
.table-row-link:hover { background: var(--color-primary-tint); cursor: pointer; }

/* ---------- Misc ---------- */
.muted { color: var(--color-text-muted); }
.text-sm { font-size: 12.5px; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.divider { border: none; border-top: 1px solid var(--color-border); margin: 18px 0; }
.empty-state { text-align: center; padding: 44px 20px; color: var(--color-text-muted); }
.spinner { width: 22px; height: 22px; border: 2.5px solid var(--color-border); border-top-color: var(--color-primary); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--grad-hero); padding: 20px; }
.auth-card { width: 400px; max-width: 94vw; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 36px; box-shadow: var(--shadow-lg); }

.toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 1000; }
.toast { padding: 12px 18px; border-radius: 11px; background: var(--toast-bg); color: var(--toast-text); font-size: 13px; font-weight: 550; box-shadow: var(--shadow-lg); animation: toastIn 0.3s var(--ease); border: 1px solid rgba(255,255,255,0.06); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(0.96); } to { opacity: 1; transform: none; } }
.toast-error { background: var(--color-red); color: #fff; }
.toast-success { background: var(--color-green); color: #fff; }

/* Tab bar: a single scrollable row (never wraps), with a soft segmented track.
   Handles many tabs gracefully instead of stacking onto two cramped lines. */
/* Two-tier client-profile nav: top-level group bar over a sub-tab strip */
.tab-groups { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; }
.tab-group { padding: 7px 16px; font-weight: 700; font-size: 13.5px; cursor: pointer; color: var(--color-text-muted); border: 1px solid var(--color-border); border-radius: 999px; background: var(--color-surface); transition: color 0.16s var(--ease), background 0.16s var(--ease), border-color 0.16s var(--ease); }
.tab-group:hover { color: var(--color-text); }
.tab-group.active { color: #fff; background: var(--color-primary); border-color: var(--color-primary); }
.tab-groups + .tabs { margin-top: 0; }

.tabs {
  display: flex; gap: 4px; flex-wrap: nowrap;
  overflow-x: auto; overflow-y: hidden;
  margin-bottom: 22px; padding: 5px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
          mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 8px 15px; font-weight: 600; font-size: 13px;
  color: var(--color-text-muted); cursor: pointer;
  white-space: nowrap; flex-shrink: 0; border-radius: 8px;
  scroll-snap-align: center;
  transition: color 0.16s var(--ease), background 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.tab:hover { color: var(--color-text); background: var(--color-primary-tint); }
.tab.active {
  color: var(--color-primary-dark); font-weight: 700;
  background: var(--color-surface); box-shadow: var(--shadow-sm);
}
html[data-theme="dark"] .tab.active { color: #fff; background: var(--grad-primary); box-shadow: var(--shadow-glow); }
html[data-theme="dark"] .badge-purple { background: color-mix(in srgb, #A78BFA 22%, var(--color-surface)); color: #C4B5FD; border-color: color-mix(in srgb, #A78BFA 40%, transparent); }

.modal-overlay { position: fixed; inset: 0; background: rgba(15,10,6,0.5); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 900; animation: pageIn 0.22s var(--ease); }
.modal { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 24px; width: 500px; max-width: 92vw; max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow-lg); animation: modalIn 0.28s var(--ease); }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(0.97); } to { opacity: 1; transform: none; } }

.exercise-row { display: flex; align-items: center; justify-content: space-between; padding: 11px 13px; border: 1px solid var(--color-border); border-radius: 10px; margin-bottom: 8px; background: var(--color-surface); transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease); }
.exercise-row:hover { border-color: var(--color-primary); box-shadow: var(--shadow-sm); }
.set-row { display: grid; grid-template-columns: 40px 1fr 1fr 1fr 1fr; gap: 8px; align-items: center; margin-bottom: 6px; }
.set-row input { text-align: center; }

.readiness-banner { padding: 15px 19px; border-radius: var(--radius); margin-bottom: 18px; font-weight: 650; border: 1px solid transparent; }
.readiness-banner.green { background: var(--color-green-bg); color: var(--color-green); border-color: color-mix(in srgb, var(--color-green) 25%, transparent); }
.readiness-banner.amber { background: var(--color-amber-bg); color: var(--color-amber); border-color: color-mix(in srgb, var(--color-amber) 25%, transparent); }
.readiness-banner.red { background: var(--color-red-bg); color: var(--color-red); border-color: color-mix(in srgb, var(--color-red) 25%, transparent); }

.progress-bar { height: 9px; background: var(--color-surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--color-border); }
.progress-bar-fill { height: 100%; background: var(--grad-primary); border-radius: 999px; transition: width 0.5s var(--ease); }

/* ---------- Documents ---------- */
.doc-list { display: flex; flex-direction: column; gap: 10px; }
.doc-row { display: flex; align-items: flex-start; gap: 14px; padding: 13px 14px; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface-2); transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease), transform 0.16s var(--ease); }
.doc-row:hover { border-color: var(--color-primary); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.doc-type { flex-shrink: 0; width: 46px; height: 46px; border-radius: 10px; color: #fff; font-weight: 800; font-size: 11px; letter-spacing: 0.02em; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-sm); }
.doc-main { flex: 1; min-width: 0; }
.doc-title { font-weight: 700; font-size: 14.5px; color: var(--color-text); display: block; }
.doc-title:hover { color: var(--color-primary-dark); text-decoration: none; }
.doc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 5px; font-size: 12px; }
.doc-notes { margin-top: 6px; }
.doc-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.doc-file-picker { padding: 12px; border: 1.5px dashed var(--color-border-strong); border-radius: var(--radius); background: var(--color-surface-2); }

/* ---- Programme builder (dark-aware overrides applied below) ---- */
.pb-section { border: 1px solid var(--color-border); border-radius: 12px; margin-top: 14px; background: var(--color-surface); overflow: hidden; box-shadow: var(--shadow-sm); }
.pb-section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 13px; background: var(--color-surface-2); border-bottom: 1px solid var(--color-border); }
.pb-letter { width: 27px; height: 27px; border-radius: 50%; background: var(--grad-primary); color: #fff; font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; box-shadow: var(--shadow-glow); }
.pb-section-title { font-weight: 700; border: none; background: transparent; padding: 2px 4px; font-size: 15px; width: auto; min-width: 120px; color: var(--color-text); }
.pb-section-title:focus { outline: 1px solid var(--color-border); border-radius: 4px; box-shadow: none; }
.pb-head-row, .pb-row { display: grid; grid-template-columns: 26px 52px minmax(130px, 1.5fr) 56px 78px 62px 74px 62px 82px 64px; align-items: center; gap: 6px; padding: 6px 12px; }
.pb-head-row { font-size: 10px; letter-spacing: .04em; text-transform: uppercase; color: var(--color-text-muted); border-bottom: 1px solid var(--color-border); background: var(--color-surface); }
.pb-row { border-bottom: 1px solid var(--color-border); }
.pb-row:hover { background: var(--color-primary-tint); }
.pb-num { color: var(--color-text-muted); font-size: 13px; text-align: center; }
.pb-thumb { width: 48px; height: 34px; object-fit: cover; border-radius: 4px; background: var(--color-surface-2); }
.pb-name { font-weight: 600; color: var(--color-primary-dark); cursor: pointer; font-size: 13.5px; line-height: 1.15; }
.pb-name-sub { font-size: 11px; color: var(--color-text-muted); font-weight: 400; }
.pb-input { width: 100%; box-sizing: border-box; padding: 5px 6px; border: 1px solid var(--color-border-strong); border-radius: 6px; font-size: 12.5px; text-align: center; background: var(--color-input-bg); color: var(--color-text); }
.pb-input:focus { border-color: var(--color-primary); outline: none; box-shadow: none; }
.pb-input.varies { color: var(--color-primary-dark); font-style: italic; }
.pb-actions { display: flex; gap: 2px; justify-content: flex-end; }
.pb-iconbtn { border: none; background: transparent; cursor: pointer; color: var(--color-text-muted); border-radius: 6px; width: 26px; height: 26px; font-size: 14px; }
.pb-iconbtn:hover { background: var(--color-primary-tint); color: var(--color-text); }
.pb-setgrid { padding: 4px 12px 10px 90px; background: var(--color-surface-2); }
.pb-setrow { display: grid; grid-template-columns: 34px 92px 58px 56px 50px 58px 50px 78px 24px; gap: 6px; align-items: center; margin-top: 4px; }
.pb-setrow .lbl { font-size: 11px; color: var(--color-text-muted); }
.pb-seq { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 12px; background: var(--color-surface-2); border-top: 1px solid var(--color-border); align-items: center; }
.pb-seq-chip { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 5px; background: var(--color-surface); border: 1px solid var(--color-border); font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; color: var(--color-text); }
.pb-add { display: flex; gap: 8px; padding: 10px 12px; }
.pb-menu { position: absolute; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 10px; box-shadow: var(--shadow-lg); z-index: 50; min-width: 170px; padding: 4px; }
.pb-menu button { display: block; width: 100%; text-align: left; border: none; background: transparent; padding: 8px 10px; border-radius: 6px; font-size: 13px; cursor: pointer; color: var(--color-text); }
.pb-menu button:hover { background: var(--color-primary-tint); }
.pb-menu button.danger { color: var(--color-red); }

/* ---- set types + superset brackets ---- */
.pb-setnum { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700; }
.pb-grouped { position: relative; margin: 2px 0 2px 10px; border-left: 3px solid var(--color-primary); border-top-left-radius: 8px; border-bottom-left-radius: 8px; background: linear-gradient(90deg, var(--color-primary-tint), transparent 40%); }
.pb-grouped::before { content: attr(data-label); position: absolute; top: 50%; left: -3px; transform: translate(-100%, -50%) rotate(180deg); writing-mode: vertical-rl; font-size: 8.5px; letter-spacing: .08em; font-weight: 700; color: var(--color-primary); background: var(--color-surface); padding: 4px 1px; border: 1px solid var(--color-primary); border-radius: 4px 0 0 4px; }
.pb-name-sub span { font-weight: 600; }

/* ---------- Check-in (RAG sliders + live preview) ---------- */
.checkin-preview {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px; border-radius: 12px; color: #fff; margin: 6px 0 16px;
  box-shadow: var(--shadow-sm); transition: background 0.25s var(--ease);
}
/* Polished RAG slider: a rounded track that fills up to the value in the band
   colour (red/amber/green), with a soft white thumb ringed in the same colour.
   --rag (band colour) and --pct (fill %) are set from JS on each change. */
.rag-field { margin-top: 2px; }
.rag-field input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 12px; margin: 10px 0; border-radius: 999px; outline: none; cursor: pointer;
  background-color: var(--color-border);
  background-image: linear-gradient(to right, var(--rag, var(--color-primary)), var(--rag, var(--color-primary)));
  background-size: var(--pct, 50%) 100%;
  background-repeat: no-repeat;
  transition: background-size 0.12s var(--ease), background-image 0.2s var(--ease);
}
.rag-field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--color-surface); border: 4px solid var(--rag, var(--color-primary));
  box-shadow: 0 1px 4px rgba(0,0,0,0.25); cursor: pointer;
  transition: transform 0.1s var(--ease), border-color 0.2s var(--ease);
}
.rag-field input[type="range"]::-webkit-slider-thumb:active { transform: scale(1.15); }
.rag-field input[type="range"]::-moz-range-thumb {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--color-surface); border: 4px solid var(--rag, var(--color-primary));
  box-shadow: 0 1px 4px rgba(0,0,0,0.25); cursor: pointer;
}
.rag-field input[type="range"]::-moz-range-progress {
  height: 12px; border-radius: 999px; background: var(--rag, var(--color-primary));
}
.rag-field input[type="range"]::-moz-range-track {
  height: 12px; border-radius: 999px; background: var(--color-border);
}
.rag-field input[type="range"]:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--rag, var(--color-primary)) 35%, transparent); }
.rag-pill {
  min-width: 34px; text-align: center; padding: 3px 12px; border-radius: 999px;
  color: #fff; font-weight: 800; font-size: 14px; box-shadow: var(--shadow-sm);
  transition: background 0.2s var(--ease);
}

/* ---------- Body-composition summary ---------- */
.bc-summary .bc-current { font-size: 30px; font-weight: 850; letter-spacing: -0.03em; line-height: 1.1; margin-top: 2px; }
.bc-delta-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 0; border-top: 1px solid var(--color-border); font-size: 13px; }
.bc-delta-row:first-child { border-top: none; }
.bc-delta { font-weight: 700; font-size: 12.5px; }
.bc-good { color: var(--color-green); }
.bc-bad { color: var(--color-red); }
.bc-flat { color: var(--color-text-muted); }

/* Nutrition daily-history target-range colouring (calories/protein) + high-fat
   flag. Tinted cell backgrounds so accuracy toward goals reads at a glance. */
.nut-ok { background: color-mix(in srgb, var(--color-green) 18%, var(--color-surface)); font-weight: 700; }
.nut-off { background: color-mix(in srgb, var(--color-red) 16%, var(--color-surface)); font-weight: 700; }
.nut-warn { background: color-mix(in srgb, var(--color-amber) 20%, var(--color-surface)); font-weight: 700; }

/* ---------- Info tips + RPE guide ---------- */
.info-tip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; border-radius: 50%; padding: 0; margin-left: 5px;
  font-size: 11px; font-weight: 800; font-style: italic; font-family: Georgia, "Times New Roman", serif;
  cursor: pointer; border: 1.5px solid var(--color-border-strong);
  background: var(--color-surface); color: var(--color-text-muted);
  line-height: 1; vertical-align: middle; flex-shrink: 0;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease), background 0.15s var(--ease);
}
.info-tip:hover { border-color: var(--color-primary); color: var(--color-primary-dark); background: var(--color-primary-tint); }
.rpe-chart { display: flex; flex-direction: column; gap: 6px; }
.rpe-row { display: grid; grid-template-columns: 54px 66px 1fr; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-surface-2); }
.rpe-badge { color: #fff; font-weight: 800; font-size: 14px; text-align: center; padding: 4px 0; border-radius: 8px; }
.rpe-rir { font-weight: 700; font-size: 12.5px; }
.session-help-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 500;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 16px; border-radius: 999px; border: none; cursor: pointer;
  background: var(--grad-primary); color: #fff; font-weight: 700; font-size: 13px; font-family: var(--font);
  box-shadow: var(--shadow-lg);
}
.session-help-fab:hover { filter: brightness(1.05); }

/* ---------- Nav icons ---------- */
.nav-ico { width: 18px; height: 18px; flex-shrink: 0; margin-right: 11px; opacity: 0.85; }
.nav-item a { position: relative; }
.nav-item.active a .nav-ico { opacity: 1; }

/* ---------- Avatars with photos ---------- */
.avatar { overflow: hidden; background-size: cover; background-position: center; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.lg { width: 88px; height: 88px; font-size: 30px; border-radius: 22px; }
.avatar-edit { display: flex; align-items: center; gap: 16px; }
.avatar-edit .hint { font-size: 12.5px; }

/* Client roster avatar (small photo/initials chip in tables & lists) */
.mini-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11px; color: #fff; overflow: hidden;
  background: var(--grad-primary);
}
.mini-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Muscle heat-map hover/tap tooltip (lay-term muscle names) */
.muscle-tip {
  position: absolute; z-index: 20; pointer-events: none;
  background: var(--color-text); color: var(--color-surface);
  padding: 4px 9px; border-radius: 8px; font-size: 12.5px; font-weight: 700;
  white-space: nowrap; transform: translateX(-50%); box-shadow: var(--shadow-md);
}

/* Unread-message badge on the Messages nav item */
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px;
  border-radius: 999px; background: var(--color-red); color: #fff;
  font-size: 11px; font-weight: 800; line-height: 1;
}
.bnav-item .nav-badge { position: absolute; top: -6px; left: 12px; margin: 0; }

/* Builder picker: hard-blocked exercise row (client lacks kit / contraindicated) */
.exercise-row.blocked { opacity: 0.55; cursor: not-allowed; display: flex; justify-content: space-between; align-items: center; }
.exercise-row.blocked:hover { background: transparent; }

/* Tick-box chip selectors (equipment / injuries) */
.chip-select { display: flex; flex-wrap: wrap; gap: 8px; }
.select-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 13px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--color-border); background: var(--color-surface);
  color: var(--color-text); font-weight: 600; font-size: 13px; line-height: 1.1;
  transition: border-color 0.12s var(--ease), background 0.12s var(--ease), color 0.12s var(--ease);
}
.select-chip:hover { border-color: var(--color-border-strong); }
.select-chip.on { border-color: var(--color-primary); background: var(--color-primary); color: #fff; }
.select-chip .chip-tag {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em;
  padding: 2px 6px; border-radius: 6px; background: rgba(0,0,0,0.08);
}
.select-chip.sev-soft { border-color: var(--color-amber); background: color-mix(in srgb, var(--color-amber) 15%, var(--color-surface)); }
.select-chip.sev-soft .chip-tag { background: var(--color-amber); color: #3b2500; }
.select-chip.sev-hard { border-color: var(--color-red); background: color-mix(in srgb, var(--color-red) 15%, var(--color-surface)); }
.select-chip.sev-hard .chip-tag { background: var(--color-red); color: #fff; }

/* Session runner: two columns on desktop (work + target), stacked on mobile so
   set logging uses the full width instead of being crushed to ~1/3. */
.session-cols { display: grid; grid-template-columns: 1fr 260px; gap: 16px; align-items: start; }
@media (max-width: 820px) {
  .session-cols { grid-template-columns: 1fr; }
}

/* Zoomable video / media stage (pinch + drag + on-screen controls) */
.zoomable { position: relative; }
.zoom-stage {
  position: relative; overflow: hidden; border-radius: 8px; background: #000;
  touch-action: none; -webkit-user-select: none; user-select: none;
}
.zoom-stage.zoomed { cursor: grab; }
.zoom-stage.zoomed:active { cursor: grabbing; }
.zoom-inner { transform-origin: center center; transition: transform 0.05s linear; will-change: transform; }
.zoom-inner > video, .zoom-inner > iframe, .zoom-inner > img { display: block; width: 100%; }
.zoom-controls {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  margin-top: 8px;
}
.zoom-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--color-border);
  background: var(--color-surface); color: var(--color-text);
  font-size: 20px; font-weight: 700; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.zoom-btn:hover { background: var(--color-surface-2); }
.zoom-btn:active { transform: scale(0.94); }
.zoom-level { min-width: 52px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.zoom-hint { text-align: center; margin-top: 4px; }

/* Session-feeling picker (Easy / Solid / Very hard) at the end of a workout */
.feel-row { display: flex; gap: 10px; }
.feel-btn {
  --feel-color: var(--color-primary);
  flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 8px; border-radius: var(--radius);
  border: 1.5px solid var(--color-border); background: var(--color-surface-2);
  color: var(--color-text); font-weight: 700; font-size: 14px; cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), transform 0.1s var(--ease);
}
.feel-btn:hover { border-color: var(--color-border-strong); }
.feel-btn:active { transform: scale(0.97); }
.feel-btn .feel-emoji { font-size: 26px; line-height: 1; }
.feel-btn.active { border-color: var(--feel-color); background: color-mix(in srgb, var(--feel-color) 12%, var(--color-surface)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--feel-color) 18%, transparent); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ============================================================
   Mobile app layout
   On phones the desktop sidebar is replaced by a fixed bottom
   tab bar (primary destinations) + a slide-up "More" sheet, and
   a slim top bar for brand + theme. This is what makes the PWA
   feel like a native app when added to the home screen.
   ============================================================ */

/* Hidden on desktop; revealed inside the mobile media query below. */
.mobile-topbar { display: none; }
.bottom-nav { display: none; }

.icon-btn {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: 10px; width: 38px; height: 38px; font-size: 17px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--color-text); line-height: 1;
}
.icon-btn:active { transform: scale(0.94); }

/* --- Bottom tab bar --- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  align-items: stretch; justify-content: space-around;
  background: var(--color-glass);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--color-border);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -6px 20px -12px rgba(24,20,17,0.28);
}
.bnav-item {
  flex: 1 1 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px; padding: 8px 2px 7px;
  min-height: 52px; background: none; border: none; cursor: pointer;
  color: var(--color-text-muted); font-weight: 650; text-decoration: none;
  transition: color 0.15s var(--ease);
}
.bnav-item:hover { text-decoration: none; }
.bnav-ico { width: 23px; height: 23px; }
.bnav-label { font-size: 10.5px; letter-spacing: -0.01em; }
.bnav-item.active { color: var(--color-primary); }
.bnav-item.active .bnav-ico { stroke: var(--color-primary); }

/* --- More sheet --- */
.sheet-scrim {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-end;
  background: rgba(10,8,6,0.46); opacity: 0; transition: opacity 0.22s var(--ease);
}
.sheet-scrim.open { opacity: 1; }
.more-sheet {
  width: 100%; max-height: 84vh; overflow-y: auto;
  background: var(--color-surface); color: var(--color-text);
  border-radius: 20px 20px 0 0; padding: 10px 16px calc(18px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform 0.26s var(--ease);
  box-shadow: var(--shadow-lg);
}
.sheet-scrim.open .more-sheet { transform: translateY(0); }
.sheet-grabber {
  width: 40px; height: 4px; border-radius: 999px; background: var(--color-border-strong);
  margin: 4px auto 12px;
}
.sheet-profile { display: flex; align-items: center; gap: 12px; padding: 4px 4px 14px; border-bottom: 1px solid var(--color-border); }
.sheet-links { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 12px 0; }
.sheet-link {
  display: flex; align-items: center; gap: 11px; padding: 13px 12px;
  border-radius: 12px; color: var(--color-text); font-weight: 600; font-size: 14px;
  text-decoration: none;
}
.sheet-link:hover { text-decoration: none; background: var(--color-surface-2); }
.sheet-link.active { background: var(--color-primary-tint); color: var(--color-primary); }
.sheet-link .nav-ico { width: 20px; height: 20px; }
.sheet-footer { display: flex; flex-direction: column; gap: 8px; padding-top: 6px; border-top: 1px solid var(--color-border); }
.sheet-footer .theme-toggle { width: 100%; justify-content: center; }

@media (max-width: 760px) {
  .app-shell { flex-direction: column; }
  .sidebar { display: none; }

  .mobile-topbar {
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 50; height: 56px; padding: 0 16px;
    background: var(--color-glass);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--color-border);
  }
  /* Preview banner sits above the sticky mobile bar; keep the bar clear of it. */
  .app-shell.previewing .mobile-topbar { top: 46px; }
  .preview-banner-sub { display: none; }
  .preview-banner-inner { padding: 0 12px; }
  .bottom-nav { display: flex; }

  .main-area { flex: 1; }
  .page {
    padding: 16px 14px calc(74px + env(safe-area-inset-bottom));
    max-width: 100%;
  }
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-header h1 { font-size: 1.5rem; }
  .topbar { display: none; }
}

/* ---- Exercise complexity-level selector (programme builder) ---- */
.pb-level-select { font-size: 11px; padding: 1px 4px; border-radius: 6px; border: 1px solid var(--color-border); background: var(--color-surface-2); color: var(--color-text); max-width: 190px; }

/* ---- #19 Printable weekly plan ---- */
.pp-warning { border: 2px solid var(--color-amber); border-radius: var(--radius); padding: 8px 12px; margin: 14px 0; background: color-mix(in srgb, var(--color-amber) 10%, var(--color-surface)); font-size: 0.85rem; }
.pp-warning ul { margin: 0; padding-left: 18px; }
.pp-warning li { margin: 2px 0; }
.pp-session { margin-top: 20px; page-break-inside: avoid; }
.pp-session h3 { margin: 0 0 6px; border-bottom: 2px solid var(--color-primary); padding-bottom: 3px; }
.pp-block { margin-top: 8px; }
.pp-block-title { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-text-muted); margin: 6px 0 2px; }
.pp-table { width: 100%; border-collapse: collapse; }
.pp-table th, .pp-table td { border: 1px solid var(--color-border); padding: 6px 8px; text-align: left; font-size: 0.86rem; vertical-align: top; }
.pp-table th { background: var(--color-surface-2); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
.pp-ex { font-weight: 600; width: 30%; }
.pp-write { width: 26%; min-height: 26px; }
.pp-cardio { margin: 2px 0 0; padding-left: 18px; font-size: 0.86rem; }
.pp-tempo { font-size: 0.74rem; color: var(--color-text-muted); margin-top: 2px; }
/* "How to perform" row under each exercise: cues + description so the sheet
   stands alone off the app. Subtle background so it reads as a sub-note. */
.pp-how-row td { background: var(--color-surface-2); }
.pp-how { font-size: 0.82rem; line-height: 1.4; }
.pp-how-label { font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.7rem; color: var(--color-text-muted); }
.pp-cues { margin: 3px 0 0; padding-left: 18px; }
.pp-cues li { margin: 1px 0; }
.pp-howtext { margin-top: 3px; }
.pp-pers { margin-top: 3px; font-style: italic; color: var(--color-text-muted); }
@media print {
  .pp-print .pp-how-row td { background: #f6f6f6 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pp-print .pp-ex-row td { page-break-inside: avoid; }
}
@media print {
  .pp-print .pp-table th { background: #f0f0f0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pp-warning { background: #fff !important; }
  .pp-write { min-height: 30px; }
}

/* ---- Superset / circuit grouped run (session runner) ---- */
.runner-group { border: 2px solid var(--color-amber); border-radius: var(--radius-lg); padding: 6px 10px 10px; margin-top: 10px; background: color-mix(in srgb, var(--color-amber) 6%, transparent); }
.runner-group-banner { padding: 6px 4px 2px; }
.runner-group-card { margin-top: 8px; }
.runner-group-num { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; background: var(--color-amber); color: #3b2500; font-size: 0.8rem; font-weight: 800; }

/* ---- Session section headers (movement-pattern blocks) ---- */
.runner-section-head { display: flex; align-items: center; gap: 8px; margin: 16px 0 2px; padding-bottom: 4px; border-bottom: 2px solid var(--color-primary); }
.runner-section-title { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-primary); }

/* ---- Sticky rest timer (session runner) ---- */
.rest-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 800; background: var(--color-surface); border-top: 1px solid var(--color-border); box-shadow: 0 -6px 20px rgba(0,0,0,0.18); padding-bottom: env(safe-area-inset-bottom); animation: pageIn 0.18s var(--ease); }
.rest-bar-fill { height: 5px; width: 100%; background: var(--color-primary); transition: width 1s linear; }
.rest-bar-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 1100px; margin: 0 auto; padding: 10px 18px; flex-wrap: wrap; }
.rest-bar-label { font-size: 0.72rem; letter-spacing: 0.12em; font-weight: 700; color: var(--color-text-muted); }
.rest-bar-time { font-size: 2.1rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; color: var(--color-primary); }
.rest-bar-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.rest-bar--soon .rest-bar-fill { background: var(--color-amber); }
.rest-bar--soon .rest-bar-time { color: var(--color-amber); animation: restPulse 1s ease-in-out infinite; }
.rest-bar--done .rest-bar-fill { background: var(--color-green); width: 100% !important; }
.rest-bar--done .rest-bar-time { color: var(--color-green); }
@keyframes restPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@media (max-width: 640px) { .rest-bar-time { font-size: 1.8rem; } .rest-bar-row { padding: 8px 12px; } }

/* ---- #58 Visual progress report (overlay + printable) ---- */
.report-overlay { position: fixed; inset: 0; background: var(--color-bg); z-index: 950; display: flex; flex-direction: column; overflow: hidden; }
.report-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--color-border); background: var(--color-surface); flex-wrap: wrap; }
.report-scroll { flex: 1; overflow-y: auto; padding: 24px 16px 60px; }
.report-print { max-width: 860px; margin: 0 auto; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 32px 36px; box-shadow: var(--shadow-lg); }
.report-header { border-bottom: 2px solid var(--color-primary); padding-bottom: 12px; margin-bottom: 8px; }
.report-header h1 { margin: 0; font-size: 1.9rem; }
.report-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 6px; color: var(--color-text-muted); font-size: 0.9rem; }
.report-section { margin-top: 26px; page-break-inside: avoid; }
.report-section h2 { font-size: 1.25rem; margin: 0 0 10px; padding-bottom: 4px; border-bottom: 1px solid var(--color-border); }
.report-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.report-stat { border: 1px solid var(--color-border); border-radius: var(--radius); padding: 12px 14px; text-align: center; background: var(--color-surface-2); }
.report-stat-value { font-size: 1.5rem; font-weight: 800; color: var(--color-primary); }
.report-stat-label { font-size: 0.8rem; color: var(--color-text-muted); margin-top: 2px; }
.report-table { width: 100%; margin-top: 12px; }
.report-chart { margin-top: 16px; }
.report-chart-title { font-size: 0.85rem; font-weight: 600; color: var(--color-text-muted); margin-bottom: 4px; }
.report-footer { margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--color-border); font-size: 0.8rem; color: var(--color-text-muted); text-align: center; }
.report-photos { display: flex; flex-direction: column; gap: 18px; }
.report-photo-pair { page-break-inside: avoid; }
.report-photo-pose { text-transform: capitalize; font-weight: 600; margin-bottom: 6px; }
.report-photo-imgs { display: flex; gap: 12px; flex-wrap: wrap; }
.report-photo-imgs figure { margin: 0; flex: 1 1 200px; max-width: 280px; }
.report-photo-imgs img { width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--color-border); display: block; }
.report-photo-imgs figcaption { font-size: 0.78rem; color: var(--color-text-muted); margin-top: 4px; text-align: center; }

@media print {
  @page { margin: 14mm; }
  body > *:not(.report-overlay) { display: none !important; }
  .report-overlay { position: static; background: #fff; overflow: visible; }
  .report-scroll { overflow: visible; padding: 0; }
  .no-print { display: none !important; }
  .report-print { max-width: none; margin: 0; border: none; box-shadow: none; padding: 0; }
  .report-stat { background: #fff; }
}
