/* ============================================================
   views.css — estilos específicos por vista
============================================================ */

/* Setup */
.setup {
  max-width: 460px;
  margin: 60px auto;
}

.setup-icon {
  font-size: 3rem;
  color: var(--accent);
  margin-bottom: 12px;
  font-family: 'DM Serif Display', serif;
}

/* Wizard */
.wizard-progress {
  display: flex;
  gap: 6px;
  margin-bottom: 26px;
}

.wizard-step {
  flex: 1;
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
}

.wizard-step.done,
.wizard-step.active {
  background: var(--accent);
}

/* Stepper circular (solo al editar perfil) */
.wizard-stepper {
  margin-bottom: 26px;
}

.wizard-stepper-track {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

.wizard-stepper-line {
  flex: 1;
  min-width: 12px;
  height: 2px;
  margin-top: 18px;
  background: var(--border);
}

.wizard-stepper-line.active {
  background: var(--accent);
}

.wizard-stepper-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  font: inherit;
  flex-shrink: 0;
  min-width: 0;
}

.wizard-stepper-step:hover .wizard-stepper-circle {
  border-color: var(--accent);
}

.wizard-stepper-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border-strong, var(--border));
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.wizard-stepper-label {
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  max-width: 72px;
}

.wizard-stepper-step.current .wizard-stepper-circle {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent, #fff);
}

.wizard-stepper-step.current .wizard-stepper-label {
  color: var(--accent);
}

.wizard-stepper-step.done .wizard-stepper-circle {
  border-color: var(--accent);
  background: var(--accent-muted, rgba(61, 154, 107, 0.15));
  color: var(--accent);
}

.wizard-stepper-step.done .wizard-stepper-label {
  color: var(--text);
}

@media (max-width: 420px) {
  .wizard-stepper-label {
    font-size: 0.65rem;
    max-width: 56px;
  }

  .wizard-stepper-circle {
    width: 32px;
    height: 32px;
    font-size: 0.82rem;
  }

  .wizard-stepper-line {
    margin-top: 16px;
  }
}

.wizard-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
}

.wizard-actions--with-skip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "skip skip"
    "back next";
  gap: 10px 12px;
  align-items: stretch;
}

.wizard-actions--with-skip .onboarding-skip {
  grid-area: skip;
  justify-self: center;
  width: auto;
  max-width: 100%;
  white-space: nowrap;
}

.wizard-actions--with-skip > .btn-secondary {
  grid-area: back;
}

.wizard-actions--with-skip > .btn-primary {
  grid-area: next;
}

.wizard-actions--col {
  flex-direction: column;
  align-items: stretch;
}

.wizard-actions--col #back {
  align-self: flex-start;
}

.wizard-save-hint {
  color: var(--text-2);
  font-size: 0.88rem;
  line-height: 1.45;
  margin: 0 0 4px 0;
  width: 100%;
}

.wizard-section {
  font-family: 'DM Serif Display', serif;
  font-size: 1.15rem;
  color: var(--accent);
  margin: 22px 0 12px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.wizard-section:first-child {
  margin-top: 0;
}

.step-optional {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  background: var(--surface-2);
  border-radius: 999px;
  vertical-align: middle;
}

/* Franjas horarias — línea de tiempo */
.slot-timeline-summary {
  font-size: 0.88rem;
  color: var(--text-2);
  margin-bottom: 16px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.slot-timeline-summary.has-items {
  color: var(--accent);
  font-weight: 600;
  border-color: var(--accent);
  background: var(--accent-muted, rgba(61, 154, 107, 0.12));
}

.slot-timeline {
  margin-bottom: 8px;
}

.slot-timeline-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.slot-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 20px;
  flex-shrink: 0;
}

.slot-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border-strong, var(--border));
  border: 2px solid var(--surface);
  flex-shrink: 0;
}

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

.slot-line {
  flex: 1;
  width: 2px;
  min-height: 24px;
  margin-top: 4px;
  background: var(--border);
}

.slot-body {
  flex: 1;
  min-width: 0;
}

.slot-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.slot-emoji {
  font-size: 1.25rem;
  line-height: 1;
}

.slot-name {
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
}

.slot-hint {
  font-size: 0.78rem;
  color: var(--text-3);
}

.slot-quick-label {
  font-size: 0.72rem;
  color: var(--text-3);
  margin-top: 10px;
  margin-bottom: 6px;
}

.slot-quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.slot-quick-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong, var(--border));
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}

.slot-quick-chip:hover {
  border-color: var(--accent);
}

/* Comidas fijas (formulario) */
.fixed-meal-item {
  background: var(--surface-2);
  padding: 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  border: 1px solid var(--border);
}

.fixed-meal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.ingredient-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px 90px;
  gap: 8px;
  margin-bottom: 6px;
  align-items: center;
}

.ingredient-row .input,
.ingredient-row .select {
  min-width: 0;
  width: 100%;
}

.ingredient-row .ing-unit {
  padding: 12px 8px;
}

@media (max-width: 500px) {
  .ingredient-row {
    grid-template-columns: minmax(0, 1fr) 70px 75px;
  }
}

/* Day tabs (vista semana) */
.day-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 18px;
}

.plan-screen-summary-card {
  margin-bottom: 1.25rem;
}

.plan-screen-summary-card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}

.plan-screen-summary-text {
  margin: 0;
  line-height: 1.5;
}

.plan-screen-meta {
  margin: 0.75rem 0 0;
  line-height: 1.45;
  color: var(--text-2, #94a3b8);
}

.plan-weekly-heading {
  margin: 0 0 14px;
  font-size: 1.1rem;
}

.plan-weekly-hint {
  margin: -8px 0 12px;
  font-size: 0.88rem;
  color: var(--text-3, #64748b);
  line-height: 1.45;
}

.day-tab {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  border: 1px solid var(--border);
}

.day-tab.active {
  background: color-mix(in srgb, var(--accent, #22c55e) 14%, var(--surface-2));
  color: var(--accent, #22c55e);
  border-color: var(--accent, #22c55e);
}

.day-total-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: 0.95rem;
  border-left: 3px solid var(--accent);
}

.day-total-banner.off-target {
  border-left-color: var(--danger);
}

/* ----- Memoria del coach ----- */
.memory-banner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 8%, var(--surface)) 0%, var(--surface) 100%);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 22px;
}

.memory-banner-first {
  background: var(--surface-2);
  border-color: var(--border);
}

.memory-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
  line-height: 1;
}

.memory-content {
  flex: 1;
  min-width: 0;
}

.memory-title {
  font-weight: 600;
  color: var(--text);
  font-size: 0.98rem;
  margin-bottom: 6px;
}

.memory-sub {
  color: var(--text-2);
  font-size: 0.88rem;
  line-height: 1.5;
}

.memory-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--text-2);
  font-size: 0.9rem;
  align-items: center;
}

