/* ============================================================
   REHAB TRACKING PWA - STYLESHEET
   Mobile-first | Dark Theme | Athletic Aesthetic
   ============================================================ */

/* ------------------------------------------------------------
   CSS CUSTOM PROPERTIES
   ------------------------------------------------------------ */
:root {
  /* Core palette */
  --bg-body: #0f0f0f;
  --bg-card: #1a1a1a;
  --bg-input: #252525;
  --bg-surface: #1e1e1e;
  --bg-elevated: #2a2a2a;

  /* Borders */
  --border-subtle: #333333;
  --border-focus: #555555;

  /* Text */
  --text-primary: #f0f0f0;
  --text-secondary: #a0a0a0;
  --text-muted: #8a8a8a;
  --text-inverse: #0f0f0f;

  /* Accent */
  --accent: #7B68EE;
  --accent-hover: #6a58dd;
  --accent-glow: rgba(123, 104, 238, 0.25);
  --accent-subtle: rgba(123, 104, 238, 0.12);

  /* Phase colors */
  --phase1: #FF6B6B;
  --phase1-bg: rgba(255, 107, 107, 0.12);
  --phase2: #FFA500;
  --phase2-bg: rgba(255, 165, 0, 0.12);
  --phase3: #51CF66;
  --phase3-bg: rgba(81, 207, 102, 0.12);

  /* Semantic */
  --success: #51CF66;
  --success-bg: rgba(81, 207, 102, 0.12);
  --warning: #FFA500;
  --warning-bg: rgba(255, 165, 0, 0.12);
  --danger: #FF6B6B;
  --danger-bg: rgba(255, 107, 107, 0.12);
  --info: #74C0FC;
  --info-bg: rgba(116, 192, 252, 0.12);

  /* Typography */
  --font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, "Cascadia Code",
    Consolas, "Liberation Mono", Menlo, monospace;
  --fs-xs: 0.9375rem;   /* 15px  (was 11px — extra bump for muted subtext) */
  --fs-sm: 1rem;        /* 16px  (was 14px) */
  --fs-base: 1rem;      /* 16px  (was 14px) */
  --fs-md: 1.125rem;    /* 18px  (was 16px) */
  --fs-lg: 1.25rem;     /* 20px  (was 18px) */
  --fs-xl: 1.5rem;      /* 24px  (was 22px) */
  --fs-2xl: 1.875rem;   /* 30px  (was 28px) */
  --lh-tight: 1.25;
  --lh-base: 1.5;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 999px;
  --radius-circle: 50%;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-accent: 0 4px 16px var(--accent-glow);

  /* Transitions */
  --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-base: 250ms;
  --duration-slow: 400ms;

  /* Layout */
  --header-height: 56px;
  --bottom-nav-height: 60px;
  --touch-target: 44px;
  --content-max-width: 600px;

  /* Safe areas */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

/* ------------------------------------------------------------
   LIGHT THEME
   ------------------------------------------------------------ */
[data-theme="light"] {
  --bg-body: #f5f5f7;
  --bg-card: #ffffff;
  --bg-input: #eeeef0;
  --bg-surface: #f0f0f2;
  --bg-elevated: #e8e8ec;

  --border-subtle: #d1d1d6;
  --border-focus: #a0a0a8;

  --text-primary: #1c1c1e;
  --text-secondary: #636366;
  --text-muted: #6c6c70;
  --text-inverse: #ffffff;

  --accent: #6355d8;
  --accent-hover: #5648c4;
  --accent-glow: rgba(99, 85, 216, 0.2);
  --accent-subtle: rgba(99, 85, 216, 0.08);

  --phase1-bg: rgba(255, 107, 107, 0.08);
  --phase2-bg: rgba(255, 165, 0, 0.08);
  --phase3-bg: rgba(81, 207, 102, 0.08);

  --success-bg: rgba(81, 207, 102, 0.08);
  --warning-bg: rgba(255, 165, 0, 0.08);
  --danger-bg: rgba(255, 107, 107, 0.08);
  --info-bg: rgba(116, 192, 252, 0.08);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .timer-overlay {
  background-color: rgba(245, 245, 247, 0.96);
}

[data-theme="light"] .pain-rule {
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

[data-theme="light"] .program-exercise-card,
[data-theme="light"] .phase-card,
[data-theme="light"] .day-row {
  box-shadow: var(--shadow-sm);
}

[data-theme="light"] .card {
  box-shadow: var(--shadow-sm);
}

[data-theme="light"] .wt-rehab          { background: rgba(240, 101, 149, 0.10); color: #d6336c; }
[data-theme="light"] .wt-chest-back     { background: rgba(255, 107, 107, 0.10); color: #e03131; }
[data-theme="light"] .wt-shoulders-arms { background: rgba(132, 94, 247, 0.10);  color: #7048e8; }
[data-theme="light"] .wt-legs           { background: rgba(34, 139, 230, 0.10);  color: #1971c2; }
[data-theme="light"] .wt-volume         { background: rgba(255, 146, 43, 0.10);  color: #e67700; }
[data-theme="light"] .wt-run            { background: rgba(18, 184, 134, 0.10);  color: #099268; }
[data-theme="light"] .wt-core           { background: rgba(183, 160, 18, 0.10);  color: #9a8700; }
[data-theme="light"] .wt-rest           { background: rgba(55, 178, 77, 0.10);   color: #2b8a3e; }


/* ------------------------------------------------------------
   RESET & BASE
   ------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--text-primary);
  background-color: var(--bg-body);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-top: calc(var(--header-height) + var(--safe-top));
  padding-bottom: calc(var(--bottom-nav-height) + var(--safe-bottom));
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  border: none;
  outline: none;
  background: none;
}

ul, ol {
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: var(--lh-tight);
  color: var(--text-primary);
}

h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }

p {
  color: var(--text-secondary);
}

::selection {
  background-color: var(--accent);
  color: #ffffff;
}

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

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-focus);
}


/* ------------------------------------------------------------
   APP HEADER
   ------------------------------------------------------------ */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-height);
  padding: 0 var(--space-4);
  padding-top: var(--safe-top);
  padding-bottom: var(--space-2);
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transform: translateZ(0);
}

.app-header__title {
  font-size: var(--fs-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.app-header__subtitle {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.app-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}


/* ------------------------------------------------------------
   TOGGLE SWITCH (GYM | HOME PILL)
   ------------------------------------------------------------ */
.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 36px;
  background-color: var(--bg-input);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.toggle-switch .slider {
  display: flex;
  align-items: center;
  position: relative;
  height: 100%;
}

.toggle-switch .slider::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 3px);
  height: calc(100% - 6px);
  background-color: var(--accent);
  border-radius: var(--radius-pill);
  transition: transform var(--duration-base) var(--ease-spring);
  z-index: 1;
}

.toggle-switch input:checked ~ .slider::before {
  transform: translateX(100%);
}

.toggle-switch__label {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-4);
  height: 100%;
  min-width: 56px;
  font-size: var(--fs-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  transition: color var(--duration-base) var(--ease-out);
}

.toggle-switch__label--active {
  color: #ffffff;
}


/* ------------------------------------------------------------
   BOTTOM NAVIGATION
   ------------------------------------------------------------ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-around;
  min-height: var(--bottom-nav-height);
  padding-top: var(--space-2);
  padding-bottom: var(--safe-bottom);
  background-color: var(--bg-card);
  border-top: 1px solid var(--border-subtle);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  min-height: var(--touch-target);
  padding: 4px 0;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  position: relative;
  transition: color var(--duration-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.nav-item__icon {
  width: 24px;
  height: 24px;
  color: var(--text-muted);
  transition: color var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

.nav-item__label {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--duration-fast) var(--ease-out);
}

.nav-item.active .nav-item__icon {
  transform: scale(1.05);
}

.nav-item.active .nav-item__label {
  font-weight: 600;
}

/* Active nav colors */
#nav-overview.active .nav-item__icon,
#nav-overview.active .nav-item__label  { color: #74C0FC; }
#nav-workout.active .nav-item__icon,
#nav-workout.active .nav-item__label   { color: #FF6B6B; }
#nav-program.active .nav-item__icon,
#nav-program.active .nav-item__label   { color: #FFA500; }
#nav-progress.active .nav-item__icon,
#nav-progress.active .nav-item__label  { color: #F06595; }
#nav-history.active .nav-item__icon,
#nav-history.active .nav-item__label { color: #4ECDC4; }
#nav-resources.active .nav-item__icon,
#nav-resources.active .nav-item__label { color: #E5D036; }

/* Ripple on tap */
.nav-item:active .nav-item__icon {
  transform: scale(0.92);
}


/* ------------------------------------------------------------
   TAB CONTENT
   ------------------------------------------------------------ */
.tab-content {
  display: none;
  padding: var(--space-4);
  animation: fadeIn var(--duration-base) var(--ease-out);
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* ------------------------------------------------------------
   CARDS
   ------------------------------------------------------------ */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  transition: border-color var(--duration-base) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-out);
}

.card:hover {
  border-color: var(--border-focus);
}

/* ------------------------------------------------------------
   EXERCISE ITEMS
   ------------------------------------------------------------ */
.exercise-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid rgba(51, 51, 51, 0.5);
  transition: opacity var(--duration-base) var(--ease-out);
}

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

.exercise-item.completed {
  opacity: 0.5;
}

.exercise-item.completed .exercise-item__name {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Custom checkbox */
.exercise-check {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-target);
  height: var(--touch-target);
  min-width: var(--touch-target);
  min-height: var(--touch-target);
  margin-top: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.exercise-check input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.exercise-check__box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-focus);
  border-radius: var(--radius-sm);
  background-color: transparent;
  transition: all var(--duration-fast) var(--ease-out);
}

.exercise-check input:checked ~ .exercise-check__box {
  background-color: var(--accent);
  border-color: var(--accent);
}

.exercise-check__box::after {
  content: "";
  display: block;
  width: 6px;
  height: 10px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform var(--duration-fast) var(--ease-spring);
}

.exercise-check input:checked ~ .exercise-check__box::after {
  transform: rotate(45deg) scale(1);
}

.exercise-item__info {
  flex: 1;
  min-width: 0;
}

.exercise-item__name {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--text-primary);
  transition: color var(--duration-base) var(--ease-out);
}

.exercise-item__detail {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

.exercise-item__meta {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}


/* ------------------------------------------------------------
   COLLAPSIBLE SECTIONS / ACCORDIONS
   ------------------------------------------------------------ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--touch-target);
  padding: var(--space-3) 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  border-bottom: 1px solid var(--border-subtle);
}

.section-header__title {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text-primary);
}

.section-header__icon {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  transition: transform var(--duration-base) var(--ease-out);
}

.section-header.open .section-header__icon {
  transform: rotate(180deg);
}

.section-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--duration-slow) var(--ease-out),
    opacity var(--duration-base) var(--ease-out);
  opacity: 0;
}

.section-content.open {
  max-height: 5000px;
  opacity: 1;
  padding: var(--space-4) 0;
}


/* ------------------------------------------------------------
   PROGRAM NAV BAR (drill-down breadcrumb)
   ------------------------------------------------------------ */
.program-nav {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  min-height: 36px;
}
.program-nav__back {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-1);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color var(--duration-fast);
  -webkit-tap-highlight-color: transparent;
}
.program-nav__back:active { color: var(--accent); }
.program-nav__title {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.program-nav__subtitle {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-left: auto;
}

/* Level transition */
.program-level {
  animation: fadeIn var(--duration-base) var(--ease-out);
}

/* ------------------------------------------------------------
   PHASE CARDS (Level 1 — Phase Selection)
   ------------------------------------------------------------ */
.phase-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: var(--space-5) var(--space-4);
  margin-bottom: var(--space-3);
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  position: relative;
}
.phase-card:active { transform: scale(0.98); }

.phase-card__accent {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  border-radius: 16px 0 0 16px;
}
.phase-card--1 .phase-card__accent { background: var(--phase1); }
.phase-card--2 .phase-card__accent { background: var(--phase2); }
.phase-card--3 .phase-card__accent { background: var(--phase3); }

.phase-card--current.phase-card--1 {
  border-color: var(--phase1);
  box-shadow: 0 0 0 1px var(--phase1), 0 4px 16px rgba(255, 107, 107, 0.15);
}
.phase-card--current.phase-card--2 {
  border-color: var(--phase2);
  box-shadow: 0 0 0 1px var(--phase2), 0 4px 16px rgba(255, 165, 0, 0.15);
}
.phase-card--current.phase-card--3 {
  border-color: var(--phase3);
  box-shadow: 0 0 0 1px var(--phase3), 0 4px 16px rgba(81, 207, 102, 0.15);
}

.phase-card__body { flex: 1; min-width: 0; }
.phase-card__header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}
.phase-card__icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}
.phase-card--1 .phase-card__icon { background: var(--phase1-bg); color: var(--phase1); }
.phase-card--2 .phase-card__icon { background: var(--phase2-bg); color: var(--phase2); }
.phase-card--3 .phase-card__icon { background: var(--phase3-bg); color: var(--phase3); }

.phase-card__badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  margin-left: auto;
}
.phase-card--1 .phase-card__badge { background: var(--phase1-bg); color: var(--phase1); }
.phase-card--2 .phase-card__badge { background: var(--phase2-bg); color: var(--phase2); }
.phase-card--3 .phase-card__badge { background: var(--phase3-bg); color: var(--phase3); }

.phase-card__title {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 var(--space-1) 0;
}
.phase-card__subtitle {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  margin: 0 0 var(--space-1) 0;
}
.phase-card__dates {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin: 0;
}
.phase-card__chevron {
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ------------------------------------------------------------
   DAY ROWS (Level 2 — Day Selection)
   ------------------------------------------------------------ */
.day-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-2);
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.day-row:active {
  transform: scale(0.98);
  border-color: var(--accent);
}
.day-row__index {
  width: 28px; height: 28px; min-width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-circle);
  background: var(--accent-subtle);
  color: var(--accent);
  font-size: var(--fs-xs);
  font-weight: 700;
}
.day-row__body { flex: 1; min-width: 0; }
.day-row__name {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.day-row__activity {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.day-row__chevron {
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Week-within-phase banner */
.phase-week-banner {
  text-align: center;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-3);
}
.phase-week-banner__label {
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}
.phase-week-banner__sub {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.phase-week-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: var(--space-2);
}
.phase-week-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transition: all var(--duration-fast);
}
.phase-week-dot.filled {
  transform: scale(1.1);
}


/* ------------------------------------------------------------
   SCHEDULE STRIP (WEEKLY CALENDAR)
   ------------------------------------------------------------ */
.schedule-strip {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3) 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

.schedule-strip::-webkit-scrollbar {
  display: none;
}

.schedule-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: var(--touch-target);
  min-height: 60px;
  padding: var(--space-2) var(--space-3);
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.schedule-day__name {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.schedule-day__number {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--text-primary);
  margin-top: var(--space-1);
}

.schedule-day__dot {
  width: 5px;
  height: 5px;
  border-radius: var(--radius-circle);
  background-color: transparent;
  margin-top: var(--space-1);
}

.schedule-day.has-workout .schedule-day__dot {
  background-color: var(--accent);
}

.schedule-day.today {
  border-color: var(--accent);
  background-color: var(--accent-subtle);
}

.schedule-day.today .schedule-day__name {
  color: var(--accent);
}

.schedule-day.active {
  background-color: var(--accent);
  border-color: var(--accent);
}

.schedule-day.active .schedule-day__name,
.schedule-day.active .schedule-day__number {
  color: #ffffff;
}

.schedule-day.active .schedule-day__dot {
  background-color: #ffffff;
}

.schedule-day:active {
  transform: scale(0.95);
}


/* ------------------------------------------------------------
   PROGRAM TAB — DAY SELECTOR + WORKOUT DISPLAY
   ------------------------------------------------------------ */
/* (Day selector removed — replaced by drill-down day-row pattern) */

/* Workout Header */
.workout-header {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
}
.workout-header__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.workout-header__title {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.workout-header__meta {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

/* Workout type badges */
.workout-type-badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.wt-rehab          { background: rgba(240, 101, 149, 0.12); color: #F06595; }
.wt-chest-back     { background: rgba(255, 107, 107, 0.12); color: #FF6B6B; }
.wt-shoulders-arms { background: rgba(177, 151, 252, 0.12); color: #B197FC; }
.wt-legs           { background: rgba(77, 171, 247, 0.12);  color: #4DABF7; }
.wt-volume         { background: rgba(255, 169, 77, 0.12);  color: #FFA94D; }
.wt-run            { background: rgba(34, 184, 207, 0.12);  color: #22B8CF; }
.wt-core           { background: rgba(229, 208, 54, 0.12);  color: #E5D036; }
.wt-rest           { background: rgba(81, 207, 102, 0.12);  color: #51CF66; }

/* Exercise cards */
.program-exercise-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-2);
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.program-exercise-card:active {
  border-color: var(--accent);
}

.exercise-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: var(--radius-circle);
  background: var(--accent-subtle);
  color: var(--accent);
  font-size: var(--fs-xs);
  font-weight: 700;
}

.program-exercise-info {
  flex: 1;
  min-width: 0;
}
.program-exercise-info .exercise-name {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.program-exercise-info .exercise-target {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

/* Section divider */
.section-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-4) 0 var(--space-3);
}
.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}
.section-divider span {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Rest day card */
.rest-day-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-8) var(--space-4);
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  gap: var(--space-2);
}
.rest-day-card__title {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--text-primary);
}
.rest-day-card__text {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  max-width: 280px;
  line-height: var(--lh-base);
}

/* Workout tab — checkbox + completed state on program-exercise-card */
.program-exercise-card .exercise-check {
  display: flex;
  align-items: center;
}
.program-exercise-card .exercise-check__box {
  width: 26px;
  height: 26px;
  min-width: 26px;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  background: transparent;
}
.program-exercise-card .exercise-check__box.checked {
  background-color: var(--accent);
  border-color: var(--accent);
}
.program-exercise-card .exercise-check__box svg {
  opacity: 0;
  transform: scale(0.5);
  transition: all var(--duration-fast) var(--ease-spring);
}
.program-exercise-card .exercise-check__box.checked svg {
  opacity: 1;
  transform: scale(1);
}
.program-exercise-card.completed .exercise-name {
  text-decoration: line-through;
  opacity: 0.5;
}
.program-exercise-card.completed .exercise-target,
.program-exercise-card.completed .badge {
  opacity: 0.4;
}

.workout-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

/* ------------------------------------------------------------
   PAIN SLIDER
   ------------------------------------------------------------ */
.pain-slider {
  padding: var(--space-3) 0;
}

.pain-slider__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}

.pain-slider__label {
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--text-primary);
}

.slider-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 32px;
  padding: 0 var(--space-2);
  font-size: var(--fs-sm);
  font-weight: 700;
  border-radius: var(--radius-sm);
  font-variant-numeric: tabular-nums;
}

.slider-value[data-level="low"] {
  color: var(--success);
  background-color: var(--success-bg);
}

.slider-value[data-level="mid"] {
  color: var(--warning);
  background-color: var(--warning-bg);
}

.slider-value[data-level="high"] {
  color: var(--danger);
  background-color: var(--danger-bg);
}

.pain-slider__track {
  position: relative;
  width: 100%;
}

/* Custom range input */
.pain-slider input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: var(--touch-target);
  background: transparent;
  cursor: pointer;
}

.pain-slider input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: var(--radius-pill);
  background: linear-gradient(
    to right,
    var(--success) 0%,
    var(--warning) 50%,
    var(--danger) 100%
  );
}

.pain-slider input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: var(--radius-pill);
  background: linear-gradient(
    to right,
    var(--success) 0%,
    var(--warning) 50%,
    var(--danger) 100%
  );
  border: none;
}

.pain-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-circle);
  background-color: #ffffff;
  border: 3px solid var(--accent);
  margin-top: -9px;
  box-shadow: var(--shadow-md);
  transition: transform var(--duration-fast) var(--ease-spring),
    box-shadow var(--duration-fast) var(--ease-out);
}

