/* ═══════════════════════════════════════════════════════
   IRONLOG — DESIGN SYSTEM v2
   Mobile-first. Desktop via @media (min-width: 768px).
   ═══════════════════════════════════════════════════════ */

/* ── 1. VARIABLES ─────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-base: #0B0E14;
  --bg-elevated: #111520;
  --bg-sidebar: #0D1018;
  --bg-card: rgba(255, 255, 255, 0.045);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --bg-input: rgba(255, 255, 255, 0.06);

  /* Accents */
  --green: #D4FF33;
  --green-dim: rgba(212, 255, 51, 0.13);
  --green-glow: 0 0 24px rgba(212, 255, 51, 0.35);
  --orange: #FF4400;
  --orange-dim: rgba(255, 68, 0, 0.16);
  --orange-glow: 0 0 20px rgba(255, 68, 0, 0.45);

  /* Text */
  --text-primary: #F2F4F8;
  --text-secondary: rgba(242, 244, 248, 0.48);
  --text-tertiary: rgba(242, 244, 248, 0.26);

  /* Borders */
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);

  /* Radius */
  --r-card: 20px;
  --r-input: 12px;
  --r-pill: 100px;
  --r-sm: 8px;

  /* Shadows */
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --shadow-float: 0 20px 60px rgba(0, 0, 0, 0.6);

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur: 200ms;

  /* Safe areas */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Sidebar (desktop) */
  --sidebar-w: 240px;
}

/* ── 2. RESET ─────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

* {
  scrollbar-width: none;
}

*::-webkit-scrollbar {
  display: none;
}

html,
body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
svg {
  display: block;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

a {
  text-decoration: none;
  color: inherit;
}

::selection {
  background: rgba(212, 255, 51, 0.2);
  color: var(--text-primary);
}

:focus-visible {
  outline: 2px solid rgba(212, 255, 51, 0.5);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ── 3. LAYOUT SHELL ──────────────────────────────────── */

/* El body scrollea de forma nativa — la tab bar es fixed */
body.page-app {
  display: block;
  min-height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  /* Espacio al final para que el contenido no quede detrás de la tab bar */
  padding-bottom: calc(14rem + env(safe-area-inset-bottom, 0px));
}

#main {
  display: block;
  width: 100%;
}

/* Registro (sesión activa) — layout flex pantalla completa, sin tab bar */
body.page-session {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  padding-bottom: 0;
}

body.page-session #main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  /* crítico: sin esto flex no puede comprimir correctamente */
  overflow: hidden;
}

body.page-session .session-header-bar {
  flex-shrink: 0;
  /* el header nunca se comprime */
}

body.page-session #session-footer {
  flex-shrink: 0;
  /* el footer nunca se comprime */
}

body.page-session .session-exercises-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 16px 16px calc(16px + var(--safe-bottom));
}

/* ── 4. iOS BOTTOM TAB BAR ────────────────────────────── */
#ios-tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  padding-top: 10px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  height: calc(64px + env(safe-area-inset-bottom, 0px));
  background: rgba(11, 14, 20, 0.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid rgba(255, 255, 255, 0.1);
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0 20px;
  cursor: pointer;
  text-decoration: none;
  color: rgba(242, 244, 248, 0.38);
  transition: color var(--dur) var(--ease);
  position: relative;
  flex: 1;
  min-width: 0;
}

.tab-item svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  transition: stroke var(--dur);
}

.tab-item span {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.tab-item.active {
  color: var(--green);
}

/* Neon line above active icon */
.tab-item.active::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 2.5px;
  background: var(--green);
  border-radius: 0 0 3px 3px;
  box-shadow: 0 0 10px rgba(212, 255, 51, 0.7), 0 0 20px rgba(212, 255, 51, 0.3);
}

/* ── 7. GLASS CARD ────────────────────────────────────── */
.card {
  background: var(--bg-card);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-radius: var(--r-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* ── 8. BUTTONS ───────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  border-radius: var(--r-input);
  background: var(--green);
  color: #0B0E14;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  border: none;
  box-shadow: var(--green-glow);
  transition: opacity var(--dur), transform var(--dur) var(--ease-spring);
  min-height: 44px;
  white-space: nowrap;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary svg {
  width: 14px;
  height: 14px;
  stroke: #0B0E14;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 16px;
  border-radius: var(--r-input);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--dur), border-color var(--dur);
  min-height: 44px;
  white-space: nowrap;
}

.btn-ghost:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

.btn-ghost svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 16px;
  border-radius: var(--r-input);
  background: transparent;
  border: 1px solid rgba(255, 68, 0, 0.25);
  color: var(--orange);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur);
  min-height: 44px;
  width: 100%;
}

.btn-danger:hover {
  background: var(--orange-dim);
}

.btn-danger svg {
  width: 14px;
  height: 14px;
  stroke: var(--orange);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ── 9. INPUTS ────────────────────────────────────────── */
.field-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-input);
  color: var(--text-primary);
  font-size: 16px;
  /* 16px evita zoom automático en iOS */
  font-weight: 500;
  outline: none;
  transition: border-color var(--dur), box-shadow var(--dur);
  min-height: 48px;
  appearance: none;
  -webkit-appearance: none;
}

.field-input:focus {
  border-color: rgba(212, 255, 51, 0.4);
  box-shadow: 0 0 0 3px rgba(212, 255, 51, 0.08);
}

.field-input::placeholder {
  color: var(--text-tertiary);
}

.field-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 6px;
  display: block;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── 10. CHIPS / FILTERS ──────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-strong);
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background var(--dur), color var(--dur), border-color var(--dur), box-shadow var(--dur);
  user-select: none;
  min-height: 34px;
}

.chip.active {
  background: var(--green);
  border-color: var(--green);
  color: #0B0E14 !important;
  box-shadow: var(--green-glow);
}

.chip.active:hover {
  color: #0B0E14 !important;
  opacity: 0.9;
}

.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  padding-right: 20px;
  /* evita que el último chip quede cortado */
  /* scrollbar invisible pero funcional */
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

/* ── 11. SECTION HEADERS ──────────────────────────────── */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section-action {
  font-size: 13px;
  font-weight: 500;
  color: var(--green);
  cursor: pointer;
  opacity: 0.9;
}

.section-action:hover {
  opacity: 1;
}

/* ── 12. BENTO GRID ───────────────────────────────────── */
.bento-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.bento-cell {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.bento-cell::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, transparent 60%);
  pointer-events: none;
}

.bento-cell.wide {
  grid-column: span 2;
}

.bento-cell.accent {
  background: linear-gradient(135deg, rgba(212, 255, 51, 0.1) 0%, rgba(212, 255, 51, 0.03) 100%);
}

.bento-cell.accent-orange {
  background: linear-gradient(135deg, rgba(255, 68, 0, 0.12) 0%, rgba(255, 68, 0, 0.03) 100%);
}

.bento-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.bento-value {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}

.bento-value.green {
  color: var(--green);
}

.bento-value.orange {
  color: var(--orange);
}

.bento-unit {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.bento-sub {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* Progress bar */
.progress-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--r-pill);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--green);
  box-shadow: var(--green-glow);
  transition: width 0.6s var(--ease);
}

