/* ==========================================================================
   FORGE GYM TRACKER · MOBILE-FIRST OLED DARK MODE UI
   Optimizado 100% para uso con una sola mano en el gimnasio
   ========================================================================== */

:root {
  /* Paleta OLED Dark Mode (Ahorro de batería y cero deslumbramiento) */
  --bg-oled: #07090e;
  --bg-surface: #0f131d;
  --bg-card: #131824;
  --bg-card-Completed: #0d1f1a;
  --bg-elevated: #1b2233;
  --bg-input: #0a0d14;

  /* Bordes y divisores */
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-highlight: rgba(255, 255, 255, 0.14);
  --border-emerald: rgba(16, 185, 129, 0.45);

  /* Acentos de alta visibilidad en gimnasio */
  --accent-primary: #10b981;       /* Esmeralda energético */
  --accent-primary-bright: #34d399;
  --accent-lime: #a3e635;          /* Lima neón para sobrecarga / PRs */
  --accent-cyan: #38bdf8;          /* Cian para referencia de semana anterior */
  --accent-amber: #f59e0b;         /* Ámbar para avisos / isométricos */
  --accent-purple: #a855f7;        /* Púrpura para 1RM y ciclos */
  --accent-danger: #ef4444;

  /* Texto */
  --text-main: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Dimensiones ergonómicas móviles */
  --nav-height: 74px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;

  --shadow-card: 0 8px 24px -4px rgba(0, 0, 0, 0.55);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Consolas, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  background-color: var(--bg-oled);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.45;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}

button, input, select {
  font-family: inherit;
  touch-action: manipulation; /* Evita retraso de 300ms y zoom accidental por doble toque */
}

/* Contenedor Principal Mobile-First */
.app-shell {
  max-width: 500px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg-oled);
  position: relative;
  padding-bottom: calc(var(--nav-height) + 90px);
  border-left: 1px solid rgba(255, 255, 255, 0.04);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
}

/* ==========================================================================
   CABECERA SUPERIOR (STICKY HEADER)
   ========================================================================== */
.top-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(7, 9, 14, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 16px 10px;
}

.header-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(56, 189, 248, 0.15));
  border: 1px solid var(--border-emerald);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--accent-primary-bright);
  font-size: 18px;
  flex-shrink: 0;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-subtitle {
  font-size: 0.74rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.db-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
}

.db-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-primary);
  box-shadow: 0 0 8px var(--accent-primary);
}

/* Selector de Ciclo */
.cycle-selector-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}

.cycle-select {
  flex: 1;
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 700;
  outline: none;
}

.btn-new-cycle-top {
  background: rgba(16, 185, 129, 0.14);
  color: var(--accent-primary-bright);
  border: 1px solid var(--border-emerald);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.btn-new-cycle-top:active {
  transform: scale(0.97);
}

/* ==========================================================================
   NAVEGACIÓN DE SEMANAS (1-4) Y DÍAS (1-3)
   ========================================================================== */
.week-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 12px 16px 6px;
}

.week-tab-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 9px 4px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.week-tab-btn .wk-label {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.week-tab-btn .wk-reps {
  font-size: 0.68rem;
  font-weight: 600;
  opacity: 0.85;
}

.week-tab-btn.active {
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.22), rgba(16, 185, 129, 0.08));
  border-color: var(--accent-primary);
  color: var(--text-main);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.18);
}

.week-tab-btn.active .wk-reps {
  color: var(--accent-lime);
}

.week-dots {
  display: flex;
  gap: 4px;
  margin-top: 3px;
}

.week-mini-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
}

.week-mini-dot.done {
  background: var(--accent-primary);
  box-shadow: 0 0 5px var(--accent-primary);
}

/* Selector de Días (Día 1, Día 2, Día 3) */
.day-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 6px 16px 10px;
}

.day-tab-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 11px 8px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}

.day-tab-btn.active {
  background: var(--text-main);
  color: var(--bg-oled);
  border-color: var(--text-main);
  box-shadow: 0 4px 14px rgba(255, 255, 255, 0.15);
}

.day-tab-btn.day-completed {
  border-color: var(--border-emerald);
}

.day-check-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 0.7rem;
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-primary-bright);
}

.day-tab-btn.active .day-check-badge {
  background: var(--accent-primary);
  color: #04130e;
}

/* ==========================================================================
   RESUMEN DE SESIÓN EN VIVO (SESSION SUMMARY BANNER)
   ========================================================================== */
.session-banner {
  margin: 4px 16px 14px;
  padding: 14px 16px;
  background: linear-gradient(145deg, #131926, #0e131d);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.session-banner-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.session-day-title {
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--text-main);
}