.pain-slider input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-circle);
  background-color: #ffffff;
  border: 3px solid var(--accent);
  box-shadow: var(--shadow-md);
  cursor: pointer;
}

.pain-slider input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.15);
  box-shadow: var(--shadow-accent);
}

.pain-slider input[type="range"]:active::-moz-range-thumb {
  transform: scale(1.15);
}

.pain-slider__scale {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-1);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}


/* ------------------------------------------------------------
   PROGRESS BAR
   ------------------------------------------------------------ */
.progress-bar {
  width: 100%;
  height: 8px;
  background-color: var(--bg-input);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--accent), #9B8AFE);
  transition: width var(--duration-slow) var(--ease-out);
  position: relative;
}

.progress-fill::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 40px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.15)
  );
  border-radius: var(--radius-pill);
}

.progress-bar--lg {
  height: 12px;
}

.progress-bar--sm {
  height: 4px;
}

.progress-bar__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
  font-size: var(--fs-sm);
}

.progress-bar__label-text {
  color: var(--text-secondary);
}

.progress-bar__label-value {
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}


/* ------------------------------------------------------------
   MILESTONES CHECKLIST
   ------------------------------------------------------------ */
.milestone-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid rgba(51, 51, 51, 0.4);
}

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

.milestone-check {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: var(--radius-circle);
  border: 2px solid var(--border-focus);
  background-color: transparent;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.milestone-check.completed {
  background-color: var(--success);
  border-color: var(--success);
}

.milestone-check.completed::after {
  content: "";
  display: block;
  width: 7px;
  height: 11px;
  border: solid #ffffff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

.milestone-item__text {
  flex: 1;
  font-size: var(--fs-base);
  color: var(--text-primary);
}

.milestone-item.done .milestone-item__text {
  color: var(--text-muted);
  text-decoration: line-through;
}

.milestone-item__date {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  white-space: nowrap;
}


/* ------------------------------------------------------------
   TIMER OVERLAY
   ------------------------------------------------------------ */
.timer-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: rgba(15, 15, 15, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-base) var(--ease-out),
    visibility var(--duration-base) var(--ease-out);
}

.timer-overlay.active {
  opacity: 1;
  visibility: visible;
}

.timer-overlay__label {
  font-size: var(--fs-md);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-4);
}

