/* ============================================================
   LoopSet — Design System
   Dark warm-slate · Space Grotesk · Sharp & Athletic
   ============================================================ */

/* --- Tokens ----------------------------------------------- */
:root {
  --rf-bg:           oklch(12% 0.01 55);
  --rf-bg-alt:       oklch(10% 0.009 55);
  --rf-surface:      oklch(17% 0.012 55);
  --rf-surface-2:    oklch(22% 0.015 55);
  --rf-surface-3:    oklch(28% 0.017 55);
  --rf-border:       oklch(27% 0.016 55);
  --rf-border-2:     oklch(36% 0.018 55);

  --rf-accent:         oklch(67% 0.165 50);
  --rf-accent-hover:   oklch(73% 0.165 50);
  --rf-accent-dim:     oklch(48% 0.125 50);
  --rf-accent-faint:   oklch(67% 0.165 50 / 0.12);
  --rf-accent-faint2:  oklch(67% 0.165 50 / 0.06);
  --rf-accent-surface: oklch(20% 0.055 50);

  --rf-text:         oklch(93% 0.006 55);
  --rf-muted:        oklch(62% 0.014 55);
  --rf-subtle:       oklch(60% 0.012 55);
  --rf-placeholder:  oklch(40% 0.012 55);
  --rf-on-accent:    oklch(11% 0.01 55);

  --rf-success:      oklch(68% 0.15 145);
  --rf-success-bg:   oklch(68% 0.15 145 / 0.12);
  --rf-danger:       oklch(62% 0.18 25);
  --rf-danger-bg:    oklch(62% 0.18 25 / 0.12);
  --rf-warning:      oklch(78% 0.16 85);
  --rf-warning-bg:   oklch(78% 0.16 85 / 0.12);

  --rf-nav-width:    228px;
  --rf-nav-bg:       oklch(9.5% 0.008 50);
  --rf-topbar-h:     52px;

  --r-xs:  4px;
  --r-sm:  6px;
  --r:     10px;
  --r-lg:  14px;
  --r-xl:  20px;

  --shadow-sm: 0 1px 3px oklch(0% 0 0 / 0.4), 0 1px 2px oklch(0% 0 0 / 0.28);
  --shadow:    0 2px 8px oklch(0% 0 0 / 0.45), 0 1px 3px oklch(0% 0 0 / 0.35);
  --shadow-md: 0 4px 16px oklch(0% 0 0 / 0.5), 0 2px 6px oklch(0% 0 0 / 0.38);
  --shadow-lg: 0 8px 32px oklch(0% 0 0 / 0.55), 0 3px 10px oklch(0% 0 0 / 0.42);
  --rf-overlay:    oklch(0% 0 0 / 0.65);

  --t: 0.14s ease;
  --t-lift: 0.18s ease;
}

/* --- Skip link --------------------------------------------- */
.rf-skip-link {
  position: absolute;
  left: -9999px;
  top: 0.5rem;
  z-index: 9999;
  background: var(--rf-accent);
  color: var(--rf-on-accent);
  padding: 0.5rem 1rem;
  border-radius: var(--r-sm);
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
}
.rf-skip-link:focus { left: 0.5rem; }

/* --- Color scheme ------------------------------------------ */
html { color-scheme: dark; }

/* --- Base -------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

/* Suppress focus ring on mouse/tap; keep it for keyboard nav */
:focus:not(:focus-visible) { outline: none; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--rf-bg);
  color: var(--rf-text);
  font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--rf-text);
  line-height: 1.25;
}

a { color: var(--rf-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

/* --- Type scale -------------------------------------------- */
.rf-page-title  { font-size: 1.375rem; font-weight: 700; letter-spacing: -0.025em; }
.rf-card-title  { font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.01em; }
.rf-stat-num    { font-size: 2.5rem; font-weight: 700; letter-spacing: -0.04em; line-height: 1; }
.rf-display     { font-size: 3.5rem; font-weight: 800; letter-spacing: -0.045em; line-height: 1; }

.rf-section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rf-muted);
  display: block;
}

.rf-text-muted   { color: var(--rf-muted); }
.rf-text-accent  { color: var(--rf-accent); }
.rf-text-success { color: var(--rf-success); }
.rf-text-danger  { color: var(--rf-danger); }
.rf-text-subtle  { color: var(--rf-subtle); }

/* --- Page layout ------------------------------------------- */
.rf-page {
  padding: 2rem 2rem 5rem;
  max-width: 1100px;
  margin-inline: auto;
  width: 100%;
}

.rf-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2rem;
  gap: 1rem;
  flex-wrap: wrap;
}

/* --- Cards ------------------------------------------------- */
.rf-card {
  background: var(--rf-surface);
  border: 1px solid var(--rf-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.rf-card-body   { padding: 1.25rem; }

.rf-card-header {
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--rf-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

/* Stat cards */
.rf-stat-card {
  background: var(--rf-surface);
  border: 1px solid var(--rf-border);
  border-radius: var(--r-lg);
  padding: 1.125rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  transition: box-shadow var(--t-lift), transform var(--t-lift);
  text-decoration: none;
  color: var(--rf-text);
}
.rf-stat-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  color: var(--rf-text);
  text-decoration: none;
}

.rf-stat-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.rf-stat-icon.si-accent   { background: var(--rf-accent-faint);   color: var(--rf-accent); }
.rf-stat-icon.si-success  { background: var(--rf-success-bg);      color: var(--rf-success); }
.rf-stat-icon.si-danger   { background: var(--rf-danger-bg);       color: var(--rf-danger); }
.rf-stat-icon.si-muted    { background: oklch(62% 0.014 55 / 0.1); color: var(--rf-muted); }
.rf-stat-icon.si-warning  { background: var(--rf-warning-bg);      color: var(--rf-warning); }

/* --- Buttons ----------------------------------------------- */
.rf-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--t), color var(--t), border-color var(--t), box-shadow var(--t);
  white-space: nowrap;
}
.rf-btn:focus-visible {
  outline: 2px solid var(--rf-accent);
  outline-offset: 2px;
}
.rf-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.rf-btn-primary {
  background: var(--rf-accent);
  color: var(--rf-on-accent);
  font-weight: 600;
}
.rf-btn-primary:hover {
  background: var(--rf-accent-hover);
  color: oklch(9% 0.008 55);
  text-decoration: none;
}

.rf-btn-ghost {
  background: transparent;
  color: var(--rf-muted);
  border-color: var(--rf-border);
}
.rf-btn-ghost:hover {
  background: var(--rf-surface-2);
  color: var(--rf-text);
  border-color: var(--rf-border-2);
  text-decoration: none;
}

.rf-btn-danger {
  background: var(--rf-danger-bg);
  color: var(--rf-danger);
  border-color: oklch(62% 0.18 25 / 0.3);
}
.rf-btn-danger:hover {
  background: oklch(62% 0.18 25 / 0.2);
  text-decoration: none;
}

.rf-btn-accent-ghost {
  background: var(--rf-accent-faint2);
  color: var(--rf-accent);
  border-color: var(--rf-accent-faint);
}
.rf-btn-accent-ghost:hover {
  background: var(--rf-accent-faint);
  text-decoration: none;
}

.rf-btn-lg  { padding: 0.6875rem 1.5rem; font-size: 0.9375rem; border-radius: var(--r); }
.rf-btn-sm  { padding: 0.3rem 0.625rem; font-size: 0.8125rem; }
.rf-btn-icon { padding: 0.375rem; border-radius: var(--r-sm); }

