:root {
  color-scheme: light;
  --bg: #f4f4f2;
  --surface: #fcfcfb;
  --surface-2: #efeeeb;
  --border: #e0dfdb;
  --text: #0b0b0b;
  --text-2: #52514e;
  --text-3: #7a7974;
  --accent: #c8102e;
  --accent-ink: #ffffff;
  --accent-soft: #fbe1e4;
  --good: #0c8a0c;
  --good-soft: #dff2df;
  --warn: #eda100;
  --warn-ink: #9a6400;
  --warn-soft: #fbefd2;
  --danger: #d03b3b;
  --gold: #b8861b;
  --series-1: #c8102e;
  --series-2: #c9962e;
  --grid: #e7e6e2;
  --heat-0: #ebeae6;
  --heat-1: #f6c3ca;
  --heat-2: #e8758a;
  --heat-3: #c8102e;
  --heat-4: #7d0a1d;
  --shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 4px 16px rgb(0 0 0 / 5%);
  --radius: 14px;
  --tabbar-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #101112;
    --surface: #1a1a19;
    --surface-2: #242423;
    --border: #2f2f2d;
    --text: #ffffff;
    --text-2: #c3c2b7;
    --text-3: #8f8e86;
    --accent: #d9233a;
    --accent-ink: #ffffff;
    --accent-soft: #361519;
    --good: #0ca30c;
    --good-soft: #15321a;
    --warn: #e7a92e;
    --warn-ink: #e7a92e;
    --warn-soft: #3a2c10;
    --danger: #e66767;
    --gold: #e0b04a;
    --series-1: #e0344a;
    --series-2: #e0b04a;
    --grid: #2a2a28;
    --heat-0: #262624;
    --heat-1: #6b1d27;
    --heat-2: #a11f33;
    --heat-3: #d9233a;
    --heat-4: #ef6a7a;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101112;
  --surface: #1a1a19;
  --surface-2: #242423;
  --border: #2f2f2d;
  --text: #ffffff;
  --text-2: #c3c2b7;
  --text-3: #8f8e86;
  --accent: #d9233a;
  --accent-ink: #ffffff;
  --accent-soft: #361519;
  --good: #0ca30c;
  --good-soft: #15321a;
  --warn: #e7a92e;
  --warn-ink: #e7a92e;
  --warn-soft: #3a2c10;
  --danger: #e66767;
  --gold: #e0b04a;
  --series-1: #e0344a;
  --series-2: #e0b04a;
  --grid: #2a2a28;
  --heat-0: #262624;
  --heat-1: #6b1d27;
  --heat-2: #a11f33;
  --heat-3: #d9233a;
  --heat-4: #ef6a7a;
  --shadow: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { fill: currentColor; }

/* ---------- Barra superior e inferior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
}
.topbar h1 { margin: 0; font-size: 1.5rem; letter-spacing: -0.01em; }
.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px;
  border: 0; border-radius: 50%; background: transparent; color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 22px; height: 22px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(3, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--border);
}
.tabbar button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 0; background: none; color: var(--text-3); font-size: 0.72rem; font-weight: 500;
}
.tabbar button svg { width: 24px; height: 24px; }
.tabbar button.active { color: var(--accent); }

main { max-width: 720px; margin: 0 auto; padding: 4px 16px 16px; outline: none; }

/* ---------- Componentes ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.card h2, .card h3 { margin: 0 0 4px; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
.section-title {
  margin: 20px 4px 8px; font-size: 0.8rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3);
}
.muted { color: var(--text-2); }
.small { font-size: 0.85rem; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font-weight: 600; text-decoration: none;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn.block { width: 100%; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 0.85rem; border-radius: 10px; }
.btn:disabled { opacity: 0.5; }

input[type="text"], input[type="number"], input[type="date"], input[type="search"], select {
  width: 100%; min-height: 44px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
}
input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
label.field { display: block; }
label.field > span { display: block; font-size: 0.8rem; color: var(--text-2); margin-bottom: 4px; }

.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); font-size: 0.85rem; white-space: nowrap;
}
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }

.segmented {
  display: inline-grid; grid-auto-flow: column; gap: 2px; padding: 3px;
  background: var(--surface-2); border-radius: 10px;
}
.segmented button {
  border: 0; background: transparent; padding: 6px 14px; border-radius: 8px;
  font-size: 0.85rem; font-weight: 600; color: var(--text-2);
}
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.tag {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2); font-size: 0.75rem; font-weight: 500;
}
.tag.accent { background: var(--accent-soft); color: var(--text); }

.list { list-style: none; margin: 0; padding: 0; }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 4px;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: 0; }
button.list-item { width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; }

.empty { text-align: center; padding: 28px 12px; color: var(--text-2); }

/* ---------- Semana ---------- */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }

/* ---------- Sesión de entrenamiento ---------- */