.session-day-focus {
  font-size: 0.76rem;
  color: var(--accent-cyan);
  font-weight: 600;
  margin-top: 2px;
}

.btn-adherence-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  border: 1px solid var(--border-highlight);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.18s ease;
}

.btn-adherence-toggle.completed {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--accent-primary);
  color: var(--accent-primary-bright);
}

.session-progress-bar-wrap {
  margin-top: 12px;
}

.session-stats-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 600;
}

.session-progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-input);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.session-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-lime));
  border-radius: 999px;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   TARJETA DE EJERCICIO (EXERCISE CARD) Y SOBRECARGA PROGRESIVA
   ========================================================================== */
.exercises-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 16px;
}

.exercise-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 15px 14px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.exercise-card.all-sets-done {
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.09), rgba(19, 24, 36, 0.95));
  border-color: var(--border-emerald);
}

.ex-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.ex-title-wrap {
  flex: 1;
}

.ex-order-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-secondary);
  margin-right: 6px;
}

.ex-muscle-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-cyan);
}

.ex-name {
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 6px;
  line-height: 1.28;
}

.ex-prescription-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  text-align: center;
  min-width: 74px;
  flex-shrink: 0;
}

.ex-prescription-sets {
  font-size: 0.68rem;
  color: var(--text-secondary);
  font-weight: 700;
  text-transform: uppercase;
}

.ex-prescription-reps {
  font-size: 0.96rem;
  font-weight: 900;
  color: var(--accent-lime);
  font-family: var(--font-mono);
}

/* Caja de Sobrecarga Progresiva (Semana Anterior) */
.prev-week-banner {
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.24);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.prev-week-banner.no-prev {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.06);
}

.prev-week-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.prev-week-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  gap: 5px;
}

.prev-week-banner.no-prev .prev-week-label {
  color: var(--text-muted);
}

.overload-status-pill {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(163, 230, 53, 0.16);
  color: var(--accent-lime);
  border: 1px solid rgba(163, 230, 53, 0.35);
}

.overload-status-pill.neutral {
  background: rgba(148, 163, 184, 0.14);
  color: var(--text-secondary);
  border-color: transparent;
}

.prev-sets-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.prev-set-chip {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(7, 9, 14, 0.65);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Acciones Rápidas de 1 Toque por Ejercicio */
.quick-fill-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.btn-quick-action {
  flex: 1;
  min-height: 36px;
  padding: 6px 9px;
  border-radius: 8px;
  font-size: 0.74rem;
  font-weight: 700;
  background: var(--bg-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-highlight);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.btn-quick-action.overload-boost {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--border-emerald);
  color: var(--accent-primary-bright);
}

.btn-quick-action.plank-timer-trigger {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}

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

/* ==========================================================================
   MODO SIMPLIFICADO POR DEFECTO (MISMO PESO Y REPS EN TODAS LAS SERIES)
   ========================================================================== */
.unified-sets-box {
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.15s ease;
}

.unified-sets-box.all-completed {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.35);
}

.unified-controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.unified-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.unified-field-label {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
  text-align: center;
}

.unified-completion-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.unified-series-pills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
  gap: 6px;
}