/* --- Inputs ----------------------------------------------- */
.rf-input {
  background: var(--rf-surface-2);
  border: 1px solid var(--rf-border);
  border-radius: var(--r-sm);
  color: var(--rf-text);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 400;
  padding: 0.5625rem 0.75rem;
  width: 100%;
  transition: border-color var(--t), box-shadow var(--t);
  outline: none;
}
.rf-input::placeholder { color: var(--rf-placeholder); }
.rf-input:focus {
  border-color: var(--rf-accent-dim);
  box-shadow: 0 0 0 3px var(--rf-accent-faint);
}

.rf-input-num {
  background: var(--rf-surface-2);
  border: 1px solid var(--rf-border);
  border-radius: var(--r-sm);
  color: var(--rf-text);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.375rem 0.5rem;
  width: 72px;
  text-align: center;
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
}
.rf-input-num:focus {
  border-color: var(--rf-accent-dim);
  box-shadow: 0 0 0 3px var(--rf-accent-faint);
}

.rf-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--rf-muted);
  display: block;
  margin-bottom: 5px;
}

.rf-select {
  background: var(--rf-surface-2);
  border: 1px solid var(--rf-border);
  border-radius: var(--r-sm);
  color: var(--rf-text);
  font-family: inherit;
  font-size: 1rem;
  padding: 0.5625rem 0.75rem;
  outline: none;
  cursor: pointer;
  transition: border-color var(--t), box-shadow var(--t);
}
.rf-select:focus {
  border-color: var(--rf-accent-dim);
  box-shadow: 0 0 0 3px var(--rf-accent-faint);
}

/* --- Badges ----------------------------------------------- */
.rf-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.rf-badge-accent  { background: var(--rf-accent-faint);   color: var(--rf-accent); }
.rf-badge-success { background: var(--rf-success-bg);      color: var(--rf-success); }
.rf-badge-danger  { background: var(--rf-danger-bg);       color: var(--rf-danger); }
.rf-badge-muted   { background: oklch(54% 0.014 55 / 0.14); color: var(--rf-muted); }
.rf-badge-warning { background: var(--rf-warning-bg);      color: var(--rf-warning); }

/* --- Empty states ----------------------------------------- */
.rf-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3.5rem 2rem;
  text-align: center;
}
.rf-empty-icon { opacity: 0.2; margin-bottom: 1.125rem; color: var(--rf-muted); }
.rf-empty h5 { font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; }
.rf-empty p {
  font-size: 0.875rem;
  color: var(--rf-muted);
  max-width: 30ch;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

/* --- Divider ---------------------------------------------- */
.rf-divider {
  border: none;
  border-top: 1px solid var(--rf-border);
  margin: 0;
}

/* --- Skeleton --------------------------------------------- */
.rf-skeleton {
  background: linear-gradient(90deg,
    var(--rf-surface) 25%,
    var(--rf-surface-2) 50%,
    var(--rf-surface) 75%);
  background-size: 200% 100%;
  animation: rf-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--r-sm);
}
@keyframes rf-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Toggle switch ---------------------------------------- */
.rf-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  cursor: pointer;
}
.rf-toggle {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.rf-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.rf-toggle-track {
  position: absolute;
  inset: 0;
  background: var(--rf-surface-3);
  border: 1px solid var(--rf-border);
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--t), border-color var(--t);
}
.rf-toggle-track::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  background: var(--rf-muted);
  border-radius: 50%;
  transition: left var(--t), background var(--t);
}
.rf-toggle input:checked + .rf-toggle-track {
  background: var(--rf-accent-faint);
  border-color: var(--rf-accent-dim);
}
.rf-toggle input:checked + .rf-toggle-track::after {
  left: calc(100% - 17px);
  background: var(--rf-accent);
}
.rf-toggle input:focus-visible + .rf-toggle-track {
  outline: 2px solid var(--rf-accent);
  outline-offset: 2px;
}

/* --- Tabs ------------------------------------------------- */
.rf-tabs {
  display: flex;
  gap: 0.25rem;
  background: var(--rf-surface-2);
  border: 1px solid var(--rf-border);
  border-radius: var(--r-sm);
  padding: 3px;
  flex-wrap: wrap;
}
.rf-tab {
  padding: 0.375rem 0.875rem;
  border-radius: calc(var(--r-sm) - 2px);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--rf-muted);
  cursor: pointer;
  border: none;
  background: transparent;
  font-family: inherit;
  transition: background var(--t), color var(--t);
  white-space: nowrap;
}
.rf-tab:hover { color: var(--rf-text); }
.rf-tab:focus-visible {
  outline: 2px solid var(--rf-accent);
  outline-offset: 2px;
}
.rf-tab.active {
  background: var(--rf-surface);
  color: var(--rf-text);
  box-shadow: var(--shadow-sm);
}

/* --- List rows -------------------------------------------- */
.rf-list-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--rf-border);
  transition: background var(--t);
}
.rf-list-item:last-child { border-bottom: none; }
.rf-list-item:hover { background: oklch(100% 0 0 / 0.025); }
.rf-list-item-clickable { cursor: pointer; }

/* --- Settings sections ------------------------------------ */
.rf-settings-section {
  border: 1px solid var(--rf-border);
  border-radius: var(--r-lg);
  background: var(--rf-surface);
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.rf-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--rf-border);
}
.rf-settings-row:last-child { border-bottom: none; }

/* --- Dashboard stats grid --------------------------------- */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}
@media (max-width: 900px) {
  .dash-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .dash-stats { grid-template-columns: 1fr; }
}

/* --- Week calendar ---------------------------------------- */
.rf-week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.625rem;
}
.rf-day-col {
  background: var(--rf-surface);
  border: 1px solid var(--rf-border);
  border-radius: var(--r);
  overflow: hidden;
  min-height: 180px;
  display: flex;
  flex-direction: column;
}
.rf-day-col.today {
  border-color: var(--rf-accent-dim);
}
.rf-day-header {
  padding: 0.625rem 0.625rem 0.5rem;
  border-bottom: 1px solid var(--rf-border);
  text-align: center;
}
.rf-day-header .day-abbr {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rf-subtle);
  display: block;
  margin-bottom: 0.125rem;
}
.rf-day-header .day-num {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--rf-text);
}
.rf-day-col.today .rf-day-header { background: var(--rf-accent-faint); }
.rf-day-col.today .day-num { color: var(--rf-accent); }
.rf-day-col.past .day-num { color: var(--rf-subtle); }
.rf-day-body { padding: 0.5rem; flex: 1; }
.rf-workout-pill {
  display: flex;
  align-items: flex-start;
  gap: 0.25rem;
  background: var(--rf-accent-faint);
  color: var(--rf-accent);
  border-radius: var(--r-sm);
  padding: 0.375rem 0.375rem 0.375rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
  cursor: default;
  transition: background var(--t);
  line-height: 1.3;
}
.rf-pill-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.rf-pill-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rf-pill-dur {
  font-size: 0.625rem;
  font-weight: 500;
  opacity: 0.7;
  line-height: 1.2;
}
.rf-pill-del {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: currentColor;
  opacity: 0;
  font-size: 0.875rem;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
  border-radius: 3px;
  transition: opacity var(--t), background var(--t);
}
.rf-workout-pill:hover .rf-pill-del { opacity: 0.7; }
.rf-pill-del:hover { opacity: 1 !important; background: oklch(62% 0.18 25 / 0.18); color: var(--rf-danger); }
.rf-workout-pill:hover { background: oklch(67% 0.165 50 / 0.18); }
.rf-workout-pill.done {
  background: var(--rf-success-bg);
  color: var(--rf-success);
}
.rf-workout-pill.planned {
  background: var(--rf-accent-faint2);
  color: oklch(66% 0.14 50);
  border: 1px dashed oklch(67% 0.165 50 / 0.25);
}

