/* ==========================================================================
   gym.iquera.dev — Estilos
   Dark mode nativo de alto contraste, mobile-first y pensado para el pulgar.
   ========================================================================== */

:root {
  /* Superficies */
  --bg: #09090b;
  --surface: #121214;
  --card: #18181b;
  --card-2: #1f1f23;
  --border: #27272a;
  --border-2: #3f3f46;

  /* Texto */
  --text: #fafafa;
  --muted: #a1a1aa;
  --dim: #71717a;

  /* Acentos */
  --accent: #22c55e;
  --accent-2: #16a34a;
  --accent-ink: #03200d;
  --accent-soft: rgba(34, 197, 94, .14);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, .16);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, .14);
  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, .16);
  --yellow: #facc15;
  --yellow-soft: rgba(250, 204, 21, .14);

  /* Forma y espacios */
  --r-lg: 18px;
  --r: 14px;
  --r-sm: 10px;
  --gutter: 16px;
  --tab-h: 64px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
body.no-scroll { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .4; cursor: default; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 30px; font-weight: 800; letter-spacing: -.03em; }
h2 { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
h3 { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
svg { flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Cifras siempre tabulares para que no "bailen" */
.num, input, .stat-value, .clock, .rest-time, .chart text, .cal-day { font-variant-numeric: tabular-nums; }

.muted { color: var(--muted); }
.dim { color: var(--dim); }
.accent { color: var(--accent); }
.amber { color: var(--amber); }
.small { font-size: 13px; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Layout ---------- */
.view {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 var(--gutter) calc(var(--tab-h) + var(--safe-b) + 112px);
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: calc(var(--safe-t) + 22px) 0 18px;
}
.eyebrow { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.eyebrow::first-letter { text-transform: uppercase; }
.back-link {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--accent); font-weight: 600; font-size: 15px;
  padding: calc(var(--safe-t) + 14px) 0 4px; margin-left: -4px;
}
.back-link svg { width: 20px; height: 20px; }

.section { margin-top: 26px; }
.section-title {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.section-title h2 { font-size: 17px; }

/* ---------- Iconos ---------- */
.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.i.sm { width: 16px; height: 16px; }
.i.lg { width: 28px; height: 28px; }

/* ---------- Tarjetas ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
}
.card + .card { margin-top: 12px; }
.card.tap { display: block; transition: border-color .15s, transform .1s; }
.card.tap:active { transform: scale(.985); border-color: var(--border-2); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px;
  border-radius: var(--r);
  font-weight: 700; font-size: 16px;
  background: var(--card-2); border: 1px solid var(--border-2);
  transition: transform .1s, background .15s, opacity .15s;
  user-select: none; -webkit-user-select: none;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:active { background: var(--accent-2); }
.btn-ghost { background: transparent; border-color: var(--border-2); }
.btn-danger { background: var(--danger-soft); border-color: transparent; color: #fca5a5; }
.btn-soft { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn.block { display: flex; width: 100%; }
.btn-row { display: flex; gap: 10px; }
.btn-row > .btn { flex: 1; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; border-radius: 12px;
  color: var(--muted);
}
.icon-btn:active { background: var(--card-2); }
.icon-btn.sm { width: 36px; height: 36px; border-radius: 10px; }
.icon-btn.bordered { border: 1px solid var(--border-2); background: var(--card); }

/* ---------- Chips / badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px;
  background: var(--card-2); border: 1px solid var(--border);
  color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; margin: 0 calc(var(--gutter) * -1); padding-inline: var(--gutter); }
.chips::-webkit-scrollbar { display: none; }
.chip-btn {
  min-height: 36px; padding: 0 14px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--border);
  color: var(--muted); font-weight: 600; font-size: 14px; white-space: nowrap;
}
.chip-btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.pr-badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 7px; border-radius: 999px;
  background: var(--amber-soft); color: var(--amber);
  font-size: 11px; font-weight: 800; letter-spacing: .02em; vertical-align: 1px;
}
.pr-badge .i { width: 12px; height: 12px; stroke-width: 2.4; }

/* ---------- Estadísticas ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-grid.two { grid-template-columns: repeat(2, 1fr); }
.stat {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r); padding: 12px;
  min-width: 0;
}
.stat-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 20px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value small { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.stat.hl .stat-value { color: var(--accent); }

/* ---------- Formularios ---------- */
.field { display: block; }
.field > span, .field-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.input, .select, textarea.input {
  width: 100%; min-height: 48px;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: 12px; padding: 0 14px;
  font-size: 16px; /* >= 16px: evita el zoom automático de iOS */
  outline: none; transition: border-color .15s;
}
textarea.input { padding: 12px 14px; min-height: 84px; resize: vertical; line-height: 1.4; }
.input:focus, .select:focus { border-color: var(--accent); }
.select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
  padding-right: 36px;
}
.seg {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 3px; gap: 3px;
}
.seg button { min-height: 40px; border-radius: 9px; font-weight: 700; color: var(--muted); }
.seg button.on { background: var(--card-2); color: var(--text); box-shadow: 0 1px 0 var(--border-2) inset; }

/* ---------- Personas ---------- */
.topbar {
  display: flex; justify-content: flex-end; align-items: center;
  padding: calc(var(--safe-t) + 10px) 0 0;
}
.topbar + .page-head, .topbar + .banner + .page-head { padding-top: 6px; }
.topbar + .banner { margin-top: 10px; }
.profile-btn {
  display: inline-flex; align-items: center; gap: 8px; max-width: 60%;
  min-height: 40px; padding: 4px 10px 4px 4px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--border);
  font-weight: 700; font-size: 14px; color: var(--text);
}
.profile-btn .i { color: var(--dim); }
.profile-btn:active { background: var(--card-2); }
.avatar {
  display: inline-grid; place-items: center; flex-shrink: 0;
  width: 32px; height: 32px; border-radius: 50%;
  background: hsl(var(--hue, 140) 55% 22%); color: hsl(var(--hue, 140) 85% 72%);
  font-size: 13px; font-weight: 800; letter-spacing: .02em;
  border: 1px solid hsl(var(--hue, 140) 50% 32%);
}
.avatar.lg { width: 44px; height: 44px; font-size: 16px; }
.active-head .who { font-size: 11px; font-weight: 700; color: var(--muted); text-align: center; text-transform: uppercase; letter-spacing: .06em; }

.sync-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--dim); flex-shrink: 0; }
.sync-dot.on { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.sync-dot.warn { background: var(--amber); box-shadow: 0 0 0 4px var(--amber-soft); }
.sync-dot.err { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; background: var(--card-2); padding: 1px 5px; border-radius: 6px; }

/* ---------- Entrenar: inicio ---------- */
.routine-card h3 { font-size: 18px; }
.routine-card .ex-names { color: var(--muted); font-size: 13px; margin: 6px 0 14px; line-height: 1.5; }
.routine-card .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.banner {
  display: flex; align-items: center; gap: 12px;
  margin-top: calc(var(--safe-t) + 12px);
  padding: 12px 14px; border-radius: var(--r);
  background: var(--accent-soft); border: 1px solid rgba(34,197,94,.35); color: var(--accent);
  font-weight: 700;
}
.banner .clock { margin-left: auto; }

/* ---------- Entrenamiento activo ---------- */
.active-head {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 8px;
  margin: 0 calc(var(--gutter) * -1);
  padding: calc(var(--safe-t) + 8px) var(--gutter) 10px;
  background: rgba(9, 9, 11, .88);
  -webkit-backdrop-filter: saturate(160%) blur(16px); backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--border);
}
.active-head .title { font-weight: 700; font-size: 15px; text-align: center; }
.active-head .clock { font-size: 22px; font-weight: 800; color: var(--accent); text-align: center; letter-spacing: -.01em; line-height: 1.1; }
.session-live {
  display: flex; justify-content: space-between; gap: 8px;
  margin: 14px 0; color: var(--muted); font-size: 13px; font-weight: 600;
}
.session-live b { color: var(--text); }

.ex-card { padding: 14px 12px 12px; }
.ex-card + .ex-card { margin-top: 14px; }
.ex-head { display: flex; align-items: flex-start; gap: 8px; padding: 0 2px; }
.ex-head h3 { font-size: 17px; }
.ex-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 5px; font-size: 12.5px; color: var(--muted); }
.note-btn {
  display: flex; align-items: flex-start; gap: 8px; width: 100%; text-align: left;
  margin: 10px 0 4px; padding: 9px 11px; border-radius: 10px;
  background: var(--yellow-soft); color: #fde68a; font-size: 13px; line-height: 1.35;
}
.note-btn.empty { background: transparent; border: 1px dashed var(--border-2); color: var(--dim); }
.note-btn .i { width: 15px; height: 15px; margin-top: 1px; }

