/* =============================================
   EviHealthY — Design System & Styles
   ============================================= */

/* --- CSS Variables --- */
:root {
  /* Adidas Running DNA (validated with test users + 2026 WCAG/color-blind research) */
  --color-primary: #DBCA28;        /* Golden Dream muted — CTAs principales */
  --color-primary-light: #E5D445;
  --color-primary-dark: #BFAF1F;
  --color-accent: #F97316;         /* Coral — highlight de marca EviHealthY */
  --color-accent-light: #FB923C;
  --color-success: #0D9488;        /* Teal-700 — complementario del amarillo, color-blind safe */
  --color-warning: #EAB308;
  --color-danger: #DC2626;
  --color-text: #0F172A;
  --color-text-light: #475569;
  --color-text-muted: #6B7280;  /* Warmer + darker — 5.1:1 on warm paper bg, AA+ */
  --color-bg: #FAF7F2;             /* Warm off-white (Adidas paper) */
  --color-bg-card: #FFFFFF;
  --color-bg-subtle: #F3EEE7;
  --color-border: #E5E0D8;
  --color-overlay: rgba(10,10,10,0.55);

  /* Adidas DNA heros */
  --color-ink: #0A0A0A;            /* Hero surfaces negro */
  --color-ink-2: #1A1A1A;
  --color-hero-bg: var(--color-ink);
  --color-hero-text: #FAF7F2;
  --color-hero-border: transparent;

  /* Evidence colors */
  --ev-oficial: #16A34A;
  --ev-texto: #2563EB;
  --ev-consenso: #EAB308;
  --ev-verificar: #F97316;
  --ev-sinverificar: #DC2626;

  /* Muscle map (Phase F — higher secondary opacity for WCAG contrast against darker body gray) */
  --muscle-primary: rgba(37,99,235,0.75);
  --muscle-secondary: rgba(37,99,235,0.55);
  --pain-color: rgba(220,38,38,0.7);

  /* Typography — evidence-based (Typewolf 2026, Untitled UI 2026):
     Inter for body (16px base, ≥1.5 line-height — Smashing 2024: good spacing
     reduces reading fatigue 25 %). Space Grotesk for display: semi-condensed
     geometric grotesque, "dramatic numbers" per Typ.io fitness pairings,
     tabular figures ideal for workout metrics. */
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2rem;
  --fs-3xl: 2.5rem;
  --fw-normal: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  /* Spacing */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;

  /* Radius */
  --radius-sm: 0.5rem;
  --radius: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);

  /* Layout */
  --nav-height: 64px;
  --max-width: 480px;
}

/* --- Dark Mode — Adidas Running DNA (warm-black + desaturated accents) --- */
[data-theme="dark"] {
  --color-primary: #C9BF30;          /* Amarillo más desaturado (no vibra sobre negro) */
  --color-primary-light: #DBCA28;
  --color-primary-dark: #A89B20;
  --color-success: #2DD4BF;          /* Teal más luminoso en dark */
  --color-text: #F5F2ED;             /* Warm off-white, no blanco puro — 18:1 AAA */
  --color-text-light: #D4CFC4;       /* 11:1 AAA — WCAG recommended for dark mode secondary */
  --color-text-muted: #AFAB9F;       /* 8.2:1 AAA — fix fatiga visual en uppercase tracked */
  --color-bg: #050505;
  --color-bg-card: #1A1A1A;
  --color-bg-subtle: #242424;
  --color-border: #2A2A2A;
  --color-overlay: rgba(0,0,0,0.75);
  --color-hero-bg: #121212;
  --color-hero-text: #F5F2ED;
  --color-hero-border: rgba(201,191,48,0.18);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.5);
  --shadow: 0 4px 14px -6px rgba(0,0,0,0.6);
  --shadow-md: 0 8px 22px -8px rgba(0,0,0,0.7);
  --shadow-lg: 0 20px 60px -20px rgba(201,191,48,0.08), 0 4px 20px -8px rgba(0,0,0,0.8);
  --muscle-primary: rgba(219,202,40,0.55);
  --muscle-secondary: rgba(219,202,40,0.32);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-size: var(--fs-base);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; }
img, svg { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* --- App Container --- */
#app {
  max-width: var(--max-width);
  margin: 0 auto;
  padding-bottom: calc(var(--nav-height) + 16px);
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}

/* --- Screen Management --- */
.screen { display: none; padding: var(--sp-4); animation: fadeIn 0.2s ease; }
.screen.active { display: block; }

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

/* --- Bottom Navigation --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-width);
  height: var(--nav-height);
  background: var(--color-bg-card);
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  padding: var(--sp-2);
  transition: color 0.15s;
  min-width: 56px;
}

.nav-item svg.nav-icon { width: 22px; height: 22px; }
.nav-item .nav-icon-fill { display: none; }
.nav-item .nav-icon-outline { display: block; }
.nav-item:active { transform: scale(0.95); }

/* Phase E — pill selected state + icon fill switch + bold label.
   Meets WCAG 1.4.11 (3:1 non-text contrast) with pill #1D4ED8 on white.
   Combines 3 independent cues (color + fill + weight) for colorblind safety. */