@media (max-width: 768px) {
  .rf-week-grid { grid-template-columns: repeat(4, 1fr); }
  .rf-page { padding: 1.25rem 1rem 4rem; }
}
@media (max-width: 480px) {
  .rf-week-grid { grid-template-columns: repeat(2, 1fr); }
  .rf-week-grid .rf-day-col:last-child:nth-child(odd) { grid-column: span 2; }
}

/* --- Log workout ------------------------------------------ */
.rf-session-start {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  gap: 1.5rem;
}
.rf-start-ring {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 2px solid var(--rf-accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--rf-accent);
  background: var(--rf-accent-faint2);
}

.rf-exercise-block {
  background: var(--rf-surface);
  border: 1px solid var(--rf-border);
  border-radius: var(--r-lg);
  margin-bottom: 0.875rem;
  overflow: hidden;
}
.rf-exercise-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1rem;
  gap: 0.75rem;
}
.rf-exercise-header h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.rf-sets-area { padding: 0 1rem 0.75rem; }
.rf-set-row {
  display: grid;
  grid-template-columns: 28px 1fr 1fr 44px;
  gap: 0.5rem;
  align-items: center;
  padding: 0.375rem 0;
  border-top: 1px solid var(--rf-border);
}
.rf-set-row:first-child { border-top: none; }
.rf-set-num {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--rf-subtle);
  text-align: center;
}
.rf-set-done {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--rf-border-2);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--t), border-color var(--t);
  justify-self: center;
  align-self: center;
}
.rf-set-done.is-done {
  background: var(--rf-accent);
  border-color: var(--rf-accent);
  color: var(--rf-on-accent);
}

.rf-session-bar {
  position: fixed;
  bottom: 0;
  left: var(--rf-nav-width);
  right: 0;
  background: var(--rf-surface);
  border-top: 1px solid var(--rf-border);
  padding: 0.875rem 2rem calc(0.875rem + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  z-index: 100;
  box-shadow: 0 -4px 16px oklch(0% 0 0 / 0.3);
}
.rf-timer {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--rf-accent);
  font-variant-numeric: tabular-nums;
}

.rf-exercise-picker {
  background: var(--rf-surface-2);
  border: 1px solid var(--rf-border-2);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 0.875rem;
}
.rf-picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--rf-border);
  cursor: pointer;
  transition: background var(--t);
  font-size: 0.875rem;
}
.rf-picker-item:last-child { border-bottom: none; }
.rf-picker-item:hover { background: oklch(100% 0 0 / 0.04); }

/* --- Progress chart --------------------------------------- */
.rf-chart-wrap {
  position: relative;
  width: 100%;
  overflow-x: auto;
}
.rf-chart-wrap svg {
  width: 100%;
  min-width: 360px;
  overflow: visible;
  display: block;
}

/* --- Template list ---------------------------------------- */
.rf-template-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--rf-border);
  transition: background var(--t);
}
.rf-template-item:last-child { border-bottom: none; }
.rf-template-item:hover { background: oklch(100% 0 0 / 0.025); }

/* --- Exercise library ------------------------------------- */
.rf-exercise-group { margin-bottom: 1.5rem; }
.rf-exercise-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--rf-border);
  gap: 0.75rem;
  font-size: 0.9rem;
  transition: background var(--t);
  cursor: pointer;
}
.rf-exercise-row:last-child { border-bottom: none; }
.rf-exercise-row:hover { background: oklch(100% 0 0 / 0.025); }

/* --- Summary card ----------------------------------------- */
.rf-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 480px) {
  .rf-summary-grid { grid-template-columns: 1fr; }
}

/* --- Scrollbar -------------------------------------------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--rf-border-2); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: oklch(44% 0.014 55); }

/* --- Misc utilities --------------------------------------- */
.rf-flex         { display: flex; }
.rf-flex-between { display: flex; align-items: center; justify-content: space-between; }
.rf-flex-center  { display: flex; align-items: center; justify-content: center; }
.rf-gap-xs  { gap: 0.375rem; }
.rf-gap-sm  { gap: 0.625rem; }
.rf-gap     { gap: 1rem; }
.rf-gap-lg  { gap: 1.5rem; }
.rf-mt-xs   { margin-top: 0.375rem; }
.rf-mt-sm   { margin-top: 0.625rem; }
.rf-mt      { margin-top: 1rem; }
.rf-mt-lg   { margin-top: 1.5rem; }
.rf-mb-xs   { margin-bottom: 0.375rem; }
.rf-mb-sm   { margin-bottom: 0.625rem; }
.rf-mb      { margin-bottom: 1rem; }
.rf-mb-lg   { margin-bottom: 1.5rem; }
.rf-w-full  { width: 100%; }

/* --- Spinner ----------------------------------------------- */
@keyframes rf-spin { to { transform: rotate(360deg); } }
.rf-spinner {
  width: 28px; height: 28px;
  border: 2.5px solid var(--rf-border-2);
  border-top-color: var(--rf-accent);
  border-radius: 50%;
  animation: rf-spin 0.7s linear infinite;
}

/* --- Auth shell -------------------------------------------- */
.rf-auth-shell {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--rf-bg);
  padding: 1.5rem;
}

.rf-auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--rf-surface);
  border: 1px solid var(--rf-border);
  border-radius: var(--r-lg);
  padding: 2.5rem 2rem 2rem;
}

.rf-auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.rf-auth-logo-icon {
  width: 48px; height: 48px;
  background: var(--rf-accent);
  border-radius: var(--r);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: oklch(10% 0.009 55);
  margin-bottom: 1rem;
}

.rf-auth-title {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--rf-text);
  margin: 0 0 0.25rem;
}

.rf-auth-sub {
  font-size: 0.875rem;
  color: var(--rf-muted);
  margin: 0;
}

.rf-auth-error {
  background: var(--rf-danger-bg);
  border: 1px solid oklch(62% 0.18 25 / 0.3);
  color: var(--rf-danger);
  border-radius: var(--r-sm);
  padding: 0.625rem 0.875rem;
  font-size: 0.8125rem;
  margin-bottom: 1.25rem;
}

.rf-auth-footer {
  text-align: center;
  font-size: 0.8125rem;
  color: var(--rf-muted);
  margin-top: 1.5rem;
  margin-bottom: 0;
}

.rf-auth-footer a {
  color: var(--rf-accent);
  text-decoration: none;
  font-weight: 600;
}

.rf-auth-footer a:hover { text-decoration: underline; }

.rf-field-error {
  display: block;
  font-size: 0.8rem;
  color: var(--rf-danger);
  margin-top: 0.25rem;
}

/* --- Topbar ------------------------------------------------ */
.rf-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--rf-topbar-h);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 2rem;
  background: oklch(12% 0.01 50 / 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rf-border);
}
.rf-topbar-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--rf-text);
  letter-spacing: -0.01em;
}
.rf-topbar-spacer { flex: 1; }