.series-pill-btn {
  height: 40px;
  border-radius: 10px;
  border: 1.5px solid var(--border-highlight);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.series-pill-btn.done {
  background: rgba(16, 185, 129, 0.22);
  border-color: var(--accent-primary);
  color: var(--accent-primary-bright);
}

.series-pill-btn:active {
  transform: scale(0.95);
}

.btn-complete-all-sets {
  width: 100%;
  height: 44px;
  border-radius: 11px;
  border: 1.5px solid var(--border-highlight);
  background: var(--bg-elevated);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-complete-all-sets.done {
  background: var(--accent-primary);
  border-color: var(--accent-primary-bright);
  color: #03150e;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.35);
}

.btn-complete-all-sets:active {
  transform: scale(0.98);
}

.btn-toggle-custom-sets {
  margin-top: 8px;
  width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px dashed rgba(148, 163, 184, 0.24);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-secondary);
  font-size: 0.73rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-toggle-custom-sets.active {
  border-style: solid;
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.08);
  color: var(--accent-cyan);
}

/* ==========================================================================
   FILAS DE SERIES (SET ROWS) - PERSONALIZACIÓN OPCIONAL POR SERIE
   ========================================================================== */
.sets-container {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sets-header-labels {
  display: grid;
  grid-template-columns: 38px 1fr 1fr 48px;
  gap: 6px;
  padding: 0 4px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.set-row {
  display: grid;
  grid-template-columns: 38px 1fr 1fr 48px;
  gap: 6px;
  align-items: center;
  padding: 6px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  transition: all 0.15s ease;
}

.set-row.completed {
  background: rgba(16, 185, 129, 0.11);
  border-color: rgba(16, 185, 129, 0.4);
}

.set-num-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 44px;
  border-radius: 10px;
  background: var(--bg-input);
  font-weight: 800;
  font-size: 0.8rem;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.set-row.completed .set-num-badge {
  background: rgba(16, 185, 129, 0.22);
  color: var(--accent-primary-bright);
  border-color: rgba(16, 185, 129, 0.35);
}

.set-prev-mini {
  font-size: 0.58rem;
  color: var(--accent-cyan);
  font-weight: 600;
  line-height: 1;
  margin-top: 2px;
}

/* Control Numérico Grande (- [Input] +) */
.stepper-control {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-highlight);
  border-radius: 11px;
  height: 46px;
  overflow: hidden;
}

.stepper-btn {
  width: 36px;
  height: 100%;
  border: none;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  font-size: 1.2rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.stepper-btn:active {
  background: rgba(16, 185, 129, 0.3);
  color: var(--accent-primary-bright);
}

.stepper-input {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 1rem; /* >=16px evita auto-zoom en iOS */
  font-weight: 800;
  text-align: center;
  outline: none;
  min-width: 0;
  -moz-appearance: textfield;
}

.stepper-input::-webkit-outer-spin-button,
.stepper-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Botón Grande de Completar Serie (1 Toque) */
.set-check-btn {
  width: 48px;
  height: 46px;
  border-radius: 12px;
  border: 1.5px solid var(--border-highlight);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 1.25rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.set-check-btn.done {
  background: var(--accent-primary);
  border-color: var(--accent-primary-bright);
  color: #03150e;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.45);
}

.set-check-btn:active {
  transform: scale(0.9);
}

/* Pie de Tarjeta de Ejercicio */
.ex-footer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.74rem;
  color: var(--text-secondary);
}

.btn-link-subtle {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}

.btn-link-subtle:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

/* Botón Principal de Finalizar Día */
.finish-workout-section {
  padding: 20px 16px 10px;
}

.btn-finish-workout {
  width: 100%;
  min-height: 56px;
  border-radius: var(--radius-lg);
  border: none;
  background: linear-gradient(135deg, var(--accent-primary), #059669);
  color: #03140d;
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 10px 25px -5px rgba(16, 185, 129, 0.45);
}

.btn-finish-workout.already-completed {
  background: var(--bg-elevated);
  color: var(--accent-primary-bright);
  border: 1.5px solid var(--accent-primary);
  box-shadow: none;
}

.btn-finish-workout:active {
  transform: scale(0.98);
}

/* ==========================================================================
   CRONÓMETRO DE DESCANSO FLOTANTE (REST TIMER PILL)
   ========================================================================== */
.rest-timer-bar {
  position: fixed;
  bottom: calc(var(--nav-height) + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 476px;
  background: rgba(15, 19, 29, 0.96);
  backdrop-filter: blur(12px);
  border: 1.5px solid var(--accent-primary);
  border-radius: 16px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  z-index: 45;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.75);
}

.rest-timer-bar.hidden {
  display: none;
}

.rest-timer-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rest-timer-clock {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--accent-lime);
}

.rest-timer-label {
  font-size: 0.74rem;
  color: var(--text-secondary);
  font-weight: 700;
}

.rest-timer-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-timer-adj {
  background: var(--bg-elevated);
  border: 1px solid var(--border-highlight);
  color: var(--text-main);
  padding: 6px 9px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
}

.btn-timer-close {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
}

/* ==========================================================================
   SECCIÓN 2: CALENDARIO Y CONTROL DE ADHERENCIA
   ========================================================================== */
.section-container {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.adherence-hero-card {
  background: linear-gradient(155deg, #131b2b, #0d121c);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow-card);
}

.ring-wrapper {
  position: relative;
  width: 108px;
  height: 108px;
  flex-shrink: 0;
}

.ring-svg {
  width: 108px;
  height: 108px;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 10;
}

.ring-progress {
  fill: none;
  stroke: var(--accent-primary);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s ease;
}

.ring-center-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ring-pct {
  font-size: 1.45rem;
  font-weight: 900;
  font-family: var(--font-mono);
  color: var(--text-main);
}

.ring-sub {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.adherence-metrics {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.adh-title {
  font-size: 1rem;
  font-weight: 800;
}

.adh-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.adh-stat-box {
  background: rgba(7, 9, 14, 0.55);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 8px 10px;
}

.adh-stat-val {
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--accent-lime);
  font-family: var(--font-mono);
}

.adh-stat-lbl {
  font-size: 0.68rem;
  color: var(--text-secondary);
  font-weight: 600;
}

/* Matriz Semanal de Cumplimiento (4 semanas × 3 días) */
.card-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-card);
}

.panel-title {
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.weekly-matrix {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.matrix-week-row {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
}

.matrix-week-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.matrix-week-name {
  font-size: 0.84rem;
  font-weight: 800;
}

.matrix-week-badge {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

.matrix-week-badge.perfect {
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-primary-bright);
}

.matrix-days-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.matrix-day-cell {
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.matrix-day-cell.done {
  background: rgba(16, 185, 129, 0.14);
  border-color: var(--accent-primary);
}

.matrix-day-num {
  font-size: 0.8rem;
  font-weight: 800;
}

.matrix-day-status {
  font-size: 0.68rem;
  color: var(--text-secondary);
  font-weight: 700;
}

.matrix-day-cell.done .matrix-day-status {
  color: var(--accent-primary-bright);
}

/* Calendario Mensual Interactivo */
.month-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.month-title {
  font-size: 0.95rem;
  font-weight: 800;
  text-transform: capitalize;
}

.btn-month-nav {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border-highlight);
  background: var(--bg-elevated);
  color: var(--text-main);
  font-weight: 800;
  cursor: pointer;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 800;
  margin-bottom: 6px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.cal-day {
  aspect-ratio: 1;
  border-radius: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  position: relative;
}

.cal-day.empty {
  background: transparent;
  border-color: transparent;
}

.cal-day.today {
  border-color: var(--accent-cyan);
  color: var(--text-main);
}

.cal-day.trained {
  background: rgba(16, 185, 129, 0.22);
  border-color: var(--accent-primary);
  color: var(--text-main);
  font-weight: 900;
}

.cal-day-tag {
  font-size: 0.55rem;
  color: var(--accent-lime);
  font-weight: 800;
  line-height: 1;
  margin-top: 2px;
}

/* ==========================================================================
   SECCIÓN 3: PROGRESO Y SOBRECARGA PROGRESIVA
   ========================================================================== */
.filter-select {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-highlight);
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 700;
  outline: none;
  margin-bottom: 12px;
}

.chart-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 10px 10px;
  margin-top: 6px;
}

.progression-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 0.8rem;
}

.progression-table th,
.progression-table td {
  padding: 9px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.progression-table th {
  font-size: 0.68rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 800;
}

.pr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pr-item-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.pr-ex-name {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.2em;
}

.pr-ex-weight {
  font-size: 1.1rem;
  font-weight: 900;
  font-family: var(--font-mono);
  color: var(--accent-lime);
  margin-top: 4px;
}

.pr-ex-meta {
  font-size: 0.66rem;
  color: var(--text-muted);
}

/* ==========================================================================
   SECCIÓN 4: DATOS, CSV/JSON, ESCALABILIDAD Y BASE DE DATOS
   ========================================================================== */
.action-buttons-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-action-row {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-highlight);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  text-align: left;
}

.btn-action-row.primary {
  background: rgba(16, 185, 129, 0.16);
  border-color: var(--accent-primary);
  color: var(--accent-primary-bright);
}

.btn-action-row.danger {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}

.form-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.form-input {
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-highlight);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
}

.code-block {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-cyan);
  overflow-x: auto;
  white-space: pre;
  margin-top: 8px;
}

/* ==========================================================================
   BARRA DE NAVEGACIÓN INFERIOR (BOTTOM NAVIGATION BAR)
   ========================================================================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 500px;
  height: var(--nav-height);
  background: rgba(10, 13, 20, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-highlight);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  z-index: 50;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.nav-item {
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 700;
  transition: color 0.15s ease;
}

.nav-item .nav-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.nav-item.active {
  color: var(--accent-primary-bright);
}

.nav-item.active .nav-icon {
  transform: translateY(-1px);
  filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.5));
}

/* ==========================================================================
   MODALES (CRONÓMETRO PLANCHA, NUEVO CICLO, AGREGAR EJERCICIO)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  max-height: 90dvh;
  overflow-y: auto;
}

.stopwatch-display {
  font-family: var(--font-mono);
  font-size: 3.4rem;
  font-weight: 900;
  text-align: center;
  color: var(--accent-lime);
  margin: 16px 0;
}

/* Toast Notification */
.toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: calc(100% - 32px);
  max-width: 440px;
  pointer-events: none;
}

.toast-msg {
  background: rgba(16, 185, 129, 0.96);
  color: #03150e;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 800;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.22s ease;
}

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