.sets { width: 100%; border-collapse: separate; border-spacing: 0 6px; }
.sets th { font-size: 0.7rem; font-weight: 600; color: var(--text-3); text-transform: uppercase; text-align: center; }
.sets td { text-align: center; padding: 0 2px; }
.sets td.n { width: 28px; font-weight: 600; color: var(--text-2); }
.sets td.prev { font-size: 0.78rem; color: var(--text-3); width: 64px; white-space: nowrap; }
.sets input { min-height: 40px; padding: 6px 4px; text-align: center; font-variant-numeric: tabular-nums; }
.sets tr.done input { background: var(--good-soft); border-color: transparent; }
.check {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-3); display: grid; place-items: center;
}
.check svg { width: 20px; height: 20px; }
tr.done .check { background: var(--good); border-color: var(--good); color: #fff; }

/* ---------- Progreso ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; min-width: 0; }
.stat .label { font-size: 0.72rem; color: var(--text-2); }
.stat .value { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat .delta { font-size: 0.72rem; color: var(--text-2); }
.chart-box { position: relative; height: 220px; margin-top: 8px; }
.chart-box.tall { height: 300px; }

.heatmap { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 3px; margin-top: 10px; }
.heat { aspect-ratio: 1; border-radius: 3px; background: var(--heat-0); }
.heat[data-l="1"] { background: var(--heat-1); }
.heat[data-l="2"] { background: var(--heat-2); }
.heat[data-l="3"] { background: var(--heat-3); }
.heat[data-l="4"] { background: var(--heat-4); }
.heat.future { visibility: hidden; }
.heat-legend { display: flex; align-items: center; gap: 3px; font-size: 0.72rem; color: var(--text-3); justify-content: flex-end; margin-top: 6px; }
.heat-legend .heat { width: 10px; height: 10px; }

details.table-view { margin-top: 10px; font-size: 0.85rem; }
details.table-view summary { cursor: pointer; color: var(--text-2); }
details.table-view table { width: 100%; border-collapse: collapse; margin-top: 6px; }
details.table-view td, details.table-view th { padding: 4px 6px; border-bottom: 1px solid var(--border); text-align: right; font-variant-numeric: tabular-nums; }
details.table-view td:first-child, details.table-view th:first-child { text-align: left; }

/* ---------- Hoja modal ---------- */
.sheet {
  width: 100%; max-width: 640px; max-height: 88vh; margin: auto auto 0; padding: 0;
  border: 0; border-radius: 20px 20px 0 0; background: var(--surface); color: var(--text);
}
@media (min-width: 700px) { .sheet { margin: auto; border-radius: 20px; } }
.sheet::backdrop { background: rgb(0 0 0 / 45%); }
.sheet-inner { padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet-head h2 { margin: 0; }

.toast {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 64px);
  transform: translateX(-50%) translateY(-12px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px;
  font-size: 0.9rem; transition: 0.2s; z-index: 50; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

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

/* ---------- v2: sugerencias, notas, fichas, cuenta ---------- */
.hint {
  margin: 0 0 6px; padding: 8px 10px; border-radius: 10px;
  background: var(--surface-2); color: var(--text-2); font-size: 0.82rem; line-height: 1.35;
}

.link-btn { border: 0; background: none; padding: 0; text-align: left; color: inherit; }
.link-btn h3 { text-decoration: underline dotted var(--text-3); text-underline-offset: 3px; }
textarea.note {
  width: 100%; margin-top: 8px; padding: 8px 12px; resize: vertical;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font-size: 0.9rem;
}
.segmented.tabs { display: grid; grid-auto-columns: 1fr; width: 100%; }
.segmented.tabs button { padding: 7px 4px; font-size: 0.8rem; }

input[type="email"], input[type="password"] {
  width: 100%; min-height: 44px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
}

/* ---------- v3: configuración inicial ---------- */
body.onboarding .tabbar, body.onboarding .topbar .icon-btn { display: none; }
body.onboarding { padding-bottom: 32px; }
.ob { max-width: 520px; margin: 0 auto; }
.ob-hero { text-align: center; padding: 32px 8px 24px; }
.ob-hero img { border-radius: 18px; }
.ob-hero h1 { font-size: 1.6rem; line-height: 1.2; margin: 16px 0 8px; letter-spacing: -0.02em; }
.ob-q { font-size: 1.35rem; line-height: 1.25; margin: 8px 0 14px; letter-spacing: -0.01em; }
.ob-progress { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 4px 0 12px; }
.ob-progress span { height: 4px; border-radius: 2px; background: var(--surface-2); }
.ob-progress span.on { background: var(--accent); }
.option {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%;
  padding: 14px 16px; text-align: left; border-radius: var(--radius);
  border: 1.5px solid var(--border); background: var(--surface);
}
.option:hover { border-color: var(--accent); }
.option.selected { border-color: var(--accent); background: var(--accent-soft); }
.day-picker { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 12px; }
.day-toggle {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 0;
  border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface); font-size: 0.7rem; color: var(--text-2);
}
.day-toggle b { font-size: 1rem; color: var(--text); }
.day-toggle.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.day-toggle.on b { color: var(--accent-ink); }
/* Elegir rutina: A (principiante) y B (lista para avanzados) */
.eyebrow { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); }
.eyebrow.accent { color: var(--accent); }
.ob-title { font-size: 2rem; line-height: 1.08; letter-spacing: -0.02em; margin: 6px 0 10px; }
.ob-rec { display: flex; flex-direction: column; min-height: calc(100dvh - 190px); padding-top: 12px; }
.ob-lead { font-size: 1rem; line-height: 1.45; color: var(--text-2); margin: 0 0 24px; }
.ob-stats { display: flex; justify-content: space-between; padding: 16px 0; margin-bottom: 24px;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.ob-stats div:last-child { text-align: right; }
.ob-stats b, .ob-mini b { display: block; font-size: 1.6rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.ob-stats span, .ob-mini span { font-size: 0.62rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); }
.ob-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 12px; }
.ob-week div { text-align: center; }
.ob-week b { display: block; font-size: 0.75rem; font-weight: 600; color: var(--text-3); margin-bottom: 6px; }
.ob-week i { display: block; height: 40px; line-height: 40px; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--border);
  font-style: normal; font-size: 0.62rem; font-weight: 600; color: var(--text); overflow: hidden; }
.ob-week .on b { color: var(--text); }
.ob-week .on i { background: var(--surface-2); box-shadow: none; }
.ob-foot { margin-top: auto; padding-top: 28px; display: flex; flex-direction: column; gap: 2px; }
.ob-foot.sticky { position: sticky; bottom: 0; padding: 20px 0 calc(env(safe-area-inset-bottom) + 8px);
  background: linear-gradient(to bottom, transparent, var(--bg) 30%); }
.btn.lg { min-height: 52px; border-radius: 14px; font-size: 1.05rem; }
.btn.ghost.quiet { color: var(--text-2); font-weight: 500; }
.group-list { background: var(--surface); border-radius: var(--radius); overflow: hidden; margin-bottom: 8px; box-shadow: var(--shadow); }
.ob-item + .ob-item, .group-list > .ob-row + .ob-row { border-top: 1px solid var(--border); }
.ob-row { display: flex; align-items: center; gap: 14px; width: 100%; padding: 13px 16px;
  border: 0; background: none; color: var(--text); text-align: left; }