/* Streak dots */
.streak-row {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.streak-dot {
  flex: 1;
  height: 28px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
}

.streak-dot.done {
  background: var(--green-dim);
  border-color: rgba(212, 255, 51, 0.3);
  color: var(--green);
}

.streak-dot.today {
  background: var(--green);
  color: #0B0E14;
  box-shadow: var(--green-glow);
  border-color: var(--green);
}

/* ── 13. ABBR BADGES ──────────────────────────────────── */
.abbr-badge {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.abbr-badge--sm {
  width: 38px;
  height: 38px;
  font-size: 9px;
}

.abbr-badge.pr {
  background: var(--orange-dim);
  border-color: rgba(255, 68, 0, 0.3);
  color: var(--orange);
  animation: pr-pulse 2.5s ease-in-out infinite;
}

.abbr-badge.cardio {
  background: rgba(96, 144, 255, 0.1);
  border-color: rgba(96, 144, 255, 0.3);
  color: #6090FF;
}

.pr-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  background: var(--orange-dim);
  border: 1px solid rgba(255, 68, 0, 0.25);
  font-size: 10px;
  font-weight: 700;
  color: var(--orange);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: var(--orange-glow);
  animation: pr-pulse 2s ease-in-out infinite;
}

@keyframes pr-pulse {

  0%,
  100% {
    box-shadow: 0 0 10px rgba(255, 68, 0, 0.25);
  }

  50% {
    box-shadow: 0 0 22px rgba(255, 68, 0, 0.55);
  }
}

/* ── 14. SESSION CARDS (dashboard + historial) ────────── */
.session-card {
  cursor: pointer;
  transition: transform 0.2s var(--ease-spring);
}

.session-card:active {
  transform: scale(0.985);
}

.session-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}

.session-card-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.session-card-date {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.duration-pill {
  padding: 5px 11px;
  border-radius: var(--r-pill);
  background: var(--green-dim);
  border: 1px solid rgba(212, 255, 51, 0.2);
  font-size: 12px;
  font-weight: 700;
  color: var(--green);
  white-space: nowrap;
}

.session-ex-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  gap: 12px;
}

.session-ex-row:last-child {
  border-bottom: none;
}

.ex-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.ex-detail-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ex-detail-sets {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.ex-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ex-main-stat {
  font-size: 15px;
  font-weight: 700;
  text-align: right;
}

.ex-main-unit {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.session-card-footer {
  display: flex;
  gap: 20px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}

.footer-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.footer-stat-value {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.footer-stat-value.green {
  color: var(--green);
}

.footer-stat-value.orange {
  color: var(--orange);
}

.footer-stat-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── 15. ROUTINE CARDS ────────────────────────────────── */
.routine-card {
  cursor: pointer;
  overflow: visible;
  position: relative;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.3s var(--ease),
              scale 0.3s var(--ease);
}

.routine-card.removing {
  opacity: 0;
  scale: 0.94;
  pointer-events: none;
}

.routine-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.routine-card:active {
  transform: scale(0.98);
}

/* ── EDIT MODE BUTTON (section header) ── */
.btn-edit-routines {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  border-radius: var(--r-input);
  background: rgba(0, 122, 255, 0.15);
  color: #007AFF;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  border: 1px solid rgba(0, 122, 255, 0.3);
  min-height: 44px;
  white-space: nowrap;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              background 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              transform var(--dur) var(--ease-spring);
}

.btn-edit-routines:hover {
  opacity: 0.85;
}

.btn-edit-routines:active {
  transform: scale(0.97);
}

.btn-edit-routines.active {
  background: #007AFF;
  border-color: #007AFF;
  color: #fff;
  box-shadow: 0 0 20px rgba(0, 122, 255, 0.35);
}

/* ── EDIT MODE ANIMATION (one-shot wink) ── */
@keyframes edit-enter {
  0%   { transform: scale(1) rotate(0deg) translateX(0); }
  15%  { transform: scale(0.97) rotate(-1deg) translateX(-2px); }
  30%  { transform: scale(0.98) rotate(0.4deg) translateX(1px); }
  50%  { transform: scale(0.975) rotate(-0.6deg) translateX(0); }
  100% { transform: scale(0.98) rotate(-0.5deg) translateX(0); }
}

.routine-card.edit-mode {
  animation: edit-enter 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  cursor: pointer;
  transform-origin: center center;
}

.routine-card.edit-mode:hover {
  box-shadow: none;
}

/* ── DELETE BUTTON (edit mode only) ── */
.routine-delete-btn {
  position: absolute;
  top: -8px;
  left: -8px;
  z-index: 20;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--bg-elevated);
  background: #FF3B30;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.6);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease-spring);
  flex-shrink: 0;
}

.routine-card.edit-mode .routine-delete-btn {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.routine-delete-btn svg {
  width: 12px;
  height: 12px;
  stroke: #fff;
  stroke-width: 3;
  stroke-linecap: round;
  pointer-events: none;
}

.routine-delete-btn:active {
  transform: scale(0.88) !important;
}

/* ── EDIT PENCIL BUTTON (edit mode only) ── */
.routine-edit-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  z-index: 20;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--bg-elevated);
  background: #007AFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.6);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease-spring);
  flex-shrink: 0;
}

.routine-card.edit-mode .routine-edit-btn {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.routine-edit-btn svg {
  width: 11px;
  height: 11px;
  stroke: #fff;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.routine-edit-btn:active {
  transform: scale(0.88) !important;
}

.routine-card-top {
  height: 110px;
  display: flex;
  align-items: flex-end;
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}

.routine-art-label {
  font-size: 52px;
  font-weight: 900;
  letter-spacing: -0.06em;
  opacity: 0.12;
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  line-height: 1;
}

.routine-art-icon {
  position: relative;
  z-index: 1;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.rart-push {
  background: linear-gradient(135deg, #1e3a1e, #2a4a0a);
  color: var(--green);
}

.rart-pull {
  background: linear-gradient(135deg, #1a1e3a, #0a1a4a);
  color: #6090FF;
}

.rart-legs {
  background: linear-gradient(135deg, #3a1e0a, #4a1a00);
  color: var(--orange);
}

.rart-full {
  background: linear-gradient(135deg, #2a1a3a, #1a0a3a);
  color: #C060FF;
}

.routine-card-body {
  padding: 16px 20px 18px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.routine-card-body-info {
  flex: 1;
  min-width: 0;
}

.routine-card-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.routine-card-meta {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 3px;
}

.routine-abbr-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.routine-abbr {
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  font-size: 9px;
  font-weight: 700;
  color: var(--text-tertiary);
  letter-spacing: 0.06em;
}

/* Play button on routine card */
.routine-play-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--green);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 0 16px rgba(212, 255, 51, .4);
  transition: transform .15s var(--ease-spring), box-shadow .15s;
}

.routine-play-btn:hover {
  box-shadow: 0 0 24px rgba(212, 255, 51, .65);
}

.routine-play-btn:active {
  transform: scale(.92);
  box-shadow: 0 0 10px rgba(212, 255, 51, .3);
}

.routine-play-btn svg {
  width: 16px;
  height: 16px;
  fill: #0B0E14;
  margin-left: 2px;
}

/* Add routine button */
.add-routine-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  border-radius: var(--r-card);
  border: 1.5px dashed var(--border-strong);
  background: transparent;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  min-height: 80px;
  width: 100%;
}

.add-routine-btn:hover {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-dim);
}

.add-routine-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Routine limit */
.limit-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--orange-dim);
  border-radius: var(--r-input);
  border: 1px solid rgba(255, 68, 0, 0.2);
  font-size: 13px;
  color: rgba(255, 120, 60, 0.9);
}

.limit-notice svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  stroke: var(--orange);
}

/* ── 16. EDITOR SHEET (mobile) / MODAL (desktop) ─────── */
.editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}