.timer-display {
  font-size: 4.5rem;
  font-weight: 200;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: var(--space-8);
  font-family: var(--font-mono);
}

.timer-display.warning {
  color: var(--warning);
}

.timer-display.danger {
  color: var(--danger);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.timer-controls {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.timer-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: var(--touch-target);
  min-height: var(--touch-target);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-pill);
  font-size: var(--fs-md);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.timer-btn--start {
  background-color: var(--accent);
  color: #ffffff;
}

.timer-btn--start:active {
  background-color: var(--accent-hover);
  transform: scale(0.96);
}

.timer-btn--pause {
  background-color: var(--warning);
  color: var(--text-inverse);
}

.timer-btn--reset {
  background-color: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.timer-btn--close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  top: calc(var(--space-4) + var(--safe-top));
  width: var(--touch-target);
  height: var(--touch-target);
  padding: 0;
  border-radius: var(--radius-circle);
  background-color: var(--bg-input);
  color: var(--text-muted);
  font-size: var(--fs-lg);
}

.timer-presets {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-8);
}

.timer-presets .timer-btn {
  padding: var(--space-2) var(--space-4);
  font-size: var(--fs-sm);
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.timer-presets .timer-btn.active {
  background-color: var(--accent-subtle);
  border-color: var(--accent);
  color: var(--accent);
}


/* ------------------------------------------------------------
   MODAL
   ------------------------------------------------------------ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-base) var(--ease-out),
    visibility var(--duration-base) var(--ease-out);
}

.modal.active {
  opacity: 1;
  visibility: visible;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
}

.modal-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--content-max-width);
  max-height: 85vh;
  background-color: var(--bg-card);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-6);
  padding-bottom: calc(var(--space-6) + var(--safe-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateY(100%);
  transition: transform var(--duration-slow) var(--ease-out);
}

.modal.active .modal-content {
  transform: translateY(0);
}

/* Pull bar removed — no swipe-to-dismiss implemented */

.modal-close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-target);
  height: var(--touch-target);
  border-radius: var(--radius-circle);
  background-color: var(--bg-input);
  color: var(--text-muted);
  font-size: var(--fs-lg);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.modal-close:active {
  background-color: var(--border-subtle);
}

.modal__title {
  font-size: var(--fs-xl);
  font-weight: 700;
  margin-bottom: var(--space-4);
  padding-right: var(--space-10);
}

.modal__section {
  margin-bottom: var(--space-5);
}

.modal__section-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}


/* ------------------------------------------------------------
   HISTORY DELETE BUTTON
   ------------------------------------------------------------ */
.history-delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-circle);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--duration-fast) var(--ease-out),
    background var(--duration-fast) var(--ease-out);
}
.history-delete-btn:active {
  color: var(--danger);
  background: rgba(255, 107, 107, 0.12);
}

/* ------------------------------------------------------------
   INFO BUTTON + POPUP TABLE
   ------------------------------------------------------------ */
.info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  min-width: var(--touch-target);
  min-height: var(--touch-target);
  border: none;
  border-radius: var(--radius-circle);
  background: rgba(123, 104, 238, 0.15);
  color: var(--accent);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
  margin-left: 4px;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--duration-fast) var(--ease-out);
}
.info-btn:active {
  background: rgba(123, 104, 238, 0.3);
}

.info-table {
  width: 100%;
  border-collapse: collapse;
}
.info-table tr {
  border-bottom: 1px solid var(--border-subtle);
}
.info-table tr:last-child {
  border-bottom: none;
}
.info-table td {
  padding: 8px 6px;
  font-size: var(--fs-sm);
  color: var(--text-primary);
  vertical-align: top;
}
.info-score {
  font-weight: 700;
  font-size: var(--fs-base);
  white-space: nowrap;
  width: 48px;
  text-align: center;
}

/* ------------------------------------------------------------
   PAIN CHART CONTAINER
   ------------------------------------------------------------ */
.pain-chart {
  width: 100%;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  overflow: hidden;
}

.pain-chart svg {
  width: 100%;
  height: auto;
  display: block;
}

.pain-chart__title {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
}

.pain-chart__legend {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-3);
  flex-wrap: wrap;
}

.pain-chart__legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.pain-chart__legend-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-circle);
}


/* ------------------------------------------------------------
   BADGES
   ------------------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px var(--space-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.4;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.badge--default {
  background-color: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.badge--accent {
  background-color: var(--accent-subtle);
  color: var(--accent);
}

.badge--success {
  background-color: var(--success-bg);
  color: var(--success);
}

.badge--warning {
  background-color: var(--warning-bg);
  color: var(--warning);
}

.badge--danger {
  background-color: var(--danger-bg);
  color: var(--danger);
}

.badge--info {
  background-color: var(--info-bg);
  color: var(--info);
}

.badge--phase1 {
  background-color: var(--phase1-bg);
  color: var(--phase1);
}

.badge--phase2 {
  background-color: var(--phase2-bg);
  color: var(--phase2);
}

.badge--phase3 {
  background-color: var(--phase3-bg);
  color: var(--phase3);
}

.badge-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}


/* ------------------------------------------------------------
   VISIBILITY TOGGLES (GYM / HOME)
   ------------------------------------------------------------ */
