/* Tabs horizontales de longitud variable (tipos de medida, sitios de pliegue) */
.subtabs {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
}
.subtab {
  white-space: nowrap;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
}
.subtab.active { background: var(--text); color: var(--bg); }

/* Selector de periodo (chips desplazables) */
.period-selector {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding-bottom: 2px;
  margin-bottom: var(--space-3);
  -webkit-overflow-scrolling: touch;
}
.period-chip {
  white-space: nowrap;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-secondary);
}
.period-chip.active { background: var(--text); color: var(--bg); }

/* Encabezado de sección discreto ("ÚLTIMA SESIÓN", "HOY"...) */
.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: var(--space-2);
}

/* Bloque "última sesión" — referencia discreta, nunca confundir con hoy, pero
   con series destacadas (no letra pequeña) para poder leerla de un vistazo. */
.last-session {
  padding: 2px 0 var(--space-4);
  margin-bottom: var(--space-2);
  border-bottom: 0.5px solid var(--border);
}
.last-session-set {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 9px 0;
}
.last-session-set-idx {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.last-session-set-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  font-variant-numeric: tabular-nums;
}
.last-session-set-value { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.last-session-set-x { font-size: 14px; color: var(--text-tertiary); }
.last-session-set-reps { font-size: 16px; font-weight: 700; }
.last-session-set-tag { flex-shrink: 0; font-size: 11px; padding: 3px 9px; }
.last-session-empty { color: var(--text-tertiary); font-size: 14px; }

/* Chips de "Objetivo" — antes una línea de texto pequeño, ahora badges
   visuales a la altura de section-label, igual patrón que .badge en el resto
   de la app. */
.target-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.target-chips-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

/* Filas de serie — lista deportiva, no tabla */
.set-group { border-bottom: 0.5px solid var(--border); }
.set-group:last-child { border-bottom: none; }
.set-row {
  display: grid;
  grid-template-columns: 20px 1fr 1fr 1fr 26px;
  align-items: center;
  gap: var(--space-2);
  padding: 12px 0;
}
/* kg y lb como columnas independientes necesitan algo más de sitio que reps/RIR */
.set-row.set-row--dual-unit { grid-template-columns: 20px 1.7fr 1fr 1fr 26px; gap: 6px; }
.set-group .set-row { padding-bottom: 2px; }
.set-total {
  text-align: right;
  padding: 0 0 10px;
  font-size: 12px;
  color: var(--text-tertiary);
}
.set-total-toggle {
  color: var(--accent);
  font-weight: 700;
  padding: 2px 4px;
}
.set-row .set-idx {
  color: var(--text-tertiary);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.set-field { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.set-field .set-unit {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
/* Columnas kg/lb independientes — cada serie se rellena en la que
   corresponda a sus discos; la otra se calcula en vivo como referencia. */
.set-weight-dual { flex-direction: row; gap: 4px; }
.set-weight-col { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: 1; min-width: 0; }
.set-weight-col input { font-size: 15px; }
.set-row input {
  background: transparent;
  border: none;
  border-radius: 0;
  text-align: center;
  padding: 0;
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-height: unset;
}
.set-row input:focus { box-shadow: none; color: var(--accent); }
.set-row input::placeholder { color: var(--text-tertiary); font-weight: 400; }

.set-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--border);
  background: transparent;
  color: transparent;
  padding: 0;
  cursor: pointer;
  min-height: unset;
}
.set-check.done { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.set-check--disabled { opacity: 0.4; }
.set-check svg { width: 12px; height: 12px; }

/* Eliminar una serie: deslizar horizontalmente revela la papelera detrás
   (nunca un botón fijo) — ver attachSetSwipeHandlers en workout-session.js. */
.set-swipe { position: relative; overflow: hidden; }
.set-swipe-content {
  position: relative;
  background: var(--surface);
  touch-action: pan-y;
  transition: transform 0.2s ease;
}
.set-swipe-content.set-swipe--dragging { transition: none; }
.set-swipe-delete {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--danger);
}
.set-swipe-delete-btn {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--danger-contrast);
  background: transparent;
  border: none;
  padding: 0;
  min-height: unset;
}
.set-swipe-delete-btn svg { width: 20px; height: 20px; }

/* Tipo de serie — opción secundaria discreta, nunca botones grandes
   permanentes (Normal/Fallo/Rest-pause/Descendente se elige en un sheet). */
.set-type-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
}
.set-type-btn {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 0;
  display: flex;
  align-items: center;
  gap: 3px;
}
.set-type-btn--active { color: var(--accent); }
.set-type-caret { font-size: 9px; opacity: 0.7; }
.set-range-done { font-size: 11px; font-weight: 600; color: var(--accent); }