.editor-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.editor-sheet {
  width: 100%;
  background: var(--bg-elevated);
  border-radius: 28px 28px 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
  max-height: 88dvh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.4s var(--ease-spring);
  padding-bottom: calc(28px + var(--safe-bottom));
}

.editor-overlay.open .editor-sheet {
  transform: translateY(0);
}

.sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.15);
  margin: 12px auto 0;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 20px;
  border-bottom: 1px solid var(--border);
}

.sheet-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sheet-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--dur);
}

.sheet-close:hover {
  background: rgba(255, 255, 255, 0.14);
}

.sheet-close svg {
  width: 13px;
  height: 13px;
  stroke: var(--text-secondary);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.editor-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Exercise editor rows */
.ex-editor-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-input);
}

.drag-handle {
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: grab;
  padding: 2px;
  flex-shrink: 0;
}

.drag-handle span {
  display: block;
  width: 13px;
  height: 1.5px;
  background: var(--text-tertiary);
  border-radius: 1px;
}

.ex-abbr-sm {
  width: 27px;
  height: 27px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 800;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.ex-name-sm {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}

.ex-type-pill {
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.06);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
}

.ex-type-pill.cardio {
  background: rgba(96, 144, 255, 0.1);
  color: #6090FF;
}

.ex-rm-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 68, 0, 0.1);
  border: 1px solid rgba(255, 68, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--dur);
}

.ex-rm-btn:hover {
  background: rgba(255, 68, 0, 0.2);
}

.ex-rm-btn svg {
  width: 10px;
  height: 10px;
  stroke: var(--orange);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Type segmented control */
.type-seg {
  display: flex;
  gap: 6px;
}

.type-seg-btn {
  padding: 7px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: var(--text-tertiary);
  transition: all var(--dur);
  min-height: 36px;
}

.type-seg-btn.active-s {
  background: var(--green-dim);
  border-color: rgba(212, 255, 51, 0.3);
  color: var(--green);
}

.type-seg-btn.active-c {
  background: rgba(96, 144, 255, 0.12);
  border-color: rgba(96, 144, 255, 0.3);
  color: #6090FF;
}

/* Desktop: modal style */
@media (min-width: 768px) {
  .editor-overlay {
    align-items: center;
    justify-content: center;
  }

  .editor-sheet {
    width: 520px;
    max-width: calc(100vw - 48px);
    max-height: 85vh;
    border-radius: 20px;
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-float);
    transform: scale(0.96) translateY(12px);
    transition: transform 0.3s var(--ease-spring);
    padding-bottom: 22px;
    margin: auto;
  }

  .editor-overlay.open .editor-sheet {
    transform: none;
  }

  .sheet-handle {
    display: none;
  }
}

/* ── 17. SESSION LOG (registro.html) ──────────────────── */

/* Sticky header */
.session-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid var(--border);
  background: rgba(11, 14, 20, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  flex-shrink: 0;
}

.session-header-info {
  min-width: 0;
}

.session-en-curso-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 2px;
}

.session-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.session-stopwatch {
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--green);
  letter-spacing: .02em;
}

.btn-abandon {
  padding: 8px 12px;
  background: var(--orange-dim);
  border: 1px solid rgba(255, 68, 0, .25);
  border-radius: var(--r-sm);
  color: var(--orange);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur);
}

.btn-abandon:active {
  background: rgba(255, 68, 0, .25);
}


/* Fixed footer */
.session-footer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 20px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  background: rgba(11, 14, 20, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.session-notes-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

.session-notes-textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-input);
  color: var(--text-primary);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  line-height: 1.5;
  resize: none;
  outline: none;
  transition: border-color var(--dur);
}

.session-notes-textarea:focus {
  border-color: rgba(212, 255, 51, .4);
}

.session-notes-textarea::placeholder {
  color: var(--text-tertiary);
}

.session-duration-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.session-duration-input {
  width: 110px;
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-input);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
  outline: none;
  font-family: 'Inter', sans-serif;
  transition: border-color var(--dur);
}

.session-duration-input:focus {
  border-color: rgba(212, 255, 51, .4);
}

.session-duration-input::placeholder {
  color: var(--text-tertiary);
  font-weight: 400;
}

.btn-finish {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 56px;
  padding: 14px;
  background: var(--green);
  color: #0B0E14;
  border: none;
  border-radius: var(--r-input);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.01em;
  cursor: pointer;
  box-shadow: var(--green-glow);
  transition: opacity var(--dur), transform .1s var(--ease-spring);
}

.btn-finish:hover {
  opacity: .92;
}

.btn-finish:active {
  transform: scale(.97);
}

.btn-finish:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
}

.btn-finish svg {
  flex-shrink: 0;
}

.rest-skip-btn {
  width: 100%;
  justify-content: center;
}

/* ── EMPTY STATE ── */
.session-empty-card {
  padding: 48px 24px;
  text-align: center;
}

.session-empty-icon {
  font-size: 32px;
  opacity: .3;
  margin-bottom: 8px;
}

.session-empty-text {
  font-size: 14px;
  color: var(--text-tertiary);
}

/* ── EXERCISE CARDS ── */
.session-ex-card {
  overflow: hidden;
  flex-shrink: 0;
}

.session-ex-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
}

.session-ex-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.session-ex-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-ex-muscle {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-top: 1px;
  opacity: 0.7;
}

.session-ex-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

/* Rest timer pill */
.session-ex-rest-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 13px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  min-height: 34px;
  transition: background var(--dur), color var(--dur);
}

.session-ex-rest-btn:active {
  background: rgba(255, 255, 255, .12);
  color: var(--text-primary);
}

.session-ex-rest-btn svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* Column headers row */
.sets-header {
  display: grid;
  grid-template-columns: 28px 36px 1fr 1fr 56px;
  gap: 8px;
  padding: 9px 16px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  text-align: center;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, .018);
}

/* Set rows */
.set-row {
  display: grid;
  grid-template-columns: 28px 36px 1fr 1fr 56px;
  gap: 8px;
  padding: 10px 16px;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, .04);
  transition: opacity .2s;
}

.set-row:last-child {
  border-bottom: none;
}

.set-row.completed {
  opacity: .36;
}

.set-num {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Weight / Reps inputs */
.set-input {
  height: 56px;
  padding: 0 6px;
  background: rgba(255, 255, 255, .07);
  border: 1.5px solid rgba(255, 255, 255, .1);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color var(--dur), box-shadow var(--dur), background var(--dur);
  font-variant-numeric: tabular-nums;
  width: 100%;
  min-width: 0;
}

.set-input:focus {
  border-color: rgba(212, 255, 51, .5);
  box-shadow: 0 0 0 3px rgba(212, 255, 51, .1);
  background: rgba(255, 255, 255, .11);
}

.set-input::placeholder {
  color: rgba(242, 244, 248, .18);
  font-weight: 400;
  font-size: 13px;
}

.set-input.pr-alert {
  border-color: rgba(255, 68, 0, .55) !important;
  box-shadow: 0 0 0 3px rgba(255, 68, 0, .1), 0 0 14px rgba(255, 68, 0, .2);
}

/* Done button */
.set-done-btn {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  border: 1.5px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .04);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--dur), border-color var(--dur), box-shadow var(--dur), transform .12s var(--ease-spring);
}

.set-done-btn:active {
  transform: scale(.84);
}

.set-done-btn svg {
  width: 22px;
  height: 22px;
  stroke: var(--text-tertiary);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke var(--dur);
}