.gym-only {
  display: none;
}

.home-only {
  display: none;
}

body.mode-gym .gym-only {
  display: block;
}

body.mode-gym .home-only {
  display: none;
}

body.mode-home .home-only {
  display: block;
}

body.mode-home .gym-only {
  display: none;
}

/* Inline variants */
body.mode-gym span.gym-only,
body.mode-gym .gym-only.inline {
  display: inline;
}

body.mode-home span.home-only,
body.mode-home .home-only.inline {
  display: inline;
}


/* ------------------------------------------------------------
   EQUIPMENT LIST
   ------------------------------------------------------------ */
.equipment-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-2) 0;
}

.equipment-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

.equipment-item__icon {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}


/* ------------------------------------------------------------
   RUN PROTOCOL
   ------------------------------------------------------------ */
.run-protocol {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
}

.run-protocol__title {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}

.run-week {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid rgba(51, 51, 51, 0.4);
}

.run-week:last-child {
  border-bottom: none;
}

.run-week__label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-muted);
  min-width: 48px;
  white-space: nowrap;
}

.run-week__detail {
  flex: 1;
  font-size: var(--fs-base);
  color: var(--text-primary);
}

.run-week.current {
  background-color: var(--accent-subtle);
  border-radius: var(--radius-sm);
  padding-left: var(--space-3);
  padding-right: var(--space-3);
  margin: 0 calc(-1 * var(--space-3));
}

.run-week.current .run-week__label {
  color: var(--accent);
}

.run-week.completed .run-week__detail {
  color: var(--text-muted);
  text-decoration: line-through;
}


/* ------------------------------------------------------------
   COMPLETION BANNER
   ------------------------------------------------------------ */
.completion-banner {
  display: none;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: linear-gradient(135deg, var(--success-bg), rgba(81, 207, 102, 0.05));
  border: 1px solid rgba(81, 207, 102, 0.3);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
  animation: slideDown var(--duration-slow) var(--ease-spring);
}

.completion-banner.visible {
  display: flex;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.completion-banner__icon {
  font-size: var(--fs-xl);
  color: var(--success);
}

.completion-banner__text {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--success);
}


/* ------------------------------------------------------------
   FORMS
   ------------------------------------------------------------ */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.form-input {
  display: block;
  width: 100%;
  min-height: var(--touch-target);
  padding: var(--space-3) var(--space-4);
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--fs-md);
  transition: border-color var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out);
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-textarea {
  display: block;
  width: 100%;
  min-height: 100px;
  padding: var(--space-3) var(--space-4);
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--fs-md);
  resize: vertical;
  transition: border-color var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out);
}

.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-textarea::placeholder {
  color: var(--text-muted);
}


/* ------------------------------------------------------------
   BUTTONS
   ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--touch-target);
  padding: var(--space-3) var(--space-5);
  font-size: var(--fs-base);
  font-weight: 600;
  line-height: 1;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  white-space: nowrap;
  border: 1px solid transparent;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background-color: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background-color: var(--accent-hover);
}

.btn-primary:active {
  background-color: var(--accent-hover);
  box-shadow: var(--shadow-accent);
}

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

.btn-danger:hover {
  background-color: #e85c5c;
}

.btn-outline {
  background-color: transparent;
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}

.btn-outline:hover {
  border-color: var(--border-focus);
  background-color: var(--bg-input);
}

.btn-ghost {
  background-color: transparent;
  color: var(--accent);
  border-color: transparent;
}

.btn-ghost:hover {
  background-color: var(--accent-subtle);
}

.btn-sm {
  min-height: 32px;
  padding: var(--space-1) var(--space-3);
  font-size: var(--fs-sm);
  border-radius: var(--radius-sm);
}

.btn-lg {
  min-height: 52px;
  padding: var(--space-4) var(--space-8);
  font-size: var(--fs-md);
  border-radius: var(--radius-lg);
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-icon {
  min-height: var(--touch-target);
  min-width: var(--touch-target);
  padding: var(--space-2);
  border-radius: var(--radius-circle);
}


/* ------------------------------------------------------------
   PROFILE CARD
   ------------------------------------------------------------ */
.profile-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  text-align: center;
  margin-bottom: var(--space-4);
}

.profile-card__avatar {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-circle);
  background-color: var(--accent-subtle);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-2xl);
  font-weight: 700;
  margin: 0 auto var(--space-3);
  border: 2px solid var(--accent);
}

.profile-card__name {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text-primary);
}

.profile-card__detail {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
  border-bottom: 1px solid rgba(51, 51, 51, 0.4);
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-row__label {
  font-size: var(--fs-base);
  color: var(--text-secondary);
}

.stat-row__value {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.stat-grid__item {
  text-align: center;
  padding: var(--space-3);
  background-color: var(--bg-input);
  border-radius: var(--radius-md);
}

.stat-grid__value {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.stat-grid__label {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}


/* ------------------------------------------------------------
   PAIN RULES CARDS
   ------------------------------------------------------------ */
.pain-rule {
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  border-left: 3px solid var(--border-subtle);
}

.pain-rule + .pain-rule {
  margin-top: var(--space-3);
}

.pain-rule--low  { border-left-color: var(--success); }
.pain-rule--mid  { border-left-color: var(--warning); }
.pain-rule--high { border-left-color: var(--danger); }

.pain-rule__signal {
  font-weight: 700;
  font-size: var(--fs-sm);
  margin-bottom: var(--space-2);
}

.pain-rule--low .pain-rule__signal  { color: var(--success); }
.pain-rule--mid .pain-rule__signal  { color: var(--warning); }
.pain-rule--high .pain-rule__signal { color: var(--danger); }

.pain-rule__detail {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: 1.4;
}

.pain-rule__detail + .pain-rule__detail {
  margin-top: var(--space-1);
}

.pain-rule__label {
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: var(--fs-xs);
  letter-spacing: 0.03em;
  margin-right: var(--space-2);
}


/* ------------------------------------------------------------
   UTILITY CLASSES
   ------------------------------------------------------------ */
.text-muted {
  color: var(--text-muted);
}

.text-secondary {
  color: var(--text-secondary);
}

.text-accent {
  color: var(--accent);
}

.text-success {
  color: var(--success);
}

.text-warning {
  color: var(--warning);
}

.text-danger {
  color: var(--danger);
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-sm {
  font-size: var(--fs-sm);
}

.text-xs {
  font-size: var(--fs-xs);
}

.text-bold {
  font-weight: 700;
}

.text-mono {
  font-family: var(--font-mono);
}

.mt-1 { margin-top: var(--space-2); }
.mt-2 { margin-top: var(--space-4); }
.mt-3 { margin-top: var(--space-6); }
.mt-4 { margin-top: var(--space-8); }

.mb-1 { margin-bottom: var(--space-2); }
.mb-2 { margin-bottom: var(--space-4); }
.mb-3 { margin-bottom: var(--space-6); }
.mb-4 { margin-bottom: var(--space-8); }

.mx-auto { margin-left: auto; margin-right: auto; }

.pt-1 { padding-top: var(--space-2); }
.pb-1 { padding-bottom: var(--space-2); }
.px-1 { padding-left: var(--space-2); padding-right: var(--space-2); }
.py-1 { padding-top: var(--space-2); padding-bottom: var(--space-2); }

.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-1 { gap: var(--space-2); }
.gap-2 { gap: var(--space-4); }
.gap-3 { gap: var(--space-6); }

.flex-1 {
  flex: 1;
}

.w-full {
  width: 100%;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: var(--space-4) 0;
}

.container {
  width: 100%;
  max-width: var(--content-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}


/* ------------------------------------------------------------
   ANIMATIONS & INTERACTION HELPERS
   ------------------------------------------------------------ */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-input) 25%,
    var(--bg-elevated) 50%,
    var(--bg-input) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--radius-sm);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeInUp var(--duration-base) var(--ease-out) both;
}

.animate-in:nth-child(1) { animation-delay: 0ms; }
.animate-in:nth-child(2) { animation-delay: 50ms; }
.animate-in:nth-child(3) { animation-delay: 100ms; }
.animate-in:nth-child(4) { animation-delay: 150ms; }
.animate-in:nth-child(5) { animation-delay: 200ms; }
.animate-in:nth-child(6) { animation-delay: 250ms; }
.animate-in:nth-child(7) { animation-delay: 300ms; }
.animate-in:nth-child(8) { animation-delay: 350ms; }

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}


/* ------------------------------------------------------------
   TOAST / NOTIFICATIONS
   ------------------------------------------------------------ */
.toast {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + var(--space-4));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 600;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-primary);
  opacity: 0;
  visibility: hidden;
  transition: all var(--duration-base) var(--ease-out);
  white-space: nowrap;
}