.nav-item.active {
  color: #fff;
  position: relative;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 52px;
  height: 28px;
  background: var(--color-primary-dark, #1D4ED8);
  border-radius: 14px;
  z-index: 0;
}
.nav-item.active svg.nav-icon,
.nav-item.active span { position: relative; z-index: 1; }
.nav-item.active .nav-icon-outline { display: none; }
.nav-item.active .nav-icon-fill { display: block; }
.nav-item.active span {
  color: var(--color-text, #0F172A);
  font-weight: var(--fw-bold);
  margin-top: 6px;
}

/* Home avatar is now the gateway to Profile (replaces removed tab) */
.avatar-trigger {
  display: block;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 50%;
  transition: transform 0.15s, box-shadow 0.15s;
}
.avatar-trigger:hover { transform: scale(1.05); box-shadow: 0 0 0 3px rgba(37,99,235,0.2); }
.avatar-trigger:active { transform: scale(0.95); }

.profile-settings-btn {
  background: none;
  border: none;
  color: var(--color-text-muted);
  padding: 8px;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.profile-settings-btn:hover {
  background: rgba(0,0,0,0.06);
  color: var(--color-primary-dark, #1D4ED8);
}
.profile-settings-btn svg { width: 20px; height: 20px; }

/* Shopping locked screen layout */
.shopping-locked-container { padding-top: var(--sp-6); }
.shopping-lock-icon {
  font-size: 4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--sp-2);
  opacity: 0.6;
  animation: lock-pulse 2.5s ease-in-out infinite;
  color: var(--color-text);
}
.shopping-lock-icon svg { display: block; }
@keyframes lock-pulse {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.05); }
}
.shopping-preview-list {
  list-style: none;
  padding: 0;
  margin: var(--sp-2) 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.shopping-preview-list li {
  padding: var(--sp-2) var(--sp-3);
  background: var(--color-bg-subtle);
  border-radius: var(--radius-md, 8px);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--color-text);
}
.shopping-preview-list li svg { flex-shrink: 0; color: var(--color-primary); }

/* --- Typography --- */
.heading-1 { font-family: var(--font-display); font-size: var(--fs-2xl); font-weight: 700; line-height: 1.2; letter-spacing: -0.5px; }
.heading-2 { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 700; line-height: 1.3; letter-spacing: -0.3px; }
.heading-3 { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 600; line-height: 1.4; letter-spacing: -0.2px; }
.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.text-muted { color: var(--color-text-muted); }
.text-light { color: var(--color-text-light); }
.text-center { text-align: center; }
.text-accent { color: var(--color-accent); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }

/* --- Cards --- */
.card {
  background: var(--color-bg-card);
  border-radius: var(--radius);
  padding: var(--sp-4);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-sm);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-base);
  border: none;
  transition: all 0.15s;
  min-height: 44px;
  min-width: 44px;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); }

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

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

.btn-outline {
  background: transparent;
  border: 2px solid var(--color-border);
  color: var(--color-text);
}
.btn-outline:hover { border-color: var(--color-primary); color: var(--color-primary); }

.btn-ghost { background: transparent; color: var(--color-primary); }
.btn-ghost:hover { background: var(--color-bg-subtle); }

.btn-sm { padding: var(--sp-2) var(--sp-3); font-size: var(--fs-sm); min-height: 36px; }
.btn-lg { padding: var(--sp-4) var(--sp-6); font-size: var(--fs-lg); }
.btn-block { width: 100%; }
.btn-icon { padding: var(--sp-2); border-radius: var(--radius-sm); }

/* --- Inputs --- */
.form-group { margin-bottom: var(--sp-4); }
.form-label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--color-text-light);
  margin-bottom: var(--sp-1);
}

.form-input {
  width: 100%;
  padding: var(--sp-3);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-card);
  color: var(--color-text);
  font-size: var(--fs-base);
  min-height: 44px;
  transition: border-color 0.15s;
}

.form-input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }
.form-input::placeholder { color: var(--color-text-muted); }

.form-select {
  width: 100%;
  padding: var(--sp-3);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-card);
  color: var(--color-text);
  font-size: var(--fs-base);
  min-height: 44px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

.form-error { color: var(--color-danger); font-size: var(--fs-sm); margin-top: var(--sp-1); }

/* --- Toggle Switch --- */
.toggle-wrap { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-3) 0; }
.toggle {
  width: 48px; height: 28px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  border: none;
}
.toggle::after {
  content: '';
  width: 22px; height: 22px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 3px; left: 3px;
  transition: transform 0.2s;
  box-shadow: var(--shadow-sm);
}
.toggle.active { background: var(--color-primary); }
.toggle.active::after { transform: translateX(20px); }

/* --- Chips / Tags --- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}

.chip-primary { background: rgba(37,99,235,0.1); color: var(--color-primary); }
.chip-accent { background: rgba(249,115,22,0.1); color: var(--color-accent); }
.chip-success { background: rgba(22,163,74,0.1); color: var(--color-success); }
.chip-warning { background: rgba(234,179,8,0.1); color: #A16207; }
.chip-danger { background: rgba(220,38,38,0.1); color: var(--color-danger); }

/* Evidence chips */
.ev-badge { cursor: pointer; transition: transform 0.1s; }
.ev-badge:active { transform: scale(0.95); }
.ev-oficial { background: rgba(22,163,74,0.12); color: var(--ev-oficial); }
.ev-texto { background: rgba(37,99,235,0.12); color: var(--ev-texto); }
.ev-consenso { background: rgba(234,179,8,0.12); color: #A16207; }
.ev-verificar { background: rgba(249,115,22,0.12); color: var(--ev-verificar); }
.ev-sinverificar { background: rgba(220,38,38,0.12); color: var(--ev-sinverificar); }

/* --- Exercise Card --- */
.exercise-card {
  background: var(--color-bg-card);
  border-radius: var(--radius);
  padding: var(--sp-4);
  border: 1px solid var(--color-border);
  margin-bottom: var(--sp-3);
  transition: box-shadow 0.15s;
}

.exercise-card:active { box-shadow: var(--shadow-md); }

.exercise-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}