/* Selector rápido de barra (Barra libre) — misma altura/discreción que el
   tipo de serie, junto al que se coloca. */
.input-bar-pick {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  background: var(--surface-2);
  border: none;
  border-radius: var(--radius-sm);
  padding: 2px 4px;
  max-width: 130px;
  min-height: unset;
}

/* Bloques extra de rest-pause/descendente — bajo la fila principal de la serie. */
.set-extra-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 4px 0 10px;
  flex-wrap: wrap;
}
.set-extra-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}
.set-extra-chips, .set-extra-steps { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.set-extra-chip-input {
  width: 40px;
  text-align: center;
  background: var(--surface-2);
  border: none;
  border-radius: var(--radius-sm);
  padding: 4px 0;
  font-size: 14px;
  font-weight: 700;
}
.set-step {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 3px 6px;
}
.set-step-weight, .set-step-weight-kgpart, .set-step-weight-lbpart, .set-step-reps {
  width: 40px;
  text-align: center;
  background: transparent;
  border: none;
  padding: 2px 0;
  font-size: 14px;
  font-weight: 700;
}
.set-step-x { color: var(--text-tertiary); font-size: 12px; }
.set-step-remove { color: var(--text-tertiary); font-size: 12px; padding: 0 2px; }
.set-extra-add {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  padding: 3px 8px;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
}

/* Tarjeta de ejercicio dentro de un entrenamiento */
.exercise-card { padding: var(--space-4); margin-bottom: var(--space-3); }
.exercise-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}
.exercise-card-header h3 { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.exercise-card.collapsed .exercise-card-header { margin-bottom: 0; }
.exercise-collapse-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.exercise-collapse-toggle:active h3 { color: var(--text-secondary); }
.exercise-collapse-caret {
  display: inline-block;
  flex-shrink: 0;
  color: var(--text-secondary);
  transition: transform 0.15s ease;
}
.exercise-collapse-caret.is-collapsed { transform: rotate(-90deg); }

/* Deslizar el ejercicio hacia la izquierda revela el PR detrás — mismo
   patrón que .set-swipe (workout-session.js#attachExercisePrSwipe), pero a
   ancho completo en vez de un fleco fijo. */
/* Grid con los dos paneles apilados en la misma celda — así el alto del
   contenedor es siempre el MÁXIMO de los dos (última sesión vs. PR), nunca
   el del panel visible en reposo; con position:absolute+inset:0 el panel
   más alto se recortaba en vez de determinar el alto real. */
.exercise-swipe { position: relative; overflow: hidden; display: grid; margin-bottom: var(--space-3); }
.exercise-swipe-content,
.exercise-swipe-pr { grid-area: 1 / 1 / 2 / 2; }
.exercise-swipe-content {
  background: var(--surface);
  transition: transform 0.25s ease;
  touch-action: pan-y;
  z-index: 1;
}
.exercise-swipe-content.exercise-swipe--dragging { transition: none; }
.exercise-swipe-pr {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.pr-trophy { display: inline-flex; color: var(--accent); }
.pr-trophy svg { width: 19px; height: 19px; }

/* Callout de progresión — arriba/al lado, comprensible de un vistazo */
.progress-callout {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
}
.progress-callout:last-child { margin-bottom: 0; }
.progress-callout-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
}
.progress-callout-title { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.progress-callout-text { font-size: 14px; color: var(--text-secondary); line-height: 1.35; }

.progress-callout--good { background: var(--accent-soft); }
.progress-callout--good .progress-callout-icon { background: var(--accent); color: var(--accent-contrast); }
.progress-callout--good .progress-callout-title { color: var(--accent); }

.progress-callout--warn { background: var(--warn-soft); }
.progress-callout--warn .progress-callout-icon { background: var(--warn); color: var(--warn-contrast); }
.progress-callout--warn .progress-callout-title { color: var(--warn); }

.progress-callout--neutral {
  padding: var(--space-1) 0;
  background: transparent;
}
.progress-callout--neutral .progress-callout-text { color: var(--text-tertiary); font-size: 13px; }

/* Mini gráfica de progresión (sparkline) dentro de la tarjeta de ejercicio */
.sparkline-container { height: 44px; margin: var(--space-2) 0 var(--space-1); }

/* Hero de estadística — para pantallas de detalle (peso, ejercicio) */
.stat-hero { margin-bottom: var(--space-5); }
.stat-hero .stat-hero-label { font-size: 14px; color: var(--text-secondary); font-weight: 500; margin-bottom: 2px; }
.stat-hero .stat-hero-value { display: flex; align-items: baseline; gap: 10px; }
.stat-hero .stat-hero-delta { font-size: 16px; font-weight: 700; }

/* Tarjetas de estadística secundaria (grid de PRs, etc.) */
.stat-tile { padding: var(--space-3) 0; }
.stat-tile .stat-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 3px; }
.stat-tile .stat-value { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.stat-tile .stat-sub { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.stat-grid .stat-tile:nth-child(odd) { padding-right: var(--space-3); }
.stat-grid .stat-tile:nth-child(-n+2) { border-bottom: 0.5px solid var(--border); padding-bottom: var(--space-3); margin-bottom: var(--space-3); }

.chart-container { position: relative; height: 200px; margin-top: var(--space-2); }

/* Rejilla de plantillas de entrenamiento (Días/Rutinas) */
.template-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
}
.template-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: none;
  padding: 0;
}
.template-tile:active { opacity: 0.6; }
.template-tile-add .icon-badge { color: var(--text-tertiary); font-weight: 300; }
.template-tile-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.2;
  max-width: 68px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Tarjetas de acción de Entreno (Nueva rutina / rutinas / Entrenamiento libre /
   Importar desde foto) — misma familia visual que el resto de la app: fondo
   --surface, borde sutil, radio grande. */
.action-card-list { display: flex; flex-direction: column; gap: var(--space-3); }
.action-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-4);
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: left;
  box-shadow: var(--shadow-card);
}
.action-card:active { background: var(--surface-2); }
.action-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--accent-soft);
  color: var(--accent);
  overflow: hidden;
}
.action-card-icon svg { width: 22px; height: 22px; }
.action-card-icon--dashed {
  background: none;
  border: 1.5px dashed var(--accent);
}
.action-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.action-card-title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.action-card-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.action-card-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius-pill);
  padding: 3px 7px;
  flex-shrink: 0;
}
.action-card-chevron {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  flex-shrink: 0;
}
.action-card-chevron svg { width: 14px; height: 14px; }