.ob-row-t { font-size: 1.05rem; font-weight: 500; }
.ob-row-s { font-size: 0.82rem; color: var(--text-3); margin-top: 1px; }
.ob-radio { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--border); position: relative; }
.ob-radio.on { background: var(--accent); border-color: var(--accent); }
.ob-radio.on::after { content: ""; position: absolute; left: 6.5px; top: 3px; width: 5px; height: 10px;
  border: solid var(--accent-ink); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.ob-detail { padding: 0 16px 12px 52px; }
.ob-mini { display: grid; grid-template-columns: repeat(4, 1fr); padding: 12px 0; border-top: 1px solid var(--border); }
.ob-mini b { font-size: 1.15rem; }
.ob-mini span { font-size: 0.55rem; letter-spacing: 0.1em; }
.ob-days { font-size: 0.82rem; color: var(--text-2); margin-bottom: 4px; }
.ob-detail .link { padding: 6px 0; font-size: 0.9rem; }
details.more { margin-top: 12px; }
details.more > summary {
  cursor: pointer; color: var(--accent); font-weight: 600; padding: 10px 4px; list-style: none;
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: '＋ '; }
details.more[open] > summary::before { content: '－ '; }

.segmented.unit-switch { padding: 2px; border-radius: 8px; }
.segmented.unit-switch button { padding: 2px 9px; font-size: 0.75rem; border-radius: 6px; }

/* ---------- v4: guía muscular y vista del plan ---------- */
.thumb {
  width: 64px; height: 64px; flex: none; border-radius: 14px; overflow: hidden;
  background: var(--surface-2); display: grid; place-items: center; border: 0; padding: 0;
}
.thumb svg { width: 100% !important; height: 100% !important; display: block; }
.thumb [data-muscle-map] { width: 100%; height: 100%; display: block; }

.plan-chips .chip { font-size: 0.9rem; padding: 7px 14px; }
.plan-chips .chip .ok { color: var(--good); }
.plan-chips .chip.active .ok { color: inherit; }
.plan-head { display: flex; justify-content: space-between; align-items: baseline; margin: 6px 4px 4px; }
.plan-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2px 12px; }
.plan-item {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 10px 0;
  border: 0; border-bottom: 1px solid var(--border); background: none; text-align: left;
}
.plan-item:last-child { border-bottom: 0; }
.plan-item .name { display: block; }
.plan-item .meta { display: block; color: var(--text-2); font-size: 0.85rem; }
.cta-bar {
  position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 10px);
  margin: 12px 0 4px; z-index: 4;
}
.cta-bar .cta { min-height: 52px; font-size: 1.05rem; border-radius: 14px; box-shadow: 0 6px 18px rgb(0 0 0 / 25%); }
.muscle-guide { background: var(--surface-2); border-radius: var(--radius); padding: 12px 8px 12px; margin-bottom: 4px; }
.muscle-guide .bodies { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; text-align: center; }
.muscle-guide .body-map { max-width: 170px; margin: 0 auto; }
.muscle-guide .cap { font-size: 0.72rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.muscle-guide .legend { display: flex; gap: 16px; justify-content: center; margin: 8px 0; font-size: 0.82rem; color: var(--text-2); }
.sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; vertical-align: -1px; margin-right: 6px; }
.sw-primary { background: #e0302a; }
.sw-secondary { background: #e0302a; opacity: 0.45; }
.tag-primary { background: rgb(224 48 42 / 18%); color: var(--text); }

/* ---------- v5: menú de cuenta y ajustes ---------- */
.profile-btn { position: relative; color: var(--text-2); }
.profile-btn svg { width: 26px; height: 26px; }
.profile-btn .dot {
  position: absolute; top: 7px; right: 7px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg);
}
.avatar {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 0.95rem;
}
.avatar.lg { width: 48px; height: 48px; font-size: 1.3rem; flex: none; }
.sheet-head { gap: 4px; }
.sheet-head h2 { font-size: 1.2rem; }
.back-btn { margin-left: -8px; }
.back-btn svg { width: 26px; height: 26px; }
.account-head { display: flex; align-items: center; gap: 12px; padding: 4px 0 16px; }
.ellipsis { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cloud-card {
  background: var(--accent-soft); border-radius: var(--radius); padding: 16px; margin-bottom: 16px;
}
.cloud-card p { margin: 4px 0 12px; }
.menu-list {
  background: var(--surface-2); border-radius: var(--radius); overflow: hidden; margin-bottom: 14px;
}
.menu-row {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 12px 16px;
  border: 0; border-bottom: 1px solid var(--border); background: none; color: var(--text);
  text-align: left; font-size: 1rem; cursor: pointer;
}
.menu-row:last-child { border-bottom: 0; }
.menu-row:active { background: var(--border); }
.menu-row .muted { font-size: 0.95rem; }
.menu-row .chev { color: var(--text-3); font-size: 1.3rem; line-height: 1; }
.row-help { display: block; margin-top: 1px; }
.check-mark { color: var(--accent); font-weight: 700; }
.switch {
  position: relative; flex: none; width: 46px; height: 28px; border-radius: 14px;
  background: var(--border); transition: background 0.2s;
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 30%); transition: transform 0.2s;
}
.switch.on { background: var(--good); }
.switch.on::after { transform: translateX(18px); }
.login-links { text-align: center; margin-top: 12px; color: var(--text-2); font-size: 0.92rem; }
.login-links p { margin: 10px 0 0; }
.link { border: 0; background: none; padding: 4px; color: var(--accent); font-weight: 600; cursor: pointer; }

/* ---------- v6: terminar entrenamiento y resumen ---------- */
.finish-btn { min-height: 54px; margin-top: 12px; font-size: 1.05rem; border-radius: 14px; }
.danger-row { color: var(--danger); }
body.no-scroll { overflow: hidden; }
.celebrate {
  position: fixed; inset: 0; z-index: 100; overflow-y: auto; background: var(--bg);
  padding: calc(env(safe-area-inset-top) + 20px) 16px calc(env(safe-area-inset-bottom) + 20px);
  animation: win-in 0.3s ease-out;
}
@keyframes win-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.win { max-width: 460px; margin: 0 auto; text-align: center; position: relative; z-index: 1; }
.win-title { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; margin: 8px 0 2px; }
.win-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 20px 0 10px; }
.win-stat {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}

.win-stat b { font-size: 1.6rem; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.win-stat span:last-child { font-size: 0.78rem; color: var(--text-2); }

.win-week {
  display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin: 12px 0;
}
.win-week .dots { display: inline-flex; gap: 6px; }
.win-week .dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--border); }
.win-week .dots i.on { background: var(--gold); }

.win-done { min-height: 54px; font-size: 1.05rem; border-radius: 14px; }
@media (prefers-reduced-motion: reduce) {
  .celebrate { animation: none; }
}

