/* Maratón — estilos. Pensado primero para el móvil, con contraste alto para
   leerlo en la calle y botones grandes para usarlo con una mano. */

:root {
  color-scheme: light;
  --fondo: #f4f4f1;
  --superficie: #ffffff;
  --superficie-2: #ecebe6;
  --texto: #0b0b0b;
  --texto-2: #45443f;
  --texto-3: #6b6a64;
  --borde: #d6d5cd;
  --borde-fuerte: #9b9a92;
  --acento: #c7360a;
  --acento-hover: #a92d07;
  --acento-texto: #ffffff;
  --acento-suave: #fde4d9;
  --ok: #0a7d0a;
  --ok-fondo: #dff3df;
  --parcial: #8a5a00;
  --parcial-fondo: #fff0cc;
  --mal: #c22d2d;
  --mal-fondo: #fbe1e1;
  --neutro-fondo: #ecebe6;
  --aviso-marca: #e79a00;
  --sobre-estado: #ffffff;
  --rejilla: #e1e0d9;
  --eje: #c3c2b7;
  --sombra: 0 1px 2px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.05);
  --radio: 16px;
  --radio-s: 10px;
  --nav-alto: 72px;
  --fuente: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --fondo: #0d0d0d;
    --superficie: #1a1a19;
    --superficie-2: #262624;
    --texto: #f5f4f0;
    --texto-2: #cfcec5;
    --texto-3: #a3a29a;
    --borde: #34342f;
    --borde-fuerte: #6b6a64;
    --acento: #ff6b2c;
    --acento-hover: #ff8550;
    --acento-texto: #0b0b0b;
    --acento-suave: #3a1d10;
    --ok: #3ccf3c;
    --ok-fondo: #12301a;
    --parcial: #ffc23d;
    --parcial-fondo: #3a2d0c;
    --mal: #ff6b6b;
    --mal-fondo: #3d1515;
    --neutro-fondo: #262624;
    --aviso-marca: #ffb21f;
    --sobre-estado: #0b0b0b;
    --rejilla: #2c2c2a;
    --eje: #45453f;
    --sombra: none;
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --fondo: #0d0d0d;
  --superficie: #1a1a19;
  --superficie-2: #262624;
  --texto: #f5f4f0;
  --texto-2: #cfcec5;
  --texto-3: #a3a29a;
  --borde: #34342f;
  --borde-fuerte: #6b6a64;
  --acento: #ff6b2c;
  --acento-hover: #ff8550;
  --acento-texto: #0b0b0b;
  --acento-suave: #3a1d10;
  --ok: #3ccf3c;
  --ok-fondo: #12301a;
  --parcial: #ffc23d;
  --parcial-fondo: #3a2d0c;
  --mal: #ff6b6b;
  --mal-fondo: #3d1515;
  --neutro-fondo: #262624;
  --aviso-marca: #ffb21f;
  --sobre-estado: #0b0b0b;
  --rejilla: #2c2c2a;
  --eje: #45453f;
  --sombra: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font-family: var(--fuente);
  font-size: 17px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 750; }
h3 { font-size: 1.02rem; font-weight: 700; }
p { margin: 0; }
a { color: var(--acento); font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--acento); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Estructura ---------- */
.app { min-height: 100dvh; }
.cargando { padding: 40vh 16px 0; text-align: center; color: var(--texto-3); }
.marco { display: flex; flex-direction: column; min-height: 100dvh; }
.cabecera {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--fondo) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--borde);
}
.cabecera h1 { font-size: 1.25rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contenido {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--nav-alto) + 32px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 16px;
}

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  background: var(--superficie);
  border-top: 1px solid var(--borde);
}
.nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 58px; border-radius: 12px;
  color: var(--texto-3); text-decoration: none; font-size: 0.78rem; font-weight: 650;
}
.nav a svg { width: 26px; height: 26px; }
.nav a[aria-current='page'] { color: var(--texto); }
.nav a[aria-current='page'] svg { color: var(--acento); }
.nav a.nav-mas { color: var(--acento-texto); }
.nav a.nav-mas span.circulo {
  display: grid; place-items: center;
  width: 58px; height: 58px; margin-top: -22px;
  border-radius: 50%; background: var(--acento);
  box-shadow: 0 4px 14px rgba(199, 54, 10, 0.35);
}
.nav a.nav-mas svg { width: 30px; height: 30px; color: var(--acento-texto); }