.exercise-card-title { font-weight: var(--fw-semibold); font-size: var(--fs-base); }
.exercise-card-meta { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); }

.difficulty-dots {
  display: inline-flex;
  gap: 3px;
}

.difficulty-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-border);
}

.difficulty-dot.filled { background: var(--color-accent); }

/* --- Set Input Row --- */
.set-row {
  display: grid;
  grid-template-columns: 40px 1fr 1fr 80px 44px;
  gap: var(--sp-2);
  align-items: center;
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--color-border);
}

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

.set-number {
  font-weight: var(--fw-bold);
  color: var(--color-text-muted);
  font-size: var(--fs-sm);
  text-align: center;
}

.set-input {
  width: 100%;
  padding: var(--sp-2);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
  text-align: center;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  min-height: 38px;
}

.set-input:focus { border-color: var(--color-primary); outline: none; }

.set-check {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--color-border);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.set-check.checked { background: var(--color-success); border-color: var(--color-success); color: #fff; }

/* --- RIR Selector --- */
.rir-selector {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.rir-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  background: transparent;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
}

.rir-dot.selected { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

/* --- RPE Scale --- */
.rpe-scale {
  display: flex;
  gap: 4px;
  justify-content: space-between;
}

.rpe-btn {
  flex: 1;
  min-height: 36px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-border);
  background: transparent;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--color-text-muted);
  transition: all 0.15s;
  padding: 0;
}

.rpe-btn.selected { color: #fff; border-color: transparent; }
.rpe-btn[data-rpe="1"], .rpe-btn[data-rpe="2"], .rpe-btn[data-rpe="3"] { }
.rpe-btn[data-rpe="1"].selected, .rpe-btn[data-rpe="2"].selected, .rpe-btn[data-rpe="3"].selected { background: var(--color-success); }
.rpe-btn[data-rpe="4"].selected, .rpe-btn[data-rpe="5"].selected, .rpe-btn[data-rpe="6"].selected { background: var(--color-warning); }
.rpe-btn[data-rpe="7"].selected, .rpe-btn[data-rpe="8"].selected { background: var(--color-accent); }
.rpe-btn[data-rpe="9"].selected, .rpe-btn[data-rpe="10"].selected { background: var(--color-danger); }

/* --- Timer --- */
.timer-display {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-bold);
  text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
  padding: var(--sp-6) 0;
}

.timer-label {
  text-align: center;
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  color: var(--color-text-light);
  margin-bottom: var(--sp-2);
}

.timer-controls {
  display: flex;
  gap: var(--sp-3);
  justify-content: center;
  margin-top: var(--sp-4);
}

.timer-ring {
  width: 200px; height: 200px;
  margin: 0 auto;
  position: relative;
}

.timer-ring svg { transform: rotate(-90deg); }

.timer-ring-bg { stroke: var(--color-border); }
.timer-ring-fill { stroke: var(--color-primary); transition: stroke-dashoffset 1s linear; }
.timer-ring-text {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
}

/* --- Muscle Map --- */
.muscle-map-container {
  display: flex;
  justify-content: center;
  gap: var(--sp-4);
  padding: var(--sp-4) 0;
}

.muscle-map-view {
  width: 130px;
  position: relative;
}

.muscle-map-view svg { width: 100%; height: auto; }
.muscle-map-view svg path { fill: var(--color-bg-subtle); stroke: var(--color-border); stroke-width: 0.5; transition: fill 0.2s; }
.muscle-map-view svg path.muscle-primary { fill: var(--muscle-primary); }
.muscle-map-view svg path.muscle-secondary { fill: var(--muscle-secondary); }
.muscle-map-view svg path.pain-area { fill: var(--pain-color); }
.muscle-map-view svg path.muscle-path { cursor: default; transition: fill 0.2s, opacity 0.2s; }
.muscle-map-view svg path.muscle-interactive { cursor: pointer; }
.muscle-map-view svg path.muscle-interactive:hover { opacity: 0.8; }
.muscle-map-view svg path.pain-marked { fill: var(--pain-color, rgba(220,38,38,0.6)) !important; opacity: 1 !important; }

/* --- Equipment Grid --- */
.equipment-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-2);
  max-height: 50vh;
  overflow-y: auto;
}
.equipment-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: var(--sp-2) var(--sp-1);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg-card);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  text-align: center;
  min-height: 70px;
}
.equipment-item.selected {
  border-color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 10%, transparent);
}
.equipment-icon {
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text);
  opacity: 0.8;
  line-height: 1;
  margin-bottom: 2px;
}
.equipment-icon svg { width: 22px; height: 22px; stroke-width: 2; }
.equipment-item.selected .equipment-icon { color: var(--color-primary); opacity: 1; }
.equipment-item.selected .equipment-icon svg { stroke-width: 2.2; }
.equipment-label { font-size: var(--fs-xs); font-weight: var(--fw-medium); line-height: 1.2; color: var(--color-text); }
.badge-count {
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  background: var(--color-primary);
  color: #fff;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 4px;
}