.toast.visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.toast--success {
  border-color: rgba(81, 207, 102, 0.3);
}

.toast--error {
  border-color: rgba(255, 107, 107, 0.3);
}

.toast--warning {
  border-color: rgba(255, 165, 0, 0.3);
  white-space: normal;
  text-align: center;
  max-width: 90vw;
  border-radius: var(--radius-xl, 16px);
  padding: var(--space-4) var(--space-5);
}


/* ------------------------------------------------------------
   RESPONSIVE: TABLET (600px+)
   ------------------------------------------------------------ */
@media (min-width: 600px) {
  :root {
    --content-max-width: 720px;
    --header-height: 60px;
  }

  body {
    padding-left: var(--space-6);
    padding-right: var(--space-6);
  }

  .tab-content {
    padding: var(--space-6);
    max-width: var(--content-max-width);
    margin: 0 auto;
  }

  .card {
    padding: var(--space-5);
  }

  .modal-content {
    max-height: 80vh;
    border-radius: var(--radius-xl);
    margin: auto;
    max-width: 520px;
  }

  .modal {
    align-items: center;
    padding: var(--space-6);
  }

  .stat-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .schedule-day {
    min-width: 56px;
  }

  .timer-display {
    font-size: 6rem;
  }

  .equipment-list {
    gap: var(--space-3);
  }
}


/* ------------------------------------------------------------
   RESPONSIVE: DESKTOP (900px+)
   ------------------------------------------------------------ */
@media (min-width: 900px) {
  :root {
    --content-max-width: 860px;
    --bottom-nav-height: 0px;
  }

  /* Move nav to a sidebar or top bar on desktop */
  .bottom-nav {
    position: fixed;
    top: 0;
    bottom: auto;
    left: 0;
    right: auto;
    width: 80px;
    height: 100vh;
    flex-direction: column;
    justify-content: flex-start;
    padding: calc(var(--header-height) + var(--space-6)) var(--space-2) var(--space-6);
    border-top: none;
    border-right: 1px solid var(--border-subtle);
  }

  .nav-item.active::after {
    display: none;
  }

  body {
    padding-left: calc(80px + var(--space-6));
    padding-bottom: var(--space-6);
  }

  .app-header {
    left: 80px;
  }

  .tab-content {
    padding: var(--space-8);
    max-width: var(--content-max-width);
  }

  .timer-display {
    font-size: 7rem;
  }

  .schedule-day {
    min-width: 64px;
    padding: var(--space-3) var(--space-4);
  }

  /* Two-column layout for certain sections */
  .desktop-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
  }
}


/* ------------------------------------------------------------
   RESPONSIVE: WIDE DESKTOP (1200px+)
   ------------------------------------------------------------ */
@media (min-width: 1200px) {
  :root {
    --content-max-width: 960px;
  }

  .bottom-nav {
    width: 200px;
  }

  .nav-item {
    flex-direction: row;
    justify-content: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    width: 100%;
    border-radius: var(--radius-md);
  }

  .nav-item__label {
    font-size: var(--fs-base);
  }

  .nav-item.active {
    background-color: var(--accent-subtle);
  }

  .nav-item.active::after {
    display: none;
  }

  body {
    padding-left: calc(200px + var(--space-8));
  }

  .app-header {
    left: 200px;
  }
}


/* ------------------------------------------------------------
   LANDSCAPE PHONE
   ------------------------------------------------------------ */
@media (max-height: 500px) and (orientation: landscape) {
  .timer-display {
    font-size: 3rem;
    margin-bottom: var(--space-4);
  }

  .timer-presets {
    margin-bottom: var(--space-4);
  }

  .timer-overlay__label {
    margin-bottom: var(--space-2);
  }
}




/* ------------------------------------------------------------
   DARK MODE FORCED (for browsers with forced colors)
   ------------------------------------------------------------ */
@media (forced-colors: active) {
  .btn-primary,
  .btn-danger {
    border: 2px solid ButtonText;
  }

  .exercise-check__box {
    border: 2px solid ButtonText;
  }

  .progress-fill {
    background: Highlight;
  }

  .nav-item.active .nav-item__icon,
  .nav-item.active .nav-item__label {
    color: Highlight;
  }

  .pain-slider input[type="range"]::-webkit-slider-thumb {
    background-color: Highlight;
    border-color: ButtonText;
  }
}


/* ============================================================
   BRIDGE STYLES — Align HTML/JS class names with CSS
   ============================================================ */

/* ── Equipment Toggle (Header Gym/Home buttons) ── */
.equipment-toggle {
  display: flex;
  background-color: var(--bg-input);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
}

.equip-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  min-height: var(--touch-target);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.03em;
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.equip-btn.active {
  background-color: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-accent);
}

.equip-btn:not(.active):hover {
  color: var(--text-secondary);
  background-color: rgba(255,255,255,0.05);
}

.equip-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Date input overflow fix for iOS */
input[type="date"].form-input {
  max-width: 100%;
  -webkit-appearance: none;
}

/* ── Nav item — direct SVG + span children ── */
.nav-item > svg {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  transition: color var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

.nav-item > span {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--duration-fast) var(--ease-out);
}

.nav-item.active > svg {
  transform: scale(1.05);
}

.nav-item.active > span {
  font-weight: 600;
}

.nav-item:active > svg {
  transform: scale(0.92);
}

/* Per-tab active colors */
#nav-overview.active > svg,
#nav-overview.active > span  { color: #74C0FC; }
#nav-workout.active > svg,
#nav-workout.active > span   { color: #FF6B6B; }
#nav-program.active > svg,
#nav-program.active > span   { color: #FFA500; }
#nav-progress.active > svg,
#nav-progress.active > span  { color: #F06595; }
#nav-history.active > svg,
#nav-history.active > span { color: #4ECDC4; }
#nav-resources.active > svg,
#nav-resources.active > span { color: #E5D036; }

/* ── Stat Row (Profile card, NSAID section) ── */
.stat-label {
  font-size: var(--fs-base);
  color: var(--text-secondary);
}

.stat-value {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
  max-width: 60%;
}

.stat-value.diagnosis {
  color: var(--danger);
  font-size: var(--fs-sm);
}

/* ── Today's Workout Header ── */
.today-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) 0;
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
  gap: var(--space-2);
}

.today-date {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text-primary);
}

.today-phase {
  font-size: var(--fs-sm);
  color: var(--accent);
  font-weight: 500;
}

.today-workout-label {
  font-size: var(--fs-md);
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--accent);
}

/* ── Workout Hero Card (ring + info) ── */
#workout-hero {
  position: sticky;
  top: calc(var(--header-height) + var(--safe-top));
  z-index: 50;
  margin: calc(-1 * var(--space-4));
  margin-bottom: 0;
  padding: var(--space-4);
  padding-bottom: 0;
  background: var(--bg-body);
}
.workout-hero-card {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.workout-hero__ring {
  position: relative;
  flex-shrink: 0;
  width: 96px;
  height: 96px;
}

.workout-hero__pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.workout-hero__pct-sign {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 1px;
}

.workout-hero__info {
  flex: 1;
  min-width: 0;
}

.workout-hero__label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}
.workout-hero__title {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 var(--space-1) 0;
  line-height: var(--lh-tight);
}

.workout-hero__badges {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.workout-hero__count {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.workout-hero__meta {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.workout-hero__status {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-secondary);
  font-style: italic;
}

/* ── Workout Day Swipe Dots ── */
.workout-day-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding-bottom: var(--space-2);
}
.workout-day-arrow {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-circle);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.workout-day-arrow:hover { background: var(--accent-subtle); color: var(--accent); }
.workout-day-arrow.disabled { opacity: 0.25; pointer-events: none; }
@media (min-width: 600px) {
  .workout-day-arrow { display: flex; }
}
.workout-day-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
}
.workout-day-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  opacity: 0.3;
  transition: opacity 0.2s, transform 0.2s;
}
.workout-day-dot.active {
  opacity: 1;
  background: var(--accent);
  transform: scale(1.3);
}

/* ── Preview Mode (non-today workouts) ── */
.workout-hero-card--preview {
  opacity: 0.75;
}
.program-exercise-card.preview-mode .exercise-check {
  opacity: 0.35;
  pointer-events: none;
}

/* (Phase pills removed — replaced by drill-down phase-card pattern) */