.set-done-btn.done {
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 0 18px rgba(212, 255, 51, .4);
}

.set-done-btn.done svg {
  stroke: #0B0E14;
}

/* Add set button */
.add-set-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px 16px 14px;
  padding: 12px;
  width: calc(100% - 32px);
  border-radius: var(--r-sm);
  border: 1px dashed var(--border-strong);
  background: transparent;
  color: var(--text-tertiary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--dur);
}

.add-set-btn:active {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-dim);
}

/* Remove set button */
.set-remove-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: color var(--dur), background var(--dur);
  flex-shrink: 0;
}

.set-remove-btn:hover,
.set-remove-btn:active {
  color: var(--orange);
  background: var(--orange-dim);
}

.set-remove-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Input validation error state */
.set-input.input-error {
  border-color: rgba(255, 68, 0, .7) !important;
  box-shadow: 0 0 0 3px rgba(255, 68, 0, .15) !important;
  animation: input-pulse 0.4s ease;
}

@keyframes input-pulse {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.03); }
  60%  { transform: scale(0.98); }
  100% { transform: scale(1); }
}

/* Rest overlay */
.rest-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(11, 14, 20, .9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s var(--ease);
}

.rest-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.rest-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 2.5rem 2.5rem 2rem;
  text-align: center;
  width: min(320px, calc(100vw - 2rem));
  box-shadow: var(--shadow-float);
}

.rest-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}

.rest-time {
  font-size: 4.5rem;
  font-weight: 800;
  color: var(--green);
  line-height: 1;
  margin-bottom: 20px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.04em;
}

.rest-bar-track {
  height: 4px;
  background: rgba(255, 255, 255, .08);
  border-radius: var(--r-pill);
  overflow: hidden;
  margin-bottom: 24px;
}

.rest-bar-fill {
  height: 100%;
  background: var(--green);
  border-radius: var(--r-pill);
  transition: width 1s linear;
}

/* ── 18. HISTORIAL CARDS ──────────────────────────────── */
.historial-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.historial-card-handle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  gap: 12px;
}

.hc-left {
  flex: 1;
  min-width: 0;
}

.hc-date {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 3px;
}

.hc-title-text {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hc-right-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.hc-meta-items {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.hc-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.panel-chevron {
  color: var(--text-tertiary);
  transition: transform 0.3s var(--ease);
}

.historial-card.expanded .panel-chevron {
  transform: rotate(180deg);
}

/* Expandable body */
.history-panel-wrapper {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.38s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  border-top: 0px solid var(--border);
}

.history-panel-wrapper.is-expanded {
  grid-template-rows: 1fr;
  border-top-width: 1px;
}

.history-panel-content {
  min-height: 0;
}

.hc-panel-inner {
  padding: 16px 20px 20px;
}

/* Exercise table in historial */
.hc-exercise {
  margin-bottom: 18px;
}

.hc-exercise:last-child {
  margin-bottom: 0;
}

.hc-exercise-name {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.hc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.hc-table thead tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.hc-table th {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  text-align: left;
  padding: 5px 8px 5px 0;
}

.hc-table td {
  padding: 8px 8px 8px 0;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.hc-table tr:last-child td {
  border-bottom: none;
}

.hc-table tr.pr-row td {
  background: rgba(255, 68, 0, 0.08);
  color: var(--text-primary);
  font-weight: 600;
}

.hc-pr-val {
  color: var(--orange);
  font-weight: 700;
}

.hc-notes {
  font-size: 13px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid var(--green);
  border-radius: 0 6px 6px 0;
  padding: 8px 12px;
  margin: 12px 0;
  font-style: italic;
}

.hc-footer-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  margin-top: 12px;
}

.hc-delete-btn {
  background: transparent;
  border: 1px solid rgba(255, 68, 0, 0.2);
  border-radius: var(--r-sm);
  color: var(--orange);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
  transition: background var(--dur);
}

.hc-delete-btn:hover {
  background: var(--orange-dim);
}

/* ── 19. PERFIL ───────────────────────────────────────── */
.profile-hero-section {
  text-align: center;
  padding: 24px 20px 0;
}

.avatar-wrap {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green-dim), rgba(212, 255, 51, 0.04));
  border: 2px solid rgba(212, 255, 51, 0.28);
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.avatar-wrap::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid rgba(212, 255, 51, 0.1);
}

.avatar-initials {
  font-size: 28px;
  font-weight: 800;
  color: var(--green);
  letter-spacing: -0.04em;
}

/* Dashboard header with avatar */
.dashboard-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 24px 20px 0;
  padding-top: calc(24px + env(safe-area-inset-top, 0px));
}

.dashboard-avatar-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(212, 255, 51, 0.1);
  border: 1.5px solid rgba(212, 255, 51, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-decoration: none;
  transition: background var(--dur);
  margin-top: 4px;
}

.dashboard-avatar-btn:hover {
  background: rgba(212, 255, 51, 0.18);
}

.dashboard-avatar-btn .avatar-initials {
  font-size: 13px;
  font-weight: 800;
}

.profile-display-name {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.profile-since {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.stats-row {
  display: flex;
  gap: 1px;
  background: var(--border);
  border-radius: var(--r-card);
  overflow: hidden;
}

.stat-box {
  flex: 1;
  padding: 16px 12px;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.stat-box-value {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.stat-box-value.green {
  color: var(--green);
}

.stat-box-value.orange {
  color: var(--orange);
}

.stat-box-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Body stat rows */
.body-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}

.body-stat-row:last-child {
  border-bottom: none;
}

.bsr-label {
  font-size: 14px;
  color: var(--text-secondary);
}

.bsr-val {
  font-size: 16px;
  font-weight: 700;
}

.bsr-unit {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
  margin-left: 3px;
}

/* Settings list */
.settings-group {
  display: flex;
  flex-direction: column;
  border-radius: var(--r-card);
  overflow: hidden;
  border: 1px solid var(--border);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-card);
  cursor: pointer;
  gap: 12px;
  transition: background var(--dur);
}

.settings-row:hover {
  background: var(--bg-card-hover);
}

.settings-row+.settings-row {
  border-top: 1px solid var(--border);
}

.sr-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sr-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sr-icon svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sr-label {
  font-size: 14px;
  font-weight: 500;
}

.sr-value {
  font-size: 13px;
  color: var(--text-tertiary);
}

.sr-chev svg {
  width: 14px;
  height: 14px;
  stroke: var(--text-tertiary);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.4;
}

/* IMC bar */
.imc-bar-track {
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--r-pill);
  overflow: hidden;
}

.imc-bar-fill {
  height: 100%;
  border-radius: var(--r-pill);
  transition: width 0.5s var(--ease), background 0.3s;
}

/* Goal chips */
.goal-chip {
  padding: 8px 16px;
  border-radius: var(--r-sm);
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all var(--dur);
  min-height: 36px;
}

.goal-chip:hover {
  border-color: var(--border-strong);
  color: var(--text-secondary);
}

.goal-chip.active {
  background: var(--green-dim);
  border-color: rgba(212, 255, 51, 0.35);
  color: var(--green);
}

/* Edit mode inputs */
.perfil-input--active {
  border-color: rgba(212, 255, 51, 0.3) !important;
  opacity: 1 !important;
}

.perfil-input--active:focus {
  border-color: var(--green) !important;
}

/* Biometric inline inputs (peso / altura) */
.biometric-input {
  width: 64px;
  background: none;
  border: none;
  border-bottom: 1.5px solid transparent;
  outline: none;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: right;
  padding-bottom: 2px;
  opacity: 0.55;
  cursor: default;
  transition: opacity var(--dur), border-color var(--dur), color var(--dur);
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
  appearance: textfield;
}

.biometric-input::-webkit-inner-spin-button,
.biometric-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

.biometric-input--active {
  opacity: 1;
  cursor: text;
  border-bottom-color: rgba(212, 255, 51, 0.35);
}

.biometric-input--active:focus {
  border-bottom-color: var(--green);
  box-shadow: 0 1px 0 0 rgba(212, 255, 51, 0.5);
}

.biometric-input--error {
  color: var(--orange) !important;
  border-bottom-color: var(--orange) !important;
}

.btn-save-active {
  background: var(--green) !important;
  color: #0B0E14 !important;
}

.profile-save-msg.success {
  color: var(--green);
}

.profile-save-msg.error {
  color: var(--orange);
}

/* ── 20. ONBOARDING ───────────────────────────────────── */
.page-onboarding {
  min-height: 100dvh;
  background: var(--bg-base);
  background-image: radial-gradient(ellipse 60% 40% at 20% 50%, rgba(212, 255, 51, 0.06) 0%, transparent 70%),
    radial-gradient(ellipse 50% 60% at 80% 30%, rgba(96, 144, 255, 0.04) 0%, transparent 70%);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1.5rem 1.25rem 3rem;
  overflow-y: auto;
}

/* ── 21. AUTH PAGE ────────────────────────────────────── */
body.page-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  overflow: auto;
}