/* --- Progress Charts --- */
.chart-container { padding: var(--sp-4) 0; }
.chart-container svg { width: 100%; height: auto; }

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.stat-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--sp-3);
  text-align: center;
}

.stat-value {
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  color: var(--color-primary);
}

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

/* --- PR Badge --- */
.pr-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-3);
  background: linear-gradient(135deg, #F59E0B, #F97316);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  animation: prPulse 0.5s ease;
}

@keyframes prPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* --- Avatar --- */
.avatar-preview {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: var(--color-bg-subtle);
  border: 3px solid var(--color-primary);
  margin: 0 auto var(--sp-4);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.avatar-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.avatar-option {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  border: 2px solid var(--color-border);
  background: var(--color-bg-subtle);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: var(--sp-1);
}

.avatar-option.selected { border-color: var(--color-primary); background: rgba(37,99,235,0.08); }

/* --- Readiness Assessment --- */
.readiness-grid {
  display: grid;
  gap: var(--sp-3);
  margin: var(--sp-4) 0;
}

.readiness-item { }
.readiness-label { font-size: var(--fs-sm); font-weight: var(--fw-medium); margin-bottom: var(--sp-2); }
.readiness-btns { display: flex; gap: var(--sp-2); }
.readiness-btn {
  flex: 1;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-border);
  background: transparent;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--color-text-light);
  transition: all 0.15s;
  text-align: center;
}
.readiness-btn.selected { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

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

.readiness-labels span:nth-child(2) { text-align: center; }

/* --- Consent Accordions --- */
.consent-section { margin-bottom: var(--sp-2); border: 1px solid var(--color-border); border-radius: var(--radius-sm); overflow: hidden; }

.consent-accordion {
  width: 100%; padding: var(--sp-3) var(--sp-4);
  background: var(--color-bg-subtle); border: none; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--color-text);
  text-align: left; font-family: inherit;
}

.consent-accordion:hover { background: var(--color-border); }
.accordion-icon { font-size: var(--fs-lg); font-weight: var(--fw-bold); transition: transform 0.2s; }
.consent-accordion.open .accordion-icon { transform: rotate(45deg); }

.consent-panel {
  display: none; padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-sm); line-height: 1.7; color: var(--color-text-light);
}

.consent-panel.open { display: block; }
.consent-panel ul { padding-left: var(--sp-5); margin: var(--sp-2) 0; }
.consent-panel li { margin-bottom: var(--sp-2); }
.consent-panel p { margin-bottom: var(--sp-2); }

.consent-checkboxes { display: flex; flex-direction: column; gap: var(--sp-3); }

.consent-check-label {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  font-size: var(--fs-sm); line-height: 1.5; cursor: pointer;
  padding: var(--sp-3); border: 1.5px solid var(--color-border); border-radius: var(--radius-sm);
}

.consent-check-label input[type="checkbox"] {
  width: 20px; height: 20px; margin-top: 2px; flex-shrink: 0;
  accent-color: var(--color-primary);
}

/* --- Cycle Tracker --- */
.cycle-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin: var(--sp-4) 0;
}

.cycle-day {
  aspect-ratio: 1;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  border: none;
  cursor: pointer;
  background: var(--color-bg-subtle);
  color: var(--color-text);
  transition: all 0.15s;
}

.cycle-day.menstrual { background: rgba(220,38,38,0.15); color: var(--color-danger); }
.cycle-day.follicular { background: rgba(22,163,74,0.15); color: var(--color-success); }
.cycle-day.ovulatory { background: rgba(37,99,235,0.15); color: var(--color-primary); }
.cycle-day.luteal { background: rgba(249,115,22,0.15); color: var(--color-accent); }
.cycle-day.today { border: 2px solid var(--color-text); font-weight: var(--fw-bold); }

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-overlay);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--color-bg-card);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: var(--max-width);
  max-height: 85vh;
  overflow-y: auto;
  padding: var(--sp-6);
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-handle {
  width: 40px; height: 4px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  margin: 0 auto var(--sp-4);
}

.modal-title { font-size: var(--fs-lg); font-weight: var(--fw-bold); margin-bottom: var(--sp-4); }