.rf-topbar-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--rf-surface);
  border: 1px solid var(--rf-border);
  border-radius: var(--r-sm);
  padding: 0.4375rem 0.75rem;
  color: var(--rf-muted);
  font-family: inherit;
  font-size: 0.8125rem;
  width: 210px;
  cursor: pointer;
  transition: border-color var(--t), background var(--t);
  user-select: none;
  flex-shrink: 0;
}
.rf-topbar-search:hover {
  background: var(--rf-surface-2);
  border-color: var(--rf-border-2);
}
.rf-topbar-search:focus-visible {
  outline: 2px solid var(--rf-accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.rf-topbar-action {
  width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  background: var(--rf-surface);
  border: 1px solid var(--rf-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--t), color var(--t);
  color: var(--rf-muted);
  text-decoration: none;
  flex-shrink: 0;
}
.rf-topbar-action:hover {
  background: var(--rf-surface-2);
  color: var(--rf-text);
  text-decoration: none;
}
.rf-topbar-action:focus-visible {
  outline: 2px solid var(--rf-accent);
  outline-offset: 2px;
}

.rf-notif-btn {
  position: relative;
}
.rf-notif-btn::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--rf-accent);
  border: 1.5px solid oklch(12% 0.01 50);
}

@media (max-width: 768px) {
  .rf-topbar-search { display: none; }
}

/* --- User avatar ------------------------------------------- */
.rf-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--rf-accent-surface);
  border: 1px solid oklch(67% 0.165 50 / 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--rf-accent);
  flex-shrink: 0;
}

/* --- Page eyebrow ------------------------------------------ */
.rf-page-eyebrow {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rf-muted);
  margin-bottom: 0.25rem;
}

/* --- Card link (header action) ----------------------------- */
.rf-card-link {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--rf-accent);
  text-decoration: none;
  transition: color var(--t);
}
.rf-card-link:hover { color: var(--rf-accent-hover); text-decoration: none; }

/* --- Dashboard layout -------------------------------------- */
.rf-dash-grid {
  display: grid;
  grid-template-columns: 1fr 296px;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 1000px) {
  .rf-dash-grid { grid-template-columns: 1fr; }
}

/* --- Today's workout card ---------------------------------- */
.rf-today-card {
  background: var(--rf-surface);
  border: 1px solid var(--rf-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.rf-today-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.125rem 1.25rem 1rem;
  border-bottom: 1px solid var(--rf-border);
}
.rf-today-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--rf-accent-surface);
  color: var(--rf-accent);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  margin-bottom: 0.5rem;
}
.rf-today-badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--rf-accent);
  flex-shrink: 0;
}
.rf-today-name {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--rf-text);
  letter-spacing: -0.01em;
  margin-bottom: 0.25rem;
}
.rf-today-name-sub {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--rf-muted);
}
.rf-today-meta {
  font-size: 0.75rem;
  color: var(--rf-muted);
}
.rf-today-ex-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--rf-border);
  gap: 1rem;
}
.rf-today-ex-row:last-child { border-bottom: none; }
.rf-today-ex-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--rf-text);
  margin-bottom: 2px;
}
.rf-today-ex-detail {
  font-size: 0.75rem;
  color: var(--rf-muted);
}
.rf-today-ex-last {
  color: var(--rf-subtle);
}
.rf-today-set-dots {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.rf-today-set-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--rf-surface-3);
}
.rf-today-ex-more {
  padding: 0.625rem 1.25rem;
  font-size: 0.75rem;
  color: var(--rf-muted);
  font-style: italic;
  text-align: center;
}

/* Done-today variant */
.rf-today-badge--done {
  background: var(--rf-success-bg);
  color: var(--rf-success);
}
.rf-today-badge--done::before { display: none; }

.rf-today-done-stats {
  display: flex;
  border-bottom: 1px solid var(--rf-border);
}
.rf-today-done-stat {
  flex: 1;
  padding: 0.875rem 0.5rem;
  text-align: center;
  border-right: 1px solid var(--rf-border);
}
.rf-today-done-stat:last-child { border-right: none; }
.rf-today-done-val {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--rf-text);
  letter-spacing: -0.02em;
}
.rf-today-done-label {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--rf-muted);
  margin-top: 3px;
}
.rf-today-set-dot--done { background: var(--rf-success); }

/* --- Session list items ------------------------------------ */
.rf-session-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--rf-border);
}
.rf-session-item:last-child { border-bottom: none; }
.rf-session-body { min-width: 0; flex: 1; overflow: hidden; }
.rf-session-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  background: var(--rf-surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--rf-muted);
  letter-spacing: 0.04em;
}
.rf-session-icon.accent {
  background: var(--rf-accent-surface);
  color: var(--rf-accent);
}
.rf-session-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--rf-text);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rf-session-meta {
  font-size: 0.75rem;
  color: var(--rf-muted);
}
.rf-session-vol {
  margin-left: auto;
  text-align: right;
  flex-shrink: 0;
}
.rf-session-vol-num {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--rf-text);
  font-variant-numeric: tabular-nums;
}
.rf-session-vol-label {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--rf-muted);
  margin-top: 1px;
}

/* --- Stat tiles (2×2 grid) --------------------------------- */
.rf-stat-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.625rem;
}
.rf-stat-tile {
  background: var(--rf-surface-2);
  border-radius: var(--r);
  padding: 0.875rem;
}
.rf-stat-tile-label {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--rf-muted);
  margin-bottom: 0.375rem;
}
.rf-stat-tile-val {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--rf-text);
  letter-spacing: -0.025em;
  line-height: 1;
}
.rf-stat-tile-sub {
  font-size: 0.6875rem;
  color: var(--rf-muted);
  margin-top: 0.3125rem;
}

/* --- Stat tile target label -------------------------------- */
.rf-stat-tile-target {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--rf-muted);
  margin-left: 1px;
}

/* --- Volume split bars ------------------------------------- */
.rf-split-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.5rem;
}
.rf-split-row:last-of-type { margin-bottom: 0; }
.rf-split-label {
  font-size: 0.75rem;
  color: var(--rf-muted);
  width: 76px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rf-split-bar-bg {
  flex: 1;
  background: var(--rf-surface-2);
  border-radius: 999px;
  height: 5px;
  overflow: hidden;
}
.rf-split-bar-fill {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: var(--rf-accent);
  transform-origin: left;
  transition: transform 0.5s ease-out;
}
.rf-split-pct {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--rf-muted);
  width: 22px;
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.rf-split-footer {
  font-size: 0.6875rem;
  color: var(--rf-subtle);
  margin-top: 0.75rem;
}

/* --- Week schedule list ------------------------------------ */
.rf-schedule-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.25rem;
  border-bottom: 1px solid var(--rf-border);
}
.rf-schedule-item:last-child { border-bottom: none; }
.rf-schedule-day {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  background: var(--rf-surface-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.rf-schedule-day.today { background: var(--rf-accent-surface); }
.rf-schedule-day-name {
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--rf-muted);
  line-height: 1;
}
.rf-schedule-day.today .rf-schedule-day-name { color: var(--rf-accent); }
.rf-schedule-day-num {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--rf-text);
  line-height: 1.2;
}
.rf-schedule-day.today .rf-schedule-day-num { color: var(--rf-accent); }
.rf-schedule-workout {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--rf-text);
}
.rf-schedule-item.today .rf-schedule-workout { color: var(--rf-accent); }
.rf-schedule-rest {
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--rf-muted);
  font-style: italic;
}

/* --- Template exercise editor ------------------------------ */
.rf-tmpl-ex-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.25rem;
  border-bottom: 1px solid var(--rf-border);
  transition: background var(--t);
}
.rf-tmpl-ex-row:hover { background: oklch(100% 0 0 / 0.02); }

.rf-tmpl-ex-num {
  width: 20px;
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--rf-muted);
  text-align: center;
}

.rf-tmpl-ex-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.rf-tmpl-ex-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--rf-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rf-tmpl-ex-fields {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.rf-tmpl-ex-fields > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.rf-tmpl-ex-field-label {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--rf-muted);
}