/* ── Tab Title ── */
.tab-title {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

/* ── Exercise Card Content (JS-generated) ── */
.exercise-main {
  flex: 1;
  min-width: 0;
  cursor: pointer;
  padding: var(--space-2) 0;
}

.exercise-name {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.exercise-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.exercise-target {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.exercise-details {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid rgba(51,51,51,0.4);
}

.exercise-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2) var(--space-4);
  margin-bottom: var(--space-3);
}

.detail-label {
  display: block;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-value {
  display: block;
  font-size: var(--fs-sm);
  color: var(--text-primary);
  font-weight: 500;
}

.exercise-notes {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  font-style: italic;
  line-height: var(--lh-base);
}

.exercise-item .exercise-check {
  display: flex;
  align-items: flex-start;
  padding-top: var(--space-3);
}

.exercise-item .exercise-check__box {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  background: transparent;
}

.exercise-item .exercise-check__box.checked {
  background-color: var(--accent);
  border-color: var(--accent);
}

.exercise-item .exercise-check__box svg {
  opacity: 0;
  transform: scale(0.5);
  transition: all var(--duration-fast) var(--ease-spring);
}

.exercise-item .exercise-check__box.checked svg {
  opacity: 1;
  transform: scale(1);
}

.exercise-item.completed .exercise-name {
  text-decoration: line-through;
  opacity: 0.5;
}

.exercise-item.completed .exercise-meta {
  opacity: 0.4;
}

.timer-trigger {
  margin-top: var(--space-2);
}

/* ── Badge variants ── */
.badge-accent {
  background-color: var(--accent-subtle);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
}

.badge-sm {
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 600;
  background-color: var(--bg-input);
  color: var(--text-secondary);
}

.badge-phase1 { background-color: var(--phase1-bg); color: var(--phase1); padding: 4px 12px; border-radius: var(--radius-pill); font-size: var(--fs-sm); font-weight: 600; }
.badge-phase2 { background-color: var(--phase2-bg); color: var(--phase2); padding: 4px 12px; border-radius: var(--radius-pill); font-size: var(--fs-sm); font-weight: 600; }
.badge-phase3 { background-color: var(--phase3-bg); color: var(--phase3); padding: 4px 12px; border-radius: var(--radius-pill); font-size: var(--fs-sm); font-weight: 600; }

/* (Old phase timeline cards removed — replaced by program drill-down) */

.phase-indicator {
  margin-top: var(--space-3);
}

/* ── Chart Legend ── */
.chart-legend {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  margin-top: var(--space-3);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-circle);
  display: inline-block;
}

/* ── Timer Overlay Content ── */
.timer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
}

.timer-buttons {
  display: flex;
  gap: var(--space-3);
}

.timer-btn-reset {
  background: var(--bg-elevated);
  color: var(--accent);
}
.timer-btn-close {
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

/* ── Completion Banner Content ── */
.completion-text {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--success);
}

.completion-quote {
  font-size: var(--fs-sm);
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.5;
  text-align: center;
  max-width: 340px;
}

.completion-author {
  font-style: normal;
  font-weight: 600;
  color: var(--text-muted);
  font-size: var(--fs-xs);
}

.completion-banner.visible {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

/* ── Milestone check styling (JS-generated) ── */
.milestone-item .milestone-check {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-circle);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast) var(--ease-out);
}

.milestone-item .milestone-check.checked {
  background-color: var(--success);
  border-color: var(--success);
}

.milestone-item .milestone-check svg {
  opacity: 0;
  transition: opacity var(--duration-fast);
}

.milestone-item .milestone-check.checked svg {
  opacity: 1;
}

/* ── App header refinements ── */
.header-left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.header-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.app-title {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

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

/* ── Profile icon button ── */
.profile-icon-btn {
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  width: var(--touch-target);
  height: var(--touch-target);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--duration-fast), border-color var(--duration-fast);
}

.profile-icon-btn:hover,
.profile-icon-btn:active {
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Profile slide-over panel ── */
.profile-panel {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg-body);
  transform: translateX(100%);
  transition: transform var(--duration-base) var(--ease-out);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.profile-panel.open {
  transform: translateX(0);
}

.profile-panel__header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--header-height);
  padding: 0 var(--space-4);
  padding-top: var(--safe-top);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.profile-panel__back {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-1);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color var(--duration-fast);
}

.profile-panel__back:hover,
.profile-panel__back:active {
  color: var(--accent);
}

.profile-panel__title {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.profile-panel__body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-5) var(--space-4);
  padding-bottom: calc(var(--space-8) + var(--safe-bottom));
}

/* ── Settings gear button (inside profile header) ── */
.profile-panel__settings-btn {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  width: var(--touch-target);
  height: var(--touch-target);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--duration-fast), border-color var(--duration-fast);
}

.profile-panel__settings-btn:hover,
.profile-panel__settings-btn:active {
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Settings sections ── */
.settings-section {
  padding-bottom: var(--space-5);
  margin-bottom: var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}

.settings-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.settings-section__title {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 var(--space-3) 0;
}

.settings-section--danger {
  border-bottom-color: rgba(255, 107, 107, 0.15);
}

.settings-section--danger .settings-section__title {
  color: var(--danger);
}

.settings-info__row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-2) 0;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

.settings-info__row span:first-child {
  color: var(--text-muted);
}

/* ── Settings toggle row ── */
.settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.settings-toggle-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-toggle-label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.settings-toggle-desc {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

/* ── Theme toggle switch ── */
.theme-switch {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}

.theme-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-switch__track {
  display: block;
  width: 48px;
  height: 28px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background var(--duration-base), border-color var(--duration-base);
  position: relative;
}

.theme-switch__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform var(--duration-base) var(--ease-spring), background var(--duration-base);
}

.theme-switch input:checked + .theme-switch__track {
  background: var(--accent);
  border-color: var(--accent);
}

.theme-switch input:checked + .theme-switch__track .theme-switch__thumb {
  transform: translateX(20px);
  background: #ffffff;
}

/* ── Run Protocol (JS-generated) ── */
.run-protocol {
  padding: var(--space-4);
}

.run-protocol__title {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}

.run-week {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid rgba(51,51,51,0.4);
}

.run-week:last-child { border-bottom: none; }

.run-week__label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--accent);
  min-width: 80px;
  white-space: nowrap;
}

.run-week__detail {
  font-size: var(--fs-base);
  color: var(--text-primary);
  line-height: var(--lh-base);
}