/* ---------- v7: sesión en modo enfoque ---------- */
body.in-session .topbar, body.in-session .tabbar { display: none; }
body.in-session { padding-bottom: 16px; }
body.in-session main { padding-top: calc(env(safe-area-inset-top) + 8px); }
.session-bar { display: flex; align-items: center; gap: 8px; padding: 6px 0 12px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); font-weight: 600; font-variant-numeric: tabular-nums;
}
.pill svg { width: 18px; height: 18px; }
.pill.pill-input { width: auto; min-height: 40px; font-size: 0.9rem; }
.pill-btn { border-radius: 999px; min-height: 40px; padding: 0 18px; }
.rail {
  display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x proximity; padding: 2px 2px 12px;
  margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.stage { padding-top: 4px; min-height: 50vh; }
.stage-head { display: flex; align-items: flex-start; gap: 4px; margin-top: 2px; }
.stage-head h2 { font-size: 1.45rem; line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
.stage-sub { color: var(--text-2); margin: 2px 0 10px; }
.last-line { font-size: 0.85rem; color: var(--text-2); margin-bottom: 8px; }
.set-grid { display: grid; gap: 8px; margin: 12px 0 8px; }
.set-labels, .set-row { display: grid; grid-template-columns: 44px 1fr 1fr 44px; gap: 8px; align-items: center; }
.set-grid.with-effort .set-labels, .set-grid.with-effort .set-row { grid-template-columns: 44px 1fr 1fr 56px 44px; }
.set-labels { font-size: 0.78rem; color: var(--text-3); padding: 0 2px; }
.set-labels span { text-align: center; }
.set-labels span:first-child { text-align: center; }
.unit-label { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.set-n {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); font-weight: 700; color: var(--text-2);
}
.pill-input {
  width: 100%; min-height: 44px; border-radius: 999px; border: 1.5px solid transparent; background: var(--surface-2);
  text-align: center; font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; padding: 6px 8px;
}
.pill-input:focus { border-color: var(--accent); outline: none; }
.pill-input::placeholder { color: var(--text-3); font-weight: 500; }
.small-input { font-size: 0.95rem; }
.set-check {
  width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--border); background: transparent;
  color: var(--text-3); display: grid; place-items: center; padding: 0;
}
.set-check svg { width: 22px; height: 22px; }
.set-row.next .set-n { background: var(--accent-soft); color: var(--text); }
.set-row.done .set-n, .set-row.done .pill-input { background: var(--good-soft); color: var(--text); }
.set-row.done .set-check { background: var(--good); border-color: var(--good); color: #fff; }
.set-actions { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.add-set { display: inline-flex; align-items: center; gap: 10px; border: 0; background: none; color: var(--accent); font-weight: 600; padding: 4px 0; }

.session-cta {
  position: sticky; bottom: calc(env(safe-area-inset-bottom) + 12px); margin-top: 20px; z-index: 4;
}
.session-btn { min-height: 56px; border-radius: 999px; font-size: 1.05rem; box-shadow: 0 8px 24px rgb(0 0 0 / 30%); }
.segmented.unit-switch { vertical-align: middle; }
/* Ajustes de la sesión: las píldoras deben ganar al estilo general de los campos numéricos. */
.set-row .pill-input, .session-bar .pill-input {
  border-radius: 999px; border: 1.5px solid transparent; background: var(--surface-2);
  min-height: 46px; padding: 6px 4px; font-size: 1rem;
}
.set-row .pill-input:focus { border-color: var(--accent); }
.set-row.done .pill-input { background: var(--good-soft); }
.set-actions { flex-wrap: wrap; row-gap: 4px; }
.set-actions .link, .add-set { white-space: nowrap; font-size: 0.95rem; }
.set-actions .link { padding: 6px 4px; }
.last-line { overflow-wrap: anywhere; }
.session-bar .pill-btn { border-radius: 999px; }

/* ---------- v8: buscador arriba, variantes y series de aproximación ---------- */
.sheet.sheet-top { margin: 0 auto auto; border-radius: 0 0 20px 20px; max-height: 100dvh; }
.sheet.sheet-top .sheet-inner { padding-top: calc(env(safe-area-inset-top) + 12px); }
@media (min-width: 700px) { .sheet.sheet-top { margin: 40px auto auto; border-radius: 20px; } }
.pick-results { overflow-y: auto; overscroll-behavior: contain; max-height: 50vh; }
.variant-list { display: grid; gap: 10px; }
.variant {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 10px 14px 10px 10px; text-align: left;
  border: 1.5px solid var(--border); border-radius: var(--radius); background: var(--surface-2); color: var(--text);
}
.variant:hover { border-color: var(--accent); }
.variant b, .variant .muted { display: block; }
.variant .chev { color: var(--text-3); font-size: 1.3rem; }
.warm-toggle {
  display: flex; align-items: center; gap: 10px; width: 100%; margin: 10px 0 2px; padding: 10px 14px;
  border: 0; border-radius: var(--radius); background: var(--surface-2); color: var(--text); text-align: left; font-size: 0.95rem;
}
.set-row.warm .set-n { background: transparent; border: 1.5px dashed var(--border); color: var(--text-3); font-size: 0.9rem; }
.set-row.warm .pill-input { background: transparent; border: 1.5px dashed var(--border); }
.set-row.warm.done .pill-input, .set-row.warm.done .set-n { border-style: solid; border-color: var(--good); background: transparent; }
.warm-actions { display: flex; gap: 12px; justify-content: flex-end; margin: -2px 0 6px; font-size: 0.9rem; }
.set-n small { font-size: 0.7rem; margin-left: 1px; color: var(--text-3); font-weight: 700; }
.set-row.side-end { margin-bottom: 6px; }
.set-row[class*="side"] { }
.set-n { display: flex; align-items: center; justify-content: center; gap: 1px; }
.toggles { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 2px; }
.toggle-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font-size: 0.88rem; font-weight: 600;
}
.toggle-chip.on { color: var(--text); }
.switch.sm { width: 34px; height: 20px; border-radius: 10px; }
.switch.sm::after { top: 2px; left: 2px; width: 16px; height: 16px; }
.switch.sm.on::after { transform: translateX(14px); }
button.set-n { border: 0; padding: 0; cursor: pointer; font: inherit; font-weight: 700; }
.set-row.warm button.set-n { border: 1.5px dashed var(--border); }
/* El buscador ocupa la pantalla desde arriba: el teclado nunca tapa la búsqueda ni los primeros resultados. */
.sheet.sheet-top { height: auto; max-height: calc(var(--vvh, 100dvh)); }

/* Durante la sesión los avisos van abajo, sobre el botón principal, para no tapar el carrusel. */


/* v9: "última vez" compacto */
.last-line { font-size: 0.85rem; color: var(--text-2); margin: 0 0 4px; }
.last-line b { color: var(--text); font-weight: 600; }
.last-label {
  display: inline-block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-3); margin-right: 4px;
}

/* Contador de series compacto y botón de nota */
.set-actions { gap: 10px; margin-top: 10px; }
.stepper-label { font-size: 0.9rem; color: var(--text-2); font-weight: 600; }
.stepper { display: inline-flex; align-items: center; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface-2); }
.step-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--surface); color: var(--accent);
  font-size: 1.4rem; line-height: 1; font-weight: 700; display: grid; place-items: center; box-shadow: var(--shadow);
}
.step-btn:disabled { color: var(--text-3); opacity: 0.5; box-shadow: none; }
.step-count { min-width: 28px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Ajustes con sesión iniciada: acciones de datos discretas al final */
.data-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; padding: 0 4px; }
.data-links .link { font-size: 0.9rem; font-weight: 500; }
.data-links .link.danger { color: var(--danger); }