/* ── 22. STATES DRIVEN BY JS ──────────────────────────── */

/* Panel states (rutinas) */
.active-routine-panel.collapsed .panel-edit-mode,
.active-routine-panel.collapsed .active-routine-header-container {
  display: none !important;
}

.active-routine-panel:not(.collapsed):not(.expanded) .panel-view-mode,
.active-routine-panel:not(.collapsed):not(.expanded) .panel-edit-mode,
.active-routine-panel:not(.collapsed):not(.expanded) .active-routine-header-container {
  display: none !important;
}

.active-routine-panel.expanded .panel-view-mode {
  display: none;
}

.active-routine-panel.expanded .panel-edit-mode {
  display: flex;
  flex-direction: column;
}

/* Expand icon rotate */
.panel-expand-icon {
  transition: transform 300ms var(--ease);
}

.active-routine-panel.expanded .panel-expand-icon {
  transform: rotate(180deg);
}

/* Nav active */
.nav-link.active {
  color: var(--text-primary);
}

/* Chips active — solo los que NO tienen fondo verde sólido */
.htab.active,
.tag-filter-btn.active,
.ptf-btn.active,
.progress-chip.active {
  color: var(--green);
}

/* Library item selected */
.library-item.selected {
  background: var(--green-dim);
}

.library-item.selected .library-item__check {
  background: var(--green);
  border-color: var(--green);
}

.library-item.selected .library-item__check svg {
  display: block;
}

.library-item__check svg {
  display: none;
}

/* Toast */
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(24, 29, 42, 0.96);
  border: 1px solid var(--border);
  border-radius: 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 200ms cubic-bezier(0.16, 1, 0.3, 1),
              transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-float);
  max-width: 320px;
  pointer-events: auto;
}

.toast-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast__icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.toast-success {
  color: #D4FF33;
  border-color: rgba(212, 255, 51, 0.25);
}

.toast-error {
  color: #FF6B35;
  border-color: rgba(255, 107, 53, 0.25);
}

.toast-info {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.12);
}

#toast-container {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

@media (min-width: 600px) {
  #toast-container {
    left: auto;
    right: 24px;
    transform: none;
    align-items: flex-end;
    bottom: 32px;
  }
}

/* ── Custom Confirm Dialog ── */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 8500;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  opacity: 0;
  transition: opacity 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

.confirm-overlay.open {
  opacity: 1;
}

.confirm-sheet {
  width: 100%;
  max-width: 480px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  padding: 24px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%);
  transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

.confirm-overlay.open .confirm-sheet {
  transform: translateY(0);
}

.confirm-sheet__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.confirm-sheet__body {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

.confirm-sheet__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.confirm-btn-danger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  background: rgba(255, 107, 53, 0.12);
  border: 1px solid rgba(255, 107, 53, 0.3);
  color: #FF6B35;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur);
}

.confirm-btn-danger:active {
  background: rgba(255, 107, 53, 0.22);
}

.confirm-btn-cancel {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur);
}

.confirm-btn-cancel:active {
  background: rgba(255, 255, 255, 0.09);
}