/* ── Equipment List (JS-generated) ── */
.equipment-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.equipment-item {
  padding: var(--space-2) var(--space-3);
  background: var(--bg-input);
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

/* ── Schedule Day ── */
.schedule-strip {
  display: flex;
  overflow-x: auto;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  margin-bottom: var(--space-4);
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.schedule-strip::-webkit-scrollbar { display: none; }

.schedule-day.today {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.schedule-day__name {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.schedule-day__activity {
  display: block;
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.2;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── 2-Column Form Row ── */
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

/* ── Profile BMI Display ── */
.profile-bmi-display {
  margin-top: var(--space-2);
}

/* ── Resource Items ── */
/* ── Resource Widgets ── */
.res-widget__header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.res-widget__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.res-widget__icon--doc { background: rgba(123,104,238,0.15); color: var(--accent); }
.res-widget__icon--summary { background: rgba(34,184,207,0.15); color: #22B8CF; }
.res-widget__icon--video { background: rgba(255,107,107,0.15); color: #FF6B6B; }
.res-widget__title-group { min-width: 0; }
.res-widget__sub {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

.resource-link {
  text-decoration: none;
}
.resource-link svg {
  flex-shrink: 0;
}

/* Protocol summary phase cards */
.res-summary-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-3);
}
.res-phase-card {
  padding: var(--space-3) var(--space-3);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}
.res-phase-card__title {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-primary);
}
.res-phase-card__weeks {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: 2px;
}
.res-phase-card__desc {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  line-height: var(--lh-base);
  margin-top: var(--space-1);
}

/* Video list */
.resource-video-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.resource-video-item:last-child { border-bottom: none; }
.resource-video-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--accent);
  text-decoration: none;
  font-size: var(--fs-sm);
  font-weight: 500;
  min-width: 0;
}
.resource-video-link:hover { text-decoration: underline; }
.resource-video-link svg { flex-shrink: 0; color: var(--accent); }

.res-video-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

/* ── Rehab Widgets ── */
.rehab-widget__header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.rehab-widget__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.rehab-widget__icon--chart     { background: rgba(255, 107, 107, 0.15); color: #FF6B6B; }
.rehab-widget__icon--entry     { background: rgba(240, 101, 149, 0.15); color: #F06595; }
.rehab-widget__icon--history   { background: rgba(123, 104, 238, 0.15); color: var(--accent); }
.rehab-widget__icon--milestones { background: rgba(81, 207, 102, 0.15); color: #51CF66; }
.rehab-widget__icon--rules     { background: rgba(255, 165, 0, 0.15); color: #FFA500; }
.rehab-widget__icon--meds      { background: rgba(34, 184, 207, 0.15); color: #22B8CF; }
.rehab-widget__icon--checkin   { background: rgba(56, 178, 172, 0.15); color: #38B2AC; }
.rehab-widget__icon--journal   { background: rgba(116, 192, 252, 0.15); color: #74C0FC; }
.rehab-widget__icon--progress  { background: rgba(240, 101, 149, 0.15); color: #F06595; }
.rehab-widget__title-group { min-width: 0; }
.rehab-widget__sub {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: 2px;
}
.collapsible-widget__chevron {
  margin-left: auto;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  transition: transform var(--duration-base) var(--ease-out);
  flex-shrink: 0;
}
.widget.cw-open .collapsible-widget__chevron {
  transform: rotate(180deg);
}
.collapsible-widget__body {
  display: none;
  margin-top: var(--space-3);
  animation: fadeIn var(--duration-base) var(--ease-out);
}
.widget.cw-open .collapsible-widget__body {
  display: block;
}

/* ── Pain Slider override ── */
.pain-slider {
  width: 100%;
  height: 6px;
  border-radius: var(--radius-pill);
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(to right, var(--success), var(--warning), var(--danger));
  outline: none;
  margin: var(--space-2) 0;
}

.pain-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-circle);
  background: #fff;
  border: 2px solid var(--accent);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.pain-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-circle);
  background: #fff;
  border: 2px solid var(--accent);
  cursor: pointer;
}

/* ── Overview Widgets ── */
.widget {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.widget:active {
  transform: scale(0.98);
}

.widget--hero {
  padding: var(--space-5) var(--space-4);
  text-align: center;
}

.widget--sm {
  padding: var(--space-3);
  text-align: center;
  margin-bottom: 0;
}

.workout-status-pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.workout-status-pill--not-started {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.workout-status-pill--in-progress {
  background: var(--accent-subtle);
  color: var(--accent);
  border: 1px solid var(--accent);
}

.workout-status-pill--complete {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success);
}
.workout-status-pill--rest {
  background: rgba(78, 205, 196, 0.1);
  color: #4ECDC4;
  border: 1px solid rgba(78, 205, 196, 0.3);
}

.widget-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.widget-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-2);
}

.widget-value {
  font-size: var(--fs-xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.widget-value--sm {
  font-size: var(--fs-md);
}

.widget-hint {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.widget-nav-hint {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: var(--space-3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

/* Progress Arc */
.progress-arc {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.progress-arc svg {
  display: block;
}
.progress-arc__phase {
  margin-top: var(--space-3);
}
.progress-arc__week {
  font-size: var(--fs-2xl);
  font-weight: 700;
  color: var(--text-primary);
}
.progress-arc__week span {
  font-size: var(--fs-sm);
  font-weight: 400;
  color: var(--text-muted);
}

/* Equipment widget */
.widget-equipment-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.widget-equipment-row svg {
  flex-shrink: 0;
  color: var(--accent);
}
.widget-equipment-info {
  flex: 1;
}
.widget-equipment-title {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text-primary);
}
.widget-equipment-sub {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.widget-equipment-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
  display: none;
}
.widget-equipment-list.open {
  display: flex;
}
.widget-equipment-item {
  padding: var(--space-1) var(--space-3);
  background: var(--bg-input);
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

/* ── Diagnosis Chips ── */
#diagnosis-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  min-height: 28px;
}

.diagnosis-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  background: var(--accent-subtle);
  color: var(--accent);
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  font-weight: 500;
  max-width: 100%;
}
.diagnosis-chip__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.diagnosis-chip__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: none;
  background: rgba(255,255,255,0.08);
  color: var(--accent);
  border-radius: var(--radius-circle);
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: background var(--duration-fast);
}

.diagnosis-chip__remove:hover {
  background: rgba(255,107,107,0.3);
  color: var(--danger);
}

/* ── Diagnosis Form Container ── */
.diagnosis-form {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.diagnosis-form > .form-input {
  margin: 0;
}

.diagnosis-detail-row {
  display: flex;
  gap: var(--space-3);
  align-items: flex-end;
}

.diagnosis-detail-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.diagnosis-detail-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.diagnosis-detail-col .form-input {
  min-height: 36px;
  font-size: var(--fs-sm);
}

.diagnosis-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

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

.diagnosis-custom-row {
  display: flex;
  gap: var(--space-2);
}

.side-pills {
  display: flex;
  gap: 2px;
  background: var(--bg-elevated);
  border-radius: var(--radius-pill);
  padding: 2px;
  height: 40px;
  align-items: center;
}

.side-pill {
  padding: 8px 14px;
  font-size: var(--fs-xs);
  font-weight: 600;
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--duration-fast);
  -webkit-tap-highlight-color: transparent;
  height: 34px;
  display: flex;
  align-items: center;
}

.side-pill.active {
  background: var(--accent);
  color: #fff;
}

.side-pill:hover:not(.active) {
  color: var(--text-secondary);
  background: rgba(255,255,255,0.04);
}

.side-pills--compact {
  height: 28px;
  padding: 1px;
}
.side-pills--compact .side-pill {
  padding: 4px 10px;
  font-size: 0.7rem;
  height: 24px;
}

/* Side indicators in chips */
.diag-side {
  font-weight: 700;
  font-size: var(--fs-xs);
  margin-left: 2px;
}

.diag-side--l {
  color: #E5D036;
}

.diag-side--r {
  color: #FF6B6B;
}

.diag-side--both {
  color: #51CF66;
}

.diag-note {
  font-size: var(--fs-xs);
  color: var(--text-primary);
  font-weight: 400;
  margin-left: 4px;
}

/* Active phase card highlight */
.phase-card.phase-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-accent);
}

/* ── Weekly Goals Widget ── */
/* ── Weekly Goals — Compact Layout ── */
.wg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}
.wg-streak {
  display: flex;
  align-items: center;
  gap: 6px;
}
.wg-streak__count {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.wg-streak__label {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-weight: 500;
}
.wg-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}
.wg-stat {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
}
.wg-progress {
  margin-top: auto;
}
.wg-stat__value {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.wg-stat__of {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-muted);
}
.wg-stat__label {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: 2px;
}
.wg-stat .progress-bar {
  background-color: rgba(255, 255, 255, 0.06);
  margin-top: 8px;
}
.wg-goals-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}
.wg-goal {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.wg-goal--done {
  color: var(--success);
}
.wg-goal--done span {
  text-decoration: line-through;
  opacity: 0.7;
}

/* ── Streak Flame ── */
.streak-flame {
  width: 20px;
  height: 20px;
  vertical-align: -3px;
  flex-shrink: 0;
  display: inline-block;
}
@media (min-width: 600px) {
  .streak-flame {
    width: 24px;
    height: 24px;
  }
}

/* ── Journal Widget ── */
.journal-entry {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.journal-entry:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.journal-entry:first-child {
  padding-top: 0;
}
.journal-entry__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
}
.journal-entry__stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}
.journal-stat strong {
  color: var(--text-primary);
}

/* ============================================================
   ONBOARDING WIZARD
   ============================================================ */

.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 700;
  background-color: var(--bg-body);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-slow) var(--ease-out),
    visibility var(--duration-slow) var(--ease-out);
}
.onboarding-overlay.active {
  opacity: 1;
  visibility: visible;
}

.onboarding-container {
  position: relative;
  width: 100%;
  max-width: var(--content-max-width);
  height: 100%;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: var(--safe-top) var(--space-5) var(--safe-bottom);
  overflow: hidden;
}

/* ── Progress Dots ── */
.onboarding-progress {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-5) 0 var(--space-4);
  flex-shrink: 0;
}
.onboarding-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--border-subtle);
  transition: background-color var(--duration-base) var(--ease-out),
    transform var(--duration-base) var(--ease-spring);
}
.onboarding-dot.active {
  background-color: var(--accent);
  transform: scale(1.25);
}
.onboarding-dot.completed {
  background-color: var(--accent);
}

/* ── Steps ── */
.onboarding-step {
  position: absolute;
  inset: 0;
  top: 60px;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateX(60px);
  pointer-events: none;
  transition: opacity var(--duration-base) var(--ease-out),
    transform var(--duration-base) var(--ease-out);
}
.onboarding-step.active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
  position: relative;
}
.onboarding-step.exit-left {
  opacity: 0;
  transform: translateX(-60px);
  pointer-events: none;
}
.onboarding-step.enter-right {
  opacity: 0;
  transform: translateX(60px);
  pointer-events: none;
}

.onboarding-step__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-6) 0;
  overflow-y: auto;
}
.onboarding-step__footer {
  flex-shrink: 0;
  padding: var(--space-4) 0 var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* ── Typography ── */
.onboarding-logo { margin-bottom: var(--space-5); }
.onboarding-logo img {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-xl);
}
.onboarding-title {
  font-size: var(--fs-2xl);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 var(--space-3);
}
.onboarding-heading {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 var(--space-2);
}
.onboarding-subtitle,
.onboarding-desc {
  font-size: var(--fs-md);
  color: var(--text-secondary);
  margin: 0 0 var(--space-6);
  line-height: var(--lh-base);
  max-width: 320px;
}
.onboarding-hint {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-top: var(--space-3);
}

/* ── Input ── */
.onboarding-input {
  max-width: 300px;
  margin: 0 auto;
  text-align: center;
  font-size: var(--fs-lg);
}

