/* ===== Loopi · estilos ===== */
:root {
  --local: #6C4DFF; --sobre: #FFFFFF; --coral: #FF6B8A;
  --base: #F6F7FB; --ink: #171725; --mu: #555A70; --ln: rgba(23, 23, 37, 0.09);
  --glass: rgba(255, 255, 255, 0.62); --glassbd: rgba(255, 255, 255, 0.85);
  --sombra: 0 8px 28px rgba(23, 23, 37, 0.08);
  --input: rgba(255, 255, 255, 0.85);
  --soft: color-mix(in srgb, var(--local) 13%, rgba(255, 255, 255, 0.5));
  --softtx: color-mix(in srgb, var(--local) 70%, #000);
  --link: color-mix(in srgb, var(--local) 72%, #000);
  --coralsoft: rgba(255, 107, 138, 0.16); --coraltx: #A3213F; --cod: #C42B52;
  --dis: rgba(23, 23, 37, 0.06); --distx: #8A8FA3;
  --g1: 45%; --g2: 28%; --g3: 22%;
  --pill: rgba(255, 255, 255, 0.55); --pillbd: rgba(255, 255, 255, 0.85);
  --pillsh: 0 10px 30px rgba(23, 23, 37, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --act: rgba(255, 255, 255, 0.95); --acttx: #171725; --actsh: 0 2px 8px rgba(23, 23, 37, 0.1); --inact: #555A70;
  color-scheme: light;
}
[data-tema="oscuro"] {
  --base: #0D0D16; --ink: #F2F2F7; --mu: #A9ADC2; --ln: rgba(255, 255, 255, 0.1);
  --glass: rgba(255, 255, 255, 0.07); --glassbd: rgba(255, 255, 255, 0.14);
  --sombra: 0 8px 28px rgba(0, 0, 0, 0.35);
  --input: rgba(255, 255, 255, 0.06);
  --soft: color-mix(in srgb, var(--local) 26%, rgba(255, 255, 255, 0.04));
  --softtx: color-mix(in srgb, var(--local) 45%, #fff);
  --link: color-mix(in srgb, var(--local) 45%, #fff);
  --coralsoft: rgba(255, 107, 138, 0.16); --coraltx: #FFA3B6; --cod: #FF8FA6;
  --dis: rgba(255, 255, 255, 0.06); --distx: #7A7F99;
  --g1: 38%; --g2: 22%; --g3: 18%;
  --pill: rgba(255, 255, 255, 0.08); --pillbd: rgba(255, 255, 255, 0.2);
  --pillsh: 0 12px 30px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  --act: rgba(255, 255, 255, 0.16); --acttx: #FFFFFF; --actsh: none; --inact: rgba(255, 255, 255, 0.65);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; overscroll-behavior-y: none; }
body { overscroll-behavior-y: none; }
body {
  margin: 0; min-height: 100vh; background: var(--base); color: var(--ink);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 16px; line-height: 1.45;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(90% 55% at 8% 0%, color-mix(in srgb, var(--local) var(--g1), transparent) 0%, transparent 70%),
    radial-gradient(80% 50% at 100% 38%, color-mix(in srgb, var(--local) var(--g2), transparent) 0%, transparent 70%),
    radial-gradient(90% 60% at 25% 100%, color-mix(in srgb, var(--local) var(--g3), transparent) 0%, transparent 70%),
    var(--base);
}
a { color: var(--link); font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--local); outline-offset: 2px; }
img { max-width: 100%; }
.oculto { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; position: relative; }
.cargando { padding: 80px 20px; text-align: center; color: var(--mu); }
.cuerpo { padding: 20px 18px 0; display: flex; flex-direction: column; gap: 14px; }
.con-nav { padding-bottom: 110px; }
h1 { margin: 0; font-size: 28px; line-height: 1.1; font-weight: 800; letter-spacing: -0.025em; }
h2 { margin: 0; font-size: 17px; font-weight: 800; }
.sub { margin: 4px 0 0; color: var(--mu); font-size: 15px; }
.chico { font-size: 13px; color: var(--mu); }
.centro { text-align: center; }

/* Cabeceras de vidrio (bajadas para no chocar con la barra del celular) */
.hdr-local, .hdr-app {
  margin: calc(env(safe-area-inset-top, 0px) + 22px) 12px 0; padding: 16px 18px 18px; border-radius: 24px;
  display: flex; flex-direction: column; gap: 12px; color: var(--ink); background: var(--glass); border: 1px solid var(--glassbd); box-shadow: var(--sombra); -webkit-backdrop-filter: blur(20px) saturate(1.5); backdrop-filter: blur(20px) saturate(1.5);
}
.hdr-local a.volver { color: var(--mu); font-size: 13px; text-decoration: none; }
.hdr-fila { display: flex; align-items: center; gap: 12px; }
.logo-local {
  width: 48px; height: 48px; border-radius: 50%; background: var(--local); color: var(--sobre); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; overflow: hidden;
}
.logo-local:has(img) { background: #fff; box-shadow: 0 0 0 1px var(--ln); }
.logo-local img { width: 82%; height: 82%; object-fit: contain; }
.logo-local.grande { width: 72px; height: 72px; font-size: 20px; }
.hdr-nombre { font-weight: 800; font-size: 18px; line-height: 1.15; }
.hdr-rubro { font-size: 13px; color: var(--mu); }
.barra-sup { display: flex; align-items: center; padding: calc(env(safe-area-inset-top, 0px) + 22px) 16px 0; }
.marca { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 19px; letter-spacing: -0.03em; }
.marca img { width: 32px; height: 32px; }
.etiqueta { font-size: 13px; font-weight: 700; background: var(--soft); color: var(--softtx); padding: 6px 11px; border-radius: 20px; border: 0; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fila { display: flex; align-items: center; gap: 8px; }
.empuja { margin-left: auto; }

/* Botón de tema */
.btn-tema {
  width: 40px; height: 40px; border-radius: 50%; border: 0; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; background: var(--soft); color: var(--softtx);
}

/* Tarjetas y formularios */
.card { border-radius: 20px; padding: 16px 18px; color: var(--ink); background: var(--glass); border: 1px solid var(--glassbd); box-shadow: var(--sombra); -webkit-backdrop-filter: blur(20px) saturate(1.5); backdrop-filter: blur(20px) saturate(1.5); }
button.card, a.card { font: inherit; text-align: left; width: 100%; }
.opcion { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.opcion b { display: block; font-size: 17px; }
.opcion .ico-op { width: 48px; height: 48px; border-radius: 16px; background: var(--soft); color: var(--softtx); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.card.lista { padding: 0; overflow: hidden; }
.campo { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
.campo input, .campo textarea, .campo select, .input {
  width: 100%; min-width: 0; padding: 13px 15px; border: 1.5px solid var(--ln); border-radius: 14px;
  background: var(--input); font-weight: 400; font-size: 16px;
}
.campo textarea { resize: vertical; min-height: 96px; }
.campo .ayuda { font-weight: 400; font-size: 13px; color: var(--mu); }
input.pin { text-align: center; letter-spacing: 0.4em; font-weight: 700; font-size: 22px; }
.dos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.btn {
  display: block; width: 100%; text-align: center; text-decoration: none; border: 0; border-radius: 14px;
  padding: 15px; font-weight: 700; font-size: 16px; background: var(--local); color: var(--sobre);
}
.btn.sec { background: var(--input); color: var(--ink); border: 1.5px solid var(--ln); }
.btn.suave { background: var(--soft); color: var(--softtx); }
.btn.mini { width: auto; display: inline-block; padding: 9px 13px; font-size: 14px; border-radius: 12px; }
.btn:disabled { background: var(--dis); color: var(--distx); cursor: not-allowed; border: 0; }
.btn.coral { background: var(--coral); color: #171725; }
.link-btn { background: none; border: 0; padding: 6px; color: var(--link); font-weight: 600; font-size: 14px; }
.error { color: var(--cod); font-weight: 600; font-size: 14px; min-height: 1.2em; }

.regalo { display: flex; align-items: center; gap: 12px; background: var(--coralsoft); color: var(--coraltx); padding: 12px 16px; border-radius: 14px; font-weight: 600; font-size: 14px; }
.regalo b { font-size: 22px; font-weight: 800; }

/* Puntos */
.puntos-num { display: flex; align-items: baseline; gap: 8px; }
.puntos-num b { font-size: 56px; font-weight: 800; line-height: 1; letter-spacing: -0.03em; }
.puntos-num span { font-size: 16px; font-weight: 600; color: var(--mu); }
.barra { height: 14px; background: var(--soft); border-radius: 7px; overflow: hidden; margin: 12px 0; }
.barra > div { height: 100%; background: var(--local); border-radius: 7px; transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
.barra.fina { height: 8px; margin: 0; width: 52px; }
.falta { font-size: 15px; color: var(--mu); }
.falta b { color: var(--cod); }
.falta b.osc { color: var(--ink); }

.item { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--ln); }
.item:last-child { border-bottom: 0; }
.item .nom { flex-grow: 1; font-weight: 600; font-size: 15px; }
.badge { font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 20px; background: var(--soft); color: var(--ink); white-space: nowrap; }
.badge.ok { background: var(--coral); color: #171725; }
.mov { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--ln); font-size: 14px; }
.mov:last-child { border-bottom: 0; }
.mov time { display: block; color: var(--mu); font-size: 12px; }
.mov .mas { font-weight: 700; color: var(--link); }
.mov .menos { font-weight: 700; color: var(--cod); }

/* Filas de listas */
.fila-lista {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--ln);
  text-decoration: none; color: var(--ink); width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left;
}
.fila-lista:last-child { border-bottom: 0; }
.fila-lista .quien { flex-grow: 1; min-width: 0; }
.fila-lista .quien b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fila-lista .quien span { font-size: 13px; color: var(--mu); }
.fila-lista .pts { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; font-weight: 800; font-size: 17px; }

/* Tarjetas de "Mis locales" */
.local-card { display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--ink); }
.local-card .logo-local { width: 44px; height: 44px; font-size: 13px; }
.local-card .num { text-align: right; }
.local-card .num b { display: block; font-size: 26px; line-height: 1; font-weight: 800; }
.punteado { border: 1.5px dashed color-mix(in srgb, var(--local) 45%, transparent); border-radius: 20px; padding: 16px; display: flex; gap: 12px; align-items: center; color: var(--softtx); font-weight: 600; font-size: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 0; background: var(--soft); color: var(--softtx); font-weight: 600; font-size: 13px; padding: 8px 12px; border-radius: 20px; }
.ig { display: flex; align-items: center; gap: 12px; }
.ig .ico { width: 46px; height: 46px; border-radius: 14px; background: var(--coralsoft); color: var(--cod); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.loopi-pie { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; color: var(--mu); padding: 14px 0 4px; }
.loopi-pie img { width: 18px; height: 18px; }
.loopi-pie b { color: var(--ink); }
.ig .ico { background: var(--soft) !important; color: var(--softtx) !important; }

/* Píldora de vidrio */
.pildora {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 20;
  width: 200px; padding: 6px; display: flex; gap: 6px; border-radius: 32px;
  background: var(--pill); border: 1px solid var(--pillbd); box-shadow: var(--pillsh);
  -webkit-backdrop-filter: blur(18px) saturate(1.6); backdrop-filter: blur(18px) saturate(1.6);
}
.pildora a {
  flex: 1; height: 52px; display: flex; align-items: center; justify-content: center; border-radius: 26px;
  color: var(--inact); text-decoration: none; transition: background 0.2s;
}
.pildora a[aria-current="page"] { background: var(--act); color: var(--acttx); box-shadow: var(--actsh); }

/* Avisos */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 160px);
  background: var(--ink); color: var(--base); padding: 12px 18px; border-radius: 14px; font-weight: 700; font-size: 15px;
  transition: transform 0.3s; z-index: 50; max-width: 90%; text-align: center;
}
.toast { opacity: 0; visibility: hidden; transition: transform 0.3s, opacity 0.3s, visibility 0.3s; }
.toast.ver { transform: translate(-50%, 0); opacity: 1; visibility: visible; }

/* Bienvenida */
.portada { padding: 30px 24px 26px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.portada img { width: 130px; height: 130px; }
.portada .nombre { font-size: 48px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; }

/* Cartel imprimible */
.cartel {
  margin: 10px auto 20px; width: calc(100% - 24px); max-width: 420px; aspect-ratio: 1 / 1.414; background: var(--local); color: #fff;
  color: var(--sobre); border-radius: 20px; padding: 28px 28px 20px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
}
.cartel h1 { font-size: 36px; color: inherit; }
.cartel .qr { background: #fff; border-radius: 18px; padding: 12px; width: 200px; height: 200px; }
.cartel .qr svg { width: 100%; height: 100%; display: block; }
.cartel .logo-local { width: 42px; height: 42px; }
.cartel .loopi-pie { color: inherit; margin-top: auto; }
.cartel .loopi-pie b { color: inherit; }
.cartel .logo-local { background: #fff; color: var(--local); }
@media print {
  body { background: #fff; }
  .no-imprimir, .pildora, .toast { display: none !important; }
  .cartel { margin: 0 auto; border-radius: 0; max-width: none; width: 148mm; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@media (prefers-reduced-motion: reduce) { .barra > div, .toast, .pildora a { transition: none; } }

/* Botón con borde punteado (escanear QR) */
button.punteado { width: 100%; background: transparent; font: inherit; font-weight: 600; font-size: 14px; text-align: left; cursor: pointer; }
.chip.hoy { background: var(--coral); color: #171725; }
select.input { appearance: none; -webkit-appearance: none; background-image: none; }

/* Hojas emergentes (cumpleaños y lector QR) */
.hoja-fondo {
  position: fixed; inset: 0; z-index: 40; background: rgba(10, 10, 20, 0.45);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
}
.hoja {
  width: 100%; max-width: 480px; margin: 0 8px calc(8px + env(safe-area-inset-bottom, 0px)); padding: 22px 20px;
  border-radius: 26px; display: flex; flex-direction: column; gap: 12px; color: var(--ink);
  background: var(--base); border: 1px solid var(--glassbd); box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25);
  animation: subir 0.25s ease-out;
}
@keyframes subir { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.visor { position: relative; border-radius: 20px; overflow: hidden; background: #000; aspect-ratio: 1 / 1; }
.visor video { width: 100%; height: 100%; object-fit: cover; display: block; }
.visor .marco { position: absolute; inset: 18%; border: 3px solid rgba(255, 255, 255, 0.9); border-radius: 22px; box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.35); }
@media (prefers-reduced-motion: reduce) { .hoja { animation: none; } }

/* Guía para agregar a la pantalla de inicio */
.paso { display: flex; align-items: center; gap: 12px; font-size: 15px; }
.paso-n { width: 26px; height: 26px; border-radius: 50%; background: var(--local); color: var(--sobre); font-weight: 800; font-size: 13px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.paso-ico { width: 42px; height: 42px; border-radius: 12px; background: var(--soft); color: var(--softtx); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* Actualizar: indicador al deslizar hacia abajo y botón */
.ptr {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 12px); z-index: 30;
  width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: var(--local); background: var(--glass); border: 1px solid var(--glassbd); box-shadow: var(--sombra);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  transform: translate(-50%, -64px); opacity: 0; pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.ptr.arrastrando { transition: none; }
.ptr.girando { transform: translate(-50%, 34px) !important; opacity: 1 !important; }
.ptr.girando svg, .btn-tema.girando svg { animation: girar 0.8s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ptr.girando svg, .btn-tema.girando svg { animation-duration: 2s; } }