.set {
  margin-top: 8px; padding: 8px 8px 10px;
  border-radius: 14px; background: var(--surface); border: 1px solid var(--border);
  transition: background .2s, border-color .2s;
}
.set.is-done { background: rgba(34, 197, 94, .07); border-color: rgba(34, 197, 94, .38); }
.set-top { display: flex; align-items: center; gap: 8px; }
.set-type {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  font-weight: 800; font-size: 14px;
  background: var(--card-2); border: 1px solid var(--border-2); color: var(--text);
}
.set-type.t-W { background: var(--yellow-soft); border-color: transparent; color: var(--yellow); }
.set-type.t-F { background: var(--danger-soft); border-color: transparent; color: #f87171; }
.set-type.t-D { background: var(--violet-soft); border-color: transparent; color: var(--violet); }
.set-info { flex: 1; min-width: 0; line-height: 1.25; }
.set-name { font-size: 13px; font-weight: 700; display: block; }
.prev-btn { font-size: 12.5px; color: var(--muted); text-align: left; padding: 2px 0; }
.prev-btn b { color: var(--text); font-weight: 600; }
.rpe {
  appearance: none; -webkit-appearance: none;
  height: 34px; padding: 0 8px; min-width: 58px;
  border-radius: 10px; border: 1px solid var(--border-2); background: var(--card);
  font-size: 16px; font-weight: 600; text-align: center; text-align-last: center; color: var(--muted);
}
.rpe.has { color: var(--text); border-color: var(--accent); }
.set-bottom { display: grid; grid-template-columns: 1fr 1fr 52px; gap: 6px; margin-top: 8px; }

.stepper {
  display: grid; grid-template-columns: 34px 1fr 34px; align-items: stretch;
  height: 52px; border-radius: 12px; overflow: hidden;
  background: var(--card); border: 1px solid var(--border-2);
}
.stepper > button { color: var(--muted); display: grid; place-items: center; }
.stepper > button:active { background: var(--card-2); color: var(--text); }
.stepper .mid { display: flex; flex-direction: column; justify-content: center; min-width: 0; border-inline: 1px solid var(--border); }
.stepper input {
  width: 100%; border: 0; background: transparent; outline: none;
  text-align: center; font-size: 20px; font-weight: 800; padding: 0; line-height: 1.1;
}
.stepper input::placeholder { color: var(--dim); font-weight: 600; }
.stepper .unit { font-size: 10px; text-align: center; color: var(--dim); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.stepper.sm { height: 44px; grid-template-columns: 30px 1fr 30px; }
.stepper.sm output { display: grid; place-items: center; font-weight: 800; font-size: 17px; border-inline: 1px solid var(--border); }

.check {
  display: grid; place-items: center;
  border-radius: 12px; border: 2px solid var(--border-2);
  color: var(--dim); background: var(--card);
  transition: background .15s, transform .1s, border-color .15s;
}
.check .i { width: 26px; height: 26px; stroke-width: 3; }
.check:active { transform: scale(.94); }
.check.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.ex-foot { display: flex; gap: 8px; margin-top: 10px; }
.ex-foot .btn { flex: 1; }

/* ---------- Barra de descanso ---------- */
.restbar {
  position: fixed; z-index: 40;
  left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tab-h) + var(--safe-b) + 10px);
  width: min(560px, 100%); padding: 0 12px;
}
.restbar[hidden] { display: none; }
.rest-inner {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 10px 12px 14px; border-radius: 16px;
  background: #1c1c20; border: 1px solid var(--border-2);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .55);
  animation: rise .22s ease-out;
}
.rest-progress { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); transition: width .5s linear; }
.rest-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.rest-time { font-size: 28px; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.rest-inner .btn-sm { min-height: 44px; padding: 0 10px; }
.restbar.done .rest-inner { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.restbar.done .rest-label { color: var(--accent-ink); }

/* ---------- Rutinas (editor) ---------- */
.rt-item { padding: 14px; }
.rt-item + .rt-item { margin-top: 12px; }
.rt-grid { display: grid; grid-template-columns: 1fr 1.1fr 1fr; gap: 8px; margin-top: 12px; }
.rep-range { display: flex; align-items: center; gap: 4px; height: 44px; }
.rep-range input { width: 100%; min-width: 0; height: 44px; text-align: center; padding: 0 4px; font-weight: 700; }
.rt-grid .select { min-height: 44px; padding: 0 26px 0 10px; background-position: right 6px center; }
.rt-item textarea.input { min-height: 64px; margin-top: 10px; font-size: 16px; }

/* ---------- Listas ---------- */
.list { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.list-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  min-height: 56px; padding: 10px 14px;
}
.list-item + .list-item { border-top: 1px solid var(--border); }
.list-item:active { background: var(--card-2); }
.list-item .i { color: var(--dim); }
.list-group-title { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 20px 4px 8px; }

/* ---------- Historial ---------- */
.calendar { padding: 14px 12px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head h3::first-letter { text-transform: uppercase; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal-dow { font-size: 11px; font-weight: 700; color: var(--dim); padding: 4px 0; }
.cal-day {
  aspect-ratio: 1; display: grid; place-items: center;
  border-radius: 50%; font-size: 14px; font-weight: 600; color: var(--muted);
  max-width: 42px; width: 100%; margin: 0 auto;
}
.cal-day.out { visibility: hidden; }
.cal-day.today { box-shadow: inset 0 0 0 1.5px var(--border-2); color: var(--text); }
.cal-day.on { background: var(--accent); color: var(--accent-ink); font-weight: 800; }
.cal-foot { display: flex; justify-content: space-around; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.cal-foot b { color: var(--text); font-size: 16px; }

.month-title { font-size: 13px; font-weight: 700; color: var(--muted); margin: 22px 4px 10px; }
.month-title::first-letter, .session-card .date::first-letter { text-transform: uppercase; }
.session-card .top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.session-card .date { font-size: 12.5px; color: var(--muted); font-weight: 600; white-space: nowrap; display: inline-block; }
.session-card .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.session-card .ex-names { margin-top: 8px; font-size: 13px; color: var(--muted); }

.detail-ex + .detail-ex { margin-top: 12px; }
.detail-set { display: grid; grid-template-columns: 30px 1fr auto; gap: 8px; align-items: center; padding: 7px 0; border-top: 1px solid var(--border); font-size: 14px; }
.detail-set:first-of-type { border-top: 0; }
.detail-set .tag { font-weight: 800; color: var(--muted); text-align: center; }
.detail-set .tag.t-W { color: var(--yellow); }
.detail-set .tag.t-F { color: #f87171; }
.detail-set .tag.t-D { color: var(--violet); }
.detail-set .aside { color: var(--dim); font-size: 12.5px; }

/* ---------- Gráficos ---------- */
.chart-card { padding: 14px 10px 8px; }
.chart-card + .chart-card { margin-top: 12px; }
.chart-title { display: flex; justify-content: space-between; align-items: baseline; padding: 0 6px 6px; }
.chart-title h3 { font-size: 14px; }
.chart-title .num { font-size: 13px; color: var(--muted); font-weight: 600; }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis-label { fill: var(--dim); font-size: 10px; font-family: var(--font); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart .dot { fill: var(--bg); stroke: var(--accent); stroke-width: 2; }
.chart .dot.last { fill: var(--accent); }
.chart .val { fill: var(--text); font-size: 11px; font-weight: 700; font-family: var(--font); }
.chart .bar { fill: var(--accent); opacity: .85; }
.chart .bar.cur { opacity: 1; }
.chart .bar.zero { fill: var(--border-2); }
.chart.amber .line { stroke: var(--amber); }
.chart.amber .dot { stroke: var(--amber); }
.chart.amber .dot.last { fill: var(--amber); }
.chart-empty { padding: 34px 12px; text-align: center; color: var(--dim); font-size: 14px; }

.records { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }

/* ---------- Estados vacíos ---------- */
.empty {
  text-align: center; padding: 34px 20px;
  border: 1px dashed var(--border-2); border-radius: var(--r-lg);
  color: var(--muted);
}
.empty .i { width: 34px; height: 34px; color: var(--dim); margin-bottom: 8px; }
.empty p { margin-bottom: 14px; }

/* ---------- Hoja inferior (bottom sheet) ---------- */
#sheet-root { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
#sheet-root.open { pointer-events: auto; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .6); animation: fade .2s ease-out; }
.sheet {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(560px, 100%); max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--border); border-bottom: 0;
  border-radius: 22px 22px 0 0;
  padding: 8px var(--gutter) calc(var(--safe-b) + 18px);
  animation: sheet-up .26s cubic-bezier(.2, .9, .3, 1);
}
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--border-2); margin: 0 auto 14px; }
.sheet-body h2 { margin-bottom: 6px; }
.sheet-body > p { color: var(--muted); margin-bottom: 16px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 18px; }
.sheet-actions .btn { flex: 1; white-space: nowrap; padding: 0 12px; }
.sheet .list-item { padding-inline: 4px; }
.sheet .list { background: transparent; border: 0; border-radius: 0; }
.picker-list { max-height: 46dvh; overflow-y: auto; margin: 10px calc(var(--gutter) * -1) 12px; padding: 0 var(--gutter); }
.search { position: relative; margin: 12px 0 10px; }
.search .i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--dim); }
.search .input { padding-left: 40px; }
.summary-hero { text-align: center; padding: 6px 0 16px; }
.summary-hero .i { width: 46px; height: 46px; color: var(--amber); margin-bottom: 6px; }
.pr-list { margin-top: 14px; }
.pr-list li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); font-size: 14px; }
.pr-list ul { list-style: none; margin: 0; padding: 0; }