@media (min-width: 900px) {
  .marco { display: grid; grid-template-columns: 220px 1fr; grid-template-rows: auto 1fr; }
  .cabecera { grid-column: 2; }
  .contenido { grid-column: 2; max-width: 1040px; padding-bottom: 48px; }
  .nav {
    grid-row: 1 / span 2; grid-column: 1;
    position: sticky; top: 0; height: 100dvh;
    display: flex; flex-direction: column; gap: 4px; padding: 20px 12px;
    border-top: 0; border-right: 1px solid var(--borde);
  }
  .nav::before { content: 'Maratón'; font-weight: 850; font-size: 1.35rem; padding: 4px 12px 16px; color: var(--texto); }
  .nav a { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 12px; font-size: 1rem; min-height: 50px; }
  .nav a[aria-current='page'] { background: var(--superficie-2); }
  .nav a.nav-mas { order: -1; background: var(--acento); color: var(--acento-texto); margin-bottom: 12px; }
  .nav a.nav-mas span.circulo { width: auto; height: auto; margin: 0; background: none; box-shadow: none; }
  .nav a.nav-mas svg { width: 24px; height: 24px; }
  .rejilla-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
}

/* ---------- Tarjetas y texto ---------- */
.tarjeta {
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 16px;
  box-shadow: var(--sombra);
  display: flex; flex-direction: column; gap: 12px;
  min-width: 0;
}
.tarjeta.acento { border-color: var(--acento); border-width: 2px; }
.tarjeta-cabecera { display: flex; align-items: center; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
.etiqueta { font-size: 0.78rem; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; color: var(--texto-3); }
.secundario { color: var(--texto-2); }
.terciario { color: var(--texto-3); font-size: 0.92rem; }
.pequeno { font-size: 0.88rem; }
.numeros { font-variant-numeric: tabular-nums; }
.hero { font-size: 3.4rem; font-weight: 850; line-height: 1; letter-spacing: -0.03em; }
.hero small { font-size: 1.1rem; font-weight: 700; letter-spacing: 0; color: var(--texto-2); margin-left: 6px; }
.dato-grande { font-size: 1.9rem; font-weight: 800; line-height: 1.05; letter-spacing: -0.02em; }
.fila { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fila.entre { justify-content: space-between; }
.pila { display: flex; flex-direction: column; gap: 8px; }
.vacio { color: var(--texto-3); text-align: center; padding: 16px 8px; }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 900px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); padding: 14px; min-width: 0; }
.tile .valor { font-size: 1.6rem; font-weight: 800; line-height: 1.1; margin-top: 4px; overflow-wrap: anywhere; }
.tile .detalle { color: var(--texto-3); font-size: 0.86rem; margin-top: 2px; }

/* ---------- Botones ---------- */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px; padding: 0 20px;
  border-radius: 14px; border: 2px solid transparent;
  background: var(--acento); color: var(--acento-texto);
  font-weight: 750; font-size: 1.05rem; text-decoration: none;
  cursor: pointer; touch-action: manipulation; user-select: none;
}
.boton:hover { background: var(--acento-hover); }
.boton:active { transform: translateY(1px); }
.boton:disabled { opacity: 0.55; cursor: not-allowed; }
.boton.ancho { width: 100%; }
.boton.secundario { background: var(--superficie); color: var(--texto); border-color: var(--borde-fuerte); }
.boton.secundario:hover { background: var(--superficie-2); }
.boton.fantasma { background: transparent; color: var(--texto); border-color: transparent; min-height: 48px; padding: 0 12px; }
.boton.fantasma:hover { background: var(--superficie-2); }
.boton.peligro { background: transparent; color: var(--mal); border-color: var(--mal); }
.boton.peligro:hover { background: var(--mal-fondo); }
.boton.pequeno { min-height: 44px; font-size: 0.95rem; padding: 0 14px; border-radius: 12px; }
.boton svg { width: 22px; height: 22px; flex: none; }
.icono-boton {
  display: grid; place-items: center; width: 48px; height: 48px; flex: none;
  border-radius: 12px; border: 0; background: transparent; color: var(--texto); cursor: pointer;
}
.icono-boton:hover { background: var(--superficie-2); }
.icono-boton svg { width: 26px; height: 26px; }

.barra-guardar {
  position: sticky; bottom: calc(var(--nav-alto) + env(safe-area-inset-bottom) + 8px);
  z-index: 10; padding-top: 8px;
  background: linear-gradient(to top, var(--fondo) 70%, transparent);
}
@media (min-width: 900px) { .barra-guardar { bottom: 16px; } }