/* Rest overlay open */
.rest-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* PR Celebration */
@keyframes pr-enter {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }

  70% {
    transform: scale(1.06);
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes pr-glow {

  0%,
  100% {
    text-shadow: 0 0 32px rgba(255, 68, 0, 0.4);
  }

  50% {
    text-shadow: 0 0 64px rgba(255, 68, 0, 0.9);
  }
}

.pr-celebration {
  position: fixed;
  inset: 0;
  z-index: 8000;
  background: rgba(11, 14, 20, 0.9);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pr-celebration__card {
  background: var(--bg-elevated);
  border: 1px solid rgba(255, 68, 0, 0.25);
  border-radius: 24px;
  padding: 2.5rem 3rem;
  text-align: center;
  max-width: 360px;
  width: 90%;
  animation: pr-enter 0.5s var(--ease-spring) forwards;
}

.pr-celebration__trophy {
  font-size: 48px;
  margin-bottom: 12px;
  display: block;
}

.pr-celebration__label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 8px;
}

.pr-celebration__value {
  font-size: 52px;
  font-weight: 900;
  letter-spacing: -2px;
  color: var(--orange);
  animation: pr-glow 2s ease infinite;
  line-height: 1;
}

.pr-celebration__exercise {
  font-size: 16px;
  font-weight: 700;
  margin-top: 8px;
}

.pr-celebration__date {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.pr-celebration__btn {
  margin-top: 20px;
  background: var(--orange);
  color: #fff;
  border: none;
  padding: 10px 24px;
  border-radius: var(--r-input);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.pr-celebration__counter {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  margin-top: 12px;
}

.pr-celebration__next {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 16px;
  animation: _pulse 1s ease-in-out infinite;
}

/* ── 23. UTILITIES ────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 25%, rgba(255, 255, 255, 0.07) 50%, rgba(255, 255, 255, 0.04) 75%);
  background-size: 200% 100%;
  animation: skeleton-sweep 1.6s ease infinite;
  border-radius: var(--r-input);
}

@keyframes skeleton-sweep {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 2rem auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-tertiary);
}

.empty-state-icon {
  font-size: 36px;
  margin-bottom: 10px;
  opacity: 0.4;
}

.empty-state-text {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}

.divider {
  height: 1px;
  background: var(--border);
}

.mono {
  font-variant-numeric: tabular-nums;
}

/* Scroll content wrapper */
.scroll-content {
  padding: 20px 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Page header (desktop) */
.page-header {
  padding: 32px 32px 20px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.page-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.page-sub {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.page-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.page-body {
  padding: 0 32px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (max-width: 767px) {
  .page-header {
    padding: 20px 20px 0;
  }

  .page-title {
    font-size: 22px;
  }

  .page-body {
    padding: 0 0 32px;
  }
}

/* Desktop routines grid */
@media (min-width: 768px) {
  .routines-grid-desktop {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
}

/* ── 24. EX-TAGS (injected by JS) ─────────────────────── */
.ex-tag {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.ex-tag--push {
  background: rgba(212, 255, 51, 0.1);
  color: var(--green);
}

.ex-tag--pull {
  background: rgba(96, 144, 255, 0.1);
  color: #6090FF;
}

.ex-tag--legs {
  background: rgba(255, 68, 0, 0.1);
  color: var(--orange);
}

.ex-tag--accessory {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-secondary);
}

.ex-tag--cardio {
  background: rgba(96, 144, 255, 0.12);
  color: #6090FF;
}

.badge-pr {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  color: #0B0E14;
  background: var(--orange);
  border-radius: 4px;
  padding: 2px 6px;
}

/* Library items */
.library-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background var(--dur);
  min-height: 60px;
}

.library-item:last-child {
  border-bottom: none;
}

.library-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.library-item__check {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.library-item__info {
  flex: 1;
  min-width: 0;
}

.library-item__name {
  font-size: 14px;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.library-item__meta {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.library-empty {
  padding: 2rem;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
}

.library-item__tags {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

/* Exercise search modal */
.ex-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease);
}

.ex-modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

#ex-modal {
  width: 100%;
  background: var(--bg-elevated);
  border-radius: 24px 24px 0 0;
  border: 1px solid var(--border);
  max-height: 80dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (min-width: 768px) {
  .ex-modal-overlay {
    align-items: center;
    justify-content: center;
  }

  #ex-modal {
    width: 560px;
    max-width: calc(100vw - 48px);
    border-radius: 20px;
    max-height: 80vh;
    margin: auto;
  }

  #ex-detail-sheet {
    width: 560px;
    max-width: calc(100vw - 48px);
    border-radius: 20px;
    max-height: 85vh;
    margin: auto;
  }
}

/* ── LOAD MORE ── */
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.library-item--new {
  animation: fade-in-up 0.22s var(--ease) both;
}

.library-load-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 16px;
  background: transparent;
  border: none;
  border-top: 1px solid var(--border);
  color: #007AFF;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur), opacity var(--dur);
  flex-shrink: 0;
}

.library-load-more:hover {
  background: rgba(0, 122, 255, 0.06);
}

.library-load-more:active {
  background: rgba(0, 122, 255, 0.12);
}

.library-load-more:disabled {
  opacity: 0.5;
  cursor: default;
}

.library-load-more__spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0, 122, 255, 0.25);
  border-top-color: #007AFF;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── EXERCISE MODAL STRUCTURE ── */
.ex-modal-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-elevated);
}

.ex-modal-search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 16px;
  color: var(--text-primary);
}

.ex-modal-search-input::placeholder {
  color: var(--text-tertiary);
}

.ex-modal-esc-btn {
  background: rgba(255, 255, 255, .07);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 11px;
  padding: 4px 8px;
  cursor: pointer;
  flex-shrink: 0;
}

.ex-modal-footer {
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
}

.ex-modal-done-btn {
  width: 100%;
  justify-content: center;
}

.library-list-scroll {
  flex: 1;
  overflow-y: auto;
}

.library-item-skeleton {
  height: 64px;
  border-radius: 8px;
  margin: 8px 16px;
}

/* ── MUSCLE FILTER BAR ── */
.muscle-filter-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
  flex-shrink: 0;
  background: var(--bg-elevated);
}

.muscle-filter-bar::-webkit-scrollbar {
  display: none;
}

.muscle-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 13px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .05);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  min-height: 30px;
  transition: background var(--dur), color var(--dur), border-color var(--dur), box-shadow var(--dur);
  letter-spacing: 0.03em;
}

.muscle-chip.active {
  background: var(--green-dim);
  border-color: rgba(212, 255, 51, .4);
  color: var(--green);
  box-shadow: 0 0 0 1px rgba(212, 255, 51, .15);
}

.library-item__meta-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  flex-wrap: wrap;
}

.library-item__muscle {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* ── EXERCISE DETAIL SHEET ── */
.ex-detail-sheet {
  width: 100%;
  background: var(--bg-elevated);
  border-radius: 24px 24px 0 0;
  border: 1px solid var(--border);
  max-height: 85dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ex-detail-hero {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: rgba(255, 255, 255, .04);
  flex-shrink: 0;
  overflow: hidden;
}

.ex-hero-skeleton {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
    rgba(255,255,255,.04) 25%,
    rgba(255,255,255,.09) 50%,
    rgba(255,255,255,.04) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.ex-hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}

.ex-hero-img.loaded {
  opacity: 1;
}

.ex-hero-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ex-hero-placeholder svg {
  width: 48px;
  height: 48px;
  stroke: var(--text-tertiary);
  opacity: 0.18;
  stroke-width: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ex-hero-img.loaded + .ex-hero-skeleton,
.ex-hero-img.loaded ~ .ex-hero-placeholder {
  display: none;
}

.ex-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  -webkit-overflow-scrolling: touch;
}

.ex-detail-title-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.ex-detail-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.01em;
  flex: 1;
  min-width: 0;
}

.muscle-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: rgba(212, 255, 51, .1);
  border: 1px solid rgba(212, 255, 51, .2);
  font-size: 10px;
  font-weight: 700;
  color: var(--green);
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 3px;
}

.ex-detail-description {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.ex-detail-description p {
  margin: 0 0 10px;
}

.ex-detail-description p:last-child {
  margin-bottom: 0;
}

/* Protocol rows (rutinas editor) */
.protocol-row {
  display: grid;
  grid-template-columns: 1fr 56px 72px 56px 32px;
  gap: 8px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.protocol-row:last-child {
  border-bottom: none;
}

.protocol-row__name {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.protocol-row__input {
  height: 38px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  transition: border-color var(--dur);
}

.protocol-row__input:focus {
  border-color: rgba(212, 255, 51, 0.4);
}

.protocol-row__remove {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 50%;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 13px;
  transition: color var(--dur), background var(--dur);
}

.protocol-row__remove:hover {
  color: var(--orange);
  background: rgba(255, 68, 0, 0.1);
}

@media (max-width: 500px) {
  .protocol-row {
    grid-template-columns: 1fr auto auto auto auto;
    grid-template-rows: auto auto;
    gap: 5px 7px;
    padding: 10px 14px;
  }

  .protocol-row__name {
    grid-column: 1/-1;
    grid-row: 1;
    font-size: 13px;
    font-weight: 600;
  }

  .protocol-row__input,
  .protocol-row__remove {
    grid-row: 2;
  }

  .protocol-row__input {
    height: 40px;
    font-size: 15px;
    min-width: 44px;
  }
}

/* PM cards (progress) */
/* ═══════════════════════════════════════════════════════
   PROGRESO HUB — Kinetic Laboratory Layout
   ═══════════════════════════════════════════════════════ */

/* Page wrapper */
.prog-page {
  padding-top: calc(20px + env(safe-area-inset-top, 0px));
}

/* ── TIER 1: Selection bar ── */
.prog-selection-bar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 4px;
}

.prog-header__eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.prog-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.prog-chips {
  flex-shrink: 0;
  margin-bottom: 0;
}

.prog-search-wrap {
  flex: 1;
  min-width: 160px;
  position: relative;
}

.prog-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-input);
  transition: border-color var(--dur);
}

.prog-search-bar:focus-within {
  border-color: rgba(212, 255, 51, .4);
}

.prog-search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 14px;
  color: var(--text-primary);
}

.prog-search-input::placeholder { color: var(--text-tertiary); }

.psd-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: rgba(17, 21, 32, .98);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--r-input);
  z-index: 50;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: var(--shadow-float);
}