.memory-stats > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.memory-delta {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  font-weight: 700;
}

.memory-delta.positive { color: var(--success); }
.memory-delta.negative { color: var(--danger); }

.memory-pattern {
  font-weight: 500;
}

/* ----- Version footer (Ajustes) ----- */
.version-footer {
  margin-top: 28px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 0.8rem;
  text-align: center;
  letter-spacing: 0.02em;
}

/* ----- Legal (Ajustes + vista documento) ----- */
.legal-link-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legal-link-btn {
  justify-content: flex-start;
  text-align: left;
}

.legal-back {
  margin-bottom: 8px;
  padding-left: 0;
}

.legal-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.legal-tab {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-2);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.82rem;
  cursor: pointer;
}

.legal-tab.active {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.legal-doc-card {
  padding: 1.25rem 1.35rem;
}

.legal-prose {
  color: var(--text);
  line-height: 1.65;
  font-size: 0.92rem;
}

.legal-prose h1,
.legal-prose h2,
.legal-prose h3 {
  margin: 1.25rem 0 0.5rem;
  line-height: 1.3;
}

.legal-prose h1 { font-size: 1.35rem; }
.legal-prose h2 { font-size: 1.12rem; }
.legal-prose h3 { font-size: 1rem; color: var(--text-2); }

.legal-prose p,
.legal-prose li {
  margin: 0.5rem 0;
  color: var(--text-2);
}

.legal-prose ul,
.legal-prose ol {
  padding-left: 1.25rem;
  margin: 0.5rem 0;
}

.legal-prose a {
  color: var(--accent);
}

.legal-prose code {
  font-size: 0.85em;
  background: var(--bg-subtle);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.version-footer strong {
  color: var(--text-2);
  font-weight: 600;
}

/* Meal cards */
.meal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
  transition: border-color var(--transition);
}

.meal-card.fixed {
  border-color: var(--accent);
  border-width: 2px;
  background: linear-gradient(135deg, var(--surface) 0%, color-mix(in srgb, var(--accent) 6%, var(--surface)) 100%);
}

.meal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 10px;
  flex-wrap: wrap;
}

.meal-name {
  font-family: 'DM Serif Display', serif;
  font-size: 1.35rem;
  color: var(--text);
}

.meal-time {
  font-size: 0.85rem;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.meal-kcal {
  font-weight: 700;
  color: var(--accent);
  font-size: 1.05rem;
}

.meal-badge {
  display: inline-block;
  padding: 3px 9px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.meal-foods { list-style: none; }

.meal-food {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 0.92rem;
}

.meal-food:last-child { border-bottom: none; }

.food-name { color: var(--text); }
.food-qty { color: var(--text-2); }

.food-kcal {
  color: var(--text-3);
  font-size: 0.82rem;
  margin-left: 8px;
}

.meal-note {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  color: var(--text-2);
  border-left: 3px solid var(--accent);
}

/* Daily log */
.log-meal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  gap: 12px;
}

.log-meal-info {
  flex: 1;
  min-width: 0;
}

.log-meal-name {
  font-weight: 600;
  color: var(--text);
  font-size: 0.98rem;
}

.log-meal-meta {
  font-size: 0.82rem;
  color: var(--text-3);
  margin-top: 2px;
}

.log-actions {
  display: flex;
  gap: 8px;
}

.log-btn {
  width: 42px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.9rem;
  transition: all 150ms;
}

.log-btn.yes.active { background: var(--success); color: white; border-color: var(--success); }
.log-btn.no.active  { background: var(--danger);  color: white; border-color: var(--danger); }
.log-btn:hover { border-color: var(--border-strong); }

/* Análisis IA */
.analysis-box {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 8%, var(--surface)) 0%, var(--surface) 100%);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 22px;
  margin-top: 20px;
}

.analysis-box h3 {
  color: var(--accent);
  margin-bottom: 12px;
}

.analysis-rec {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-top: 10px;
  border-left: 3px solid var(--accent);
}

/* Progress / chart */
.chart-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin: 20px 0;
}

.history-row {
  display: grid;
  grid-template-columns: 110px 80px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

.history-row:last-child { border-bottom: none; }
.history-date { color: var(--text-2); font-weight: 500; }
.history-weight { font-weight: 700; color: var(--text); }
.history-note { color: var(--text-3); font-size: 0.85rem; }

@media (max-width: 500px) {
  .history-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .history-row .history-note { grid-column: span 2; }
}

/* ----- Progreso unificado (dieta + entreno) ----- */
.progress-view .pg-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.pg-tab {
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  touch-action: manipulation;
  min-height: 44px;
}

.pg-tab.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--text);
}

.pg-tab:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pg-section-title {
  margin: 0 0 12px;
  font-size: 1rem;
}

.pg-goal-card {
  margin-bottom: 20px;
}

.pg-goal-meta {
  margin: 0 0 14px;
  font-size: 0.9rem;
}

.pg-goal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 640px) {
  .pg-goal-grid {
    grid-template-columns: 1fr;
  }
}

.pg-goal-item {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.pg-goal-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  font-weight: 600;
  margin-bottom: 6px;
}

.pg-goal-msg {
  margin: 8px 0 0;
  font-size: 0.88rem;
  line-height: 1.45;
}

.pg-status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.pg-status--ok {
  background: color-mix(in srgb, var(--success) 18%, var(--surface));
  color: var(--success);
}

