/* ============ Estilo iOS · modo oscuro ============ */
:root {
  color-scheme: dark;
  --bg: #000000;
  --bg2: #1c1c1e;
  --bg3: #2c2c2e;
  --bg4: #3a3a3c;
  --sep: rgba(84, 84, 88, .55);
  --label: #ffffff;
  --label2: rgba(235, 235, 245, .62);
  --label3: rgba(235, 235, 245, .32);
  --fill: rgba(118, 118, 128, .24);
  --fill2: rgba(118, 118, 128, .36);
  --blue: #0a84ff;
  --green: #30d158;
  --red: #ff453a;
  --orange: #ff9f0a;
  --yellow: #ffd60a;
  --indigo: #5e5ce6;
  --teal: #64d2ff;
  --r: 12px;
  --top: env(safe-area-inset-top, 0px);
  --bottom: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--label); }
body { min-height: 100vh; min-height: 100dvh; font-size: 17px; line-height: 1.35; letter-spacing: -.01em; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- barra de navegación ---------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  padding: calc(var(--top) + 10px) 16px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: rgba(0, 0, 0, .72);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid var(--sep);
  min-height: 52px;
}
.nav-titulo { font-size: 17px; font-weight: 600; text-align: center; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-lado { min-width: 70px; display: flex; align-items: center; }
.nav-lado.der { justify-content: flex-end; }
.enlace { background: none; border: 0; padding: 6px 0; color: var(--blue); font-size: 17px; cursor: pointer; }
.enlace:disabled { color: var(--label3); }
.enlace.rojo { color: var(--red); }

.pagina { max-width: 680px; margin: 0 auto; padding: 8px 16px calc(var(--bottom) + 32px); }
.titulo-grande { font-size: 34px; font-weight: 700; letter-spacing: .01em; margin: 12px 4px 4px; line-height: 1.15; }
.subtitulo { color: var(--label2); font-size: 15px; margin: 0 4px 20px; }

/* ---------- listas agrupadas ---------- */
.grupo-cab { text-transform: uppercase; font-size: 13px; color: var(--label2); margin: 24px 16px 7px; letter-spacing: .02em; }
.grupo-pie { font-size: 13px; color: var(--label2); margin: 7px 16px 0; line-height: 1.4; }
.grupo { background: var(--bg2); border-radius: var(--r); overflow: hidden; }
.celda {
  display: flex; align-items: center; gap: 12px; min-height: 44px;
  padding: 11px 16px; position: relative; background: var(--bg2); width: 100%; border: 0; text-align: left;
}
.celda + .celda::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--sep); }
.celda.toca { cursor: pointer; }
.celda.toca:active { background: var(--bg3); }
.celda .principal { flex: 1; min-width: 0; }
.celda .sec { color: var(--label2); font-size: 15px; }
.celda .peq { color: var(--label2); font-size: 13px; }
.celda .valor { color: var(--label2); font-variant-numeric: tabular-nums; }
.chevron::after { content: "›"; color: var(--label3); font-size: 22px; line-height: 1; margin-left: 4px; }

.campo { flex: 1; background: transparent; border: 0; color: var(--label); font: inherit; outline: none; padding: 0; min-width: 0; }
.campo::placeholder { color: var(--label3); }
input[type="number"].campo { text-align: right; max-width: 80px; }