/* --- Info button (ℹ️ next to labels like RIR / Volume Load) --- */
.info-btn {
  background: none;
  border: none;
  padding: 0 2px;
  margin-left: 2px;
  font-size: 0.85em;
  line-height: 1;
  cursor: pointer;
  opacity: 0.75;
  vertical-align: middle;
  transition: opacity 0.15s, transform 0.15s;
}
.info-btn:hover { opacity: 1; transform: scale(1.1); }
.info-btn:focus-visible { outline: 2px solid var(--color-primary, #2563EB); outline-offset: 2px; border-radius: 4px; }

/* Info modal body: readable paragraph rhythm */
#info-modal-body p { margin: 0 0 0.6rem; font-size: var(--fs-sm); line-height: 1.55; }
#info-modal-body ul { margin: 0.3rem 0 0.8rem; font-size: var(--fs-sm); line-height: 1.6; }

/* --- Readiness: segmented scale (Adidas DNA, sin emoji decorativo) --- */
.scale-row {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  margin-bottom: var(--sp-2);
}
.scale-row .scale-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--sp-3);
}
.scale-row .scale-head h4 {
  margin: 0; font-size: var(--fs-sm); font-weight: var(--fw-bold);
  letter-spacing: -0.2px; color: var(--color-text);
  display: inline-flex; align-items: center; gap: 6px;
}
.scale-row .scale-head h4 svg {
  width: 14px; height: 14px; stroke-width: 2;
  color: var(--color-text-muted);
}
.scale-row .scale-head .val-bubble {
  background: var(--color-primary); color: var(--color-ink);
  border-radius: var(--radius-full);
  font-size: var(--fs-xs); font-weight: 800;
  padding: 3px 10px; letter-spacing: 0.5px;
  min-height: 22px; display: inline-flex; align-items: center;
}
.scale-row .scale-head .val-bubble.placeholder {
  background: transparent; color: var(--color-text-muted);
  border: 1px dashed var(--color-border);
}
.scale-bar {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.scale-dot {
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--color-bg-subtle);
  border: none; cursor: pointer;
  font-size: var(--fs-sm); font-weight: 800;
  color: var(--color-text-muted);
  transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.scale-dot:hover { background: var(--color-border); }
.scale-dot.active,
.scale-dot.selected {
  background: var(--color-ink); color: var(--color-primary);
  transform: scale(1.03);
}
[data-theme="dark"] .scale-dot.active,
[data-theme="dark"] .scale-dot.selected {
  background: var(--color-primary); color: var(--color-ink);
}
.scale-ends {
  display: flex; justify-content: space-between;
  font-size: var(--fs-xs); color: var(--color-text-muted);
  letter-spacing: 0.3px; margin-top: var(--sp-2);
}

/* --- Login brand mark (paleta armónica, baja saturación, anti eye-strain) ---
   Evidencia 2025:
   - "high-saturation hues increase glare and make prolonged reading
     uncomfortable" — Accessibility Checker 2025
   - "saturated tones tend to appear stronger against darker surfaces,
     which can affect readability" — Yellowball 2025
   Decisión: ink sobre disco cálido + aureola dorada sutil. Contraste
   18.2:1 AAA; el golden queda como halo decorativo, no protagonista. */
.login-brand-mark {
  width: 72px; height: 72px;
  margin: 0 auto var(--sp-3);
  border-radius: 50%;
  background: var(--color-ink);
  color: var(--color-primary);      /* timón dorado sobre ink */
  display: flex; align-items: center; justify-content: center;
  box-shadow:
    0 0 0 6px color-mix(in srgb, var(--color-primary) 18%, transparent),
    0 10px 30px -12px rgba(10,10,10,0.35);
  position: relative;
}
[data-theme="dark"] .login-brand-mark {
  background: var(--color-primary); /* en dark invertido: disco dorado */
  color: var(--color-ink);
  box-shadow:
    0 0 0 6px color-mix(in srgb, var(--color-primary) 24%, transparent),
    0 10px 30px -12px rgba(201,191,48,0.18);
}

/* --- Home layout (Adidas Running DNA — preview-exact) --- */
.home-header {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.home-header-meta { flex: 1; min-width: 0; }
.home-date-label {
  font-size: 0.7rem; font-weight: 700;
  color: var(--color-text-muted);
  letter-spacing: 1.8px; text-transform: uppercase;
  margin: 0 0 4px;
}
.home-greeting {
  margin: 0; font-size: 1.5rem; font-weight: 700;
  letter-spacing: -0.8px; color: var(--color-text);
  line-height: 1.05;
  font-family: var(--font-display);
}
.home-avatar .avatar-preview {
  background: var(--color-ink); color: var(--color-primary);
  border: none !important;
}
[data-theme="dark"] .home-avatar .avatar-preview {
  background: var(--color-primary); color: var(--color-ink);
}

.home-readiness-hero {
  display: block; width: 100%; text-align: left;
  background: var(--color-hero-bg);
  color: var(--color-hero-text);
  border: 1px solid var(--color-hero-border);
  border-radius: var(--radius-xl);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s;
}
.home-readiness-hero:active { transform: scale(0.99); }
.home-readiness-hero::after {
  content: ''; position: absolute;
  right: -40px; top: -40px;
  width: 160px; height: 160px;
  background: var(--color-primary);
  border-radius: 50%;
  opacity: 0.15;
  pointer-events: none;
}
.readiness-hero-label {
  font-size: 0.7rem; font-weight: 700;
  color: var(--color-primary); letter-spacing: 2px;
  text-transform: uppercase;
  position: relative; z-index: 1;
}
.readiness-hero-value {
  font-family: var(--font-display);
  font-size: 4.2rem; font-weight: 700; letter-spacing: -3px;
  line-height: 0.95; margin-top: 4px;
  font-variant-numeric: tabular-nums;
  position: relative; z-index: 1;
  color: var(--color-hero-text);
}
/* Placeholder state — cuando no hay readiness hoy */
.readiness-hero-value.is-placeholder {
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: 0;
  opacity: 0.45;
  line-height: 1.1;
  margin-top: 6px;
  padding-top: 4px;
}
.readiness-hero-value.is-placeholder small { display: none; }
.readiness-hero-value small {
  font-size: 1.1rem; font-weight: 700;
  color: rgba(255,255,255,0.6); letter-spacing: 0;
  margin-left: 6px;
}
.readiness-hero-chip {
  background: rgba(219,202,40,0.18);
  color: var(--color-primary);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.8px; text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: var(--sp-3);
  position: relative; z-index: 1;
}
.readiness-hero-chip svg { width: 13px; height: 13px; stroke-width: 2.5; }

.section-label {
  font-size: 0.7rem; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--color-text-muted);
  margin: var(--sp-4) 4px var(--sp-2);
}
.section-label-row {
  display: flex; align-items: center; justify-content: space-between;
}
.section-link {
  background: none; border: none; cursor: pointer;
  color: var(--color-text);
  font-size: 0.7rem; font-weight: 800;
  letter-spacing: 1.2px; text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 2px;
  padding: 2px 4px;
}
.section-link svg { width: 14px; height: 14px; stroke-width: 2.5; }

.tile-grid-4 {
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.workout-card-home {
  display: flex; align-items: center; gap: var(--sp-3);
  width: 100%; text-align: left;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-2);
  cursor: pointer;
  transition: transform 0.15s;
}
.workout-card-home:active { transform: scale(0.99); }
.workout-thumb-home {
  width: 44px; height: 44px; border-radius: var(--radius);
  background: var(--color-bg-subtle);
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text);
  flex-shrink: 0;
}
.workout-thumb-home svg { width: 22px; height: 22px; stroke-width: 2; }
.workout-meta-home { flex: 1; min-width: 0; }
.workout-meta-home h4 {
  margin: 0; font-size: var(--fs-sm); font-weight: 800;
  letter-spacing: -0.2px; color: var(--color-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.workout-meta-home p {
  margin: 2px 0 0; font-size: var(--fs-xs);
  color: var(--color-text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.workout-val-home { text-align: right; }
.workout-val-home b {
  display: block; font-size: var(--fs-lg); font-weight: 900;
  letter-spacing: -0.3px; color: var(--color-text);
}
.workout-val-home span {
  font-size: 0.65rem; color: var(--color-text-muted);
  letter-spacing: 1px; text-transform: uppercase;
}

/* Readiness screen hero context */
.readiness-context-hero {
  background: var(--color-hero-bg);
  color: var(--color-hero-text);
  border: 1px solid var(--color-hero-border);
  border-radius: var(--radius-xl);
  padding: var(--sp-5);
  margin-bottom: var(--sp-3);
}
.readiness-context-hero h3 {
  margin: 0 0 4px; font-size: 1.2rem; font-weight: 900;
  letter-spacing: -0.4px;
}
.readiness-context-hero p {
  margin: 0; font-size: var(--fs-xs);
  color: rgba(255,255,255,0.55);
}

/* --- Home hero greeting + tile grid (Adidas DNA) --- */
.home-hero {
  background: var(--color-hero-bg);
  color: var(--color-hero-text);
  border: 1px solid var(--color-hero-border);
  border-radius: var(--radius-xl);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
  position: relative;
  overflow: hidden;
}
.home-hero::after {
  content: ''; position: absolute;
  right: -40px; top: -40px;
  width: 160px; height: 160px;
  background: var(--color-primary);
  border-radius: 50%;
  opacity: 0.13;
  pointer-events: none;
}
.home-hero-row {
  display: flex; align-items: center; gap: var(--sp-3);
  position: relative; z-index: 1;
}
.home-hero-greeting {
  flex: 1; min-width: 0;
}
.home-hero-greeting p {
  font-size: var(--fs-xs); font-weight: 700;
  color: var(--color-primary); letter-spacing: 2px;
  text-transform: uppercase; margin: 0 0 4px;
}
.home-hero-greeting h2 {
  margin: 0; font-size: 1.5rem; font-weight: 900;
  letter-spacing: -0.5px; color: var(--color-hero-text);
}
.home-hero-streak {
  text-align: right;
}
.home-hero-streak .val {
  font-size: 2.25rem; font-weight: 900;
  letter-spacing: -1.5px; color: var(--color-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.home-hero-streak .label {
  font-size: var(--fs-xs); color: rgba(255,255,255,0.55);
  letter-spacing: 1px; text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 4px;
}
.home-hero-streak .label svg { width: 12px; height: 12px; stroke-width: 2; }

/* Tile grid with icon on top-left, label uppercase, number XXL */
.tile-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}
.adidas-tile {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
}
.adidas-tile svg {
  width: 18px; height: 18px; stroke-width: 2;
  color: var(--color-text); opacity: 0.7;
  margin-bottom: 4px;
}
.adidas-tile .tile-label {
  font-size: var(--fs-xs); font-weight: 700;
  color: var(--color-text-muted);
  letter-spacing: 1.3px; text-transform: uppercase;
}
.adidas-tile .tile-value {
  font-family: var(--font-display);
  font-size: 1.75rem; font-weight: 700;
  letter-spacing: -0.8px; line-height: 1.1;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
}
/* Placeholder tile-value (— / 5 when no data) */
.adidas-tile .tile-value.is-placeholder {
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0;
  opacity: 0.45;
  margin-top: 8px;
}
.adidas-tile .tile-value small {
  font-size: 0.8rem; font-weight: 600;
  color: var(--color-text-muted); margin-left: 3px;
}
/* When the tile is a <button> it inherits browser defaults — reset them so
   it matches the visual of a <div>-based tile exactly, plus a subtle press. */
button.adidas-tile.tile-clickable {
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease;
}
button.adidas-tile.tile-clickable:hover { border-color: var(--color-primary); }
button.adidas-tile.tile-clickable:active { transform: scale(0.98); }

/* --- Hero surfaces (Adidas DNA: negro + acento amarillo) --- */
.hero-card {
  background: var(--color-hero-bg);
  color: var(--color-hero-text);
  border: 1px solid var(--color-hero-border);
  border-radius: var(--radius-xl);
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  margin-bottom: var(--sp-4);
  position: relative;
  overflow: hidden;
}
.hero-label {
  font-size: var(--fs-xs); font-weight: var(--fw-bold);
  color: var(--color-primary); letter-spacing: 2px;
  text-transform: uppercase; margin-bottom: var(--sp-2);
}
.hero-sub {
  font-size: var(--fs-xs);
  color: rgba(255,255,255,0.55); margin-top: var(--sp-1);
}
.volume-hero {
  background: var(--color-hero-bg); color: var(--color-hero-text);
  border: 1px solid var(--color-hero-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4) var(--sp-5);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3);
}
.volume-hero .vol-label {
  font-size: var(--fs-xs); font-weight: var(--fw-bold);
  color: var(--color-primary); letter-spacing: 1.6px;
  text-transform: uppercase;
}
.volume-hero .vol-value {
  font-family: var(--font-display);
  font-size: 2rem; font-weight: 700; letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}

/* Routine exercise row with video thumb */
.routine-ex-row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--color-border);
}
.routine-ex-row:last-child { border-bottom: none; }
.routine-video-thumb {
  position: relative;
  width: 88px; height: 50px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--color-ink);
  cursor: pointer;
  border: none; padding: 0;
}
.routine-video-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.routine-video-thumb::after {
  content: '\25B6';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  background: rgba(0,0,0,0.55);
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px;
  pointer-events: none;
}
.routine-video-thumb.no-video {
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text-muted);
  font-size: 18px;
}
.routine-video-thumb.no-video::after { display: none; }
.routine-ex-meta { flex: 1; min-width: 0; }
.routine-ex-meta .name {
  font-size: var(--fs-sm); font-weight: var(--fw-semibold);
  letter-spacing: -0.1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: block;
}
.routine-ex-meta .info {
  font-size: var(--fs-xs); color: var(--color-text-muted);
  margin-top: 2px;
}