/* Previsualización de un tema (Ajustes > Tema) — 3 círculos superpuestos
   (fondo/superficie/acento) en el color LITERAL de ese tema, no en variables
   CSS (tiene que poder mostrar el aspecto de un tema que no está activo). */
.theme-swatch { display: inline-flex; flex-shrink: 0; }
.theme-swatch span {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  margin-left: -8px;
}
.theme-swatch span:first-child { margin-left: 0; }

/* Selector de modo de importación por foto (Detectar automáticamente / Una
   rutina / Programa completo) — tarjetas seleccionables tipo radio. También
   reutilizado por el selector de Tema (Ajustes). */
.import-mode-opt {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--space-4);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.import-mode-opt--active { border-color: var(--accent); background: var(--accent-soft); }
.import-mode-opt:active { transform: scale(0.98); }

/* Anillo de progreso simulado de la pantalla "Analizando…" */
.analyzing-ring {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: conic-gradient(var(--accent) calc(var(--pct) * 1%), var(--surface-2) 0);
  transition: background 300ms var(--ease);
}
.analyzing-ring::before {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--bg);
}
.analyzing-pct {
  position: relative;
  z-index: 1;
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Calendario mensual de entrenamientos — representa sesiones realizadas */
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}
.cal-title {
  font-size: 15px;
  font-weight: 700;
  text-transform: capitalize;
  color: var(--text);
}
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-tertiary);
  margin-bottom: var(--space-2);
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  touch-action: manipulation;
}
.cal-day {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: var(--radius-md);
  background: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  -webkit-touch-callout: none;
  user-select: none;
}
.cal-day:active { background: var(--surface-2); }
.cal-day.is-outside { color: var(--text-tertiary); opacity: 0.4; }
.cal-day-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
}
.cal-day.is-today .cal-day-num { background: var(--accent); color: var(--accent-contrast); }
.cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.cal-day.has-multiple .cal-dot { width: 14px; height: 5px; border-radius: var(--radius-pill); }