.prog-time-filters {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
  border-radius: var(--r-input);
  padding: 4px;
  flex-shrink: 0;
}

.ptf-btn {
  padding: 5px 10px;
  border-radius: 7px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
}

.ptf-btn.active {
  background: rgba(255,255,255,.08);
  color: var(--text-primary);
}

/* ── TIER 2: Symmetric chart twins ── */
.prog-charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: stretch;
}

.prog-chart-card {
  display: flex;
  flex-direction: column;
  height: 360px;
  overflow: hidden;
}

.prog-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.prog-chart-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.prog-chart-peak {
  font-size: 26px;
  font-weight: 800;
  color: var(--green);
  letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
}

.prog-chart-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-tertiary);
}

.prog-legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.prog-chart-body {
  position: relative;
  padding: 12px;
  height: 290px;
  flex-shrink: 0;
}

.prog-chart-body canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.prog-chart-empty {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 13px;
  text-align: center;
  padding: 16px;
}

/* ── TIER 3: Bento 4-col metrics ── */
.prog-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .prog-charts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .prog-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .prog-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .prog-chips {
    overflow-x: auto;
  }
}

@media (max-width: 380px) {
  .prog-metrics-grid {
    grid-template-columns: 1fr;
  }
}

.pm-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 18px;
}

.pm-card__label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.pm-card__value {
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pm-card__sub {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* Progress search */
.psd-item {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background var(--dur);
}

.psd-item:last-child {
  border-bottom: none;
}

.psd-item:hover {
  background: rgba(212, 255, 51, 0.07);
  color: var(--text-primary);
}

/* Session rows (dashboard) */
.session-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  overflow: hidden;
}

.session-row__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
}

.session-row__sets-pill {
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 9px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.session-row__sets-num {
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.session-row__sets-lbl {
  font-size: 8px;
  color: var(--text-tertiary);
  margin-top: 1px;
}

.session-row__info {
  flex: 1;
  min-width: 0;
}

.session-row__title-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 3px;
}

.session-row__title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-row__pr-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--orange);
  background: var(--orange-dim);
  border: 1px solid rgba(255, 68, 0, 0.25);
  padding: 2px 6px;
  border-radius: var(--r-pill);
  flex-shrink: 0;
}

.session-row__meta {
  display: flex;
  align-items: center;
  gap: 4px;
}

.session-row__meta span {
  font-size: 11px;
  color: var(--text-tertiary);
}

.session-row__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  flex-shrink: 0;
}

/* Fixed-width metadata slots — keeps column alignment across cards */
.session-row__stats {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-shrink: 0;
}

.hc-meta-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-variant-numeric: tabular-nums;
}