.pg-status--mid {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--accent);
}

.pg-status--low {
  background: color-mix(in srgb, var(--danger) 14%, var(--surface));
  color: var(--danger);
}

.pg-dual-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 800px) {
  .pg-dual-metrics {
    grid-template-columns: 1fr;
  }
}

.pg-metric-group-title {
  margin: 0 0 10px;
  font-size: 0.85rem;
  color: var(--text-2);
  font-weight: 600;
}

.metrics--compact .metric {
  padding: 12px 14px;
}

.metrics--compact .metric-value {
  font-size: 1.45rem;
}

.pg-chart-legend,
.pg-cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 12px;
  font-size: 0.82rem;
}

.pg-legend-bar::before {
  content: '▮';
  color: color-mix(in srgb, var(--accent) 55%, transparent);
  margin-right: 4px;
}

.pg-legend-line::before {
  content: '—';
  color: var(--accent);
  margin-right: 4px;
  font-weight: 700;
}

.pg-week-chart {
  width: 100%;
  height: auto;
}

.pg-week-table-wrap {
  overflow-x: auto;
  margin-top: 14px;
}

.pg-week-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.pg-week-table th,
.pg-week-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.pg-week-table th {
  color: var(--text-3);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.pg-calendar-card {
  margin-top: 20px;
}

.pg-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 4px;
  font-size: 0.72rem;
  color: var(--text-3);
  font-weight: 600;
  text-align: center;
}

.pg-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.pg-cal-pad {
  aspect-ratio: 1;
}

.pg-cal-day {
  aspect-ratio: 1;
  min-height: 2.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
  position: relative;
}

.pg-cal-day--diet-high {
  background: color-mix(in srgb, var(--success) 22%, var(--surface-2));
}

.pg-cal-day--diet-mid {
  background: color-mix(in srgb, var(--accent) 16%, var(--surface-2));
}

.pg-cal-day--diet-low {
  background: color-mix(in srgb, var(--danger) 12%, var(--surface-2));
}

.pg-cal-day--selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent);
}

.pg-cal-num {
  font-size: 0.82rem;
  font-weight: 600;
}

.pg-cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.pg-cal-detail {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}

.pg-cal-detail-title {
  margin: 0 0 8px;
  font-size: 0.95rem;
  text-transform: capitalize;
}

.pg-cal-sessions {
  margin: 8px 0 0;
  padding-left: 1.1rem;
}

.pg-cal-hint {
  margin: 0;
  font-size: 0.85rem;
}

.pg-analyze-btn {
  margin: 20px 0;
}

.pg-analyze-hint {
  text-align: center;
  margin: 20px 0;
  font-size: 0.9rem;
}

.pg-empty {
  margin: 12px 0;
  font-size: 0.9rem;
}

.pg-workout-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 16px 0 20px;
}

.pg-session-list {
  padding: 0.5rem 0.85rem;
  margin-bottom: 24px;
}

.pg-session-row {
  display: grid;
  grid-template-columns: 5.5rem 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

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

@media (max-width: 520px) {
  .pg-session-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

.pg-session-date {
  color: var(--text-2);
  font-weight: 500;
}

.pg-session-name {
  font-weight: 600;
}

.pg-session-meta {
  font-size: 0.82rem;
}

.pg-ex-progress-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pg-ex-card {
  padding: 12px 14px;
}

.pg-ex-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.pg-ex-card-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pg-ex-latest {
  font-size: 0.9rem;
}

.pg-spark {
  width: 80px;
  height: 28px;
  flex-shrink: 0;
}

.pg-hint-inline {
  font-size: 0.82rem;
}

/* Historial de planes */
.plan-history-modal-body .history-plan + .history-plan {
  margin-top: 10px;
}

.history-plan {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  border: 1px solid var(--border);
}

.history-plan-info { flex: 1; }
.history-plan-date { font-weight: 600; }
.history-plan-meta {
  font-size: 0.82rem;
  color: var(--text-3);
  margin-top: 2px;
}

/* Lista de compras */
.shopping-cat { margin-bottom: 18px; }

.shopping-cat-title {
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.shopping-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 0.92rem;
}

.shopping-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}

@media (min-width: 600px) {
  .shopping-overlay {
    align-items: center;
    padding: 24px;
  }
}

.shopping-modal {
  width: 100%;
  max-width: 520px;
  max-height: min(85vh, 640px);
  display: flex;
  flex-direction: column;
  margin: 0;
}

.shopping-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.shopping-modal-sub {
  color: var(--text-3);
  font-size: 0.9rem;
  margin: 4px 0 0;
}

.shopping-modal-close {
  min-width: 40px;
  padding: 8px 12px;
}

.shopping-modal-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  margin-bottom: 16px;
}

.shopping-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.shopping-modal-actions .btn { flex: 1; min-width: 140px; }

body.modal-open { overflow: hidden; }

/* ----- Preview de cálculos en wizard step 1 ----- */
.calc-preview {
  margin: 18px 0 4px 0;
  padding: 14px 16px;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.55;
}

.calc-preview[hidden] { display: none; }

.calc-preview-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  font-size: 0.92rem;
}

.calc-preview-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.calc-preview-row strong {
  font-family: 'DM Serif Display', serif;
  font-size: 1.4rem;
  color: var(--accent);
}

.calc-preview-tdee {
  color: var(--text-3);
  font-size: 0.82rem;
}

.calc-preview-macros {
  color: var(--text-2);
  font-size: 0.88rem;
}

.calc-preview-macros strong {
  color: var(--text);
}

.calc-preview-error {
  color: var(--danger);
  font-weight: 500;
}

/* Hint debajo de un input */
.hint {
  display: block;
  margin-top: 4px;
  color: var(--text-3);
  font-size: 0.8rem;
}

/* ----- Inputs con validación inline ----- */
.input.invalid {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 6%, var(--surface-2));
}

.input.invalid:focus {
  outline: none;
  border-color: var(--danger);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger) 25%, transparent);
}

.input-error {
  display: block;
  margin-top: 4px;
  color: var(--danger);
  font-size: 0.8rem;
  font-weight: 500;
}