.rf-tmpl-ex-fields input[type="number"] {
  width: 52px;
  text-align: center;
  font-size: 0.875rem;
  padding: 0.3rem 0.4rem;
  background: var(--rf-surface-2);
  border: 1px solid var(--rf-border);
  border-radius: var(--r-sm);
  color: var(--rf-text);
}
.rf-tmpl-ex-fields input[type="number"]:focus {
  outline: 2px solid var(--rf-accent);
  outline-offset: 1px;
  border-color: transparent;
}

.rf-tmpl-drag-handle {
  flex-shrink: 0;
  cursor: grab;
  color: var(--rf-subtle);
  opacity: 0;
  transition: opacity var(--t);
  display: flex;
  align-items: center;
  padding: 0 2px;
}
.rf-tmpl-ex-row:hover .rf-tmpl-drag-handle { opacity: 1; }
.rf-tmpl-ex-row.rf-dragging { opacity: 0.35; }
.rf-tmpl-ex-row.rf-drag-over {
  background: var(--rf-accent-surface);
  border-top: 2px solid var(--rf-accent);
}

/* --- Exercise picker panel --------------------------------- */
.rf-ex-picker-panel {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.rf-ex-picker-list {
  background: var(--rf-surface);
  border: 1px solid var(--rf-border);
  border-radius: var(--r-sm);
  max-height: 240px;
  overflow-y: auto;
}

.rf-ex-picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid var(--rf-border);
  cursor: pointer;
  transition: background var(--t);
  gap: 0.75rem;
}
.rf-ex-picker-item:last-child { border-bottom: none; }
.rf-ex-picker-item:hover { background: oklch(100% 0 0 / 0.04); }
.rf-ex-picker-item.added {
  opacity: 0.55;
  cursor: default;
}
.rf-ex-picker-item.added:hover { background: transparent; }

/* --- Reduced motion ---------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  .rf-skeleton { animation: none; background: var(--rf-surface-2); }
  .rf-spinner { animation: none; border-top-color: var(--rf-accent); }
}

/* ============================================================
   Log Workout — Active Session UI
   ============================================================ */

/* Session header bar (sticky, below rf-topbar) */
.rf-lw-bar {
  position: sticky;
  top: var(--rf-topbar-h, 52px);
  z-index: 30;
  background: oklch(12% 0.01 50 / 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rf-border);
  height: 54px;
  display: flex;
  align-items: center;
  padding: 0 1rem;
  gap: 0;
  flex-shrink: 0;
}

.rf-lw-exit {
  display: flex; align-items: center; gap: 6px;
  color: var(--rf-muted); font-size: 0.875rem; font-weight: 500;
  background: none; border: none; cursor: pointer;
  padding: 8px 4px; transition: color 120ms ease;
  flex-shrink: 0; font-family: inherit;
}
.rf-lw-exit:hover { color: var(--rf-text); }
.rf-lw-exit svg { flex-shrink: 0; }

.rf-lw-bar-center { flex: 1; text-align: center; }
.rf-lw-bar-name {
  font-size: 0.9375rem; font-weight: 700; color: var(--rf-text);
  letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 220px; margin: 0 auto; line-height: 1.2;
}
.rf-lw-bar-elapsed {
  font-size: 0.6875rem; font-weight: 600; color: var(--rf-subtle);
  letter-spacing: 0.04em; margin-top: 2px;
  font-variant-numeric: tabular-nums; line-height: 1;
}

.rf-lw-finish-btn {
  background: none; border: 1.5px solid var(--rf-accent);
  border-radius: var(--r-sm); color: var(--rf-accent);
  font-size: 0.8125rem; font-weight: 700;
  padding: 7px 14px; cursor: pointer; letter-spacing: 0.01em;
  transition: background 150ms ease, color 150ms ease;
  white-space: nowrap; flex-shrink: 0; font-family: inherit;
}
.rf-lw-finish-btn:hover { background: var(--rf-accent); color: var(--rf-on-accent); }

/* Rest timer band */
.rf-lw-rest {
  background: oklch(14% 0.04 50);
  border-bottom: 1px solid oklch(35% 0.08 50 / 0.4);
  padding: 14px 20px 16px;
  transition: background 300ms ease, border-color 300ms ease;
}
.rf-lw-rest.hidden { display: none; }
.rf-lw-rest-label {
  font-size: 0.625rem; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--rf-accent-dim);
  text-align: center; margin-bottom: 6px;
}
.rf-lw-rest-display {
  font-size: 3.25rem; font-weight: 800; color: var(--rf-accent);
  text-align: center; line-height: 1; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.rf-lw-rest-display.urgent { color: var(--rf-danger); }
.rf-lw-rest-controls {
  display: flex; gap: 10px; justify-content: center; margin-top: 12px;
}
.rf-lw-rest-btn {
  background: oklch(22% 0.05 50); border: none; border-radius: var(--r-sm);
  color: var(--rf-muted); font-size: 0.8125rem; font-weight: 600;
  padding: 11px 18px; min-height: 44px; cursor: pointer; font-family: inherit;
  transition: background 120ms ease, color 120ms ease;
}
.rf-lw-rest-btn:hover { background: oklch(28% 0.06 50); color: var(--rf-text); }
.rf-lw-rest-progress {
  height: 3px; background: oklch(22% 0.05 50);
  border-radius: 2px; margin-top: 14px; overflow: hidden;
}
.rf-lw-rest-fill {
  width: 100%; height: 100%; background: var(--rf-accent); border-radius: 2px;
  transform-origin: left;
  transition: transform 1s linear;
}

/* Exercise progress pips row (mobile) */
.rf-lw-pips-row {
  padding: 14px 18px 0;
  display: flex; align-items: center; gap: 8px;
}
.rf-lw-pips {
  display: flex; gap: 4px; flex: 1;
}
.rf-lw-pip {
  flex: 1; height: 3px; border-radius: 2px;
  background: var(--rf-surface-3);
  transition: background 200ms ease;
}
.rf-lw-pip.done { background: oklch(45% 0.10 145); }
.rf-lw-pip.active { background: var(--rf-accent); }
.rf-lw-pips-label {
  font-size: 0.6875rem; font-weight: 600; color: var(--rf-subtle);
  white-space: nowrap; letter-spacing: 0.04em;
}

/* Exercise header */
.rf-lw-ex-head { padding: 16px 18px 12px; }
.rf-lw-ex-muscle {
  font-size: 0.625rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--rf-subtle); margin-bottom: 4px;
}
.rf-lw-ex-name {
  font-size: 1.375rem; font-weight: 800; color: var(--rf-text);
  letter-spacing: -0.02em; line-height: 1; margin-bottom: 8px;
}
.rf-lw-ex-head-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.rf-lw-ex-last {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--rf-surface-2); border-radius: 6px;
  padding: 5px 10px; font-size: 0.6875rem; color: var(--rf-muted);
}
.rf-lw-ex-last strong { color: var(--rf-muted); font-weight: 600; }

/* Sets area */
.rf-lw-sets-area { padding: 0 18px; }
.rf-lw-sets-header {
  display: grid; grid-template-columns: 28px 1fr 1fr 48px;
  gap: 8px; align-items: center;
  padding: 8px 4px;
  border-bottom: 1px solid var(--rf-border);
  margin-bottom: 4px;
}
.rf-lw-sets-header span {
  font-size: 0.5625rem; font-weight: 700; letter-spacing: 0.10em;
  text-transform: uppercase; color: var(--rf-subtle); text-align: center;
}
.rf-lw-sets-header span:first-child { text-align: left; }