.hc-meta-item__val {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.hc-meta-item__lbl {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-top: 1px;
}

.hc-meta-item--exercises {
  min-width: 42px;
}

.hc-meta-item--time {
  min-width: 52px;
}

.hc-meta-item--volume {
  min-width: 72px;
}

/* On very narrow screens hide the exercises count */
@media (max-width: 400px) {
  .hc-meta-item--exercises {
    display: none;
  }
}

.session-row__tag {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 4px;
}

.session-row__tag--push {
  color: var(--green);
  background: rgba(212, 255, 51, 0.09);
}

.session-row__tag--pull {
  color: #6090FF;
  background: rgba(96, 144, 255, 0.1);
}

.session-row__tag--legs {
  color: var(--orange);
  background: rgba(255, 68, 0, 0.09);
}

.session-row__tag--acc {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
}

.session-row__tag--cardio {
  color: #6090FF;
  background: rgba(96, 144, 255, 0.1);
}

.session-row__tag--default {
  color: var(--text-tertiary);
  background: rgba(255, 255, 255, 0.04);
}

.session-row__date {
  font-size: 11px;
  color: var(--text-tertiary);
}

.session-row__chevron {
  color: var(--text-tertiary);
  transition: transform var(--dur) var(--ease);
}

.session-row__chevron.open {
  transform: rotate(90deg);
}

.session-row__body {
  background: rgba(255, 255, 255, 0.018);
  border-top: 1px solid var(--border);
  padding: 8px 18px;
}

.session-row__detail {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.session-row__detail:last-child {
  border-bottom: none;
}

.session-row__detail-name {
  font-size: 13px;
  color: var(--text-secondary);
}

.session-row__detail-stats {
  display: flex;
  gap: 14px;
}

.session-row__detail-stats span {
  font-size: 12px;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

/* Routine cards (JS rendered) */
.routine-card-old {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 20px;
}

.stat-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 8px;
  display: block;
}

.stat-value {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}

.stat-value.green {
  color: var(--green);
}

.stat-unit {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.stat-sub {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-item--right {
  text-align: right;
}

.lift-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.lift-card--pr {
  border-color: rgba(255, 68, 0, 0.2);
}

.lift-card__label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.lift-card__value {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1;
}

.lift-card__value.green {
  color: var(--green);
}

.lift-card__value.orange {
  color: var(--orange);
}

.lift-card__unit {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-left: 4px;
}

.lift-card__name {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.lift-card__pr-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--orange);
  background: var(--orange-dim);
  padding: 2px 6px;
  border-radius: 4px;
}

.lift-card__pr-cta {
  margin-top: 8px;
  font-size: 11px;
  color: rgba(255, 68, 0, 0.7);
}

/* Volume chart */
.volume-chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 20px;
}

.volume-chart__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.volume-chart__bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 56px;
}

.volume-chart__col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.volume-chart__bar {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
}

.volume-chart__bar--active {
  background: var(--green);
  box-shadow: 0 0 8px rgba(212, 255, 51, 0.3);
}

.volume-chart__bar--partial {
  background: rgba(212, 255, 51, 0.28);
}

.volume-chart__day {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Misc JS-generated */
.ignite {
  background: linear-gradient(135deg, var(--green) 0%, #a8ff44 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ignite-orange {
  background: linear-gradient(135deg, var(--orange) 0%, #ff9a6e 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.empty-state {
  color: var(--text-tertiary);
  text-align: center;
  padding: 2rem 0;
}

.view-mode-empty,
.historial-empty {
  color: var(--text-tertiary);
  font-size: 14px;
  text-align: center;
  padding: 2rem;
}

/* SBD / PR table */
.smd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.smd-table thead tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.smd-table th {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  text-align: left;
  padding: 5px 8px 5px 0;
}

.smd-set-row td {
  padding: 8px 8px 8px 0;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.smd-set-row.smd-set-pr td {
  background: rgba(255, 68, 0, 0.08);
  color: var(--text-primary);
  font-weight: 600;
}

.smd-set-num {
  color: var(--text-tertiary) !important;
  font-size: 12px;
}

.smd-pr-badge {
  font-size: 9px;
  font-weight: 800;
  color: #0B0E14;
  background: var(--orange);
  border-radius: 4px;
  padding: 2px 6px;
}

.smd-pr-val {
  color: var(--orange);
  font-weight: 700;
}

.smd-exercise {
  margin-bottom: 16px;
}

.smd-exercise:last-child {
  margin-bottom: 0;
}

.smd-exercise__name {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.hc-tag {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
}

/* PR list */
.pr-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.pr-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.pr-row:last-child {
  border-bottom: none;
}

.pr-name {
  flex: 1;
  font-weight: 500;
}

.pr-weight {
  color: var(--green);
  font-variant-numeric: tabular-nums;
}

.pr-reps {
  color: var(--text-secondary);
  font-size: 12px;
}

.pr-orm {
  font-size: 11px;
  color: var(--orange);
  font-variant-numeric: tabular-nums;
}

/* exercise-cards-grid (view mode) */
.exercise-cards-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ex-card {
  min-width: 120px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

.ex-card__name {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ex-card__stats {
  display: flex;
  gap: 6px;
  align-items: center;
}

.ex-card__reps {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--green);
  font-weight: 700;
}

.ex-card__rest {
  font-size: 10px;
  color: var(--text-tertiary);
}

/* freq calendar cells */
.freq-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.05);
  min-width: 0;
}

.freq-cell.trained {
  background: var(--green);
}

.freq-cell.today {
  outline: 2px solid rgba(255, 255, 255, 0.3);
  outline-offset: -1px;
}

.freq-grid-week {
  grid-template-columns: repeat(7, 1fr);
}

.freq-grid-month {
  grid-template-columns: repeat(7, 1fr);
}

.freq-grid-sixmonths {
  grid-template-columns: repeat(26, 1fr);
}

.freq-grid-year {
  grid-template-columns: repeat(52, 1fr);
  gap: 2px;
}

/* ═══════════════════════════════════════════════════════
   PREMIUM DASHBOARD — High Performance Layer
   ═══════════════════════════════════════════════════════ */

/* ── SHADOW CHART ── */
/* ── MASTER VOLUME CARD (Shadow Chart merged) ── */
.shadow-chart {
  padding: 20px 20px 14px;
  position: relative;
  overflow: hidden;
  gap: 0;
}

/* Chart area bleeds to card edges — no horizontal padding */
.shadow-chart__chart-wrap,
.shadow-chart__days,
.shadow-chart__progress {
  margin-left: -20px;
  margin-right: -20px;
}

.shadow-chart__days {
  padding-left: 20px;
  padding-right: 20px;
}

.shadow-chart__progress {
  padding-left: 0;
  padding-right: 0;
}

.shadow-chart__top {
  margin-bottom: 12px;
}

.shadow-chart__title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.shadow-chart__big-val {
  display: flex;
  align-items: baseline;
  gap: 5px;
  line-height: 1;
}

.shadow-chart__vol {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.shadow-chart__vol.green  { color: var(--green); }
.shadow-chart__vol.orange { color: var(--orange); }

.shadow-chart__unit {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.shadow-chart__vs {
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
  letter-spacing: 0.03em;
}

.shadow-chart__vs.beating {
  color: var(--green);
}

.shadow-chart__vs.behind {
  color: var(--orange);
}

.shadow-chart__vs.equal {
  color: var(--text-tertiary);
}

.shadow-chart__chart-wrap {
  position: relative;
  width: 100%;
  height: 160px;
}

.shadow-chart__svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  cursor: crosshair;
}

.shadow-chart__chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.shadow-chart__days {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
}

.shadow-chart__day {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  text-align: center;
  flex: 1;
  font-variant-numeric: tabular-nums;
}

.shadow-chart__day.today {
  color: #CCFF00;
  text-shadow: 0 0 8px rgba(204, 255, 0, 0.6);
}

.shadow-chart__day.future {
  opacity: 0.2;
}

.shadow-chart__progress {
  height: 2px;
  background: rgba(255, 255, 255, 0.05);
  margin-top: 10px;
  position: relative;
}

.shadow-chart__progress::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    rgba(255,255,255,0.04) 0px,
    rgba(255,255,255,0.04) 1px,
    transparent 1px,
    transparent 14.28%
  );
}

.shadow-chart__progress-fill {
  height: 100%;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.shadow-chart__progress-fill.green {
  background: #CCFF00;
  box-shadow: 0 0 6px rgba(204, 255, 0, 0.7);
}

.shadow-chart__progress-fill.orange {
  background: var(--orange);
  box-shadow: 0 0 6px rgba(255, 68, 0, 0.5);
}

/* ── CHART TOOLTIP — HUD style ── */
.chart-tooltip {
  position: absolute;
  top: 2px;
  pointer-events: none;
  background: rgba(11, 14, 20, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(204, 255, 0, 0.18);
  border-radius: 6px;
  padding: 7px 10px;
  min-width: 128px;
  z-index: 10;
  transition: left 0.08s linear;
  box-shadow: 0 0 12px rgba(204, 255, 0, 0.08), inset 0 1px 0 rgba(255,255,255,0.04);
}

.chart-tooltip__day {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #CCFF00;
  margin-bottom: 5px;
}

.chart-tooltip__row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  margin-top: 3px;
}

.chart-tooltip__dot {
  width: 5px;
  height: 5px;
  flex-shrink: 0;
  transform: rotate(45deg);
}

.chart-tooltip__dot.curr { background: #CCFF00; box-shadow: 0 0 4px rgba(204,255,0,0.6); }
.chart-tooltip__dot.prev { background: rgba(160, 168, 180, 0.5); }

.chart-tooltip__label {
  color: var(--text-tertiary);
  flex: 1;
  font-size: 10px;
  letter-spacing: 0.04em;
}

.chart-tooltip__val {
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
}

/* ── PERFORMANCE METRICS ── */
.perf-metric {
  padding: 18px 20px;
  gap: 6px;
}

.perf-metric__icon {
  font-size: 18px;
  line-height: 1;
  margin-bottom: 2px;
}

.perf-metric__value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}

.perf-metric__value.blue {
  color: #007AFF;
}

.perf-metric__value.orange {
  color: var(--orange);
}

.perf-metric__label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.perf-metric__sub {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* Density gauge */
.density-gauge {
  position: relative;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
}

.density-gauge svg {
  transform: rotate(-90deg);
}

.density-gauge__track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.07);
  stroke-width: 4;
}

.density-gauge__fill {
  fill: none;
  stroke: #007AFF;
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s var(--ease);
  filter: drop-shadow(0 0 4px rgba(0, 122, 255, 0.5));
}

/* ── IRON LEGACY ── */
.iron-legacy {
  padding: 20px;
  overflow: hidden;
}

.iron-legacy__shelf {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 4px;
}

.trophy-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.trophy-hex {
  width: 60px;
  height: 60px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.trophy-hex svg.hex-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.trophy-hex__icon {
  position: relative;
  z-index: 1;
  font-size: 22px;
  line-height: 1;
}

.trophy-item.unlocked .trophy-hex svg.hex-bg {
  filter: drop-shadow(0 0 8px rgba(212, 255, 51, 0.35));
}

.trophy-item.locked .trophy-hex {
  opacity: 0.12;
  filter: grayscale(1);
}

.trophy-item__name {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  line-height: 1.3;
}

.trophy-item.locked .trophy-item__name {
  color: var(--text-tertiary);
  opacity: 0.5;
}

.trophy-item__date {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--green);
  font-variant-numeric: tabular-nums;
}

/* ── WEEKLY CHALLENGE HUB ── */
.challenge-hub {
  padding: 18px 20px;
  overflow: hidden;
}

.challenge-hub__title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}

.challenge-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.challenge-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  text-align: center;
}

.challenge-option:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--border-strong);
}

.challenge-option.active {
  border-color: var(--green);
  background: var(--green-dim);
}

.challenge-option.active .challenge-option__icon {
  filter: none;
}

.challenge-option__icon {
  font-size: 20px;
  line-height: 1;
  filter: grayscale(0.4);
}

.challenge-option__name {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.challenge-option.active .challenge-option__name {
  color: var(--green);
}

.challenge-option__desc {
  font-size: 9px;
  color: var(--text-tertiary);
  line-height: 1.3;
}