/* ── Option Cards ── */
.onboarding-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  width: 100%;
  max-width: 340px;
}
.onboarding-options--row {
  flex-direction: row;
}
.onboarding-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-4);
  background: var(--bg-card);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: var(--fs-md);
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
  text-align: left;
}
.onboarding-option:active {
  transform: scale(0.97);
}
.onboarding-option.selected {
  border-color: var(--accent);
  background: var(--accent-subtle);
  box-shadow: 0 0 0 1px var(--accent);
}
.onboarding-option--large {
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1;
  padding: var(--space-5) var(--space-4);
}
.onboarding-option__icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}
.onboarding-option__label {
  font-weight: 600;
}
.onboarding-option__sub {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

/* ── Skip / Ghost Button ── */
.onboarding-skip {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  cursor: pointer;
  padding: var(--space-2);
  transition: color var(--duration-fast);
}
.onboarding-skip:hover {
  color: var(--text-secondary);
}
.onboarding-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: var(--space-2);
}
.onboarding-back {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  padding: var(--space-1) 0;
  cursor: pointer;
  transition: color 0.2s;
}
.onboarding-back:hover {
  color: var(--text-secondary);
}

/* ── PROFILE NUDGE CARD ── */
.profile-nudge-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: background 0.2s;
}
.profile-nudge-card:active {
  background: var(--bg-card-hover, rgba(255,255,255,0.03));
}
.profile-nudge__ring {
  position: relative;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}
.profile-nudge__ring svg {
  display: block;
}
.profile-nudge__pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-primary);
}
.profile-nudge__text {
  flex: 1;
  min-width: 0;
}
.profile-nudge__title {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-primary);
}
.profile-nudge__sub {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: 2px;
}
.profile-nudge__arrow {
  font-size: 1.4rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ── WELCOME BACK OVERLAY ── */
.welcome-back-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s, visibility 0.4s;
}
.welcome-back-overlay.active {
  opacity: 1;
  visibility: visible;
}
.welcome-back-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-4);
  max-width: 360px;
  width: 100%;
  text-align: center;
}
.welcome-back-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-2);
}
.welcome-back-title {
  font-size: var(--fs-xl);
  font-weight: 700;
  margin-bottom: var(--space-1);
}
.welcome-back-sub {
  color: var(--text-muted);
  font-size: var(--fs-sm);
  margin-bottom: var(--space-4);
}
.welcome-back-stats {
  display: flex;
  gap: var(--space-4);
  justify-content: center;
  margin-bottom: var(--space-4);
}
.welcome-back-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.welcome-back-stat__val {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--accent);
}
.welcome-back-stat__label {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: 2px;
}
.welcome-back-rec {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin-bottom: var(--space-4);
  font-size: var(--fs-sm);
  line-height: 1.5;
  border-left: 3px solid var(--text-muted);
}
.welcome-back-rec--mild { border-left-color: var(--phase2); }
.welcome-back-rec--moderate { border-left-color: #FFA500; }
.welcome-back-rec--strong { border-left-color: var(--danger); }
.welcome-back-rec p { margin: 0; }

/* ── RAMP-BACK BANNER ── */
.ramp-back-banner {
  background: rgba(255, 165, 0, 0.1);
  border: 1px solid rgba(255, 165, 0, 0.25);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-top: var(--space-3);
  text-align: center;
}
.ramp-back-banner__title {
  font-weight: 600;
  font-size: var(--fs-sm);
  color: #FFA500;
  margin-bottom: 2px;
}
.ramp-back-banner__sub {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

/* ── RAMP-BACK OVERVIEW WIDGET ── */
.ramp-back-widget {
  border-left: 3px solid #FFA500;
}
.ramp-back-widget__header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.ramp-back-widget__icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}
.ramp-back-widget__title {
  font-weight: 600;
  font-size: var(--fs-base);
  color: #FFA500;
}
.ramp-back-widget__sub {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-top: 2px;
}
.ramp-back-widget__hint {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-align: center;
  margin-top: var(--space-2);
}

/* ── SAFETY NUDGES ── */
.safety-nudge {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  margin: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  line-height: 1.4;
  animation: nudgeSlideIn 0.3s ease;
}
.safety-nudge--pain {
  background: rgba(240, 101, 149, 0.1);
  border: 1px solid rgba(240, 101, 149, 0.25);
  color: var(--text-primary);
}
.safety-nudge__msg { flex: 1; }
.safety-nudge__close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
}
@keyframes nudgeSlideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ------------------------------------------------------------
   EXERCISE LOGGING (Modal)
   ------------------------------------------------------------ */
.exercise-log-form {
  margin-top: 16px;
  padding-top: 12px;
}
.log-section-divider {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin: 16px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
}
.log-previous {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-bottom: 10px;
}
.log-set-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.log-set-label {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  min-width: 38px;
  flex-shrink: 0;
}
.log-input {
  width: 60px;
  padding: 6px 8px;
  font-size: var(--fs-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: var(--text-primary);
  text-align: center;
  -moz-appearance: textfield;
}
.log-input::-webkit-outer-spin-button,
.log-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.log-input:focus {
  border-color: var(--accent);
  outline: none;
}
.log-unit {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  min-width: 24px;
}
.log-x {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

/* Mini history in modal */
.log-history-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: var(--fs-xs);
  border-bottom: 1px solid var(--border-subtle);
}
.log-history-date {
  color: var(--text-muted);
  min-width: 50px;
}
.log-history-detail {
  color: var(--text-secondary);
  flex: 1;
}
.log-history-vol {
  color: var(--text-muted);
  font-size: 0.7rem;
}

/* Logged indicator dot on exercise card */
.logged-indicator {
  color: var(--success);
  font-size: 8px;
  margin-right: 4px;
  vertical-align: middle;
}

/* ------------------------------------------------------------
   LIFT PROGRESS & EXERCISE TRENDS CHARTS
   ------------------------------------------------------------ */
.lift-chart-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.lift-legend-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: var(--fs-xs);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: opacity 0.15s;
}
.lift-legend-btn.active {
  border-color: currentColor;
  color: var(--text-primary);
}
.lift-legend-btn.inactive {
  opacity: 0.35;
}
.lift-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.exercise-trend-select {
  width: 100%;
  padding: 8px 12px;
  font-size: var(--fs-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-primary);
  margin-bottom: 12px;
}
.exercise-trend-select:focus {
  border-color: var(--accent);
  outline: none;
}
.chart-empty-state {
  text-align: center;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  padding: 24px 0;
}

/* ============================================================
   V1 VISUAL POLISH — Subtle depth
   ============================================================ */
.workout-hero-card {
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(123,104,238,0.04) 100%);
}

/* ============================================================
   HISTORY TAB — Calendar + Day Detail
   ============================================================ */

/* ── Month Header ── */
.history-month-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) 0;
  margin-bottom: var(--space-3);
}
.history-month-title {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.history-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-target);
  height: var(--touch-target);
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
}
.history-nav-btn:active {
  background-color: var(--bg-elevated);
  border-color: var(--accent);
  transform: scale(0.95);
}

/* ── Monthly Stats ── */
.history-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.history-stat {
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}
.history-stat__value {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.history-stat__label {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Calendar Grid ── */
.history-calendar {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  margin-bottom: var(--space-4);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}
.cal-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: var(--space-2);
}
.cal-dow {
  text-align: center;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-muted);
  padding: var(--space-1) 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.cal-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.cal-cell:active:not(.cal-cell--empty):not(.cal-cell--future) {
  transform: scale(0.9);
}
.cal-cell--empty,
.cal-cell--future {
  cursor: default;
}
.cal-cell--future {
  opacity: 0.3;
}
.cal-day {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  margin-top: 3px;
}

/* Cell status colors */
.cal-cell--complete { background: var(--success-bg); }
.cal-cell--complete .cal-day { color: var(--success); font-weight: 600; }
.cal-cell--complete .cal-dot { background: var(--success); }

.cal-cell--partial { background: var(--warning-bg); }
.cal-cell--partial .cal-day { color: var(--warning); font-weight: 600; }
.cal-cell--partial .cal-dot { background: var(--warning); }

.cal-cell--rest .cal-day { color: var(--text-muted); }

.cal-cell--missed { background: var(--danger-bg); opacity: 0.6; }
.cal-cell--missed .cal-day { color: var(--danger); }

.cal-cell--today { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal-cell--today .cal-day { color: var(--accent); font-weight: 700; }

.cal-cell--selected { background: var(--accent-subtle); outline: 2px solid var(--accent); outline-offset: -2px; }
.cal-cell--selected .cal-day { color: var(--accent); font-weight: 700; }

/* ── Day Detail Card ── */
.history-detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  cursor: default;
  animation: fadeIn var(--duration-base) var(--ease-out);
}
.history-detail__header {
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
}
.history-detail__date {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--text-primary);
}
.history-detail__meta {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: 2px;
}
.history-detail__rest {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  padding: var(--space-3) 0;
}
.history-detail__summary {
  margin-bottom: var(--space-3);
}
.history-detail__count {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}
.history-section-title {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: var(--space-3) 0 var(--space-2);
}
.history-section-title:first-child {
  margin-top: 0;
}
.history-ex {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.history-ex:last-child {
  border-bottom: none;
}
.history-ex:not(.history-ex--done) {
  opacity: 0.45;
}
.history-ex__check {
  flex-shrink: 0;
  margin-top: 2px;
}
.history-ex__info {
  flex: 1;
  min-width: 0;
}
.history-ex__name {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-primary);
}
.history-ex__prescription {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.history-ex__log {
  font-size: var(--fs-xs);
  color: var(--accent);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