/* Lucide icon helper (consistent stroke) */
.icon { width: 18px; height: 18px; stroke-width: 2; vertical-align: -3px; }
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 24px; height: 24px; }

/* --- Video Embed --- */
.video-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  margin-bottom: var(--sp-4);
}

.video-container iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
}

/* --- Search --- */
.search-bar {
  position: relative;
  margin-bottom: var(--sp-4);
}

.search-bar input {
  width: 100%;
  padding: var(--sp-3) var(--sp-3) var(--sp-3) 44px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-bg-card);
  color: var(--color-text);
  font-size: var(--fs-base);
  min-height: 44px;
}

.search-bar input:focus { border-color: var(--color-primary); outline: none; }

.search-bar svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  width: 20px; height: 20px;
  pointer-events: none;
}

/* --- Category Filter --- */
.category-filter {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  padding-bottom: var(--sp-2);
  margin-bottom: var(--sp-4);
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.category-filter::-webkit-scrollbar { display: none; }

.filter-chip {
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-full);
  border: 1.5px solid var(--color-border);
  background: transparent;
  color: var(--color-text-light);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s;
}

.filter-chip.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

/* --- Install Banner --- */
.install-banner {
  position: fixed;
  bottom: calc(var(--nav-height) + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: calc(var(--max-width) - 32px);
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  box-shadow: var(--shadow-lg);
  z-index: 90;
}

.install-banner.hidden { display: none; }

.install-banner-text { font-size: var(--fs-sm); font-weight: var(--fw-medium); }

.install-banner .btn {
  background: #fff;
  color: var(--color-primary);
  font-size: var(--fs-sm);
  padding: var(--sp-2) var(--sp-3);
  white-space: nowrap;
}

.install-banner-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: var(--fs-lg);
  padding: var(--sp-1);
  cursor: pointer;
}