/* ---------- Formularios ---------- */
.campo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.campo > span, .campo > label, .leyenda { font-weight: 700; font-size: 0.95rem; color: var(--texto-2); }
.entrada, select.entrada, textarea.entrada {
  width: 100%; min-height: 56px; padding: 12px 14px;
  border: 2px solid var(--borde-fuerte); border-radius: 12px;
  background: var(--superficie); color: var(--texto);
  font-size: 1.1rem;
}
textarea.entrada { min-height: 120px; resize: vertical; line-height: 1.4; }
textarea.entrada.codigo { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 0.85rem; min-height: 220px; }
.entrada:focus { border-color: var(--acento); outline: none; box-shadow: 0 0 0 3px var(--acento-suave); }
.entrada.enorme { font-size: 2.1rem; font-weight: 800; min-height: 72px; text-align: center; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.entrada.enorme::placeholder { color: var(--texto-3); font-weight: 600; opacity: 0.6; }
.ayuda { font-size: 0.86rem; color: var(--texto-3); }
.dos-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.error-campo { color: var(--mal); font-weight: 650; font-size: 0.95rem; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.cuadricula { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 420px) { .chips.cuadricula { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.chip {
  min-height: 48px; padding: 0 14px;
  border-radius: 12px; border: 2px solid var(--borde-fuerte);
  background: var(--superficie); color: var(--texto);
  font-weight: 700; font-size: 0.98rem; cursor: pointer; touch-action: manipulation;
}
.chip[aria-pressed='true'] { background: var(--texto); color: var(--fondo); border-color: var(--texto); }
.chip.pequeno { min-height: 40px; font-size: 0.9rem; padding: 0 12px; }

.rpe { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
@media (min-width: 520px) { .rpe { grid-template-columns: repeat(10, 1fr); } }
.rpe button {
  min-height: 52px; border-radius: 12px; border: 2px solid var(--borde-fuerte);
  background: var(--superficie); font-weight: 800; font-size: 1.15rem; cursor: pointer; touch-action: manipulation;
}
.rpe button[aria-pressed='true'] { background: var(--acento); color: var(--acento-texto); border-color: var(--acento); }

.lectura-ritmo {
  display: flex; align-items: baseline; justify-content: center; gap: 8px;
  padding: 10px; border-radius: 12px; background: var(--superficie-2);
}
.lectura-ritmo strong { font-size: 1.7rem; font-weight: 850; font-variant-numeric: tabular-nums; }

.pestanas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; background: var(--superficie-2); border-radius: 14px; }
.pestanas a, .pestanas button {
  display: grid; place-items: center; min-height: 48px; border-radius: 11px; border: 0;
  background: transparent; color: var(--texto-2); font-weight: 750; text-decoration: none; cursor: pointer;
}
.pestanas [aria-current='page'], .pestanas [aria-selected='true'] { background: var(--superficie); color: var(--texto); box-shadow: var(--sombra); }

/* Ejercicios de fuerza */
.ejercicio { display: grid; grid-template-columns: 1fr 1fr 1fr 48px; gap: 8px; align-items: end; padding: 12px 0; border-top: 1px solid var(--borde); }
.ejercicio:first-child { border-top: 0; padding-top: 0; }
.ejercicio .nombre { grid-column: 1 / -1; }
.ejercicio .entrada { min-height: 52px; font-size: 1.05rem; padding: 10px; }
.ejercicio .ultimo { grid-column: 1 / -1; font-size: 0.85rem; color: var(--texto-3); margin-top: -4px; }
.ejercicio label span { font-size: 0.8rem; font-weight: 700; color: var(--texto-3); }

/* ---------- Estados del plan ---------- */
.estado {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 32px; padding: 0 10px; border-radius: 999px;
  font-size: 0.86rem; font-weight: 750; white-space: nowrap;
  border: 0; cursor: default;
}
button.estado { cursor: pointer; }
.estado svg { width: 16px; height: 16px; }
.estado.hecho { background: var(--ok-fondo); color: var(--ok); }
.estado.parcial { background: var(--parcial-fondo); color: var(--parcial); }
.estado.saltado { background: var(--mal-fondo); color: var(--mal); }
.estado.pendiente, .estado.sin_datos { background: var(--neutro-fondo); color: var(--texto-2); }
.estado.descanso { background: transparent; color: var(--texto-3); border: 1px dashed var(--borde-fuerte); }

.tipo {
  display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; border-radius: 8px;
  background: var(--superficie-2); color: var(--texto); font-size: 0.85rem; font-weight: 750;
}
.tipo.carrera { background: var(--acento-suave); color: var(--texto); }

.semana-dias { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.semana-dias .dia {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 0; border-radius: 12px; background: var(--superficie-2); min-width: 0;
}
.semana-dias .dia.hoy { outline: 2px solid var(--texto); }
.semana-dias .dia b { font-size: 0.85rem; }
.semana-dias .dia .marca { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.semana-dias .dia .marca svg { width: 16px; height: 16px; }
.semana-dias .dia .km { font-size: 0.74rem; color: var(--texto-2); font-variant-numeric: tabular-nums; }
.marca.hecho { background: var(--ok); color: var(--sobre-estado); }
.marca.parcial { background: var(--parcial); color: var(--sobre-estado); }
.marca.saltado { background: var(--mal); color: var(--sobre-estado); }
.marca.pendiente { border: 2px solid var(--borde-fuerte); }
.marca.descanso { color: var(--texto-3); }
.marca.libre { color: var(--texto-3); }

.progreso { height: 12px; border-radius: 999px; background: var(--acento-suave); overflow: hidden; }
.progreso > div { height: 100%; border-radius: 999px; background: var(--acento); }
.progreso.gastada > div { background: var(--mal); }

.aviso {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px; border-radius: var(--radio);
  background: var(--parcial-fondo); color: var(--texto); border: 1px solid color-mix(in srgb, var(--parcial) 40%, transparent);
}
.aviso svg { width: 24px; height: 24px; flex: none; color: var(--parcial); margin-top: 1px; }
.aviso.fuerte { background: var(--mal-fondo); border-color: color-mix(in srgb, var(--mal) 40%, transparent); }
.aviso.fuerte svg { color: var(--mal); }
.aviso.info { background: var(--superficie-2); border-color: var(--borde); }
.aviso.info svg { color: var(--texto-2); }
.aviso.ok { background: var(--ok-fondo); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.aviso.ok svg { color: var(--ok); }
.aviso ul { margin: 6px 0 0; padding-left: 20px; }
.aviso li { margin: 4px 0; }

/* ---------- Listas ---------- */
.lista { display: flex; flex-direction: column; }
.lista > * + * { border-top: 1px solid var(--borde); }
.item {
  display: flex; gap: 12px; align-items: center; padding: 12px 0; min-height: 64px;
  color: inherit; text-decoration: none; background: none; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; text-align: left; cursor: pointer;
}
.lista > .item:first-child { border-top: 0; }
.item .cuerpo { flex: 1; min-width: 0; }
.item .titulo { font-weight: 750; }
.item .sub { color: var(--texto-2); font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.item .flecha { color: var(--texto-3); width: 20px; height: 20px; flex: none; }
.item .icono-tipo {
  width: 44px; height: 44px; border-radius: 12px; flex: none; display: grid; place-items: center;
  background: var(--acento-suave); color: var(--acento);
}
.item .icono-tipo.fuerza { background: var(--superficie-2); color: var(--texto); }
.item .icono-tipo svg { width: 24px; height: 24px; }

.sesion-plan { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 10px; align-items: start; padding: 12px 0; }
.sesion-plan .dia-col { font-weight: 800; font-size: 0.9rem; color: var(--texto-2); line-height: 1.2; padding-top: 4px; }
.sesion-plan .dia-col small { display: block; font-weight: 600; color: var(--texto-3); }
.sesion-plan.es-hoy .dia-col { color: var(--acento); }
.sesion-plan .desc { color: var(--texto-2); font-size: 0.92rem; margin-top: 4px; }
.sesion-plan .metas { font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 4px; }

.semana-plan { scroll-margin-top: 84px; }
.semana-plan > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; }
.semana-plan > summary::-webkit-details-marker { display: none; }
.semana-plan > summary .chev { transition: transform 0.15s; width: 20px; height: 20px; color: var(--texto-3); }
.semana-plan[open] > summary .chev { transform: rotate(90deg); }

.menu-estado { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* ---------- Gráficas ---------- */
.grafica { width: 100%; min-height: 180px; position: relative; }
.grafica svg { display: block; width: 100%; overflow: visible; }
.grafica .rejilla line { stroke: var(--rejilla); stroke-width: 1; }
.grafica .base { stroke: var(--eje); stroke-width: 1; }
.grafica text { fill: var(--texto-3); font-size: 12px; font-family: var(--fuente); font-variant-numeric: tabular-nums; }
.grafica text.valor { fill: var(--texto); font-weight: 750; font-size: 12.5px; }
.grafica .barra { fill: var(--acento); }
.grafica .barra.tenue { fill: color-mix(in srgb, var(--acento) 50%, var(--texto-3)); }
.grafica .barra.aviso { fill: var(--aviso-marca); }
.grafica .barra.futura { fill: none; stroke: var(--borde-fuerte); stroke-width: 1.5; stroke-dasharray: 3 3; }
.grafica .objetivo { stroke: var(--texto); stroke-width: 2.5; stroke-linecap: round; }
.grafica .zona { fill: transparent; cursor: pointer; outline: none; }
.grafica .zona:hover, .grafica .zona:focus { fill: color-mix(in srgb, var(--texto) 7%, transparent); }
.grafica .marca-aviso { fill: var(--aviso-marca); stroke: var(--superficie); stroke-width: 2; }
.leyenda-graf { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.86rem; color: var(--texto-2); }
.leyenda-graf span { display: inline-flex; align-items: center; gap: 6px; }
.leyenda-graf i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--acento); }
.leyenda-graf i.sw-aviso { background: var(--aviso-marca); }
.leyenda-graf i.objetivo { height: 3px; border-radius: 2px; background: var(--texto); }
.leyenda-graf i.futura { background: none; border: 1.5px dashed var(--borde-fuerte); }
.leyenda-graf i.tenue { background: color-mix(in srgb, var(--acento) 50%, var(--texto-3)); }
details.tabla > summary { cursor: pointer; color: var(--texto-2); font-weight: 650; font-size: 0.92rem; min-height: 40px; display: flex; align-items: center; }
table.datos { width: 100%; border-collapse: collapse; font-size: 0.92rem; font-variant-numeric: tabular-nums; }
table.datos th, table.datos td { text-align: right; padding: 8px 6px; border-bottom: 1px solid var(--borde); }
table.datos th:first-child, table.datos td:first-child { text-align: left; }
table.datos th { color: var(--texto-3); font-weight: 700; font-size: 0.82rem; }
.tabla-scroll { overflow-x: auto; }

.tooltip {
  position: fixed; z-index: 100; pointer-events: none;
  padding: 8px 10px; border-radius: 10px; max-width: 240px;
  background: var(--texto); color: var(--fondo);
  font-size: 0.88rem; font-weight: 600; line-height: 1.3; box-shadow: 0 4px 18px rgba(0, 0, 0, 0.2);
}

.ritmos { display: flex; flex-direction: column; gap: 10px; }
.ritmos .r { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: baseline; }
.ritmos .r .nom { font-weight: 700; }
.ritmos .r .val { font-weight: 800; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.ritmos .r .det { grid-column: 1 / -1; color: var(--texto-3); font-size: 0.85rem; }

.marcas { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }

pre.prompt {
  white-space: pre-wrap; word-break: break-word; margin: 0;
  max-height: 320px; overflow: auto; padding: 12px; border-radius: 12px;
  background: var(--superficie-2); font-size: 0.82rem; line-height: 1.45;
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
}
.pasos { counter-reset: paso; display: flex; flex-direction: column; gap: 16px; }
.paso { display: grid; grid-template-columns: 36px 1fr; gap: 12px; }
.paso::before {
  counter-increment: paso; content: counter(paso);
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--texto); color: var(--fondo); font-weight: 800;
}
.paso > div { min-width: 0; display: flex; flex-direction: column; gap: 10px; }

.zona-archivo {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  min-height: 180px; padding: 20px; text-align: center;
  border: 2px dashed var(--borde-fuerte); border-radius: var(--radio);
  background: var(--superficie); cursor: pointer;
}
.zona-archivo.encima { border-color: var(--acento); background: var(--acento-suave); }
.zona-archivo svg { width: 40px; height: 40px; color: var(--acento); }

/* ---------- Acceso ---------- */
.acceso { max-width: 440px; margin: 0 auto; padding: calc(32px + env(safe-area-inset-top)) 16px 32px; display: flex; flex-direction: column; gap: 20px; }
.marca-app { display: flex; align-items: center; gap: 12px; }
.marca-app img { width: 56px; height: 56px; border-radius: 14px; }
.marca-app h1 { font-size: 2rem; }

/* ---------- Avisos flotantes ---------- */
.toasts { position: fixed; left: 16px; right: 16px; bottom: calc(var(--nav-alto) + 20px + env(safe-area-inset-bottom)); z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
@media (min-width: 900px) { .toasts { bottom: 24px; left: 240px; } }
.toast {
  pointer-events: auto; max-width: 520px; width: 100%;
  padding: 14px 16px; border-radius: 14px;
  background: var(--texto); color: var(--fondo);
  font-weight: 650; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  animation: entrar 0.18s ease-out;
}
.toast.error { background: var(--mal); color: #fff; }
@keyframes entrar { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } * { transition: none !important; } }

.lista > .etiqueta + .item { border-top: 0; }

/* Ajustes tras revisar las capturas */
.rejilla-2 { display: flex; flex-direction: column; gap: 16px; }
@media (min-width: 900px) { .rejilla-2 { display: grid; grid-template-columns: 1fr 1fr; } }
.acciones-rapidas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.acciones-rapidas .boton { padding: 0 8px; }
.casilla { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.casilla input { width: 26px; height: 26px; flex: none; margin: 0; accent-color: var(--acento); }
.nav .etq-mas { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (min-width: 900px) {
  .nav .etq-mas { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .contenido.estrecho { max-width: 760px; }
}
/* Pestaña activa bien visible en los dos temas; el «hover» solo con ratón (en el móvil se queda pegado). */
.pestanas [aria-current='page'], .pestanas [aria-selected='true'] { background: var(--texto); color: var(--fondo); }
@media (hover: none) {
  .boton:hover { background: var(--acento); }
  .boton.secundario:hover { background: var(--superficie); }
  .boton.fantasma:hover, .boton.peligro:hover { background: transparent; }
}

/* ===================== v2: fuerza, carrera y cardio al mismo nivel ===================== */
/* Un color por tipo de entreno (validado para daltonismo en claro y oscuro):
   fuerza azul, correr naranja, el resto del cardio aguamarina. El texto nunca
   va en esos colores: siempre en los de texto. */
:root { --s-fuerza: #2a78d6; --s-correr: #eb6834; --s-cardio: #1baf7a; --s-otra: #8a56d0; --dock-alto: 250px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) { --s-fuerza: #3987e5; --s-correr: #d95926; --s-cardio: #199e70; --s-otra: #9d6fe0; } }
:root[data-theme='dark'] { --s-fuerza: #3987e5; --s-correr: #d95926; --s-cardio: #199e70; --s-otra: #9d6fe0; }
.c-fuerza { --s: var(--s-fuerza); }
.c-correr { --s: var(--s-correr); }
.c-cardio { --s: var(--s-cardio); }
.c-otra { --s: var(--s-otra); }
.item .icono-tipo.c-fuerza, .item .icono-tipo.c-correr, .item .icono-tipo.c-cardio, .item .icono-tipo.c-otra { background: color-mix(in srgb, var(--s) 16%, var(--superficie)); color: var(--texto); }
.item .icono-tipo.c-fuerza svg, .item .icono-tipo.c-correr svg, .item .icono-tipo.c-cardio svg, .item .icono-tipo.c-otra svg { color: var(--s); }
i.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--s); margin-right: 6px; vertical-align: 0; }
h2.seccion { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
h2.seccion svg { width: 22px; height: 22px; color: var(--s-correr); }
.tile .valor small { font-size: 0.9rem; font-weight: 700; color: var(--texto-2); }
.dato-lateral { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; flex: none; }
.dato-lateral b { font-size: 1.1rem; }
.dato-lateral small { font-size: 0.75rem; color: var(--texto-3); }
.tarjeta.compacta { padding: 12px 16px; gap: 6px; }
.enlace-fila { color: inherit; text-decoration: none; font-weight: 500; min-height: 44px; }
.enlace-fila .flecha { width: 18px; height: 18px; color: var(--texto-3); }
button.enlace { background: none; border: 0; padding: 6px 0; color: var(--acento); font-weight: 650; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; min-height: 40px; }
button.enlace svg { width: 18px; height: 18px; }

/* ---------- Empezar ---------- */
.tiles-empezar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile-grande {
  display: flex; align-items: center; gap: 12px; min-height: 76px; padding: 12px 14px;
  border-radius: 14px; border: 2px solid var(--s); background: color-mix(in srgb, var(--s) 12%, var(--superficie));
  color: var(--texto); text-decoration: none; touch-action: manipulation;
}
.tile-grande svg { width: 30px; height: 30px; flex: none; color: var(--s); }
.tile-grande b { display: block; font-size: 1.15rem; font-weight: 800; }
.tile-grande small { display: block; color: var(--texto-2); font-weight: 600; font-size: 0.85rem; }
.tile-grande.activo { background: var(--s); border-color: var(--s); color: #fff; }
.tile-grande.activo svg, .tile-grande.activo small { color: #fff; }
.tile-grande .flecha { margin-left: auto; width: 22px; height: 22px; }
.otros-cardio { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.chip-icono {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 64px; padding: 6px 2px; border-radius: 12px; border: 1px solid var(--borde);
  background: var(--superficie); color: var(--texto); text-decoration: none; font-size: 0.8rem; font-weight: 700; text-align: center;
}
.chip-icono svg { width: 24px; height: 24px; color: var(--s, var(--texto-2)); }
.enlace-chip { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.enlace-chip svg { width: 18px; height: 18px; color: var(--s-fuerza); }
.chips.deportes .chip { display: flex; align-items: center; gap: 8px; justify-content: flex-start; padding: 0 10px; }
.chips.deportes .chip svg { width: 20px; height: 20px; flex: none; }
.chips.desliza { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 2px; }
.chips.desliza .chip { flex: none; }
.chip.radio { display: inline-flex; align-items: center; gap: 6px; }
.chip.radio input { width: 18px; height: 18px; accent-color: var(--acento); margin: 0; }
.chip.radio:has(input:checked) { background: var(--texto); color: var(--fondo); border-color: var(--texto); }
.chip.peligro { color: var(--mal); border-color: var(--mal); }
.chip svg { width: 16px; height: 16px; vertical-align: -3px; }

/* ---------- Semana en Hoy ---------- */
.semana-dias .marcas-dia { display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 26px; }
.semana-dias .punto { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--s); color: #fff; }
.semana-dias .punto svg { width: 14px; height: 14px; }
.semana-dias .punto.nada { background: var(--borde-fuerte); width: 6px; height: 6px; flex: none; margin-top: 9px; }
.semana-dias .mas-n { font-size: 0.72rem; color: var(--texto-2); font-weight: 700; }
.totales-semana { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.totales-semana > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.totales-semana b { font-size: 1.15rem; }
.totales-semana .etiqueta { font-size: 0.7rem; }

/* ---------- Registro de pesas ---------- */
body.en-sesion .nav { display: none; }
body.en-sesion .contenido { padding-bottom: 24px; }
.sesion-barra {
  position: sticky; top: calc(58px + env(safe-area-inset-top)); z-index: 15;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: -16px -16px 0; padding: 8px 16px; background: var(--fondo); border-bottom: 1px solid var(--borde);
}
.sesion-barra svg { width: 18px; height: 18px; vertical-align: -3px; }
.sesion-barra b { font-size: 1.1rem; }
.ejercicio-card { gap: 8px; padding: 14px; }
.ejercicio-card h3 { font-size: 1.1rem; }
.ejercicio-card.en-ss { border-left: 4px solid var(--s-fuerza); }
.tipo.ss { gap: 6px; align-self: flex-start; }
.tipo.ss svg { width: 16px; height: 16px; }
.series { display: flex; flex-direction: column; gap: 4px; }
.serie {
  display: grid; grid-template-columns: 28px 1fr auto 28px; align-items: center; gap: 8px;
  min-height: 48px; padding: 0 10px; border-radius: 10px; border: 2px solid transparent;
  background: var(--superficie-2); color: var(--texto); text-align: left; cursor: pointer; touch-action: manipulation;
}
.serie .n { font-weight: 800; color: var(--texto-3); }
.serie .v { font-weight: 750; font-size: 1.05rem; }
.serie .ok { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; }
.serie.hecha .ok { background: var(--ok); color: var(--sobre-estado); }
.serie.hecha .ok svg { width: 16px; height: 16px; }
.serie.hecha .v { color: var(--texto-2); }
.serie.actual { border-color: var(--s-fuerza); background: color-mix(in srgb, var(--s-fuerza) 12%, var(--superficie)); }
.serie.calent .n { font-size: 0.8rem; }
.menu-ej { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: 6px; border-top: 1px solid var(--borde); }
.hueco-dock { height: calc(var(--dock-alto) + env(safe-area-inset-bottom)); }
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; flex-direction: column; gap: 10px;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--superficie); border-top: 1px solid var(--borde); box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.08);
}
@media (min-width: 900px) { .dock { left: 220px; } .dock > * { max-width: 728px; width: 100%; margin-left: auto; margin-right: auto; } }
.dock-titulo { font-size: 0.98rem; color: var(--texto-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock-titulo b { color: var(--texto); }
.steppers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stepper { display: grid; grid-template-columns: 50px minmax(0, 1fr) 50px; align-items: center; border: 2px solid var(--borde-fuerte); border-radius: 14px; overflow: hidden; background: var(--superficie); }
.stepper button { height: 60px; border: 0; background: var(--superficie-2); color: var(--texto); cursor: pointer; touch-action: manipulation; display: grid; place-items: center; }
.stepper button:active { background: var(--borde); }
.stepper button svg { width: 26px; height: 26px; }
.stepper label { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; }
.stepper input.valor { width: 100%; border: 0; background: transparent; text-align: center; font-size: 1.4rem; letter-spacing: -0.02em; font-weight: 850; padding: 0; line-height: 1.1; }
.stepper input.valor:focus { outline: none; background: var(--acento-suave); }
.stepper label span { font-size: 0.72rem; font-weight: 700; color: var(--texto-3); margin-top: -2px; }
.esfuerzo { display: flex; gap: 6px; align-items: center; overflow-x: auto; scrollbar-width: none; }
.esfuerzo .chip { flex: none; min-width: 44px; padding: 0 8px; }
.fila-dock { display: flex; gap: 8px; align-items: stretch; }
.fila-dock .chip { flex: none; min-height: 60px; }
.boton.grande { min-height: 60px; font-size: 1.15rem; }
.descanso { display: flex; flex-direction: column; gap: 6px; padding: 8px 12px; border-radius: 12px; background: color-mix(in srgb, var(--s-fuerza) 14%, var(--superficie)); }
.descanso b { font-size: 1.3rem; }
.descanso.listo { flex-direction: row; justify-content: space-between; align-items: center; background: var(--ok-fondo); }
.descanso.listo b { font-size: 1rem; }
.barra-desc { height: 6px; border-radius: 999px; background: var(--borde); overflow: hidden; }
.barra-desc > div { height: 100%; background: var(--s-fuerza); border-radius: 999px; transition: width 0.25s linear; }

/* Hoja (selector de ejercicios, final de la sesión) */
.hoja { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, 0.45); display: flex; align-items: flex-end; justify-content: center; }
.hoja-caja {
  width: 100%; max-width: 720px; max-height: 92dvh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  background: var(--fondo); border-radius: 20px 20px 0 0;
}
.hoja-lista .item { min-height: 56px; }

/* ---------- Gráficas de líneas y barras horizontales ---------- */
.grafica .linea { fill: none; stroke: var(--s); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.grafica .punto-final { fill: var(--s); stroke: var(--superficie); stroke-width: 2; }
.leyenda-graf i.raya { width: 16px; height: 3px; border-radius: 2px; background: var(--s); }
.barras-h { display: flex; flex-direction: column; gap: 8px; }
.bh { display: grid; grid-template-columns: 96px 1fr 40px; gap: 10px; align-items: center; outline: none; }
.bh .nom { font-weight: 650; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bh .pista { height: 12px; }
.bh .relleno { display: block; height: 100%; min-width: 2px; border-radius: 0 4px 4px 0; background: var(--s-fuerza); }
.bh .val { text-align: right; font-weight: 750; }
.bh:focus-visible { outline: 3px solid var(--acento); outline-offset: 2px; border-radius: 6px; }

/* ---------- Seguimiento: carrera, molestias, check-in, plan, compartir ---------- */
.chips.tipos-carrera { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.chips.tipos-carrera .chip { padding: 0 6px; }
.chips.sensaciones { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.chips.sensaciones .chip { padding: 0 2px; font-size: 0.9rem; }
.escala { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.escala.larga, .molestia .escala { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.escala button {
  min-height: 48px; border-radius: 12px; border: 2px solid var(--borde-fuerte);
  background: var(--superficie); font-weight: 800; font-size: 1.05rem; cursor: pointer; touch-action: manipulation;
}
.escala button[aria-pressed='true'] { background: var(--texto); color: var(--fondo); border-color: var(--texto); }
.molestia { padding: 12px; border-radius: 12px; background: var(--superficie-2); margin-top: 8px; }
details.mas-datos > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--texto-2); }
.lista-simple { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.relleno.c-correr-relleno { background: var(--s-correr); }
.entrada.fecha-mini { min-height: 40px; width: auto; padding: 4px 8px; font-size: 0.95rem; }
.compartir-sesion { gap: 4px; }
.semana-nav b { font-size: 1.05rem; }
.semana-nav .icono-boton:disabled { opacity: 0.3; }
.diferencias ul { margin-top: 2px; }
.diferencias .etiqueta { margin-top: 8px; }
.tiles-empezar > :only-child { grid-column: 1 / -1; }
a.tarjeta.compacta.enlace-fila { flex-direction: row; align-items: center; justify-content: space-between; text-decoration: none; color: inherit; }
body.en-sesion .toasts { bottom: calc(var(--dock-alto) + 24px + env(safe-area-inset-bottom)); }

/* ---------- Rutinas a medida ---------- */
.rutina-item { gap: 8px; }
.rutina-item .cuerpo-enlace { flex: 1; min-width: 0; display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; min-height: 48px; }
.rutina-item .boton.pequeno { flex: none; }
.dias-rutina { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.dias-rutina .chip { padding: 0; min-height: 48px; font-size: 1.05rem; }
.ej-rutina { gap: 10px; padding: 12px; }
.ej-rutina .cabeza { display: flex; align-items: flex-start; gap: 2px; }
.nombre-ej {
  flex: 1; min-width: 0; min-height: 44px; display: flex; gap: 10px; align-items: flex-start;
  padding: 4px 0; border: 0; background: none; color: inherit; text-align: left; cursor: pointer;
}
.nombre-ej .num { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--superficie-2); font-weight: 800; font-size: 0.85rem; }
.nombre-ej .txt { min-width: 0; }
.nombre-ej b { display: block; font-size: 1.05rem; line-height: 1.25; overflow-wrap: anywhere; text-decoration: underline dotted var(--borde-fuerte); text-underline-offset: 4px; }
.nombre-ej small { display: block; color: var(--texto-3); font-size: 0.85rem; font-weight: 600; margin-top: 2px; }
.ej-rutina .icono-boton { width: 44px; height: 44px; }
.ej-rutina .icono-boton svg { width: 22px; height: 22px; }
.ej-rutina .icono-boton:disabled { opacity: 0.25; cursor: default; }
.stepper.compacto { grid-template-columns: 44px minmax(0, 1fr) 44px; border-radius: 12px; }
.stepper.compacto button { height: 54px; }
.stepper.compacto button svg { width: 22px; height: 22px; }
.stepper.compacto input.valor, .stepper.compacto output.valor { font-size: 1.25rem; }
.stepper output.valor { display: block; text-align: center; font-weight: 850; line-height: 1.1; }
.stepper input.valor::placeholder { color: var(--texto-3); }
.kg-objetivo { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 58px; border: 2px solid var(--borde-fuerte); border-radius: 12px; background: var(--superficie); overflow: hidden; }
.kg-objetivo .entrada { min-height: 0; height: 36px; border: 0; padding: 0; text-align: center; font-size: 1.25rem; font-weight: 850; background: transparent; box-shadow: none; }
.kg-objetivo:focus-within { border-color: var(--acento); }
.kg-objetivo span { font-size: 0.72rem; font-weight: 700; color: var(--texto-3); margin-top: -2px; }

/* ---------- Otras actividades (escalada, pádel, yoga…) ---------- */
.fila-otra {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 12px;
  border: 1px solid var(--borde); border-radius: 12px; background: var(--superficie); color: var(--texto); text-decoration: none;
}
.fila-otra > svg:first-child { width: 26px; height: 26px; flex: none; color: var(--s); }
.fila-otra span { flex: 1; min-width: 0; }
.fila-otra b { display: block; font-weight: 750; }
.fila-otra small { display: block; color: var(--texto-2); font-size: 0.85rem; font-weight: 600; }
.fila-otra .flecha { width: 20px; height: 20px; color: var(--texto-3); flex: none; }
.chips.tipos-otra { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chips.tipos-otra .chip { padding: 0 10px; text-align: left; }
.chips.duraciones { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.chips.duraciones .chip { padding: 0 2px; }