/* Set row overrides inside session */
.rf-lw-sets-area .rf-set-row {
  display: grid;
  grid-template-columns: 28px 1fr 1fr 48px;
  gap: 8px; align-items: center;
  padding: 6px 4px;
  border-radius: 10px;
  margin-bottom: 4px;
  border-top: none;
  transition: background 150ms ease;
}
.rf-lw-sets-area .rf-set-row.set-done { background: var(--rf-success-bg); }
.rf-lw-sets-area .rf-set-row.set-done .rf-set-num { color: oklch(45% 0.10 145); }
.rf-lw-sets-area .rf-set-row.set-active {
  background: var(--rf-accent-faint2);
  padding: 10px 4px;
}
.rf-lw-sets-area .rf-set-row.set-active .rf-set-num { color: var(--rf-accent); }

/* Set field (done / pending static display) */
.rf-lw-set-field {
  text-align: center; font-size: 0.9375rem; font-weight: 700; color: var(--rf-text);
}
.rf-lw-set-field small {
  display: block; font-size: 0.5625rem; font-weight: 500; color: var(--rf-subtle);
}
.rf-lw-sets-area .rf-set-row.set-done .rf-lw-set-field { color: var(--rf-success); }
.rf-lw-sets-area .rf-set-row.set-pending .rf-lw-set-field { opacity: 0.35; }

/* Stepper control */
.rf-stepper {
  display: flex; align-items: center;
  background: var(--rf-surface-2); border-radius: var(--r-sm);
  overflow: hidden; height: 44px;
}
.rf-stepper-btn {
  width: 44px; height: 44px;
  background: none; border: none; cursor: pointer;
  color: var(--rf-muted); font-size: 1.125rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  transition: background 100ms ease, color 100ms ease;
  flex-shrink: 0; font-family: inherit;
}
.rf-stepper-btn:hover { background: var(--rf-surface-3); color: var(--rf-text); }
.rf-stepper-btn:active { background: var(--rf-border); }
.rf-stepper-val {
  flex: 1; text-align: center;
  font-size: 0.9375rem; font-weight: 700; color: var(--rf-text);
  letter-spacing: -0.01em; font-variant-numeric: tabular-nums;
  min-width: 0; white-space: nowrap; overflow: hidden;
  line-height: 1.2;
}
.rf-stepper-unit {
  font-size: 0.5625rem; font-weight: 500; color: var(--rf-muted);
  display: block; line-height: 1; margin-top: 1px;
}

/* Log set button */
.rf-lw-log-btn {
  width: 44px; height: 44px; border-radius: var(--r-sm);
  border: 1.5px solid var(--rf-border);
  background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 120ms ease, border-color 120ms ease;
  flex-shrink: 0;
}
.rf-lw-log-btn:hover:not(:disabled) { background: var(--rf-surface-2); border-color: var(--rf-subtle); }
.rf-lw-log-btn svg { color: var(--rf-subtle); }
.rf-lw-log-btn.is-active {
  background: var(--rf-accent); border-color: var(--rf-accent);
  animation: rf-lw-pulse 2.4s ease-in-out infinite;
}
.rf-lw-log-btn.is-active:hover { background: var(--rf-accent-hover); border-color: var(--rf-accent-hover); animation: none; }
.rf-lw-log-btn.is-active svg { color: var(--rf-on-accent); }
.rf-lw-log-btn.is-done { background: var(--rf-success-bg); border-color: transparent; }
.rf-lw-log-btn.is-done svg { color: var(--rf-success); }
.rf-lw-log-btn:disabled { opacity: 0.28; cursor: default; }

@keyframes rf-lw-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.55; }
}

/* Add set button */
.rf-lw-add-set-btn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  margin: 8px 18px 12px;
  padding: 12px;
  background: none; border: 1.5px dashed var(--rf-border);
  border-radius: 10px; cursor: pointer;
  font-size: 0.8125rem; font-weight: 600; color: var(--rf-subtle);
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease;
  font-family: inherit;
  width: calc(100% - 36px);
}
.rf-lw-add-set-btn:hover {
  border-color: var(--rf-accent); color: var(--rf-accent);
  background: var(--rf-accent-faint2);
}

/* Notes area */
.rf-lw-note-area {
  margin: 0 18px 12px;
  padding: 10px 12px;
  background: var(--rf-surface);
  border-radius: var(--r-sm); border: 1px solid var(--rf-border);
  display: flex; align-items: center; gap: 8px;
  cursor: text;
}
.rf-lw-note-area svg { color: var(--rf-subtle); flex-shrink: 0; }
.rf-lw-note-input {
  flex: 1; background: none; border: none; outline: none;
  font-size: 0.75rem; color: var(--rf-muted); font-family: inherit;
}
.rf-lw-note-input::placeholder { color: var(--rf-subtle); }
.rf-lw-note-input:focus { color: var(--rf-text); }

/* Desktop layout grid */
.rf-lw-layout { display: flex; flex-direction: column; }
.rf-lw-ex-sidebar { display: none; }

@media (min-width: 769px) {
  .rf-lw-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    align-items: start;
  }
  .rf-lw-ex-sidebar {
    display: flex; flex-direction: column;
    border-right: 1px solid var(--rf-border);
    height: calc(100dvh - var(--rf-topbar-h, 52px) - 54px - 65px);
    position: sticky;
    top: calc(var(--rf-topbar-h, 52px) + 54px);
    overflow-y: auto;
  }
  .rf-lw-pips-row { display: none; }
  .rf-lw-add-ex-mobile { display: none; }
  .rf-lw-ex-nav { left: calc(var(--rf-nav-width, 228px) + 260px) !important; }
}

@media (max-width: 768px) {
  .rf-lw-ex-nav { left: 0 !important; }
}

/* Sidebar exercise items */
.rf-lw-ex-sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; cursor: pointer;
  transition: background var(--t);
  border-bottom: 1px solid var(--rf-border);
}
.rf-lw-ex-sidebar-item:hover { background: oklch(100% 0 0 / 0.03); }
.rf-lw-ex-sidebar-item.active { background: var(--rf-accent-faint2); }
.rf-lw-ex-sidebar-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--rf-border-2); flex-shrink: 0;
  transition: background var(--t);
}
.rf-lw-ex-sidebar-item.active .rf-lw-ex-sidebar-dot { background: var(--rf-accent); }
.rf-lw-ex-sidebar-item.done .rf-lw-ex-sidebar-dot { background: var(--rf-success); }
.rf-lw-ex-sidebar-name {
  font-size: 0.875rem; font-weight: 600; color: var(--rf-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1;
}
.rf-lw-ex-sidebar-meta { font-size: 0.75rem; color: var(--rf-muted); margin-top: 1px; }
.rf-lw-ex-sidebar-add {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 14px; cursor: pointer;
  font-size: 0.8125rem; font-weight: 500; color: var(--rf-accent);
  background: none; border: none; font-family: inherit;
  transition: background var(--t); width: 100%;
  border-top: 1px solid var(--rf-border); margin-top: auto;
}
.rf-lw-ex-sidebar-add:hover { background: oklch(100% 0 0 / 0.03); }

/* Exercise detail area */
.rf-lw-ex-detail { padding-bottom: 80px; min-height: 60vh; }

/* Exercise nav (fixed bottom) */
.rf-lw-ex-nav {
  position: fixed; bottom: 0;
  left: var(--rf-nav-width, 228px); right: 0;
  background: var(--rf-surface);
  border-top: 1px solid var(--rf-border);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 12px;
  z-index: 50;
  box-shadow: 0 -4px 16px oklch(0% 0 0 / 0.3);
}
.rf-lw-ex-nav-btn {
  background: var(--rf-surface-2); border: 1px solid var(--rf-border);
  border-radius: var(--r); padding: 10px 14px;
  display: flex; align-items: center; gap: 6px;
  cursor: pointer; transition: background 120ms ease, border-color 120ms ease;
  font-family: inherit; text-align: left;
}
.rf-lw-ex-nav-btn:hover { background: var(--rf-surface-3); border-color: var(--rf-border-2); }
.rf-lw-ex-nav-btn svg { color: var(--rf-subtle); flex-shrink: 0; }
.rf-lw-ex-nav-name { font-size: 0.75rem; font-weight: 600; color: var(--rf-muted); line-height: 1.2; }
.rf-lw-ex-nav-label {
  font-size: 0.5rem; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--rf-subtle); display: block; margin-bottom: 2px;
}
.rf-lw-ex-nav-btn.next { flex-direction: row-reverse; text-align: right; justify-content: flex-start; }