/* ---------- Mi plan ---------- */

.win-week .dots { display: inline-flex; gap: 6px; }

.plan-day {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; min-height: 64px;
  border: 0; border-bottom: 1px solid var(--border); background: none; color: inherit; font: inherit; text-align: left;
}
.plan-day:last-child { border-bottom: 0; }
button.plan-day { cursor: pointer; }
button.plan-day:active { background: var(--surface-2); }
.plan-day[data-past] { opacity: 0.55; }

.vol-row { display: grid; grid-template-columns: 104px 1fr auto; align-items: center; gap: 10px; padding: 6px 0; }
.vol-name { font-size: 0.88rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vz { display: block; font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.vz.low { color: #d08a00; }
.vz.high { color: var(--danger); }
.vol-bar { position: relative; height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.vol-band { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--good) 22%, transparent); }
.vol-plan { position: absolute; left: 0; top: 3px; bottom: 3px; border-radius: 999px; background: color-mix(in srgb, var(--text-3) 45%, transparent); }
.vol-done { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: var(--accent); }
.vol-num { font-size: 0.85rem; color: var(--text-3); font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }
.vol-num b { color: var(--text); }
.vol-legend { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; line-height: 1.35; }
.lg-band { flex: none; width: 14px; height: 10px; margin-top: 3px; border-radius: 3px; background: color-mix(in srgb, var(--good) 35%, transparent); }

/* ---------- Resumen final (estilo limpio) ---------- */
.celebrate { padding-bottom: calc(env(safe-area-inset-bottom) + 96px); }
.win-glow {
  position: fixed; left: 0; right: 0; top: 0; height: 55vh; pointer-events: none; z-index: 0;
  background: radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, #22b14c 26%, transparent), transparent 70%);
}
.win-check {
  width: 92px; height: 92px; margin: 18px auto 14px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, #22b14c 20%, transparent);
  animation: check-pop 0.45s cubic-bezier(.2,1.4,.4,1) both;
}
.win-check span { width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center; background: #22b14c; box-shadow: 0 0 32px color-mix(in srgb, #22b14c 55%, transparent); }
.win-check svg { width: 34px; height: 34px; fill: #fff; }
@keyframes check-pop { from { transform: scale(0.4); opacity: 0; } to { transform: none; opacity: 1; } }
.win-title { font-size: clamp(1.25rem, 6vw, 1.55rem); margin: 0 0 2px; white-space: nowrap; }
.win-sub { color: var(--text-3); font-size: 0.92rem; }
.win-stats { margin: 22px 0 12px; }
.win-stat { gap: 3px; padding: 14px 4px 12px; border-radius: 18px; border-color: transparent; background: var(--surface-2); }
.win-stat svg { width: 20px; height: 20px; fill: var(--text); margin-bottom: 4px; }
.win-stat b { font-size: 1.05rem; letter-spacing: -0.01em; white-space: nowrap; }
.win-stat span:last-child { font-size: 0.78rem; color: var(--text-3); }

.win-list { text-align: left; }
.win-ex { display: flex; align-items: center; gap: 14px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.win-ex:last-child { border-bottom: 0; }
.win-ex .thumb { width: 56px; height: 56px; flex: none; border-radius: 14px; overflow: hidden; background: var(--surface-2); }
.win-ex .name { display: block; font-weight: 500; }
.win-ex .meta { display: block; font-size: 0.85rem; color: var(--text-3); margin-top: 2px; }
.win-pr { font-size: 0.85rem; }
.win-week { border-radius: 18px; border-color: transparent; background: var(--surface-2); margin-top: 18px; }

.win-foot {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 2; padding: 12px 16px calc(env(safe-area-inset-bottom) + 12px);
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.win-foot { display: flex; gap: 10px; justify-content: center; }
.win-foot .win-done { max-width: 400px; margin: 0; min-height: 54px; }

@media (prefers-reduced-motion: reduce) { .win-check { animation: none; } }

/* ---------- Progreso: analíticas ---------- */
.range-tabs { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; margin-bottom: 12px; }
.an-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.an-tile {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
.an-tile b { font-size: 1.15rem; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; white-space: nowrap; }
.an-tile span { font-size: 0.68rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; }
.an-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 14px 14px; margin-bottom: 14px; }
.an-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; border-bottom: 1px solid var(--border); margin: 0 -14px 10px; padding: 0 14px; }
.an-head h3 { margin: 0; font-size: 1rem; font-weight: 600; color: var(--text-2); }
.info-btn {
  width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--accent); background: none; color: var(--accent);
  font: italic 700 0.8rem/1 Georgia, serif; display: grid; place-items: center; cursor: pointer; padding: 0;
}
.segmented.sm button { padding: 5px 14px; font-size: 0.85rem; }
.ex-spark { padding: 4px 0 10px; border-bottom: 1px solid var(--border); }
.ex-spark:last-of-type { border-bottom: 0; }
.ex-spark-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px; width: 100%;
  border: 0; background: none; color: var(--text); font: inherit; padding: 6px 0 4px; text-align: left; cursor: pointer;
}
.ex-spark-head span { font-size: 0.95rem; }
.ex-spark-head b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ex-spark-head small { color: var(--text-3); font-weight: 500; }
.spark-box { position: relative; height: 130px; }

/* ---------- Descanso entre series ---------- */
.rest-bar {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px; padding: 8px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: 0 8px 24px rgb(0 0 0 / 25%);
}
.rest-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent-soft); transition: width 1s linear; z-index: 0; }
.rest-bar > *:not(.rest-fill) { position: relative; z-index: 1; }
.rest-time { flex: 1; display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.rest-time small { font-size: 0.7rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; }
.rest-time b { font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.rest-adj {
  width: 52px; height: 44px; border-radius: 999px; border: 0; background: var(--surface-2); color: var(--text);
  font-weight: 700; font-size: 0.9rem; font-variant-numeric: tabular-nums;
}
.rest-skip { height: 44px; padding: 0 16px; border-radius: 999px; border: 0; background: none; color: var(--accent); font-weight: 700; }
.up-line { font-size: 0.85rem; font-weight: 700; color: var(--good); margin: 2px 0 4px; }
.up-line span { font-weight: 500; color: var(--text-3); }

/* ---------- Fase 2: configuración rápida ---------- */
.ob-gender { display: grid; grid-template-columns: 1fr 1fr; width: 100%; margin-bottom: 8px; }
.ob-gender button { padding: 12px; font-size: 1rem; }
.ob-note { margin: 4px 4px 12px; }
.code-btn { margin-top: 4px; }
.code-input { text-align: center; font-size: 1.4rem; letter-spacing: 0.3em; font-variant-numeric: tabular-nums; }
.install-card { position: relative; padding-right: 44px; }
.install-card p { margin: 4px 0 8px; }
.install-x { position: absolute; top: 6px; right: 6px; }
.install-steps { margin: 0; padding-left: 20px; line-height: 1.7; }
.inline-ico { width: 18px; height: 18px; vertical-align: -3px; fill: var(--accent); }
.empty-progress { text-align: center; padding: 28px 20px; }
.empty-progress .ep-icon { width: 56px; height: 56px; margin: 0 auto 10px; border-radius: 50%; background: var(--accent-soft); display: grid; place-items: center; }
.empty-progress .ep-icon svg { width: 28px; height: 28px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico-trophy { width: 1.05em; height: 1.05em; vertical-align: -0.16em; fill: none; stroke: var(--gold); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.empty-progress p { margin: 6px 0 16px; }

/* Invitación a crear cuenta tras el primer entrenamiento */
.win-save {
  text-align: left; margin: 16px 0 4px; padding: 16px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.win-save .ws-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.win-save .ws-ico { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); display: grid; place-items: center; }
.win-save .ws-ico svg { width: 22px; height: 22px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.win-save b { font-size: 1rem; }
.win-save p { margin: 2px 0 0; font-size: 0.9rem; line-height: 1.35; color: var(--text-2); }
.win-save .row { gap: 8px; }

/* ---------- Cabecera centrada en las 3 pestañas ---------- */
.topbar { justify-content: center; padding-top: calc(env(safe-area-inset-top) + 22px); padding-bottom: 14px; min-height: 64px; }
.topbar h1 { font-size: 1.25rem; font-weight: 700; text-align: center; }
.topbar .profile-btn { position: absolute; right: 12px; bottom: 8px; }

/* ---------- Mi plan (opción B) ---------- */
.plan-hero { text-align: center; padding: 22px 16px 16px; }
.plan-hero .ring {
  --p: 0%; width: 136px; height: 136px; margin: 0 auto 10px; border-radius: 50%;
  background: conic-gradient(var(--good) 0 var(--p), var(--surface-2) var(--p) 100%);
  display: grid; place-items: center;
}
.plan-hero .ring > div {
  width: 110px; height: 110px; border-radius: 50%; background: var(--surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1;
}
.plan-hero .ring b { font-size: 2rem; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.plan-hero .ring small { font-size: 0.78rem; color: var(--text-3); }
.plan-routine { font-size: 0.92rem; color: var(--text-2); }
.plan-routine .link { padding: 0 2px; }
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-top: 16px; }
.wk {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0;
  border: 0; background: none; color: inherit; font: inherit;
}
button.wk { cursor: pointer; }
.wk small { font-size: 0.72rem; color: var(--text-3); font-weight: 600; }
.wk span {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  font-size: 0.85rem; font-weight: 600; color: var(--text-3); font-variant-numeric: tabular-nums;
}
.wk.planned span { background: var(--surface-2); color: var(--text); }
.wk.missed span { background: var(--surface-2); color: var(--text-3); text-decoration: line-through; }
.wk.done span { background: var(--good); }
.wk.done svg { width: 18px; height: 18px; fill: #fff; }
.wk.today span { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.next-card {
  display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 12px; padding: 14px 18px;
  border: 0; border-radius: 18px; background: var(--accent); color: var(--accent-ink); font: inherit; text-align: left; cursor: pointer;
}
.next-card small { display: block; font-size: 0.8rem; opacity: 0.85; }
.next-card b { display: block; font-size: 1.1rem; }
.next-chev { font-size: 1.6rem; line-height: 1; }
.next-card.done { background: var(--good-soft); color: var(--text); cursor: default; }
.next-card.neutral { background: var(--surface); border: 1px solid var(--border); color: var(--text); cursor: default; }
.plan-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pt {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; min-height: 84px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; color: inherit; font: inherit; text-align: left;
}
button.pt { cursor: pointer; }
button.pt:active { background: var(--surface-2); }
.pt small { font-size: 0.72rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.pt small em { font-style: normal; color: var(--accent); text-transform: none; }
.pt b { font-size: 1rem; }
.pt-state { font-size: 0.8rem; color: var(--text-3); display: inline-flex; align-items: center; gap: 4px; }
.pt-state svg { width: 14px; height: 14px; fill: currentColor; }
.pt-state.ok { color: var(--good); font-weight: 700; }
.pt-state.today { color: var(--accent); font-weight: 700; }
.pt.done { background: var(--good-soft); border-color: transparent; }
.pt.missed { opacity: 0.6; }
.pt.is-today:not(.done) { border: 2px solid var(--accent); padding: 11px 13px; }
.vol-acc { margin: 14px 0; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; }
.vol-acc summary {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px; list-style: none; cursor: pointer; font-weight: 600;
}
.vol-acc summary::-webkit-details-marker { display: none; }
.acc-chev { transition: transform 0.2s; color: var(--text-3); }
.vol-acc[open] .acc-chev { transform: rotate(180deg); }
.vol-body { padding: 0 16px 14px; }

/* ---------- Resumen: compartir como protagonista ---------- */
.share-cta {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 56px; margin: 18px 0 6px;
  border: 0; border-radius: 16px; background: var(--text); color: var(--bg); font: inherit; font-size: 1.05rem; font-weight: 700; cursor: pointer;
  box-shadow: 0 8px 24px rgb(0 0 0 / 18%);
}
.share-cta svg { width: 22px; height: 22px; fill: currentColor; }
.share-cta:active { transform: scale(0.98); }
.win-list { margin-top: 18px; }
.win-ex { gap: 12px; padding: 13px 4px; font-size: 0.95rem; font-weight: 600; }
.win-ex-val { color: var(--text-3); font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.win-foot .win-done { background: var(--surface-2); border-color: transparent; color: var(--text-2); font-weight: 600; max-width: 460px; }

/* ---------- Hoja de compartir ---------- */

.share-stage { display: flex; justify-content: center; margin: 16px 0 10px; }
.share-frame {
  position: relative; height: min(46vh, 400px); aspect-ratio: 9 / 16; border-radius: 18px; overflow: hidden;
  background: #0b0b0c; box-shadow: 0 16px 44px rgb(0 0 0 / 35%); touch-action: pan-y;
}
.share-frame.checker { background: conic-gradient(#2a2a2c 25%, #1f1f21 0 50%, #2a2a2c 0 75%, #1f1f21 0) 0 0 / 16px 16px; }
.share-frame.checker.light { background: conic-gradient(#f2f2f4 25%, #e2e2e6 0 50%, #f2f2f4 0 75%, #e2e2e6 0) 0 0 / 16px 16px; }
.share-frame img { width: 100%; height: 100%; display: block; object-fit: cover; transition: opacity 0.2s; }
.share-frame.loading img { opacity: 0.35; }
.share-spin {
  position: absolute; left: 50%; top: 50%; width: 28px; height: 28px; margin: -14px 0 0 -14px; border-radius: 50%;
  border: 3px solid rgb(255 255 255 / 25%); border-top-color: #fff; animation: spin 0.8s linear infinite; display: none;
}
.share-frame.loading .share-spin { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.share-hint { text-align: center; min-height: 1.4em; margin: 8px 12px 4px; }
.share-acts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 6px 0 4px; text-align: center; }
.share-acts > * {
  display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; background: none; color: var(--text-2);
  font: inherit; font-size: 0.8rem; font-weight: 500; cursor: pointer; padding: 0;
}
.share-acts .ic { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text); }
.share-acts .ic.p { background: var(--text); color: var(--bg); }
.share-acts svg { width: 24px; height: 24px; fill: currentColor; }
.ink-dot { width: 24px; height: 24px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px rgb(128 128 128 / 55%); transition: background 0.2s; }
.ink-dot.white { background: #fff; }
.ink-dot.black { background: #111; }
.bg-dot { width: 24px; height: 24px; border-radius: 7px; box-shadow: inset 0 0 0 1.5px rgb(128 128 128 / 55%); }
.bg-dot.none { background: conic-gradient(#bbb 25%, #fff 0 50%, #bbb 0 75%, #fff 0) 0 0 / 8px 8px; }
.bg-dot.dark { background: linear-gradient(#3a3f46, #15171a); }
.bg-dot.light { background: linear-gradient(#f5f5f7, #d9d9de); }

/* ---------- Resumen v2: chips, botón de compartir y ejercicios plegables ---------- */
.win-chips { display: flex; justify-content: center; gap: 8px; margin: 4px 0 2px; }
.win-chip {
  display: inline-flex; align-items: baseline; gap: 5px; padding: 7px 14px; border-radius: 999px;
  background: var(--surface-2); color: var(--text); font-size: 0.95rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.win-chip small { font-size: 0.8rem; font-weight: 500; color: var(--text-3); }
.win-chip.up { color: var(--good); }
.win-chip.gold { background: color-mix(in srgb, var(--gold) 16%, var(--surface-2)); }

.share-cta {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 14px; width: 100%;
  height: auto; min-height: 92px; margin: 18px 0 8px; padding: 12px 14px 12px 12px; text-align: left;
  border-radius: 22px; background: linear-gradient(135deg, #e0344a 0%, #b5102a 55%, #7d0a1d 100%); color: #fff;
  box-shadow: 0 14px 34px color-mix(in srgb, #c8102e 38%, transparent), inset 0 1px 0 rgb(255 255 255 / 18%);
}
.share-cta::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, rgb(255 255 255 / 22%) 45%, transparent 60%);
  transform: translateX(-100%); animation: sc-shine 2.8s ease-in-out 0.8s 2;
}
@keyframes sc-shine { to { transform: translateX(100%); } }
.sc-thumb {
  flex: none; width: 42px; height: 75px; border-radius: 8px; overflow: hidden; background: #0b0b0c;
  transform: rotate(-6deg); box-shadow: 0 6px 14px rgb(0 0 0 / 35%), 0 0 0 1.5px rgb(255 255 255 / 55%);
  opacity: 0; transition: opacity 0.3s;
}
.sc-thumb.ready { opacity: 1; }
.sc-thumb img { width: 100%; height: 100%; display: block; object-fit: cover; }
.sc-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.sc-text b { font-size: 1.08rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
.sc-text small { font-size: 0.82rem; font-weight: 500; opacity: 0.85; }
.sc-go {
  flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; color: #b5102a; box-shadow: 0 4px 10px rgb(0 0 0 / 20%);
}
.sc-go svg { width: 20px; height: 20px; fill: currentColor; }
.share-cta:active { transform: scale(0.98); }
@media (prefers-reduced-motion: reduce) { .share-cta::after { animation: none; } }

.win-exs { margin-top: 10px; text-align: left; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); }
.win-exs summary { display: flex; align-items: center; gap: 10px; padding: 14px 16px; list-style: none; cursor: pointer; font-weight: 600; }
.win-exs summary::-webkit-details-marker { display: none; }
.win-exs[open] .acc-chev { transform: rotate(180deg); }
.win-exs .win-list { margin: 0; padding: 0 16px 6px; }
.win-exs .win-ex { padding: 11px 0; font-size: 0.92rem; }

/* Vista previa interactiva de la imagen para compartir */
.share-frame { touch-action: none; user-select: none; -webkit-user-select: none; }
.sf-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.share-frame .sf-sticker { position: absolute; width: auto; height: auto; object-fit: fill; cursor: grab; -webkit-user-drag: none; }
.sf-guide { position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: #f6dc97; opacity: 0; transition: opacity 0.15s; pointer-events: none; }
.sf-guide.on { opacity: 0.9; }
.sf-align {
  position: absolute; top: 50%; left: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; background: rgb(0 0 0 / 45%);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); z-index: 2; pointer-events: none; opacity: 0;
}
.sf-align.on { animation: sf-align-pop 0.9s ease both; }
@keyframes sf-align-pop { 0% { opacity: 0; transform: scale(0.8); } 15%, 60% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1); } }
.sf-align svg { width: 26px; height: 26px; fill: currentColor; }

/* Controles compactos estilo iPhone: cápsulas de opción (Aproximación, Por lado) y contador de series */
.toggles { gap: 6px; margin: 8px 0 2px; }
.toggle-chip {
  gap: 4px; padding: 5px 12px; border: 0; background: var(--surface-2); color: var(--text-2);
  font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: background 0.15s, color 0.15s;
}
.toggle-chip.on { background: var(--accent-soft); color: var(--accent); }
.chip-mark { font-weight: 700; }
.stepper-label { font-size: 0.95rem; color: var(--text); font-weight: 600; }
.stepper-label .step-count { min-width: 0; }
.stepper { gap: 0; padding: 0; border-radius: 9px; background: var(--surface-2); }
.step-btn {
  width: 46px; height: 32px; border-radius: 0; background: none; box-shadow: none;
  color: var(--text); font-size: 1.25rem; font-weight: 400;
}
.step-btn + .step-btn { border-left: 1px solid var(--border); }
.step-btn:disabled { color: var(--text-3); opacity: 0.45; }
.stage textarea.note { margin: 6px 0 2px; }

/* Carrusel del entreno (opción C, 26-09-2026): tarjetas pequeñas en color, solo la actual grande
   con borde carmesí; las pendientes algo transparentes y las hechas con un check verde en la esquina. */
.rail { align-items: flex-end; gap: 8px; }
.rail-item {
  position: relative; flex: none; width: 52px; height: 78px; border-radius: 14px; padding: 0; overflow: hidden;
  background: var(--surface); border: 0;
  scroll-snap-align: center; cursor: pointer; transition: width 0.2s, height 0.2s, opacity 0.2s;
}
.rail-item.active { width: 72px; height: 108px; border-radius: 16px; }
/* Hechos y pendientes, igual de suaves; el check verde de los hechos queda nítido encima. */
.rail-item:not(.active) [data-muscle-map] { opacity: 0.6; }
.rail-item [data-muscle-map] { display: block; width: 100%; height: 100%; }
.rail-item svg { width: 100% !important; height: 100% !important; }
.rail-item:not(.rail-add)::after { content: ''; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px var(--border); pointer-events: none; }
.rail-item.active::after { box-shadow: inset 0 0 0 2px var(--accent); }
.rail-check {
  position: absolute; right: 4px; bottom: 4px; z-index: 2; width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center; background: var(--good); color: #fff; font-size: 0.65rem; font-weight: 800;
  box-shadow: 0 0 0 2px var(--surface);
}
.rail-add { display: grid; place-items: center; font-size: 1.5rem; color: var(--text-2); box-shadow: none; border: 1.5px dashed var(--border); background: transparent; }

/* Resumen (26-09-2026): «Listo» en carmesí; compartir pasa a tarjeta neutra, sin brillo animado. */
.win-foot .win-done { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.share-cta {
  min-height: 76px; border-radius: 18px; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.share-cta::after { content: none; animation: none; }
.sc-thumb { width: 34px; height: 60px; transform: rotate(-4deg); box-shadow: 0 3px 8px rgb(0 0 0 / 25%); }
.sc-text b { font-size: 1rem; font-weight: 600; }
.sc-text small { color: var(--text-2); opacity: 1; }
.sc-go { width: 38px; height: 38px; background: var(--accent-soft); color: var(--accent); box-shadow: none; }
.sf-photo[hidden] { display: none; }

/* 26-09-2026: avisos siempre arriba, como una notificación del iPhone (no tapan el descanso). */
.toast { top: calc(env(safe-area-inset-top) + 12px); border-radius: 16px; padding: 12px 18px; font-weight: 500;
  box-shadow: 0 8px 24px rgb(0 0 0 / 22%); text-align: center; }
/* Safari hace zoom si un campo tiene letra de menos de 16 px. */
textarea.note, .small-input, .set-row .small-input, .pill.pill-input, input, select, textarea { font-size: max(16px, 1em); }
.unit-tag { font-size: 0.72rem; font-weight: 600; color: var(--text-3); text-transform: none; }
.menu-title { margin: 4px 4px 6px; font-weight: 600; }
.menu-list + .menu-title { margin-top: 16px; }
.chart-hint { margin: 6px 2px 0; text-align: center; font-size: 0.78rem; }

/* Progreso con color que significa algo (26-09-2026): verde = bien / mejora, ámbar = por debajo. */
.an-delta { display: block; width: fit-content; margin: 5px auto 0; padding: 1px 8px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--surface-2); color: var(--text-3); }
.an-delta.up { background: var(--good-soft); color: var(--good); }
.sw-row { display: grid; grid-template-columns: 76px 1fr 58px; align-items: center; gap: 10px; padding: 6px 0; }
.sw-name { font-size: 0.92rem; }
.sw-track { position: relative; height: 12px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.sw-band { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--good) 14%, transparent);
  border-left: 1.5px solid var(--good); border-right: 1.5px solid var(--good); }
.sw-bar { position: absolute; left: 0; top: 2px; bottom: 2px; border-radius: 4px; background: var(--good); }
.sw-bar.low { background: var(--warn); }
.sw-num { text-align: right; font-size: 0.85rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sw-num b { font-weight: 700; }
.sw-tag { margin-left: 4px; font-size: 0.6rem; font-weight: 700; letter-spacing: 0.08em; color: var(--warn-ink); }
.sw-tag.high { color: var(--text-3); }
.sw-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: 0.75rem; color: var(--text-3); }
.sw-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.ex-spark-head .ex-delta { margin-left: 8px; padding: 1px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 700;
  background: var(--surface-2); color: var(--text-3); white-space: nowrap; }
.ex-spark-head .ex-delta.up { background: var(--good-soft); color: var(--good); }

/* Editor de rutina (26-09-2026): lista del día con miniatura, toque = hoja, ≡ = arrastrar. */
.red-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; }
.red-item { display: flex; align-items: center; border-bottom: 1px solid var(--border); background: var(--surface); }
.red-item.dragging { position: relative; z-index: 2; box-shadow: 0 8px 24px rgb(0 0 0 / 18%); transform: scale(1.02); }
.red-main { flex: 1; display: flex; align-items: center; gap: 14px; min-width: 0; padding: 10px 0 10px 12px; border: 0; background: none; color: inherit; font: inherit; text-align: left; }
.red-main .thumb { width: 52px; height: 52px; border-radius: 12px; }
.red-main .name { display: block; }
.red-main .meta { display: block; color: var(--text-2); font-size: 0.85rem; margin-top: 2px; font-variant-numeric: tabular-nums; }
.red-handle { flex: none; display: grid; place-items: center; width: 48px; align-self: stretch; color: var(--text-3); touch-action: none; cursor: grab; }
.red-handle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.red-add { display: block; width: 100%; padding: 14px; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; text-align: left; }
.red-more { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.red-more > summary { display: flex; align-items: center; padding: 14px 16px; list-style: none; cursor: pointer; font-weight: 600; }
.red-more > summary::-webkit-details-marker { display: none; }
.red-more[open] .acc-chev { transform: rotate(180deg); }
.red-more-body { padding: 0 16px 16px; }
#sheet .menu-row .rex-reps { flex: none; width: 96px; min-height: 36px; text-align: right; border: 0; border-radius: 8px; background: var(--surface); font-weight: 600; color: var(--text); padding: 4px 10px; }
#sheet .menu-row .rex-reps:focus { outline: 2px solid var(--accent); }
.plan-head .link { margin-left: 12px; padding: 0; }