/* --- Consent Screen --- */
.consent-box {
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--sp-4);
  margin: var(--sp-4) 0;
  font-size: var(--fs-sm);
  line-height: 1.6;
}

/* --- Streak Badge --- */
.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  background: linear-gradient(135deg, var(--color-accent), #F59E0B);
  color: #fff;
  border-radius: var(--radius-full);
  font-weight: var(--fw-bold);
}

/* --- Trust Bar (Evidence Modal) --- */
.trust-bar {
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-bg-subtle);
  overflow: hidden;
  margin: var(--sp-3) 0;
}

.trust-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.3s;
}

/* --- Disclaimer Bar --- */
.disclaimer-bar {
  background: var(--color-bg-subtle);
  border-radius: var(--radius-sm);
  padding: var(--sp-3);
  margin-bottom: var(--sp-4);
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
  text-align: center;
  border: 1px solid var(--color-border);
}

/* --- Legal Bar (copyright shown at the end of each screen) --- */
.legal-bar {
  padding: var(--sp-4) var(--sp-3);
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
  text-align: center;
  border-top: 1px solid var(--color-border);
  margin-top: var(--sp-6);
  letter-spacing: 0.01em;
}

/* --- Utilities --- */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: var(--sp-1); }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.mt-2 { margin-top: var(--sp-2); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }
.p-4 { padding: var(--sp-4); }
.w-full { width: 100%; }