/* ---------- Navegación inferior ---------- */
.tabbar {
  position: fixed; z-index: 50; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgba(9, 9, 11, .9);
  -webkit-backdrop-filter: saturate(160%) blur(18px); backdrop-filter: saturate(160%) blur(18px);
  border-top: 1px solid var(--border);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--dim); font-size: 11px; font-weight: 700; letter-spacing: .01em;
}
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.on { color: var(--accent); }
.tabbar a:active { opacity: .7; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; z-index: 200; left: 50%; top: calc(var(--safe-t) + 12px);
  transform: translate(-50%, -20px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px); padding: 11px 16px; border-radius: 12px;
  background: #27272a; border: 1px solid var(--border-2); color: var(--text);
  font-weight: 600; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.5);
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Animaciones ---------- */
@keyframes sheet-up { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
.check.on { animation: pop .25s ease-out; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Pantallas muy estrechas (iPhone SE, 320px) */
@media (max-width: 360px) {
  :root { --gutter: 12px; }
  .stat-value { font-size: 17px; }
  .stepper { grid-template-columns: 30px 1fr 30px; }
  .stepper input { font-size: 18px; }
  .set-bottom { grid-template-columns: 1fr 1fr 46px; }
  .prev-lbl { display: none; }
  .prev-btn::before { content: "Ant. "; }
}