.rf-lw-vol-ticker { text-align: center; }
.rf-lw-vol-num {
  font-size: 0.9375rem; font-weight: 800; color: var(--rf-text);
  letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1;
}
.rf-lw-vol-label {
  font-size: 0.5rem; font-weight: 600; letter-spacing: 0.10em;
  text-transform: uppercase; color: var(--rf-subtle);
}
.rf-lw-add-ex-nav-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--rf-accent-faint2); border: 1px solid var(--rf-accent-faint);
  border-radius: var(--r); padding: 10px 16px;
  cursor: pointer; font-size: 0.8125rem; font-weight: 600;
  color: var(--rf-accent); font-family: inherit;
  transition: background var(--t), border-color var(--t);
}
.rf-lw-add-ex-nav-btn:hover { background: var(--rf-accent-faint); }

/* Finish sheet */
.rf-lw-finish-sheet {
  position: fixed; inset: 0; z-index: 200;
  display: none; align-items: flex-end;
}
.rf-lw-finish-sheet.open { display: flex; }
.rf-lw-finish-backdrop {
  position: absolute; inset: 0;
  background: var(--rf-overlay); backdrop-filter: blur(4px);
}
.rf-lw-finish-panel {
  position: relative; z-index: 1;
  background: var(--rf-surface);
  border-radius: 20px 20px 0 0;
  border: 1px solid var(--rf-border); border-bottom: none;
  padding: 0 24px calc(40px + env(safe-area-inset-bottom));
  width: 100%; max-width: 480px; margin: 0 auto;
}
.rf-lw-finish-handle {
  width: 40px; height: 4px; background: var(--rf-border-2);
  border-radius: 2px; margin: 20px auto 20px;
}
.rf-lw-finish-title {
  font-size: 1.125rem; font-weight: 800; color: var(--rf-text);
  letter-spacing: -0.02em; margin-bottom: 6px;
}
.rf-lw-finish-sub { font-size: 0.875rem; color: var(--rf-muted); margin-bottom: 20px; }
.rf-lw-finish-stats {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 10px; margin-bottom: 20px;
}
.rf-lw-finish-stat {
  background: var(--rf-surface-2); border-radius: 10px; padding: 14px 12px;
}
.rf-lw-finish-stat-val {
  font-size: 1.25rem; font-weight: 800; color: var(--rf-text);
  letter-spacing: -0.02em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.rf-lw-finish-stat-label {
  font-size: 0.5rem; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--rf-muted); margin-top: 5px;
}
.rf-lw-finish-save {
  display: block; width: 100%; padding: 15px;
  background: var(--rf-accent); border: none; border-radius: 12px;
  color: var(--rf-on-accent); font-size: 1rem; font-weight: 800;
  cursor: pointer; transition: background 150ms ease;
  letter-spacing: -0.01em; font-family: inherit; margin-bottom: 8px;
}
.rf-lw-finish-save:hover { background: var(--rf-accent-hover); }
.rf-lw-finish-save:disabled { opacity: 0.5; cursor: not-allowed; }
.rf-lw-finish-keep {
  display: block; width: 100%; padding: 12px;
  background: none; border: none;
  color: var(--rf-muted); font-size: 0.875rem; font-weight: 500;
  cursor: pointer; font-family: inherit; text-align: center;
}
.rf-lw-finish-discard {
  display: block; width: 100%; padding: 8px;
  background: none; border: none;
  color: var(--rf-danger); font-size: 0.8125rem; font-weight: 500;
  cursor: pointer; font-family: inherit; text-align: center; margin-top: 2px;
}

/* Add exercise sheet */
.rf-lw-add-sheet {
  position: fixed; inset: 0; z-index: 200;
  display: none; align-items: flex-end;
}
.rf-lw-add-sheet.open { display: flex; }
.rf-lw-add-backdrop {
  position: absolute; inset: 0;
  background: var(--rf-overlay); backdrop-filter: blur(4px);
}
.rf-lw-add-panel {
  position: relative; z-index: 1;
  background: var(--rf-surface);
  border-radius: 20px 20px 0 0;
  border: 1px solid var(--rf-border); border-bottom: none;
  width: 100%; max-width: 480px; margin: 0 auto;
  max-height: 82vh; display: flex; flex-direction: column;
}
.rf-lw-add-panel-head {
  padding: 20px 20px 12px;
  border-bottom: 1px solid var(--rf-border); flex-shrink: 0;
}
.rf-lw-add-panel-head-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.rf-lw-add-panel-list {
  overflow-y: auto; flex: 1;
  padding-bottom: env(safe-area-inset-bottom);
}
.rf-lw-add-panel-list .rf-picker-item:last-child { border-bottom: none; }

/* ============================================================
   Export Workout Modal
   ============================================================ */

/* Overlay */
.rf-export-overlay {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: center; justify-content: center;
}
.rf-export-backdrop {
  position: absolute; inset: 0;
  background: var(--rf-overlay); backdrop-filter: blur(4px);
}
.rf-export-dialog {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  width: min(860px, calc(100vw - 2rem));
  max-height: calc(100vh - 3rem);
  background: var(--rf-surface);
  border: 1px solid var(--rf-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

/* Controls bar */
.rf-export-controls {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 0.6875rem 1rem;
  border-bottom: 1px solid var(--rf-border);
  flex-shrink: 0;
}
.rf-export-controls-title {
  font-size: 0.875rem; font-weight: 600; color: var(--rf-text);
  margin-right: auto;
  display: flex; align-items: center; gap: 0.4rem;
}
.rf-export-count-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--rf-accent-surface);
  color: var(--rf-accent);
  border-radius: 99px;
  font-size: 0.6875rem; font-weight: 700;
}
.rf-export-toggle {
  display: flex; align-items: center; gap: 0.375rem;
  font-size: 0.8125rem; color: var(--rf-muted); cursor: pointer;
  user-select: none; white-space: nowrap;
}
.rf-export-toggle input { accent-color: var(--rf-accent); cursor: pointer; }

/* Two-panel body */
.rf-export-body {
  display: flex; flex: 1; overflow: hidden;
}