.cal-header .icon-btn { background: var(--surface-2); }
.cal-header .icon-btn:active { background: var(--border); }

/* Leyenda discreta al pie del calendario */
.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 0.5px solid var(--border);
}
.cal-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
}
.cal-legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.cal-legend-dot--workout { background: var(--accent); }
.cal-legend-dot--today { background: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.cal-legend-dot--empty { background: none; border: 1.3px solid var(--border); }

/* Selector de icono (emoji o ilustración de músculo) para plantillas */
.icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.icon-picker-opt {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface-2);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.icon-picker-opt.active { background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent) inset; }

/* Icon badge — círculo de icono con identidad de color, reutilizado en accesos
   rápidos, plantillas e historial. El color es SIEMPRE identidad/categoría,
   nunca "bueno/malo" (eso es exclusivo de los badges de estado). */
.icon-badge {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
  overflow: hidden;
}
.icon-badge svg { width: 19px; height: 19px; }
.icon-badge--sm { width: 34px; height: 34px; }
.icon-badge--sm svg { width: 16px; height: 16px; }
.icon-badge--lg { width: 56px; height: 56px; font-size: 26px; }
.icon-badge--lg svg { width: 24px; height: 24px; }

.icon-badge-img, .icon-picker-opt img { width: 100%; height: 100%; object-fit: cover; display: block; }

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

.quick-action { text-align: left; }
.quick-action:active { opacity: 0.6; }

/* Rejilla de resumen (Inicio) — icon-badge + valor + etiqueta + delta */
.resumen-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4) var(--space-3);
}
.resumen-tile { display: flex; flex-direction: column; gap: 7px; }
.resumen-tile .resumen-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.resumen-tile .resumen-value { font-size: 21px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.resumen-tile .resumen-delta { font-size: 12px; font-weight: 600; color: var(--text-tertiary); }

/* Avatar genérico (sin cuentas de usuario, solo icono) */
.avatar-badge {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.avatar-badge svg { width: 22px; height: 22px; }

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 16px;
  flex-shrink: 0;
}
.icon-btn:active { background: var(--surface-2); }
.icon-btn svg { width: 16px; height: 16px; }

/* Volver a "Rutinas" dentro del editor de importación por foto — más grande
   y con etiqueta, para que se lea claramente como retroceder. */
.re-back-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  flex-shrink: 0;
}
.re-back-icon svg { width: 22px; height: 22px; }

/* Filas de checkbox (selección de datos IA) */
.checkbox-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 13px 0;
  border-bottom: 0.5px solid var(--border);
}
.checkbox-row:last-child { border-bottom: none; }
.checkbox-row input[type="checkbox"] {
  width: 24px;
  height: 24px;
  accent-color: var(--accent);
}

/* Inicio — cita motivacional, resumen del mes, progreso, mejoras recientes */
.home-underline {
  width: 28px;
  height: 3px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  margin-top: 8px;
}

.quote-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-card);
}
.quote-mark {
  font-size: 34px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 4px;
  font-family: Georgia, serif;
}

.week-dots {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.week-dot-col { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.week-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--surface-2);
}
.week-dot.active { background: var(--accent); }
.week-dot.is-today { box-shadow: 0 0 0 2px var(--accent-soft); }

