/* Entreno — Liquid Glass (material Apple) + Paleta A de Vadric (color).
 *
 * Del Liquid Glass de iOS 26 se toma el MATERIAL: capas translúcidas con blur
 * y saturación, highlight especular en el borde superior, profundidad por luz
 * y no por contorno.
 * De Vadric se toma el COLOR: tinta / hueso / latón. Nada de #F7E45F (ese es
 * de SentryIQ, producto — no toca esta app).
 *
 * Tipografía: pila del sistema. SF Pro en iPhone, Roboto en Android. Es la
 * tipografía nativa del Liquid Glass y evita descargar fuentes, que rompería
 * el "todo local, cero red".
 */

:root {
  /* --- Paleta A (Vadric) --- */
  --ink:            #0E141B;
  --ink-elev:       #1C2630;
  --graphite:       #566070;
  --bone:           #F2EEE6;
  --bone-light:     #FBFAF7;
  --brass:          #B5853A;
  --brass-hi:       #D8AE6A;
  --brass-lo:       #8A6428;

  --text:           var(--bone);
  --muted:          #8A93A1;
  --hairline:       rgba(242, 238, 230, 0.10);

  /* --- Estados (armonizados con la paleta cálida) --- */
  --ok:     #6FBF8B;
  --warn:   var(--brass-hi);
  --danger: #D97A6C;

  /* --- Material Liquid Glass --- */
  --glass:          rgba(28, 38, 48, 0.55);
  --glass-strong:   rgba(28, 38, 48, 0.78);
  --glass-thin:     rgba(242, 238, 230, 0.045);
  --glass-blur:     saturate(180%) blur(20px);
  --glass-blur-lg:  saturate(200%) blur(32px);
  /* Borde de vidrio: luz arriba, sombra abajo. Es lo que lo hace leer como
     material físico y no como un rectángulo con opacidad. */
  --glass-edge:     rgba(242, 238, 230, 0.16);
  --glass-edge-lo:  rgba(0, 0, 0, 0.30);

  --radius:   18px;
  --radius-lg: 24px;
  --tap:      48px;
  --safe-b:   env(safe-area-inset-bottom, 0px);
  --safe-t:   env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
  background: var(--ink);
  /* El vidrio necesita algo que refractar: sin variación detrás, el blur no se
     percibe. Estos halos fijos dan esa base sin distraer. */
  background-image:
    radial-gradient(120% 80% at 12% -8%, rgba(181, 133, 58, 0.16), transparent 60%),
    radial-gradient(90% 60% at 100% 8%, rgba(86, 96, 112, 0.22), transparent 55%),
    radial-gradient(80% 50% at 50% 108%, rgba(181, 133, 58, 0.08), transparent 60%);
  background-attachment: fixed;
  min-height: 100vh;
}

#app {
  padding: calc(16px + var(--safe-t)) 14px calc(104px + var(--safe-b));
  max-width: 640px;
  margin: 0 auto;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ===== Tipografía ======================================================== */
.h1 { font-size: 28px; font-weight: 700; margin: 2px 0 0; letter-spacing: -0.03em; }
.eyebrow { margin: 0; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.card-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted); margin: 0 0 12px; font-weight: 600;
}

