/* =========================================================
   Tema "Fitness" (estructura de referencia) con la paleta propia:
   Ice White protagonista · Deep Teal para superficies oscuras y texto · Soft Peach como acento.
   Se carga después de app.css y solo redefine tokens y componentes.
   ========================================================= */
:root {
  --font: "Lato", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Lato", ui-sans-serif, system-ui, sans-serif;

  /* Claro (protagonista) */
  --bg: #F4F8FA; --bg2: #FFFFFF; --card: #FFFFFF; --card2: #E8F0F3;
  --line: rgba(15, 61, 71, .08); --line-strong: rgba(15, 61, 71, .18);
  --text: #0F3D47; --muted: #4F7680; --dim: #86A3AB;
  --ink: #0F3D47; --ink-2: #134A56;
  --accent: #F59E7B; --accent-ink: #0F3D47; --accent-hover: #F7B091;
  --peach-text: #B9552E; /* peach oscurecido para texto sobre claro (AA) */
  --sec: #3F7280;
  --shadow: 0 1px 2px rgba(15, 61, 71, .04), 0 12px 32px -18px rgba(15, 61, 71, .28);
  --glass: rgba(15, 61, 71, .55);
  --r: 20px; --r-sm: 12px;
  color-scheme: light;
}

/* Superficies oscuras: mismos componentes, tokens invertidos */
.viewer, .imm, .rest, .pop, body[data-page="entrenar"], .dk {
  --bg: #0F3D47; --bg2: #0C3540; --card: #134A56; --card2: #1B5664;
  --line: rgba(244, 248, 250, .1); --line-strong: rgba(244, 248, 250, .22);
  --text: #F4F8FA; --muted: #9EC0CA; --dim: #6B98A5;
  --accent-ink: #0F3D47; --peach-text: #F59E7B; --sec: #9EC0CA;
  --shadow: 0 18px 40px -26px rgba(0, 0, 0, .7);
  color-scheme: dark;
}
html { background: var(--bg); }
html:has(body[data-page="entrenar"]) { background: #0F3D47; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-feature-settings: normal; }
body[data-page="entrenar"] { background: #0F3D47; }

h1 { font-weight: 900; letter-spacing: -.02em; }
h2 { font-weight: 900; letter-spacing: -.01em; }
h3 { font-weight: 700; color: var(--dim); }
.hero h1 em, .home-head h1 em { font-style: normal; color: inherit; background: linear-gradient(transparent 58%, rgba(245, 158, 123, .55) 58%, rgba(245, 158, 123, .55) 92%, transparent 92%); padding: 0 2px; }
.eyebrow { color: var(--muted); }

/* ---------- Cabecera y pestañas ---------- */
.top { background: rgba(244, 248, 250, .86); border-bottom-color: var(--line); }
.brand { color: var(--ink); }
.brand b { color: var(--peach-text); }
.tabs a { color: var(--muted); }
.tabs a:hover { background: rgba(15, 61, 71, .05); color: var(--ink); }
.tabs a.on { background: var(--ink); color: #F4F8FA; }
.sync, .sync.ok { background: var(--dim); }

/* ---------- Controles ---------- */
.btn { border-color: var(--line); font-weight: 700; }
.btn.primary { background: var(--ink); color: #F4F8FA; box-shadow: 0 12px 24px -14px rgba(15, 61, 71, .7); }
.btn.primary:hover { background: var(--ink-2); }
.btn.outline { border-color: var(--ink); color: var(--ink); }
.btn.outline:hover { background: rgba(15, 61, 71, .06); }
/* En superficies oscuras la acción principal es peach (como el verde de la referencia) */
.viewer .btn.primary, .imm .btn.primary, .rest .btn.primary, body[data-page="entrenar"] .btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 12px 26px -12px rgba(245, 158, 123, .7); }
.imm .btn.outline, body[data-page="entrenar"] .btn.outline { border-color: var(--accent); color: var(--accent); }
.input { background: #fff; }
.viewer .input, body[data-page="entrenar"] .input { background: var(--bg2); }
.input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(15, 61, 71, .12); }
.search .input { background: #fff; border-color: transparent; box-shadow: var(--shadow); min-height: 48px; }
.chip { background: #fff; border-color: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); font-weight: 700; }
.chip.on { background: var(--ink); color: #F4F8FA; box-shadow: none; }
.seg { background: #fff; border-color: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.seg button { font-weight: 700; }
.seg button.on { background: var(--ink); color: #F4F8FA; }
.viewer .seg, .v-bot .seg { background: var(--glass); box-shadow: none; }
.v-bot .seg button.on { background: #F4F8FA; color: var(--ink); }
body[data-page="entrenar"] .seg { background: var(--card); }
body[data-page="entrenar"] .seg button.on { background: #F4F8FA; color: var(--ink); }

.tag { background: var(--card2); color: var(--ink); font-weight: 700; }
.tag.p { background: rgba(245, 158, 123, .2); color: var(--peach-text); }
.tag.s { background: rgba(15, 61, 71, .06); color: var(--muted); }
.tag.home { background: var(--card2); color: var(--ink); }
.tag.warn { color: var(--muted); }
body[data-page="entrenar"] .tag { background: var(--card2); color: var(--text); }
body[data-page="entrenar"] .tag.p { background: rgba(245, 158, 123, .18); color: var(--accent); }

.panel, .rcard, .item, .hrow, .kpi, .setbox { border-color: transparent; box-shadow: var(--shadow); }
body[data-page="entrenar"] .setbox, body[data-page="entrenar"] .panel { border-color: var(--line); }
ol.steps li::before { color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
ol.steps li.on::before { background: var(--accent); color: var(--ink); box-shadow: none; }
ol.steps li.on { background: rgba(245, 158, 123, .12); }
.err { color: var(--text); background: rgba(245, 158, 123, .14); }
.err b { color: var(--peach-text); }
.empty { border-color: var(--line-strong); }
.toast { background: var(--ink); color: #F4F8FA; }
.modal { background: rgba(15, 61, 71, .45); }
.sheet { background: var(--bg); }
.pick.added { background: rgba(245, 158, 123, .2); }
.linkbtn, .sec-more { color: var(--peach-text); }
.count b { color: var(--ink); }

/* ---------- Inicio ---------- */
.home-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin: 4px 0 18px; }
.hello { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.hello i { font-style: normal; font-size: 9px; color: var(--accent); }
.home-head h1 { font-size: clamp(28px, 4vw, 44px); line-height: 1.08; max-width: 18ch; }
.sec { margin-bottom: 26px; }
.sec-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.sec-h h2 { font-size: 19px; }
.sec-h h2 small { font-size: 13px; font-weight: 700; color: var(--dim); margin-left: 6px; }
.sec-more { font-size: 13px; font-weight: 700; }
#all-h { margin-top: 4px; scroll-margin-top: 80px; }

/* Populares: tarjetas oscuras horizontales con play peach */
.pop-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 300px); gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding: 2px 2px 14px; margin: 0 -2px; }
.pop-row::-webkit-scrollbar { display: none; }
.pop { position: relative; height: 176px; border-radius: 22px; overflow: hidden; scroll-snap-align: start; color: var(--text); isolation: isolate;
  background: radial-gradient(70% 90% at 78% 40%, rgba(245, 158, 123, .32), transparent 65%), linear-gradient(135deg, #134A56, #0F3D47 55%, #0A2C34);
  box-shadow: 0 18px 30px -20px rgba(15, 61, 71, .8); transition: transform .4s var(--ease-out); animation: rise .55s var(--ease-out) backwards; animation-delay: calc(var(--i) * 50ms); }
.pop:active { transform: scale(.97); }
.pop-img { position: absolute; right: -8%; top: -4%; height: 112%; width: auto; aspect-ratio: 4 / 5; object-fit: cover; z-index: -1; transition: transform .6s var(--ease-out); }
.pop:hover .pop-img { transform: scale(1.05); }
.pop-t { position: absolute; left: 16px; top: 16px; bottom: 14px; right: 44%; display: flex; flex-direction: column; justify-content: space-between; }
.pop-t h3 { font-size: 18px; font-weight: 900; line-height: 1.15; letter-spacing: -.01em; color: #F4F8FA; text-transform: none; }
.pop-m { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.pop-m span { font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 999px; background: rgba(244, 248, 250, .14); color: #F4F8FA; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.pop-play { position: absolute; right: 12px; bottom: 12px; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--ink); box-shadow: 0 8px 18px -6px rgba(245, 158, 123, .8); transition: transform .35s var(--ease-spring); }
.pop-play svg { width: 18px; height: 18px; fill: currentColor; stroke: none; margin-left: 2px; }
.pop:hover .pop-play { transform: scale(1.1); }

/* Plan de hoy: filas blancas con barra de progreso peach */
.plan { display: flex; flex-direction: column; gap: 10px; }
.plan-row { position: relative; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px; border-radius: 18px; background: #fff; box-shadow: var(--shadow); transition: transform .3s var(--ease-out); }
.plan-row:active { transform: scale(.98); }
.plan-row img.t3 { width: 64px; height: 64px; border-radius: 14px; }
.plan-b { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding-right: 86px; }
.plan-b b { font-size: 15px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-b span { font-size: 12px; color: var(--muted); }
.plan-bar { position: relative; height: 16px; border-radius: 99px; background: var(--card2); margin-top: 5px; max-width: 220px; overflow: hidden; }
.plan-bar i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--accent); }
.plan-bar em { position: absolute; left: 8px; top: 0; line-height: 16px; font-size: 10px; font-style: normal; font-weight: 900; color: var(--ink); }
.plan-lvl { position: absolute; right: 10px; top: 10px; font-size: 10px; font-weight: 700; padding: 4px 9px; border-radius: 999px; background: var(--ink); color: #F4F8FA; }
.plan-more { text-align: center; font-size: 13px; font-weight: 700; color: var(--muted); padding: 6px; }

/* ---------- Biblioteca: tarjeta blanca con baldosa oscura ---------- */
.card { background: #fff; border: 0; box-shadow: var(--shadow); border-radius: 22px; }
.card:hover { box-shadow: 0 22px 40px -22px rgba(15, 61, 71, .45); }
.card::after { background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, .25) 50%, transparent 70%); }
.card .ph { margin: 6px 6px 0; border-radius: 17px; background: radial-gradient(70% 55% at 50% 42%, rgba(245, 158, 123, .3), transparent 70%), linear-gradient(180deg, #134A56, #0F3D47 70%, #0C3540); }
.card .ph::after { display: none; }
.card .body { margin-top: 0; padding: 10px 12px 13px; }
.card .mus { color: var(--peach-text); }
.card .name { color: var(--ink); font-weight: 900; }
.card .eq { color: var(--dim); }
.card .lvl { background: rgba(244, 248, 250, .16); border-color: rgba(244, 248, 250, .2); color: #F4F8FA; }

/* Miniaturas 3D en listas: baldosa oscura */
img.t3 { background: radial-gradient(70% 60% at 50% 45%, rgba(245, 158, 123, .28), transparent 70%), linear-gradient(180deg, #134A56, #0F3D47); }

/* ---------- Rutinas e historial ---------- */
.rcard { background: #fff; }
.rcard .stats b { color: var(--ink); }
.vb-g.alt i { background: var(--ink); }
.week { max-width: 460px; gap: 8px; }
.week div { font-weight: 700; color: var(--muted); text-transform: capitalize; }
.week i { height: 40px; border-radius: 14px; background: #fff; border: 0; box-shadow: var(--shadow); }
.week i.on { background: var(--accent); box-shadow: 0 10px 18px -10px rgba(245, 158, 123, .9); }
.hdate b { color: var(--ink); }

/* ---------- Visor (siempre oscuro) ---------- */
.viewer { border-radius: 24px; box-shadow: 0 24px 50px -30px rgba(15, 61, 71, .8); }
.v-tools .seg { background: #fff; }
body[data-page="entrenar"] .v-tools .seg { background: var(--card); }

/* ---------- Entrenar (oscuro, como "Workout" de la referencia) ---------- */
body[data-page="entrenar"] .trainbar .btn { background: var(--card); color: var(--text); border-color: var(--line); }
body[data-page="entrenar"] .progress { background: var(--card); }
body[data-page="entrenar"] .go-bar { background: rgba(15, 61, 71, .9); }
body[data-page="entrenar"] .kgw-ticks i.M::before { background: #F4F8FA; }

/* ---------- Móvil ---------- */
@media (max-width: 760px) {
  .top { background: var(--bg); }
  /* Barra inferior: píldora Deep Teal, activa en peach con texto; el resto solo icono */
  .tabs { background: var(--ink); border: 0; border-radius: 30px; padding: 7px; box-shadow: 0 18px 36px -16px rgba(15, 61, 71, .75); left: 16px; right: 16px; }
  .tabs a { flex: 1 1 0; flex-direction: row; gap: 8px; min-height: 50px; color: #9EC0CA; border-radius: 24px; transition: flex-grow .45s var(--ease-out), background .3s, color .3s; }
  .tabs a span { display: none; font-size: 13px; font-weight: 900; }
  .tabs a.on { flex-grow: 2.2; background: var(--accent); color: var(--ink); }
  .tabs a.on span { display: inline; }
  .tabs a:hover { background: transparent; color: #F4F8FA; }
  .tabs a.on:hover { background: var(--accent); color: var(--ink); }

  body.deep .cta-bar, body[data-page="rutina"] .add-row { background: rgba(244, 248, 250, .88); border-top-color: var(--line); }
  body.deep .back { background: rgba(15, 61, 71, .55); }
  .viewer { border-radius: 0; }
}
@media (max-width: 640px) {
  .home-head h1 { font-size: 28px; }
  .pop-row { margin: 0 -16px; padding: 2px 16px 14px; scroll-padding-inline: 16px; grid-auto-columns: 78%; }
  .card { border-radius: 20px; }
  .card .ph { margin: 5px 5px 0; border-radius: 16px; }
  .card .body { padding: 9px 10px 11px; }
  body.deep .detail .viewer::after { background: linear-gradient(transparent, rgba(15, 61, 71, .0)); }
  .detail .v-tools .seg { background: rgba(255, 255, 255, .9); box-shadow: var(--shadow); }
}

/* Ajustes */
.pop-img { right: -22%; top: -26%; height: 160%; }
.sec-h h2 small { display: block; margin: 2px 0 0; }
.rcard .thumbs img.t3, .item img.t3, .pick img.t3, .next img.t3, .plan-row img.t3 {
  background: radial-gradient(70% 60% at 50% 45%, rgba(245, 158, 123, .28), transparent 70%), linear-gradient(180deg, #134A56, #0F3D47);
}

/* ---------- Actividad (historial) ---------- */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; max-width: 520px; margin-bottom: 20px; }
.week > div { text-align: center; }
.week i { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 58px; margin: 0; border-radius: 16px; background: #fff; box-shadow: var(--shadow); color: var(--ink); font-style: normal; }
.week i small { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--dim); }
.week i b { font-size: 16px; font-weight: 900; }
.week i.on { background: var(--accent); }
.week i.on small { color: var(--ink); }
.week .today i { background: var(--ink); color: #F4F8FA; box-shadow: 0 10px 20px -10px rgba(15, 61, 71, .8); }
.week .today i small { color: #9EC0CA; }
.week .today i.on { box-shadow: 0 0 0 3px var(--accent), 0 10px 20px -10px rgba(15, 61, 71, .8); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { border-radius: 20px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); background: #fff; }
.tile span { font-size: 12px; font-weight: 700; color: var(--muted); }
.tile b { font-size: 30px; font-weight: 900; color: var(--ink); line-height: 1.1; }
.tile b small { font-size: 14px; }
.tile small { font-size: 12px; color: var(--muted); }
.tile.t-a { background: var(--ink); } .tile.t-a span, .tile.t-a small { color: #9EC0CA; } .tile.t-a b { color: #F4F8FA; }
.tile.t-b { background: #FDE6DB; }
.tile.t-c { background: #E3EEF1; }
.tile.t-d { background: #FFF; box-shadow: inset 0 0 0 2px rgba(245, 158, 123, .5), var(--shadow); }
.tile.wide { grid-column: 1 / -1; }
.tile-bars { display: flex; align-items: flex-end; gap: 8px; height: 56px; margin-top: 8px; }
.tile-bars i { flex: 1; border-radius: 6px; background: var(--accent); transform-origin: bottom; animation: bar-up .7s var(--ease-out) backwards; }
@media (max-width: 640px) { .tiles { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) {
  .plan { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plan-more { grid-column: 1 / -1; }
}

/* ---------- Logotipo "FIT from home" (una línea) ---------- */
.brand { font-family: var(--font); letter-spacing: 0; gap: 10px; }
.brand .wm { display: inline-flex; align-items: center; gap: 9px; white-space: nowrap; line-height: 1; }
.brand .wm b { margin: 0; font-weight: 900; font-size: 19px; letter-spacing: .14em; color: var(--ink); }
.brand .wm i { width: 1px; height: 16px; background: var(--line-strong); }
.brand .wm em { font-style: normal; font-weight: 400; font-size: 16px; letter-spacing: .04em; color: var(--peach-text); }
@media (max-width: 360px) { .brand .wm b { font-size: 17px; } .brand .wm em { font-size: 14px; } }

/* ---------- Entrenador por voz ---------- */
.tb-r { display: flex; align-items: center; gap: 8px; }
.cb-av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 14px; background: var(--accent); color: var(--ink); }
.coach-btn { position: relative; }
.coach-btn.on .cb-av { box-shadow: 0 0 0 0 rgba(245, 158, 123, .6); animation: cb-pulse 2.4s ease-out infinite; }
@keyframes cb-pulse { 0% { box-shadow: 0 0 0 0 rgba(245, 158, 123, .55); } 70%, 100% { box-shadow: 0 0 0 10px rgba(245, 158, 123, 0); } }
body[data-page="entrenar"] .coach-btn { background: var(--card); border-color: var(--line); color: var(--text); }

/* Subtítulo flotante con lo que dice el entrenador */
.coach-cap { position: fixed; z-index: 45; left: 50%; top: calc(64px + env(safe-area-inset-top)); width: max-content; max-width: min(92vw, 520px);
  display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border-radius: 999px;
  background: rgba(244, 248, 250, .96); color: #0F3D47; box-shadow: 0 16px 34px -14px rgba(0, 0, 0, .6);
  transform: translate(-50%, -14px) scale(.96); opacity: 0; pointer-events: none; transition: opacity .3s var(--ease-out), transform .45s var(--ease-spring); }
.coach-cap.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.coach-cap .cc-av { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; background: var(--accent); color: #0F3D47; }
.coach-cap .cc-t { font-size: 14px; font-weight: 700; line-height: 1.3; }
.coach-cap .cc-t b { display: block; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: #4F7680; }
.rest ~ .coach-cap, .coach-cap { }

/* Hoja de ajustes */
.coach-sheet { width: min(520px, 100%); }
.coach-sheet .pad { gap: 4px; overflow: auto; }
.cs-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cs-row span { display: flex; flex-direction: column; gap: 2px; }
.cs-row small { color: var(--muted); font-size: 12px; }
.cs-coaches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cs-c { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; border-radius: 18px; border: 0; background: #fff; box-shadow: inset 0 0 0 1.5px var(--line); color: var(--ink); transition: box-shadow .25s, transform .2s var(--ease-spring); }
.cs-c .cb-av { width: 40px; height: 40px; font-size: 17px; background: var(--card2); color: var(--ink); }
.cs-c small { font-size: 11px; color: var(--muted); }
.cs-c.on { box-shadow: inset 0 0 0 2px var(--ink), var(--shadow); }
.cs-c.on .cb-av { background: var(--accent); }
.cs-c:active { transform: scale(.96); }
.switch { appearance: none; -webkit-appearance: none; flex: none; width: 50px; height: 30px; border-radius: 99px; background: var(--card2); position: relative; cursor: pointer; transition: background .25s; box-shadow: inset 0 0 0 1px var(--line); }
.switch::after { content: ''; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(15, 61, 71, .3); transition: transform .3s var(--ease-spring); }
.switch:checked { background: var(--ink); }
.switch:checked::after { transform: translateX(20px); background: var(--accent); }
.cs-c { background: var(--card); color: var(--text); }
.cs-c .cb-av { background: var(--card2); color: var(--text); }
.cs-c.on { box-shadow: inset 0 0 0 2px var(--accent), var(--shadow); }
.cs-c.on .cb-av { color: #0F3D47; }

/* ---------- Marca "from home" ---------- */
.brand .wm { gap: 0; align-items: baseline; }
.brand .wm em { font-style: normal; font-weight: 400; font-size: 20px; letter-spacing: -.01em; color: var(--ink); margin-right: 5px; }
.brand .wm b { font-weight: 900; font-size: 20px; letter-spacing: -.02em; color: var(--ink); }
.brand .wm i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 3px; align-self: flex-end; margin-bottom: 4px; }

/* ---------- Mapa de calor muscular: rojo = principal, amarillo = secundario ---------- */
:root { --prim: #FF3B2F; --sec: #FFC23D; --heat-p-text: #C8261C; --heat-s-text: #7A5800; }
.tag.p { background: rgba(255, 59, 47, .12); color: var(--heat-p-text); }
.tag.s { background: rgba(255, 194, 61, .22); color: var(--heat-s-text); }
.viewer .tag.p, body[data-page="entrenar"] .tag.p { background: rgba(255, 59, 47, .2); color: #FF8A80; }
.card .mus { color: var(--heat-p-text); }
.legend { color: #F4F8FA; background: rgba(6, 30, 36, .6); }
.viewer, .imm, body[data-page="entrenar"] { --prim: #FF3B2F; --sec: #FFC23D; }

/* ---------- Cuenta ---------- */
.acct-btn { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--ink); display: grid; place-items: center; margin-left: 4px; }
.acct-btn[hidden] { display: none; }
.acct-btn svg { width: 19px; height: 19px; }
.acct-btn.in { border: 0; background: transparent; }
.acct-av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; background: var(--accent); color: var(--ink); }
.acct-av.big { width: 52px; height: 52px; font-size: 22px; flex: none; }
.acct-sheet { width: min(440px, 100%); }
.acct-sheet form.pad { gap: 12px; }
.acct-l { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.acct-l .input { min-height: 48px; font-size: 16px; }
.acct-err { margin: 0; color: var(--heat-p-text); font-size: 13px; font-weight: 700; }
.acct-row { display: flex; align-items: center; gap: 14px; }
.acct-row div { display: flex; flex-direction: column; gap: 2px; }
.acct-danger { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 12px; }
.acct-danger summary { cursor: pointer; color: var(--heat-p-text); font-weight: 700; font-size: 13px; }
.sync.dev { background: var(--dim); opacity: .5; }

/* =========================================================
   Bienvenida, iniciar sesión y crear cuenta (diseño en Figma: "from home · Onboarding y cuentas")
   ========================================================= */
body.bare .top, body.bare .tabs { display: none !important; }
body.bare main { padding: 0; max-width: none; }

/* ---------- Bienvenida ---------- */
.onb { position: relative; min-height: 100dvh; display: flex; flex-direction: column; background: #0F3D47; overflow: hidden; }
.onb-stage { position: relative; flex: 1 1 auto; min-height: 50dvh;
  background: radial-gradient(42% 38% at 50% 48%, rgba(245, 158, 123, .38), transparent 70%), linear-gradient(180deg, #134A56, #061E24); }
.onb-brand { position: absolute; left: 24px; top: calc(22px + env(safe-area-inset-top)); z-index: 2; display: flex; align-items: baseline; gap: 4px; color: #F4F8FA; font-size: 20px; }
.onb-brand b { font-weight: 900; }
.onb-brand i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); align-self: center; }
.onb-fig { position: absolute; left: 50%; top: 52%; height: min(78%, 520px); aspect-ratio: 4 / 5; transform: translate(-50%, -50%) scale(.94); opacity: 0; transition: opacity .55s var(--ease-out), transform .7s var(--ease-out); }
.onb-fig.on { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
.onb-sheet { position: relative; z-index: 2; margin-top: -32px; background: var(--bg); border-radius: 32px 32px 0 0; padding: 28px 24px calc(24px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px; max-width: 560px; width: 100%; align-self: center; }
.onb-sheet.swap .onb-h, .onb-sheet.swap .onb-p { animation: rise .5s var(--ease-out) backwards; }
.onb-sheet.swap .onb-p { animation-delay: .06s; }
.onb-dots { display: flex; gap: 6px; }
.onb-dots i { width: 8px; height: 8px; border-radius: 4px; background: rgba(15, 61, 71, .18); transition: width .4s var(--ease-out), background .3s; }
.onb-dots i.on { width: 26px; background: var(--accent); }
.onb-h { font-size: clamp(30px, 8vw, 40px); line-height: 1.08; letter-spacing: -.02em; }
.onb-h em { font-style: normal; color: var(--peach-text); }
.onb-p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.45; min-height: 3em; }
.onb-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.onb-actions .btn { width: 100%; border-radius: 18px; }
.onb-link { border: 0; background: none; color: var(--ink); font-size: 14px; font-weight: 700; padding: 8px; }
.onb-link b { font-weight: 900; }

/* ---------- Entrar / crear cuenta ---------- */
.auth { max-width: 440px; margin: 0 auto; min-height: 100dvh; padding: calc(18px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; animation: rise .5s var(--ease-out) backwards; }
.auth-back { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 1px solid var(--line); color: var(--ink); flex: none; }
.auth-back svg { width: 22px; height: 22px; }
.auth-card { position: relative; height: 150px; border-radius: 24px; overflow: hidden; padding: 24px 20px; color: #F4F8FA;
  background: radial-gradient(60% 80% at 80% 50%, rgba(245, 158, 123, .35), transparent 70%), linear-gradient(135deg, #134A56, #0A2C34); }
.auth-card b { position: relative; z-index: 1; font-size: 20px; font-weight: 900; line-height: 1.12; }
.auth-card img { position: absolute; right: -6%; top: -18%; height: 140%; aspect-ratio: 4 / 5; }
.auth h1 { font-size: 30px; letter-spacing: -.02em; margin-top: 6px; }
.auth-sub { margin: -6px 0 4px; color: var(--muted); font-size: 15px; line-height: 1.45; }
.auth-f { display: flex; flex-direction: column; gap: 14px; flex: 1; }
.auth-l { display: flex; flex-direction: column; gap: 7px; font-size: 13px; font-weight: 700; color: var(--muted); }
.auth-l .input { min-height: 52px; border-radius: 16px; font-size: 16px; background: #fff; border-color: var(--line); padding: 12px 16px; }
.auth-pw { position: relative; display: block; }
.auth-pw .input { padding-right: 52px; }
.auth-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; background: none; color: var(--dim); display: grid; place-items: center; }
.auth-meter { display: flex; align-items: center; gap: 6px; margin-top: -4px; }
.auth-meter i { width: 56px; height: 5px; border-radius: 3px; background: rgba(15, 61, 71, .12); transition: background .3s; }
.auth-meter i.on { background: var(--accent); }
.auth-meter span { font-size: 12px; font-weight: 700; color: var(--muted); margin-left: 4px; }
.auth-terms { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.auth-terms input { width: 22px; height: 22px; accent-color: #0F3D47; flex: none; }
.auth-terms a, .auth-swap a { color: var(--peach-text); font-weight: 900; }
.auth-err { margin: 0; padding: 10px 14px; border-radius: 12px; background: rgba(255, 59, 47, .1); color: var(--heat-p-text); font-size: 13px; font-weight: 700; }
.auth-actions { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 12px; }
.auth-actions .btn { width: 100%; border-radius: 18px; }
.auth-skip { background: transparent; border: 1.5px solid var(--ink); color: var(--ink); }
.auth-swap { margin: 4px 0 0; text-align: center; font-size: 14px; color: var(--muted); }
.legal p { color: var(--muted); line-height: 1.55; margin: 0; }
.legal b { color: var(--ink); }

@media (min-width: 900px) {
  .onb { flex-direction: row; }
  .onb-stage { min-height: 100dvh; }
  .onb-sheet { margin: 0; border-radius: 0; justify-content: center; padding: 48px; max-width: 520px; }
  .auth { justify-content: center; }
  .auth-actions { margin-top: 12px; }
}