/* Sidebar */
.rf-export-sidebar {
  width: 196px; flex-shrink: 0;
  border-right: 1px solid var(--rf-border);
  overflow-y: auto;
  padding: 0.75rem 0;
}
.rf-export-sidebar-label {
  font-size: 0.5625rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--rf-subtle);
  padding: 0 0.875rem 0.5rem;
}
.rf-export-tmpl-item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  cursor: pointer;
  transition: background var(--t);
}
.rf-export-tmpl-item:hover { background: var(--rf-accent-faint2); }
.rf-export-tmpl-item.selected { background: var(--rf-accent-surface); }
.rf-export-tmpl-item input { accent-color: var(--rf-accent); flex-shrink: 0; cursor: pointer; }
.rf-export-tmpl-info { flex: 1; min-width: 0; }
.rf-export-tmpl-name {
  display: block;
  font-size: 0.8125rem; font-weight: 600; color: var(--rf-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rf-export-tmpl-count {
  font-size: 0.6875rem; color: var(--rf-muted);
}

/* Preview pane */
.rf-export-preview {
  flex: 1; overflow-y: auto;
  padding: 1.25rem;
  background: oklch(14% 0.01 55);
  display: flex; flex-direction: column; gap: 1.25rem;
}
.rf-export-empty {
  flex: 1; display: flex; align-items: center; justify-content: center;
  font-size: 0.875rem; color: var(--rf-subtle);
  text-align: center;
}

/* Print target wrapper */
.rf-export-print-target {
  visibility: visible;
  display: flex; flex-direction: column; gap: 1.25rem;
}

/* Individual sheet card (in preview) */
.rf-export-sheet {
  background: #fff;
  color: #1a1a1a;
  border-radius: 8px;
  overflow: hidden;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  box-shadow: 0 2px 16px oklch(0% 0 0 / 0.35);
}

/* ── Sheet internals ─────────────────────────────── */

/* Top bar: RF · loopset.app + date */
.rf-es-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.875rem 1.375rem 0.75rem;
}
.rf-es-brand {
  display: flex; align-items: center; gap: 0.5rem;
}
.rf-es-brand-mark {
  font-size: 0.6875rem; font-weight: 800;
  letter-spacing: 0.06em; color: #1a1a1a;
  background: #f0f0f0;
  padding: 2px 6px;
  border-radius: 3px;
}
.rf-es-brand-text {
  font-size: 0.6875rem; font-weight: 500;
  color: #888; letter-spacing: 0.01em;
}
.rf-es-topbar-date {
  font-size: 0.6875rem; color: #aaa; font-weight: 400;
}

/* Horizontal rules */
.rf-es-rule {
  height: 1px; background: #e0e0e0;
  margin: 0 1.375rem;
}
.rf-es-rule-top { margin-bottom: 0; }
.rf-es-rule-bottom { margin-top: 0; }

/* Hero */
.rf-es-hero {
  padding: 1.25rem 1.375rem 1rem;
}
.rf-es-title {
  font-size: 1.5rem; font-weight: 800;
  letter-spacing: -0.03em; color: #1a1a1a;
  margin: 0 0 0.25rem;
  line-height: 1.15;
}
.rf-es-desc {
  font-size: 0.8125rem; color: #666;
  margin: 0 0 0.375rem; line-height: 1.4;
}
.rf-es-meta {
  font-size: 0.6875rem; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: #aaa;
}

/* Exercise table */
.rf-es-table {
  padding: 0 1.375rem 0.75rem;
}
.rf-es-row {
  display: grid;
  align-items: start;
  column-gap: 0.75rem;
  padding: 0.5rem 0.5rem;
  border-radius: 4px;
}
.rf-es-row-head {
  padding: 0.5rem 0.5rem 0.375rem;
  border-bottom: 1.5px solid #1a1a1a;
  font-size: 0.5625rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: #999; border-radius: 0;
}
.rf-es-row-alt {
  background: #f8f8f8;
}
.rf-es-cell-right { text-align: right; }

.rf-es-num {
  font-size: 0.75rem; font-weight: 700;
  color: #bbb;
  padding-top: 1px;
}
.rf-es-ex-name {
  display: block;
  font-size: 0.875rem; font-weight: 700; color: #1a1a1a;
  letter-spacing: -0.01em; line-height: 1.3;
}
.rf-es-ex-tags {
  display: block;
  font-size: 0.6875rem; color: #888;
  margin-top: 1px;
}
.rf-es-alt {
  display: block;
  font-size: 0.6875rem; color: #aaa;
  margin-top: 2px; font-style: italic;
}
.rf-es-sets {
  font-size: 0.8125rem; font-weight: 700;
  color: #1a1a1a; font-variant-numeric: tabular-nums;
  padding-top: 1px;
}
.rf-es-weight {
  font-size: 0.8125rem; font-weight: 600;
  color: #1a1a1a; font-variant-numeric: tabular-nums;
  padding-top: 1px;
}
.rf-es-blank { color: #ccc; font-weight: 400; letter-spacing: 0.04em; }

.rf-es-weight-entry {
  display: flex; align-items: center; justify-content: flex-end; gap: 3px;
}
.rf-es-weight-input {
  width: 52px;
  font-size: 0.8125rem; font-weight: 600; font-family: inherit;
  color: #1a1a1a;
  border: none; border-bottom: 1.5px solid #d0d0d0;
  text-align: right;
  background: transparent;
  padding: 0 0 1px;
  outline: none;
  -moz-appearance: textfield;
}
.rf-es-weight-input:focus { border-bottom-color: #1a1a1a; }
.rf-es-weight-input::-webkit-outer-spin-button,
.rf-es-weight-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.rf-es-weight-input::placeholder { color: #ccc; font-weight: 400; }
.rf-es-weight-unit { font-size: 0.75rem; color: #aaa; font-weight: 400; }

.rf-es-note-input {
  display: block;
  width: 100%;
  margin-top: 4px;
  font-size: 0.6875rem; font-family: inherit; font-weight: 400;
  color: #555;
  border: none; border-bottom: 1px dashed #d8d8d8;
  background: transparent;
  padding: 1px 0 2px;
  outline: none;
}
.rf-es-note-input::placeholder { color: #ccc; }
.rf-es-note-input:focus { border-bottom-color: #aaa; }

.rf-es-empty {
  padding: 1.5rem 1.375rem;
  font-size: 0.875rem; color: #aaa; text-align: center;
}

/* Footer */
.rf-es-footer {
  display: flex; justify-content: space-between;
  padding: 0.625rem 1.375rem;
  font-size: 0.5625rem; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: #ccc;
}

/* ============================================================
   Print styles
   ============================================================ */

/* #rf-print-root is injected as a direct <body> child by rfExport.print().
   Hidden on screen; becomes the only visible content when printing. */
#rf-print-root { display: none; }

@page { margin: 1.5cm 2cm; size: A4 portrait; }

@media print {
  /* Hide everything in the app shell */
  body > *:not(#rf-print-root) { display: none !important; }

  /* Show the cloned sheets */
  #rf-print-root {
    display: block !important;
    background: white;
    color: #1a1a1a;
    font-family: 'Space Grotesk', system-ui, sans-serif;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Each template on its own page (all except the last carry this class) */
  .rf-es-page-break {
    page-break-after: always !important;
    break-after: page !important;
  }

  /* Clean up card chrome for print */
  .rf-export-sheet { border-radius: 0 !important; box-shadow: none !important; }

  /* Keep each exercise row on one page */
  .rf-es-row { page-break-inside: avoid !important; break-inside: avoid !important; }

  /* Keep the workout header glued to the first exercise */
  .rf-es-hero  { page-break-after: avoid !important; break-after: avoid !important; }
  .rf-es-rule  { page-break-after: avoid !important; break-after: avoid !important; }

  /* Weight inputs print as plain text — hide the underline */
  .rf-es-weight-input { border-bottom-color: transparent !important; }

  /* Hide empty note inputs; show filled ones without border */
  .rf-es-note-input:placeholder-shown { display: none !important; }
  .rf-es-note-input { border-bottom: none !important; }
}