/* ===== Material base ===================================================== */
.card {
  position: relative;
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow:
    0 1px 0 rgba(242,238,230,.06) inset,      /* highlight especular superior */
    0 8px 24px rgba(0,0,0,.28),
    0 1px 2px rgba(0,0,0,.4);
}
/* Brillo especular del borde superior — la firma del Liquid Glass. */
.card::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(180deg, rgba(242,238,230,.22), rgba(242,238,230,0) 42%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.card-empty { text-align: center; color: var(--muted); }
.card-danger { border-color: rgba(217,122,108,.32); background: rgba(60,26,26,.42); }

.card-hero {
  background: linear-gradient(150deg, rgba(181,133,58,.18), rgba(28,38,48,.62) 46%);
  border-color: rgba(216,174,106,.26);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.hero-kicker { margin: 0; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--brass-hi); font-weight: 700; }
.hero-dia { margin: 6px 0 2px; font-size: 40px; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.hero-enfasis { margin: 8px 0 16px; color: var(--muted); font-size: 14px; }
.hero-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

.chip {
  display: inline-block; padding: 5px 11px; border-radius: 999px;
  background: rgba(181,133,58,.16); color: var(--brass-hi);
  border: 1px solid rgba(216,174,106,.22);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.chip-ghost { background: var(--glass-thin); color: var(--muted); border-color: var(--hairline); }

/* ===== Botones =========================================================== */
.btn {
  position: relative;
  min-height: var(--tap);
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid var(--glass-edge);
  background: var(--glass-thin);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .08s ease, filter .18s ease;
  box-shadow: 0 1px 0 rgba(242,238,230,.08) inset, 0 2px 8px rgba(0,0,0,.24);
}
.btn:active { transform: scale(.98); filter: brightness(1.08); }
.btn-block { display: flex; width: 100%; margin-top: 10px; }

.btn-primary {
  background: linear-gradient(180deg, var(--brass-hi), var(--brass) 58%, var(--brass-lo));
  color: #14100A;
  border-color: rgba(216,174,106,.5);
  box-shadow:
    0 1px 0 rgba(255,255,255,.32) inset,
    0 6px 18px rgba(181,133,58,.30),
    0 1px 2px rgba(0,0,0,.4);
}
.btn-outline { background: transparent; border-color: var(--glass-edge); }
.btn-outline-strong { background: rgba(181,133,58,.12); border-color: var(--brass); color: var(--brass-hi); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn-small { min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 11px; }
.btn-danger { background: rgba(217,122,108,.18); border-color: rgba(217,122,108,.42); color: #F0B4AA; }
.btn-registrar { min-height: 58px; font-size: 17px; margin-top: 14px; }
.btn-extra { background: rgba(181,133,58,.10); border-color: var(--brass); color: var(--brass-hi); box-shadow: none; }
.btn-terminar { margin-top: 18px; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* ===== Home ============================================================== */
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.topbar-sticky {
  position: sticky; top: 0; z-index: 20;
  background: rgba(14,20,27,.72);
  backdrop-filter: var(--glass-blur-lg);
  -webkit-backdrop-filter: var(--glass-blur-lg);
  border-bottom: 1px solid var(--hairline);
  padding: 10px 14px 12px; margin: calc(-16px - var(--safe-t)) -14px 10px;
  padding-top: calc(10px + var(--safe-t));
}
.topbar-right { display: flex; align-items: center; gap: 8px; }

.preview-row { display: flex; gap: 12px; padding: 11px 0; border-top: 1px solid var(--hairline); }
.preview-row:first-of-type { border-top: none; }
.preview-block {
  flex: 0 0 96px; width: 96px; font-size: 10px; line-height: 1.3;
  text-transform: uppercase; letter-spacing: .02em;
  color: var(--muted); padding-top: 4px;
  overflow-wrap: normal; word-break: keep-all; hyphens: none;
}
.preview-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.preview-nombre { font-weight: 600; }
.preview-obj { font-size: 13px; color: var(--muted); }
.preview-row { cursor: pointer; align-items: center; }
.preview-row:active { background: var(--glass-thin); border-radius: 10px; }
.preview-ver { flex: 0 0 18px; color: var(--brass); opacity: .75; }
.preview-ver svg { width: 18px; height: 18px; display: block; }

.stat-row { display: flex; gap: 8px; }
.stat {
  flex: 1; min-width: 0; text-align: center;
  background: var(--glass-thin); border: 1px solid var(--hairline);
  border-radius: 12px; padding: 11px 8px;
}
.stat-val { display: block; font-size: 19px; font-weight: 700; letter-spacing: -.02em; overflow-wrap: anywhere; }
.stat-lbl { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }

/* Aviso de respaldo pendiente */
.aviso {
  display: flex; align-items: center; gap: 12px;
  background: rgba(181,133,58,.14);
  border: 1px solid rgba(216,174,106,.3);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border-radius: 14px; padding: 12px 14px; margin-bottom: 12px;
}
.aviso-urgente { background: rgba(217,122,108,.16); border-color: rgba(217,122,108,.4); }
.aviso-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.aviso-txt strong { font-size: 14px; }
.aviso-txt .small { color: var(--muted); }
.aviso .btn { flex: 0 0 auto; margin: 0; }
.txt-warn { color: var(--brass-hi); }

.mini-details { margin-top: 12px; }
.mini-details > summary { cursor: pointer; color: var(--muted); font-size: 14px; padding: 8px 0; list-style: none; }
.mini-details > summary::-webkit-details-marker { display: none; }
.mini-details > summary::before { content: '▸ '; }
.mini-details[open] > summary::before { content: '▾ '; }

/* ===== Sesión ============================================================ */
.crono {
  font-variant-numeric: tabular-nums; font-size: 15px; font-weight: 700;
  color: var(--brass-hi); background: rgba(181,133,58,.14);
  border: 1px solid rgba(216,174,106,.24);
  padding: 6px 10px; border-radius: 10px;
}
.enfasis-linea { margin: 0 0 12px; color: var(--muted); font-size: 14px; }

.warmup {
  background: var(--glass); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-edge); border-radius: var(--radius);
  padding: 13px 16px; margin-bottom: 12px;
}
.warmup > summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.warmup p { margin: 10px 0 0; color: var(--muted); font-size: 14px; }

.slot { padding: 0; overflow: hidden; }
.slot.is-open { border-color: rgba(216,174,106,.34); }
.slot.is-done .slot-nombre { color: var(--muted); }

.slot-head {
  width: 100%; background: none; border: 0; text-align: left;
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
}
.slot-head-main { flex: 1; min-width: 0; }
.slot-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.tag {
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  background: var(--glass-thin); border: 1px solid var(--hairline);
  color: var(--muted); padding: 3px 7px; border-radius: 6px;
}
.tag-super { background: rgba(181,133,58,.16); color: var(--brass-hi); border-color: rgba(216,174,106,.26); }
.slot-nombre { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.015em; }
.slot-obj { margin: 3px 0 0; font-size: 13px; color: var(--muted); }

.progreso {
  flex: 0 0 auto; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 14px;
  background: var(--glass-thin); border: 1px solid var(--hairline);
  padding: 7px 10px; border-radius: 10px; color: var(--muted);
}
.progreso.is-done { background: rgba(111,191,139,.16); color: var(--ok); border-color: rgba(111,191,139,.28); }

.slot-body { padding: 0 16px 16px; border-top: 1px solid var(--hairline); }

/* --- Botón "ver ejercicio" (diagrama) --- */
.ver-ejercicio {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 8px; padding: 7px 12px 7px 9px;
  background: rgba(181,133,58,.12); border: 1px solid rgba(216,174,106,.3);
  border-radius: 10px; color: var(--brass-hi);
  font-size: 12.5px; font-weight: 600; min-height: 38px;
}
.ver-ejercicio:active { background: rgba(181,133,58,.22); }
.ver-ejercicio svg { width: 16px; height: 16px; flex: 0 0 16px; }

/* --- Términos del glosario: sigla tocable ------------------------------- */
/* .is-term: solo el gesto. No toca la apariencia, para poder colgarlo de un
   tag o un chip sin que el reset del <button> se lleve por delante su estilo. */
.is-term {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: inherit; cursor: pointer; text-align: left;
}
.is-term:active { opacity: .6; }

/* .term: el término suelto dentro de un texto corrido. */
.term {
  background: none; border: 0; padding: 0; margin: 0;
  color: inherit; font-size: inherit; font-weight: inherit; line-height: inherit;
  border-bottom: 1px dotted currentColor;
}
.term-mark {
  font-size: .68em; font-weight: 700; line-height: 1;
  color: var(--brass-hi);
  border: 1px solid currentColor; border-radius: 50%;
  width: 1.25em; height: 1.25em;
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto; opacity: .9;
}
.term-solo { background: none; border: 0; padding: 2px; }
/* Etiquetas que no son "cápsula": no deben heredar el fondo del <button>. */
.reco-lbl.is-term, .stat-lbl.is-term, .anterior-lbl .term, .term-solo {
  background: none; border: 0; padding: 0;
}
.term-nombre { margin: -6px 0 12px; color: var(--muted); font-size: 14px; }
.ficha-ejemplo { background: rgba(181,133,58,.12); border-color: rgba(216,174,106,.28); }
.hero-dia-fila { display: flex; align-items: flex-start; gap: 8px; }
.campo-lbl-term { display: flex; align-items: center; gap: 2px; }

.glosario-lista { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.glosario-item {
  display: flex; flex-direction: column; gap: 2px; text-align: left;
  background: var(--glass-thin); border: 1px solid var(--hairline);
  border-radius: 12px; padding: 11px 13px; min-height: 46px;
}
.glosario-item strong { font-size: 14px; }
.glosario-nombre { font-size: 12px; color: var(--muted); }

/* --- Recomendación de carga --- */
.reco {
  margin: 14px 0 8px; padding: 12px 14px;
  border-radius: 14px;
  background: rgba(181,133,58,.14);
  border: 1px solid rgba(216,174,106,.32);
  box-shadow: 0 1px 0 rgba(242,238,230,.06) inset;
}
.reco-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.reco-lbl {
  font-size: 10px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--brass-hi); font-weight: 700;
}
.reco-delta {
  margin-left: auto; font-size: 11px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: rgba(242,238,230,.10); border-radius: 6px; padding: 2px 7px;
}
.reco-titulo { display: block; font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.reco-detalle { margin: 6px 0 0; font-size: 12.5px; line-height: 1.4; color: var(--muted); }

.reco-subir     { background: rgba(111,191,139,.13); border-color: rgba(111,191,139,.34); }
.reco-subir .reco-lbl { color: var(--ok); }
.reco-bajar,
.reco-estancado { background: rgba(217,122,108,.13); border-color: rgba(217,122,108,.34); }
.reco-bajar .reco-lbl,
.reco-estancado .reco-lbl { color: var(--danger); }
.reco-calibracion { background: var(--glass-thin); border-color: var(--hairline); }
.reco-calibracion .reco-titulo { font-size: 16px; }

.anterior {
  display: flex; flex-direction: column; gap: 3px;
  background: var(--glass-thin); border: 1px solid var(--hairline);
  border-radius: 12px; padding: 10px 12px; margin: 14px 0;
}
.anterior-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.anterior-sets { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px; }
.anterior-vacio .anterior-sets { color: var(--muted); font-weight: 400; font-style: italic; }

.variantes { display: flex; gap: 6px; margin-bottom: 12px; }
.variante {
  flex: 1; min-width: 0;
  background: var(--glass-thin); border: 1px solid var(--hairline);
  border-radius: 12px; padding: 8px 6px; min-height: 54px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
}
.variante.is-active { border-color: var(--brass); background: rgba(181,133,58,.14); }
.variante-key { font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.variante.is-active .variante-key { color: var(--brass-hi); }
.variante-nombre {
  font-size: 11px; line-height: 1.2; text-align: center; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.cue { margin-bottom: 12px; }
.cue > summary { cursor: pointer; font-size: 13px; color: var(--muted); list-style: none; padding: 6px 0; }
.cue > summary::-webkit-details-marker { display: none; }
.cue > summary::before { content: '▸ '; }
.cue[open] > summary::before { content: '▾ '; }
.cue p { margin: 4px 0 0; font-size: 14px; }

.series { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.serie {
  display: flex; align-items: center; gap: 8px;
  background: var(--glass-thin); border: 1px solid var(--hairline);
  border-radius: 11px; padding: 9px 10px;
  font-variant-numeric: tabular-nums;
}
.serie-n { font-size: 10px; color: var(--muted); font-weight: 700; flex: 0 0 24px; }
.serie-val { font-weight: 700; }
.serie-x { color: var(--muted); }
.serie-rir { font-size: 12px; color: var(--muted); margin-left: auto; }
.serie-alt { font-size: 11px; color: var(--brass-hi); max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.serie-del {
  background: none; border: 0; color: var(--muted); font-size: 22px; line-height: 1;
  width: 34px; height: 34px; border-radius: 9px; flex: 0 0 auto;
}
.serie-del:active { background: rgba(217,122,108,.2); color: var(--danger); }

.captura { border-top: 1px solid var(--hairline); padding-top: 14px; }
.campos { display: flex; gap: 10px; }
.campo { flex: 1; min-width: 0; }
.campo-lbl { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.campo-hint { margin: 5px 0 0; font-size: 11px; color: var(--muted); }
.campo-rir { margin-top: 12px; }

.stepper {
  display: flex; align-items: stretch;
  background: var(--glass-thin); border: 1px solid var(--hairline);
  border-radius: 13px; overflow: hidden;
}
.step { flex: 0 0 46px; background: none; border: 0; font-size: 22px; font-weight: 600; color: var(--brass-hi); }
.step:active { background: rgba(181,133,58,.18); }
.num {
  flex: 1; min-width: 0; background: none; border: 0; text-align: center;
  font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums;
  padding: 12px 0; -moz-appearance: textfield;
}
.num::-webkit-outer-spin-button, .num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num:focus { outline: 2px solid var(--brass); outline-offset: -2px; border-radius: 8px; }

.rir-chips { display: flex; gap: 6px; }
.rir-chip {
  flex: 1; min-height: 46px;
  background: var(--glass-thin); border: 1px solid var(--hairline);
  border-radius: 12px; font-weight: 700; font-size: 16px; color: var(--muted);
}
.rir-chip.is-active { background: rgba(181,133,58,.18); border-color: var(--brass); color: var(--brass-hi); }

.nota {
  width: 100%; margin-top: 12px;
  background: var(--glass-thin); border: 1px solid var(--hairline);
  border-radius: 12px; padding: 12px; font-size: 14px; min-height: 46px;
}
.nota::placeholder { color: var(--muted); }
.nota:focus { outline: none; border-color: rgba(216,174,106,.4); }

.reservado {
  border: 1px dashed var(--hairline); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 12px; color: var(--muted);
}
.reservado-tag { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--brass-hi); font-weight: 700; }
.reservado p { margin: 6px 0 0; font-size: 13px; }

/* ===== Diagramas ========================================================= */
.diagrama-par { display: flex; gap: 8px; }
.diagrama-caja {
  flex: 1; min-width: 0; margin: 0;
  background: rgba(6,10,16,.5); border: 1px solid var(--hairline);
  border-radius: 14px; padding: 6px 6px 2px;
}
.diagrama-caja figcaption {
  font-size: 9.5px; color: var(--muted); text-align: center;
  text-transform: uppercase; letter-spacing: .1em; padding-bottom: 4px; font-weight: 600;
}
svg.diagrama { width: 100%; height: auto; display: block; }

/* Materiales del diagrama */
.fig-hueso       { stroke: var(--bone); stroke-linecap: round; }
.fig-hueso-fill  { fill: var(--bone); }
.fig-lejos       { stroke: var(--graphite); stroke-linecap: round; }
.fig-metal       { stroke: var(--brass); stroke-linecap: round; }
.fig-metal-fill  { fill: var(--brass); stroke: none; }
.fig-mueble      { stroke: var(--graphite); stroke-linecap: round; }
.fig-mueble-fill { fill: rgba(86,96,112,.55); stroke: none; }
.fig-estructura  { stroke: #3A4452; stroke-linecap: round; }
.fig-cable       { stroke: var(--brass-hi); stroke-dasharray: 3 3; opacity: .85; }
.fig-suelo       { stroke: rgba(242,238,230,.16); }

.ficha-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.ficha-cue {
  background: var(--glass-thin); border: 1px solid var(--hairline);
  border-radius: 12px; padding: 12px; margin-top: 12px;
}
.ficha-cue h4 {
  margin: 0 0 5px; font-size: 10px; text-transform: uppercase;
  letter-spacing: .1em; color: var(--brass-hi); font-weight: 700;
}
.ficha-cue p { margin: 0; font-size: 14px; line-height: 1.45; }
.ficha-cue + .ficha-cue { margin-top: 8px; }

/* ===== Descanso ========================================================== */
.descanso {
  position: fixed; left: 10px; right: 10px; bottom: calc(84px + var(--safe-b));
  background: var(--glass-strong);
  backdrop-filter: var(--glass-blur-lg); -webkit-backdrop-filter: var(--glass-blur-lg);
  border: 1px solid var(--glass-edge); border-radius: 16px;
  overflow: hidden; z-index: 40; max-width: 620px; margin: 0 auto;
  box-shadow: 0 1px 0 rgba(242,238,230,.1) inset, 0 12px 32px rgba(0,0,0,.5);
}
.descanso-fill { position: absolute; inset: 0 auto 0 0; background: rgba(181,133,58,.20); transition: width .25s linear; }
.descanso-row { position: relative; display: flex; align-items: center; gap: 10px; padding: 11px 12px; }
.descanso-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.descanso-time { font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--brass-hi); margin-right: auto; }
.descanso-mas, .descanso-skip {
  background: var(--glass-thin); border: 1px solid var(--hairline); border-radius: 10px;
  padding: 8px 11px; font-size: 13px; font-weight: 600; color: var(--text); min-height: 38px;
}

/* ===== Historial ========================================================= */
.tabs {
  display: flex; gap: 4px; margin-bottom: 14px; padding: 4px;
  background: var(--glass); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-edge); border-radius: 14px;
}
.tab { flex: 1; min-height: 42px; background: none; border: 0; border-radius: 11px; font-weight: 600; color: var(--muted); }
.tab.is-active {
  background: var(--glass-thin); color: var(--text);
  box-shadow: 0 1px 0 rgba(242,238,230,.08) inset, 0 2px 6px rgba(0,0,0,.24);
}

.week-sep { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 22px 0 8px; font-weight: 700; }
.sesion-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.sesion-titulo { margin: 0; font-size: 19px; font-weight: 700; }
.estado { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; padding: 4px 9px; border-radius: 7px; font-weight: 700; white-space: nowrap; }
.estado-completed { background: rgba(111,191,139,.16); color: var(--ok); }
.estado-partial { background: rgba(216,174,106,.16); color: var(--brass-hi); }

.hist-slot { padding: 9px 0; border-top: 1px solid var(--hairline); }
.hist-slot-head { display: flex; justify-content: space-between; gap: 8px; }
.hist-ex { font-weight: 600; font-size: 14px; }
.hist-slotid { font-size: 10.5px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.hist-sets { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 2px; }

.select {
  width: 100%; min-height: var(--tap);
  background: var(--glass-thin); border: 1px solid var(--hairline);
  border-radius: 12px; padding: 0 12px; font-size: 15px;
}

.spark { width: 100%; height: 90px; display: block; }
.spark-line { fill: none; stroke: var(--brass-hi); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark-area { fill: rgba(181,133,58,.16); stroke: none; }
.spark-dot { fill: var(--brass-hi); }
.spark-empty { fill: #8A93A1; font-size: 12px; }

.prog-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid var(--hairline); }
.prog-row:first-of-type { border-top: none; }
.prog-fecha { font-size: 14px; }
.prog-best { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.prog-e1rm { font-size: 12px; color: var(--brass-hi); font-variant-numeric: tabular-nums; min-width: 42px; text-align: right; }

/* ===== Ajustes =========================================================== */
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--hairline); font-size: 14px; }
.kv:first-of-type { border-top: none; }
.kv span { color: var(--muted); }
.kv-input { display: flex; align-items: center; gap: 6px; }
.num-inline {
  width: 82px; padding: 8px 10px; font-size: 16px; text-align: right;
  background: var(--glass-thin); border: 1px solid var(--hairline); border-radius: 10px;
}
.import-block { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--hairline); }
.oculto { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.radio-line { display: flex; align-items: center; gap: 10px; padding: 10px 0; font-size: 14px; color: var(--muted); }
.radio-line input { width: 20px; height: 20px; accent-color: var(--brass); }
label.btn { cursor: pointer; }

/* ===== Modal ============================================================= */
.modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(6,10,16,.6);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 12px; padding-bottom: calc(12px + var(--safe-b));
}
.modal-caja {
  width: 100%; max-width: 460px;
  max-height: 88vh; overflow-y: auto;
  background: var(--glass-strong);
  backdrop-filter: var(--glass-blur-lg); -webkit-backdrop-filter: var(--glass-blur-lg);
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius-lg); padding: 20px 18px;
  box-shadow: 0 1px 0 rgba(242,238,230,.14) inset, 0 -8px 48px rgba(0,0,0,.6);
  animation: subir .22s cubic-bezier(.22,.9,.3,1);
}
@keyframes subir { from { transform: translateY(18px); opacity: .5; } to { transform: none; opacity: 1; } }
.modal-titulo { margin: 0 0 14px; font-size: 22px; font-weight: 700; letter-spacing: -.03em; }
.modal-caja .stat-row { margin-bottom: 12px; }
.modal-acciones { margin-top: 10px; }
.nota-area { resize: vertical; min-height: 78px; font-family: inherit; }

/* ===== Aviso de nueva versión =========================================== */
.update-bar {
  position: fixed; left: 10px; right: 10px; bottom: calc(84px + var(--safe-b));
  z-index: 50; max-width: 620px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 16px;
  background: var(--glass-strong);
  backdrop-filter: var(--glass-blur-lg); -webkit-backdrop-filter: var(--glass-blur-lg);
  border: 1px solid rgba(216,174,106,.4);
  box-shadow: 0 1px 0 rgba(242,238,230,.12) inset, 0 12px 32px rgba(0,0,0,.5);
  animation: subir .22s cubic-bezier(.22,.9,.3,1);
}
.update-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.update-txt strong { font-size: 14px; }
.update-txt .small { color: var(--muted); font-size: 12px; }
.update-bar .btn { flex: 0 0 auto; margin: 0; }

/* ===== Navegación ======================================================== */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  background: rgba(14,20,27,.62);
  backdrop-filter: var(--glass-blur-lg); -webkit-backdrop-filter: var(--glass-blur-lg);
  border-top: 1px solid var(--glass-edge);
  padding: 6px 4px calc(6px + var(--safe-b));
  box-shadow: 0 -1px 0 rgba(242,238,230,.06) inset;
}
.nav-item {
  position: relative; flex: 1; min-height: 54px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600;
  border-radius: 12px;
}
.nav-item.is-active { color: var(--brass-hi); }
.nav-ico { width: 22px; height: 22px; display: block; }
.nav-ico svg { width: 100%; height: 100%; stroke-linecap: round; stroke-linejoin: round; }
.nav-dot {
  position: absolute; top: 6px; right: 50%; margin-right: -18px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 6px rgba(111,191,139,.6);
}

/* El blur es caro: en equipos que lo piden, se cae a superficies sólidas. */
@media (prefers-reduced-transparency: reduce) {
  .card, .modal-caja, .nav, .descanso, .topbar-sticky, .tabs, .warmup {
    backdrop-filter: none; -webkit-backdrop-filter: none;
    background: var(--ink-elev);
  }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