/* ----- Entreno (beta) ----- */
.workout-actions {
  margin-bottom: 16px;
}

.workout-actions .field-hint {
  margin-bottom: 0.75rem;
  line-height: 1.45;
}

.workout-quota-warn {
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  color: var(--danger);
  font-size: 0.875rem;
}

.workout-summary-card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}

.workout-summary-text {
  margin: 0;
  line-height: 1.5;
}

.workout-diet-align {
  margin: 0.75rem 0 0;
  line-height: 1.45;
}

.workout-tips {
  margin: 0.75rem 0 0;
  padding-left: 1.25rem;
  line-height: 1.45;
}

.workout-tips li + li {
  margin-top: 0.35rem;
}

.workout-generated-at {
  margin: 0.75rem 0 0;
}

.workout-day-card {
  margin-bottom: 12px;
}

.workout-day-card h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  line-height: 1.35;
  font-family: var(--font-sans, inherit);
}

.workout-day-rest {
  opacity: 0.85;
}

.workout-warmup-block {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.workout-warmup-title {
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.workout-warmup-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.workout-warmup-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
}

.workout-warmup-item span:first-of-type {
  flex: 1;
  min-width: 0;
}

.workout-warmup-thumb {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--border);
  flex: none;
}

.ws-warmup {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card, transparent);
}

.ws-warmup-summary {
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 700;
}

.ws-warmup[open] .ws-warmup-summary {
  margin-bottom: 10px;
}

/* El ejercicio 0: pildora punteada del calentamiento en la fila de navegacion. */
.ws-ex-pill--warmup {
  border-style: dashed !important;
  border-color: var(--accent) !important;
  color: var(--accent);
  background: transparent;
}

.ws-warmup-stage-head {
  margin-bottom: 12px;
}

.ws-warmup-stage-title {
  margin: 0 0 4px;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ws-warmup-badge {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-2, #777);
}

/* Tarjetas de calentamiento: UNA por renglon, imagen protagonista. */
.ws-warmup-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.ws-warmup-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--card, transparent);
  display: flex;
  flex-direction: column;
}

.ws-warmup-imgwrap {
  position: relative;
  cursor: pointer;
}

.ws-warmup-img {
  width: 100%;
  height: 240px;
  object-fit: contain;
  background: #fff;
  display: block;
}

.ws-warmup-img--ph {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.ws-warmup-cambiar,
.ws-warmup-chip {
  position: absolute;
  top: 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card, #fff);
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

.ws-warmup-cambiar {
  left: 8px;
  color: var(--accent);
  cursor: pointer;
}

.ws-warmup-chip {
  right: 8px;
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.ws-warmup-nombre {
  margin: 8px 10px 6px;
  font-size: 0.9rem;
  font-weight: 600;
}

.ws-warmup-timerrow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px 10px;
}

.ws-warmup-timerrow .ws-play-btn {
  width: 36px;
  height: 36px;
}

.ws-warmup-timerrow .ws-time-wrap {
  min-height: 36px;
}

.workout-ex-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.workout-ex-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.workout-ex-row .workout-ex-body {
  flex: 1;
  min-width: 0;
}

.workout-ex-img {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-2);
}

.workout-ex-img--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.workout-ex-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.ex-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.ex-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2, var(--surface));
  color: var(--text-2);
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.3;
}

.ex-overview,
.ex-tip {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--text-2);
}

.ex-tip::before {
  content: 'Tip: ';
  font-weight: 600;
  color: var(--text);
}

.workout-ex-detail {
  margin-top: 4px;
}

.workout-ex-body strong {
  font-size: 0.95rem;
  line-height: 1.3;
}

.workout-ex-subtitle {
  font-size: 0.82rem;
  line-height: 1.3;
}

.workout-ex-note {
  font-size: 0.85rem;
  color: var(--text-2);
}

.workout-ex-license {
  font-size: 0.75rem;
}

.workout-ex-check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-2);
  cursor: pointer;
}

.workout-adherence-card {
  margin-bottom: 16px;
  padding: 0.85rem 1rem;
}

.workout-adherence-line {
  margin: 0;
  font-size: 0.9rem;
}

.workout-adherence-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
}

.workout-adherence-row .workout-adherence-line {
  flex: 1 1 12rem;
}

#btnWorkoutHistory {
  flex-shrink: 0;
  min-height: 40px;
  touch-action: manipulation;
}

.workout-day-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}

.workout-day-head h3 {
  margin: 0;
}

.workout-day-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.workout-day-card--done {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}

.checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.checkbox-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
}

.checkbox-chip input {
  accent-color: var(--accent);
}

.workout-readiness-card {
  margin-bottom: 16px;
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.workout-checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.workout-checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--text-2);
}

.workout-checklist-item--ok {
  color: var(--text);
}

.workout-checklist-item span:first-child {
  width: 1.2em;
  font-weight: 700;
}

.workout-checklist-item--ok span:first-child {
  color: var(--accent);
}

.workout-checklist-link {
  margin-left: auto;
  padding: 4px 10px;
  font-size: 0.8rem;
}

.day-tab--rest {
  opacity: 0.75;
}

.workout-resume-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 16px;
  padding: 0.85rem 1rem;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.workout-resume-banner p {
  margin: 0;
  font-size: 0.9rem;
}

.confirm-dialog-actions--stack {
  flex-direction: column;
  align-items: stretch;
}

.confirm-dialog-actions--stack .btn {
  width: 100%;
  flex: none;
  min-height: 44px;
  touch-action: manipulation;
}

.workout-sessions-block {
  margin-bottom: 0.85rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.workout-sessions-title {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
}

.workout-sessions-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.workout-session-log {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

/* ----- Sesión guiada ----- */
.ws-session {
  max-width: 640px;
  margin: 0 auto;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
}

.ws-session-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.ws-session-head {
  min-width: 0;
  flex: 0 0 auto;
}

.ws-session-head .view-sub {
  margin: 0.2rem 0 0;
}

.ws-session-top--compact {
  margin-bottom: 0.75rem;
}

.ws-session-kicker {
  margin: 0 0 0.15rem;
  font-size: 0.82rem;
  color: var(--text-2);
}

.ws-session-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
}

.ws-session-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  justify-content: flex-end;
  margin-top: 0.35rem;
}