.home-progress-tile { padding: var(--space-4); min-width: 0; }
.home-tile-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.home-tile-icon { width: 16px; height: 16px; display: inline-flex; flex-shrink: 0; }
.home-tile-icon svg { width: 100%; height: 100%; }

.mini-sparkline { height: 36px; width: 100%; }
.mini-sparkline canvas { display: block; width: 100% !important; height: 100% !important; }
.mini-bars {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 36px;
}
.mini-bar {
  flex: 1;
  background: var(--accent-soft);
  border-radius: 3px 3px 0 0;
}
.mini-bar:last-child { background: var(--accent); }

.mejoras-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}
.mejora-tile {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-3) var(--space-2);
  text-align: center;
  cursor: pointer;
}

/* ============================================================
   Nutrición · Dieta cerrada — timeline de comidas (solo lectura, ver
   js/views/nutrition-closed-diet.js). Un nodo por grupo de `momento`:
   marcador + línea vertical a la izquierda, card de alimentos a la
   derecha. Usa los mismos tokens que el resto de Tracker (--accent,
   --surface, --border) para que funcione igual en los 3 temas.
   ============================================================ */
.meal-timeline {
  display: flex;
  flex-direction: column;
}

.meal-node {
  display: flex;
  gap: var(--space-3);
}

.meal-node-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 10px;
  flex-shrink: 0;
  padding-top: 6px;
}

.meal-node-dot {
  width: 10px;
  height: 10px;
  min-height: 10px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.meal-node-line {
  flex: 1;
  width: 1.5px;
  background: var(--border);
  margin-top: 4px;
}

.meal-node-content {
  flex: 1;
  min-width: 0;
  padding-bottom: var(--space-5);
}
.meal-node:last-child .meal-node-content { padding-bottom: 0; }

.meal-node-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-2);
  overflow-wrap: anywhere;
}

.meal-card {
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.meal-food-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: 15px;
}

.meal-food-name { min-width: 0; overflow-wrap: anywhere; }

.meal-food-grams {
  flex-shrink: 0;
  font-weight: 600;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* Nota del entrenador — visible pero secundaria respecto a las comidas/macros. */
.coach-note {
  background: var(--accent-soft);
  box-shadow: none;
  border: 0.5px solid var(--border);
}
.coach-note .type-micro {
  display: flex;
  align-items: center;
  gap: 6px;
}
.coach-note .type-micro svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ============================================================
   Nutrición · "Hoy" — resumen diario de un vistazo (ver
   js/views/nutrition-today.js). Tarjeta hero + aros de macros +
   selector Entrenamiento/Descanso. Bordes más generosos (24px) a
   propósito, para que esta tarjeta destaque como la principal de la
   pantalla frente al resto de cards (16px).
   ============================================================ */
.nutrition-hero {
  border-radius: 24px;
  padding: var(--space-5) var(--space-4);
  margin-bottom: var(--space-4);
}

.nutrition-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.nutrition-hero-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
}
.nutrition-hero-label svg { width: 18px; height: 18px; color: var(--accent); flex-shrink: 0; }

.nutrition-hero-kcal {
  font-size: 44px;
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  margin-bottom: 2px;
}

.macro-ring-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.macro-ring-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

.macro-ring {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  justify-content: center;
}

.macro-ring-value {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.macro-ring-value small { font-size: 12px; font-weight: 600; color: var(--text-secondary); }

.macro-ring-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
}

/* Selector Entrenamiento/Descanso — más grande y táctil que el .segmented
   de subtabs, pensado para tocarse con una mano como acción principal. */
.dia-tipo-toggle {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.dia-tipo-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 14px;
  box-shadow: var(--shadow-card);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.dia-tipo-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.dia-tipo-btn.active { background: var(--accent); color: var(--accent-contrast); }

/* ============================================================
   Nutrición · Historial — cada versión es una tarjeta pulsable (ver
   js/views/nutrition-history.js) en vez de una fila de lista densa.
   ============================================================ */
.history-card {
  display: block;
  width: 100%;
  text-align: left;
  border-radius: 20px;
  transition: transform var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease);
}
.history-card:active { transform: scale(0.98); opacity: 0.9; }

.history-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: 4px;
}