/* ---------- botones ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 50px; padding: 0 20px; border: 0; border-radius: 14px;
  background: var(--blue); color: #fff; font-size: 17px; font-weight: 600; cursor: pointer;
  transition: opacity .15s, transform .08s;
}
.btn:active { opacity: .75; transform: scale(.99); }
.btn:disabled { background: var(--fill); color: var(--label3); cursor: default; transform: none; }
.btn.gris { background: var(--fill); color: var(--blue); }
.btn.rojo { background: var(--red); }
.btn.verde { background: var(--green); color: #000; }
.btn.chico { width: auto; min-height: 34px; padding: 0 14px; border-radius: 999px; font-size: 15px; }
.btn + .btn { margin-top: 10px; }
.fila-btn { display: flex; gap: 10px; flex-wrap: wrap; }
.fila-btn .btn { margin: 0; }

/* ---------- switch iOS ---------- */
.switch { appearance: none; -webkit-appearance: none; width: 51px; height: 31px; border-radius: 999px; background: var(--fill2);
  position: relative; cursor: pointer; flex: none; transition: background .2s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.25); transition: transform .2s; }
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(20px); }
.switch:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- control segmentado ---------- */
.segmentado { display: flex; background: var(--fill); border-radius: 9px; padding: 2px; gap: 2px; }
.segmentado button { flex: 1; border: 0; background: transparent; color: var(--label); font-size: 13px; font-weight: 500;
  padding: 7px 6px; border-radius: 7px; cursor: pointer; white-space: nowrap; }
.segmentado button[aria-selected="true"] { background: #636366; font-weight: 600; box-shadow: 0 3px 8px rgba(0,0,0,.12); }

/* ---------- insignias / puntos ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px;
  background: var(--fill); color: var(--label2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.badge.azul { background: rgba(10,132,255,.18); color: var(--blue); }
.badge.verde { background: rgba(48,209,88,.16); color: var(--green); }
.badge.rojo { background: rgba(255,69,58,.16); color: var(--red); }
.badge.naranja { background: rgba(255,159,10,.16); color: var(--orange); }
.punto { width: 8px; height: 8px; border-radius: 50%; background: var(--label3); flex: none; }
.punto.on { background: var(--green); box-shadow: 0 0 0 3px rgba(48,209,88,.18); }

/* ---------- hoja inferior (dialog) ---------- */
dialog.hoja {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 680px; max-height: 88dvh;
  background: var(--bg2); color: var(--label); border-radius: 14px 14px 0 0;
  padding-bottom: calc(var(--bottom) + 12px); overflow: auto;
}
dialog.hoja[open] { animation: subir .28s cubic-bezier(.2,.9,.3,1); }
dialog.hoja::backdrop { background: rgba(0,0,0,.55); }
@keyframes subir { from { transform: translateY(100%); } to { transform: none; } }
.hoja-asa { width: 36px; height: 5px; border-radius: 3px; background: var(--fill2); margin: 8px auto 4px; }
.hoja-cab { display: flex; align-items: center; justify-content: space-between; padding: 6px 16px 10px; }
.hoja-cab h3 { margin: 0; font-size: 17px; font-weight: 600; }
.hoja-cuerpo { padding: 4px 16px 8px; }
.hoja-cuerpo p { color: var(--label2); font-size: 15px; margin: 4px 0 18px; text-align: center; }
.hoja-titulo { text-align: center; font-weight: 600; font-size: 17px; margin: 8px 0 4px; }
@media (min-width: 700px) {
  dialog.hoja { margin: auto; border-radius: 14px; max-width: 460px; padding-bottom: 12px; }
}

/* ---------- aviso flotante ---------- */
.toast { position: fixed; left: 50%; bottom: calc(var(--bottom) + 24px); transform: translateX(-50%) translateY(20px);
  background: rgba(58,58,60,.96); color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 15px; font-weight: 500;
  opacity: 0; transition: opacity .2s, transform .2s; z-index: 100; pointer-events: none; max-width: calc(100% - 32px); text-align: center; }
.toast.ver { opacity: 1; transform: translateX(-50%); }
.toast.error { background: rgba(255,69,58,.95); }

/* ---------- utilidades ---------- */
.centro { text-align: center; }
.tenue { color: var(--label2); }
.espaciador { height: 16px; }
.cargando { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--fill2); border-top-color: var(--label2);
  animation: girar .9s linear infinite; margin: 0 auto; }
@keyframes girar { to { transform: rotate(360deg); } }
.vacio { text-align: center; color: var(--label2); padding: 28px 16px; font-size: 15px; }