.ws-toolbar-link,
.workout-toolbar-link {
  min-height: auto;
  padding: 0.2rem 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-2);
  border: none;
  background: transparent;
  touch-action: manipulation;
}

.ws-toolbar-link:hover,
.workout-toolbar-link:hover {
  color: var(--accent);
}

.ws-sets-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
}

.ws-sets-head .ws-sets-title {
  margin: 0;
}

.ws-unit-toggle--inline {
  margin: 0;
}

/* Ajustes — perfil actual vs perfiles de cuenta */
.settings-card-profile,
.settings-card-profiles {
  margin-bottom: 14px;
}

.settings-card-title {
  margin: 0 0 14px;
  font-size: 1.05rem;
}

.settings-profile-fields {
  margin-top: 4px;
}

.settings-profile-fields .field {
  margin-bottom: 18px;
}

.settings-profile-fields .field:last-child {
  margin-bottom: 0;
}

.settings-profile-count {
  color: var(--text-3);
  font-size: 0.85rem;
  margin-top: 4px;
}

.settings-profiles-hint {
  color: var(--text-2);
  font-size: 0.88rem;
  margin: 0 0 14px;
  line-height: 1.55;
}

.profiles-account-list {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-create-profile-btn {
  margin-bottom: 0;
}

.settings-create-profile-form {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.settings-create-profile-form .field {
  margin-bottom: 12px;
}

.settings-create-profile-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.settings-delete-profile-block {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.settings-delete-profile-hint {
  color: var(--text-3);
  font-size: 0.82rem;
  margin: 8px 0 0;
  line-height: 1.5;
}

.workout-regenerate-row {
  margin-top: 1.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.workout-regenerate-hint {
  margin: 0 0 0.5rem;
}

.ws-ex-nav {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.ws-ex-nav::-webkit-scrollbar {
  display: none;
}

.ws-ex-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 2.75rem;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 0.9rem;
  cursor: pointer;
  flex-shrink: 0;
  touch-action: manipulation;
}

.ws-ex-pill.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 15%, var(--surface));
}

.ws-ex-pill.complete {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.ws-ex-pill-prog {
  font-size: 0.72rem;
  color: var(--text-2);
}

.ws-ex-stage {
  overflow: visible;
  touch-action: pan-y;
  scroll-margin-top: 12px;
}

.ws-ex-nav {
  scroll-margin-top: 8px;
}

.ws-ex-swipe-zone {
  touch-action: pan-y;
}

.ws-ex-panel--enter-next {
  animation: ws-panel-enter-next 0.42s cubic-bezier(0.33, 1, 0.68, 1) forwards;
}

.ws-ex-panel--enter-prev {
  animation: ws-panel-enter-prev 0.42s cubic-bezier(0.33, 1, 0.68, 1) forwards;
}

@keyframes ws-panel-enter-next {
  from {
    opacity: 0;
    transform: translate3d(14px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes ws-panel-enter-prev {
  from {
    opacity: 0;
    transform: translate3d(-14px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ws-ex-panel--enter-next,
  .ws-ex-panel--enter-prev {
    animation: none;
  }
}

@media (max-width: 800px) {
  .ws-ex-panel--enter-next,
  .ws-ex-panel--enter-prev {
    animation: ws-panel-fade-in 0.28s ease both;
  }
}

@keyframes ws-panel-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.ws-ex-hero {
  display: flex;
  gap: 14px;
  margin-bottom: 12px;
  overflow: hidden;
}

.ws-ex-hero--compact {
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  padding: 10px 12px;
}

.ws-ex-hero--compact .ws-ex-hero-img {
  width: 72px;
  height: 72px;
  border-radius: 10px;
}

.ws-ex-hero-img-btn {
  flex-shrink: 0;
  display: block;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
  border-radius: 10px;
  overflow: hidden;
}

.ws-ex-hero-img-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.workout-ex-img-btn {
  flex-shrink: 0;
  display: block;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
  border-radius: 8px;
  overflow: hidden;
}

.workout-ex-img-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.ex-image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: rgba(0, 0, 0, 0.88);
  box-sizing: border-box;
}

.ex-image-lightbox-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: min(520px, 100%);
  width: 100%;
}

.ex-image-lightbox-close {
  position: absolute;
  top: -4px;
  right: 0;
  z-index: 1;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  touch-action: manipulation;
}

.ex-image-lightbox-title {
  margin: 0;
  padding-right: 44px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  text-align: center;
  width: 100%;
}

.ex-image-lightbox-img {
  display: block;
  width: 100%;
  max-height: min(70vh, 520px);
  object-fit: contain;
  border-radius: 12px;
  background: var(--surface);
}

/* Las instrucciones bajo la imagen ampliada, con su propio scroll. */
.ex-image-lightbox-desc {
  max-height: 22vh;
  overflow-y: auto;
  font-size: 0.88rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.85);
  white-space: pre-line;
}

.ws-ex-hero--compact .ws-ex-hero-body h2 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.25;
}

.ws-ex-detail {
  margin: 4px 0 0;
}

.ws-ex-detail-toggle {
  display: inline-block;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  list-style: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.ws-ex-detail-toggle::-webkit-details-marker {
  display: none;
}

.ws-ex-detail-toggle::marker {
  content: '';
}

.ws-ex-detail-label--hide {
  display: none;
}

.ws-ex-detail[open] .ws-ex-detail-label--show {
  display: none;
}

.ws-ex-detail[open] .ws-ex-detail-label--hide {
  display: inline;
}

.ws-ex-detail-body {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.ws-ex-detail-body .ws-ex-instructions {
  max-height: 10rem;
  overflow-y: auto;
}

.ws-ex-hero-img {
  width: 120px;
  height: 120px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-2);
}

.ws-ex-hero-img--ph {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.ws-ex-hero-body {
  min-width: 0;
}

.ws-ex-hero-body h2 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  line-height: 1.3;
}

.ws-ex-prescription {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
}

.ws-ex-note {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--text-2);
}

.ws-ex-instructions {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--text-2);
}

.ws-unit-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 10px;
}

.ws-sets-card h3,
.ws-sets-title {
  font-size: 0.95rem;
  margin-top: 0;
}

.ws-reps-note {
  font-weight: 400;
  font-size: 0.85rem;
}

.workout-history-details {
  margin-top: 1.75rem;
}

/* ----- Historial calendario (modal) ----- */
.wh-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

@media (min-width: 600px) {
  .wh-overlay {
    align-items: center;
    padding: 24px;
  }
}

.wh-modal {
  width: 100%;
  max-width: 520px;
  max-height: min(92vh, 720px);
  display: flex;
  flex-direction: column;
  margin: 0;
  overflow: hidden;
}

.wh-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  padding-bottom: 8px;
}

.wh-modal-close-btn {
  min-width: 48px;
  min-height: 48px;
  padding: 8px 12px;
  flex-shrink: 0;
  touch-action: manipulation;
}

.wh-modal-foot {
  flex-shrink: 0;
  padding: 12px 0 0;
  margin-top: 8px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.wh-modal-foot .btn {
  min-height: 48px;
  touch-action: manipulation;
}

.wh-modal-title {
  margin: 0;
  font-size: 1.1rem;
}

.wh-modal-sub {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
}

.wh-modal-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding-right: 2px;
}

.wh-hint {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
}

.wh-empty {
  margin: 0;
  font-size: 0.9rem;
}

.wh-cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  gap: 0.5rem;
}