/* --- Responsive --- */
@media (min-width: 481px) {
  :root { --max-width: 480px; }
  .bottom-nav { border-radius: var(--radius-lg) var(--radius-lg) 0 0; box-shadow: var(--shadow-lg); }
}

@media (max-width: 360px) {
  :root { --fs-base: 0.9375rem; }
  .set-row { grid-template-columns: 32px 1fr 1fr 64px 38px; gap: var(--sp-1); }
}

/* ===== Wellness + Body Tracking (Phase A) ===== */
.metric-comparison-card .flex { align-items: baseline; }
.metric-comparison-card strong { font-size: 1.25rem; }

.body-history-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.body-history-row {
  display: grid;
  grid-template-columns: auto 1fr 1fr auto;
  gap: var(--sp-2);
  align-items: center;
  padding: var(--sp-2) var(--sp-3);
  background: var(--color-bg-subtle, rgba(0,0,0,0.03));
  border-radius: var(--radius-md, 8px);
  font-size: 0.875rem;
}
.body-history-date {
  font-weight: 600;
  color: var(--color-text-muted);
  font-size: 0.8125rem;
}
#readiness-saved-msg:empty { display: none; }

/* ===== Muscle Coverage polish (Phase B) ===== */
.coverage-summary-card { background: linear-gradient(135deg, rgba(37,99,235,0.06) 0%, rgba(37,99,235,0.02) 100%); }
.coverage-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}
.coverage-stat {
  text-align: center;
  padding: var(--sp-3) var(--sp-2);
  background: var(--color-bg-card, #fff);
  border-radius: var(--radius-md, 8px);
  border: 1px solid var(--color-border, rgba(0,0,0,0.08));
}
.coverage-stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-primary, #2563eb);
  line-height: 1.1;
}
.coverage-stat-label {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: var(--sp-1);
}
.chip-value {
  display: inline-block;
  min-width: 18px;
  padding: 0 6px;
  margin-left: 4px;
  background: rgba(0,0,0,0.08);
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ===== Multi-source routines (Phase C) ===== */
.routine-source-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2);
  padding: 4px;
  background: var(--color-bg-subtle, rgba(0,0,0,0.04));
  border-radius: var(--radius-md, 10px);
}
.routine-tab {
  border: none;
  background: transparent;
  padding: var(--sp-2) var(--sp-3);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm, 8px);
  transition: background 0.15s ease, color 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1;
}
.routine-tab svg { flex-shrink: 0; vertical-align: 0; }
.routine-tab.active {
  background: var(--color-bg-card, #fff);
  color: var(--color-primary, #2563eb);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.routine-tab:hover:not(.active) { color: var(--color-text); }

.custom-routine-card { border-left: 3px solid var(--color-primary, #2563eb); }

.custom-match-list { display: flex; flex-direction: column; gap: 6px; }
.custom-match-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: rgba(22, 163, 74, 0.08);
  border-radius: var(--radius-sm, 6px);
  font-size: 0.875rem;
  flex-wrap: wrap;
}
.custom-match-row.unmatched { background: rgba(220, 38, 38, 0.08); }
.custom-match-typed {
  font-family: var(--font-mono, monospace);
  color: var(--color-text-muted);
  font-style: italic;
}
.custom-match-arrow { color: var(--color-text-muted); }
.custom-match-found {
  font-weight: 600;
  color: var(--color-text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.custom-match-ratio {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 8px;
  background: rgba(22, 163, 74, 0.18);
  color: #15803d;
  font-size: 0.7rem;
  font-weight: 700;
}
.custom-unmatched-list { display: flex; flex-direction: column; gap: 6px; }

/* ===== Auth feedback (Phase D-2) ===== */
.auth-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
  vertical-align: middle;
  margin-left: 8px;
}
.auth-spinner.active { display: inline-block; }
@keyframes auth-spin { to { transform: rotate(360deg); } }

button[disabled] .btn-label { opacity: 0.6; }
button[disabled] { cursor: progress; }

.sync-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  margin-top: var(--sp-4);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(0,0,0,0.05);
  color: var(--color-text-muted);
}
.sync-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-text-muted);
  box-shadow: 0 0 0 0 rgba(37,99,235,0.4);
}
.sync-status-indicator.online .sync-status-dot {
  background: var(--color-success, #16A34A);
  animation: sync-pulse 2s infinite;
}
.sync-status-indicator.online {
  background: rgba(22,163,74,0.1);
  color: var(--color-success, #16A34A);
}
.sync-status-indicator.offline .sync-status-dot {
  background: var(--color-danger, #DC2626);
}
.sync-status-indicator.offline {
  background: rgba(220,38,38,0.08);
  color: var(--color-danger, #DC2626);
}
@keyframes sync-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(22,163,74,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(22,163,74,0); }
}