.wh-cal-month {
  font-weight: 600;
  font-size: 0.95rem;
}

.wh-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 4px;
}

.wh-cal-weekday {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-2);
  font-weight: 600;
}

.wh-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.wh-cal-cell {
  aspect-ratio: 1;
  min-height: 2.75rem;
}

.wh-cal-cell--pad {
  visibility: hidden;
}

.wh-cal-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  height: 100%;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  touch-action: manipulation;
  padding: 0;
  position: relative;
}

.wh-cal-day--today {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
}

.wh-cal-day--selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
}

.wh-cal-day--marked .wh-cal-day-num {
  font-weight: 700;
}

.wh-cal-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.wh-day-title {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  text-transform: capitalize;
}

.wh-day-sub {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
}

.wh-sessions-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wh-session-block {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.wh-toggle-detail {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 2px 0;
  min-height: 0;
  border: none;
  background: none;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.wh-toggle-detail:active {
  opacity: 0.75;
}

.wh-toggle-icon {
  font-size: 0.72rem;
  line-height: 1;
  opacity: 0.85;
}

.wh-session-block-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wh-session-time {
  font-weight: 700;
  font-size: 0.95rem;
}

.wh-session-routine {
  font-size: 0.88rem;
}

.wh-session-stats {
  font-size: 0.82rem;
}

.wh-session-thumbs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.wh-session-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface);
}

.wh-session-thumb--ph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.wh-session-detail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 0.25rem;
}

.wh-ex-card {
  display: flex;
  gap: 10px;
  padding: 0.5rem;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.wh-ex-img {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-2);
}

.wh-ex-img--ph {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.wh-ex-card-body {
  min-width: 0;
  flex: 1;
}

.wh-ex-card-title {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
  line-height: 1.3;
}

.wh-set-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.wh-set-chip {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-2));
  font-size: 0.78rem;
  color: var(--text-2);
}

.wh-no-detail {
  margin: 0;
  font-size: 0.85rem;
}

.wh-day-panel {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.workout-history-details > summary {
  cursor: pointer;
  color: var(--text-2);
  padding: 10px 0;
  font-weight: 600;
}

.workout-history-empty {
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
}

.workout-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.workout-history-entry {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  background: var(--surface-2);
}

.workout-history-entry > summary {
  cursor: pointer;
  list-style: none;
}

.workout-history-entry > summary::-webkit-details-marker {
  display: none;
}

.workout-history-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  font-size: 0.9rem;
}

.workout-history-ex-list {
  list-style: none;
  margin: 0.75rem 0 0.25rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.workout-history-ex {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.85rem;
}

.workout-history-ex strong {
  font-size: 0.88rem;
}

.ws-sets-card {
  width: 100%;
}

/* Tabla de series con encabezado de columnas UNICO (paridad con movil):
   # | Reps o Tiempo | Peso | check — sin etiquetas repetidas por renglon. */
.ws-set-cols {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 4px;
}

.ws-col {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-2, var(--text-muted, #777));
}

.ws-col--num { width: 34px; flex: none; }
.ws-col--play { width: 40px; flex: none; }
.ws-col--grow { flex: 1; min-width: 0; }
.ws-col--check { width: 52px; flex: none; }

.ws-set-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  width: 100%;
}

.ws-set-row:last-of-type {
  border-bottom: none;
}

.ws-set-row--done {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-radius: 8px;
  padding-left: 6px;
  padding-right: 6px;
  margin: 3px -6px;
  padding-top: 5px;
  padding-bottom: 5px;
}

.ws-set-num {
  width: 34px;
  flex: none;
  font-weight: 700;
  font-size: 0.95rem;
}

/* La serie extra: numero en acento con bote de basura, clicable para quitar. */
button.ws-set-num--extra {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  text-align: left;
  font: inherit;
  font-weight: 700;
  min-height: 44px;
}

.ws-add-set {
  margin-top: 0.65rem;
  min-height: 40px;
  touch-action: manipulation;
}

.ws-set-reps,
.ws-set-weight,
.ws-set-time {
  font-size: 16px;
  min-height: 44px;
  flex: 1;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

/* Cronometro de serie/movimiento: play + carril que se COLOREA. */
.ws-play-btn {
  width: 40px;
  height: 44px;
  flex: none;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: transparent;
  color: var(--accent);
  font-size: 0.9rem;
  cursor: pointer;
  touch-action: manipulation;
}

.ws-play-btn:disabled {
  border-color: var(--border);
  color: var(--text-2, #999);
  opacity: 0.55;
  cursor: default;
}

.ws-play-btn--hecho {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.ws-time-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  min-height: 44px;
  background: var(--bg);
}

.ws-time-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  pointer-events: none;
}

.ws-time-wrap .ws-set-time {
  position: relative;
  border: none;
  background: transparent;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ws-warmup-restante {
  position: relative;
  flex: 1;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
}

.ws-rest-hint {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.ws-set-done {
  width: 52px;
  height: 52px;
  min-height: 52px;
  padding: 0;
  border-radius: 12px;
  font-size: 1.25rem;
  line-height: 1;
  touch-action: manipulation;
  align-self: end;
}

.ws-rest-timer-mount {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
}

.ws-rest-timer-mount .ws-rest-timer {
  pointer-events: auto;
}

.ws-rest-timer {
  margin-top: 16px;
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  z-index: 200;
  box-sizing: border-box;
  max-width: calc(100vw - max(24px, env(safe-area-inset-left, 0px) + env(safe-area-inset-right, 0px)));
}

.ws-rest-timer--full {
  position: fixed;
  left: max(12px, env(safe-area-inset-left, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
  bottom: calc(12px + env(safe-area-inset-bottom, 0px) + var(--mobile-browser-bottom-buffer, 0px));
  margin-top: 0;
  width: auto;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  padding: 1rem;
}

.ws-rest-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  margin-bottom: 0.15rem;
}

.ws-rest-head .ws-rest-title {
  margin: 0;
}

.ws-rest-minimize {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}

.ws-rest-minimize:active {
  opacity: 0.8;
}

.ws-rest-timer--mini {
  position: fixed;
  right: max(12px, env(safe-area-inset-right, 0px));
  bottom: calc(12px + env(safe-area-inset-bottom, 0px) + var(--mobile-browser-bottom-buffer, 0px));
  left: auto;
  width: auto;
  max-width: min(320px, calc(100vw - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  margin-top: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 6px 6px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
}

.ws-rest-mini-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 8px;
  border: none;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
  min-height: 40px;
}

.ws-rest-mini-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  animation: ws-rest-pulse 1.2s ease-in-out infinite;
}

@keyframes ws-rest-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.85); }
}

@media (prefers-reduced-motion: reduce) {
  .ws-rest-mini-dot {
    animation: none;
  }
}

.ws-rest-mini-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
}

.ws-rest-timer--mini .ws-rest-sec {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.ws-rest-mini-skip {
  flex-shrink: 0;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.ws-rest-mini-skip:active {
  opacity: 0.85;
}

.ws-rest-btn {
  min-height: 44px;
  min-width: 4.5rem;
  touch-action: manipulation;
}

.ws-rest-title {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-2);
}

.ws-rest-sec {
  margin: 0.25rem 0 0.75rem;
  font-size: 2.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.ws-rest-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.ws-session-nav-row {
  display: flex;
  justify-content: space-between;
  margin-top: 1rem;
  gap: 8px;
}

.ws-nav-btn {
  min-height: 48px;
  flex: 1;
  touch-action: manipulation;
  position: relative;
  z-index: 2;
  padding: 12px 14px;
}

.ws-summary {
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.ws-summary-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

.ws-summary-resume,
.ws-summary-history {
  align-self: center;
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.88rem;
  touch-action: manipulation;
}

.ws-summary-actions-row {
  display: flex;
  gap: 8px;
}

.ws-summary-actions-row .btn {
  flex: 1;
  min-height: 48px;
  touch-action: manipulation;
}

.ws-summary-hint {
  text-align: center;
  margin-top: 0.75rem;
}

.ws-summary-stats {
  margin: 0;
  padding-left: 1.1rem;
  line-height: 1.7;
}

.input-sm {
  padding: 6px 8px;
  font-size: 0.9rem;
}

@media (max-width: 800px) {
  .ws-session {
    max-width: none;
    padding-bottom: calc(6.5rem + env(safe-area-inset-bottom, 0px));
  }

  .ws-session.ws-session--rest-mini {
    padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px) + var(--mobile-browser-bottom-buffer, 0px));
  }

  .ws-session.ws-session--rest-full {
    padding-bottom: calc(9rem + env(safe-area-inset-bottom, 0px) + var(--mobile-browser-bottom-buffer, 0px));
  }

  .ws-session-top {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
  }

  .ws-session-actions {
    flex-direction: row;
    gap: 6px;
  }

  .ws-history-btn {
    min-height: 44px;
    padding: 8px 10px;
    font-size: 0.82rem;
  }

  .ws-session-actions .ws-finish-btn {
    flex: 1;
    min-height: 44px;
    font-size: 0.9rem;
    padding: 10px 14px;
  }

  .ws-ex-nav {
    margin-left: -4px;
    margin-right: -4px;
    padding-left: 4px;
    padding-right: 4px;
    scroll-snap-type: x proximity;
  }

  .ws-ex-pill {
    scroll-snap-align: center;
  }

  .ws-ex-col--sets {
    order: 1;
  }

  .ws-ex-col--info {
    order: 2;
  }

  .ws-ex-hero--compact .ws-ex-hero-img {
    width: 56px;
    height: 56px;
  }

  .ws-ex-hero--compact .ws-ex-hero-body h2 {
    font-size: 1rem;
  }

  .ws-ex-detail-body .ws-ex-instructions {
    max-height: 6.5rem;
    overflow-y: auto;
  }

  .ws-session-nav-row {
    margin-top: 0.75rem;
  }

  .ws-nav-btn {
    font-size: 0.88rem;
    padding: 10px 8px;
  }

  .ws-rest-timer--full {
    position: fixed;
    left: max(12px, env(safe-area-inset-left, 0px));
    right: max(12px, env(safe-area-inset-right, 0px));
    bottom: calc(12px + env(safe-area-inset-bottom, 0px) + var(--mobile-browser-bottom-buffer, 0px));
    margin-top: 0;
    width: auto;
  }

  .ws-rest-timer--mini {
    right: max(12px, env(safe-area-inset-right, 0px));
    left: auto;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px) + var(--mobile-browser-bottom-buffer, 0px));
  }

  .ws-rest-timer--full .ws-rest-sec {
    font-size: 3rem;
  }

  .ws-unit-toggle .btn {
    min-height: 44px;
    min-width: 3.5rem;
  }

  .wh-modal {
    width: 100%;
    max-height: min(96dvh, 820px);
    border-radius: 16px 16px 0 0;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  .wh-overlay {
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .wh-modal-foot {
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    position: sticky;
    bottom: 0;
    z-index: 2;
  }

  .wh-ex-img {
    width: 64px;
    height: 64px;
  }

  .wh-ex-card-title {
    font-size: 0.88rem;
  }

  .wh-set-chip {
    font-size: 0.74rem;
    padding: 2px 7px;
  }
}

@media (min-width: 801px) {
  .ws-session {
    max-width: min(1200px, 100%);
    margin: 0;
    padding-bottom: 1.5rem;
  }

  .ws-session-top--compact {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
  }

  .ws-session-toolbar {
    margin-top: 0;
    flex-shrink: 0;
  }

  .ws-ex-swipe-zone {
    display: grid;
    grid-template-columns: minmax(280px, 36%) minmax(380px, 1fr);
    gap: 24px 28px;
    align-items: start;
  }

  .ws-ex-col--info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    grid-column: 1;
    grid-row: 1;
  }

  .ws-ex-col--sets {
    min-width: 0;
    grid-column: 2;
    grid-row: 1;
  }

  .ws-ex-hero--compact {
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 0;
    padding: 14px;
  }

  .ws-ex-hero--compact .ws-ex-hero-img {
    width: 100%;
    height: min(240px, 32vh);
    max-height: 300px;
  }

  .ws-ex-hero--compact .ws-ex-hero-body h2 {
    font-size: 1.25rem;
    margin-top: 2px;
  }

  .ws-ex-detail {
    margin-top: 8px;
  }

  .ws-ex-detail-body .ws-ex-instructions {
    max-height: 14rem;
  }

  .ws-unit-toggle {
    margin-bottom: 0;
    padding: 0 2px;
  }

  .ws-sets-card {
    position: sticky;
    top: 12px;
  }

  .ws-session-nav-row {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }

  .ws-rest-timer--full {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    bottom: max(24px, env(safe-area-inset-bottom, 0px));
    width: min(400px, calc(100vw - 48px));
  }

  .ws-rest-timer--mini {
    right: max(24px, env(safe-area-inset-right, 0px));
    bottom: max(24px, env(safe-area-inset-bottom, 0px));
  }

  .ws-session--rest-mini {
    padding-bottom: calc(4rem + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 520px) {
  .ws-set-label {
    font-size: 0.68rem;
  }
}

.btn-sm {
  min-height: 32px;
}

/* —— Sustituir ejercicio —— */
.ex-replace-overlay {
  position: fixed;
  inset: 0;
  z-index: 450;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom)
    env(safe-area-inset-left);
  background: rgba(0, 0, 0, 0.55);
  box-sizing: border-box;
}

.ex-replace-modal {
  width: 100%;
  max-width: 560px;
  max-height: min(92vh, 720px);
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  overflow: hidden;
}

.ex-replace-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 8px;
  border-bottom: 1px solid var(--border);
}

.ex-replace-title {
  margin: 0;
  font-size: 1.15rem;
}

.ex-replace-sub {
  margin: 4px 0 0;
  font-size: 0.85rem;
}

.ex-replace-body {
  padding: 12px 16px 16px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.ex-replace-hint {
  margin: 0 0 10px;
}

.ex-replace-search-wrap {
  display: block;
  margin-bottom: 10px;
}

.ex-replace-search {
  width: 100%;
}

.ex-replace-detail {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ex-replace-detail-img {
  width: 100%;
  max-width: 420px;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 12px;
  background: var(--border, #e5e5e5);
  align-self: center;
}

.ex-replace-detail-title {
  margin: 0;
  font-size: 1.05rem;
}

.ex-replace-detail-text {
  font-size: 0.88rem;
  line-height: 1.5;
  white-space: pre-line;
}

.ex-replace-detail-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.ex-replace-detail-actions .btn {
  flex: 1;
}

.ex-replace-chips {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.ex-replace-chips::-webkit-scrollbar {
  display: none;
}

.ex-replace-chip {
  flex-shrink: 0;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  touch-action: manipulation;
}

.ex-replace-chip.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--text);
}

.ex-replace-count {
  margin: 0 0 8px;
  font-size: 0.8rem;
}

.ex-replace-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ex-replace-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 8px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.ex-replace-row:hover,
.ex-replace-row:focus-visible {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.ex-replace-thumb {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--border);
}

.ex-replace-thumb--ph {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.ex-replace-row-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ex-replace-row-body strong {
  font-size: 0.95rem;
}

.ex-replace-row-body .muted {
  font-size: 0.78rem;
}

.ex-replace-empty {
  text-align: center;
  padding: 24px 8px;
}

.workout-ex-swap {
  flex-shrink: 0;
  margin-left: auto;
  align-self: center;
}

.ws-ex-hero-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.ws-ex-hero-actions .ws-ex-detail {
  margin: 0;
  flex: 1;
  min-width: 0;
}

.ws-ex-swap-btn {
  margin: 0;
  flex-shrink: 0;
  padding: 4px 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
}

@media (min-width: 640px) {
  .ex-replace-overlay {
    align-items: center;
    padding: 24px;
  }

  .ex-replace-modal {
    border-radius: var(--radius, 12px);
  }
}

/* ============ Reglas de coherencia del perfil (wizard) ============ */
.wizard-reglas {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0 4px;
}
.wizard-regla {
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.92rem;
  line-height: 1.45;
  border: 1px solid var(--border);
}
.wizard-regla--bloquea {
  background: var(--danger-bg, #fdecec);
  border-color: var(--danger, #c0392b);
  color: var(--danger, #c0392b);
  font-weight: 600;
}
.wizard-regla--advierte {
  background: var(--warn-bg, #fff7e0);
  border-color: #d9a514;
  color: #7a5c00;
}
.wizard-regla--ajusta {
  background: var(--accent-muted, #eef7ee);
  border-color: var(--accent);
  color: var(--text-1);
}
