/* Tema claro (por defecto). El oscuro se activa con data-tema="oscuro" (o "auto" + sistema oscuro). */
:root {
  --bg: #EEF2F7; --card: #FFFFFF; --card2: #EDF0F5; --text: #0E1525; --sub: #5B6475; --faint: #9AA3B2;
  --line: rgba(14,21,37,.07); --accent: #2F6BFF; --ok: #1FA463; --warn: #F08A00; --bad: #E5383B;
  --shadow: 0 1px 1px rgba(14,21,37,.03), 0 6px 20px -6px rgba(14,21,37,.08);
  --blob1: #BFD2FF; --blob2: #C4EEDB; --blob3: #DDD0FF;
  --glass: rgba(255,255,255,.58); --glass-borde: rgba(255,255,255,.85); --glass-luz: rgba(255,255,255,.9);
  --glass-sombra: 0 18px 40px -12px rgba(30,45,80,.28), 0 2px 6px rgba(30,45,80,.06);
  --pastilla: rgba(47,107,255,.12);
  --r: 22px; --tab-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, "Segoe UI", Roboto, sans-serif;
  --redonda: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  color-scheme: light;
}
:root[data-tema="oscuro"] {
  --bg: #07090E; --card: #141821; --card2: #1D222D; --text: #F2F5FA; --sub: #98A1B2; --faint: #5E6778;
  --line: rgba(255,255,255,.08); --accent: #5B8CFF; --shadow: none;
  --blob1: #1B2B5C; --blob2: #0F3A2D; --blob3: #2E2258;
  --glass: rgba(28,33,44,.55); --glass-borde: rgba(255,255,255,.12); --glass-luz: rgba(255,255,255,.18);
  --glass-sombra: 0 18px 40px -12px rgba(0,0,0,.6); --pastilla: rgba(91,140,255,.2);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-tema="auto"] {
    --bg: #07090E; --card: #141821; --card2: #1D222D; --text: #F2F5FA; --sub: #98A1B2; --faint: #5E6778;
    --line: rgba(255,255,255,.08); --accent: #5B8CFF; --shadow: none;
    --blob1: #1B2B5C; --blob2: #0F3A2D; --blob3: #2E2258;
    --glass: rgba(28,33,44,.55); --glass-borde: rgba(255,255,255,.12); --glass-luz: rgba(255,255,255,.18);
    --glass-sombra: 0 18px 40px -12px rgba(0,0,0,.6); --pastilla: rgba(91,140,255,.2);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
/* Luz ambiente: tres manchas difusas fijas detrás de todo, para que el vidrio tenga qué refractar */
body::before { content: ""; position: fixed; inset: -20vh -20vw; z-index: -1; pointer-events: none;
  background:
    radial-gradient(38vmax 32vmax at 12% 8%, var(--blob1), transparent 70%),
    radial-gradient(34vmax 30vmax at 92% 38%, var(--blob2), transparent 70%),
    radial-gradient(40vmax 34vmax at 30% 96%, var(--blob3), transparent 70%);
  filter: blur(20px); opacity: 1; }
body { min-height: 100dvh; overscroll-behavior-y: contain; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--accent); text-decoration: none; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Estructura ---------- */
.shell { display: flex; min-height: 100dvh; }
.side { display: none; }
.main { flex: 1; min-width: 0; padding: calc(env(safe-area-inset-top) + 14px) 16px calc(var(--tab-h) + env(safe-area-inset-bottom) + 40px); max-width: 920px; margin: 0 auto; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 2px 14px; }
.top h1 { font-size: 34px; line-height: 1.1; font-weight: 750; letter-spacing: -.035em; margin: 0; }
.top .acciones { display: flex; gap: 8px; }
.icono-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--text); transition: transform .15s; }
.icono-btn:active { transform: scale(.92); }
.icono-btn svg { width: 19px; height: 19px; }
.girando svg { animation: girar .8s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }

/* ---------- Vidrio: barra flotante (celu) y panel lateral (compu) ---------- */
.vidrio {
  background: var(--glass);
  backdrop-filter: blur(26px) saturate(190%); -webkit-backdrop-filter: blur(26px) saturate(190%);
  border: 1px solid var(--glass-borde);
  box-shadow: inset 0 1px 0 var(--glass-luz), var(--glass-sombra);
}
.tabs { position: fixed; z-index: 10; left: 14px; right: 14px; bottom: calc(env(safe-area-inset-bottom) + 10px);
  max-width: 440px; margin: 0 auto; height: var(--tab-h); border-radius: 26px; padding: 6px;
  display: grid; grid-template-columns: repeat(4, 1fr); isolation: isolate; }
/* La pastilla que marca la pestaña activa y se desliza entre ellas */
.tabs .pastilla { position: absolute; z-index: -1; top: 6px; bottom: 6px; left: 6px; width: calc((100% - 12px) / 4);
  border-radius: 20px; background: var(--pastilla); box-shadow: inset 0 0 0 1px rgba(47,107,255,.08);
  transform: translateX(calc(var(--i, 0) * 100%)); transition: transform .45s cubic-bezier(.3,1.35,.45,1); }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10.5px; font-weight: 600; letter-spacing: .01em; color: var(--sub); border-radius: 20px; transition: color .25s; }
.tab svg { width: 23px; height: 23px; transition: transform .3s cubic-bezier(.3,1.4,.5,1); }
.tab.on { color: var(--accent); }
.tab.on svg { transform: translateY(-1px) scale(1.06); }
.tab:active svg { transform: scale(.88); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

@media (min-width: 768px) {
  .tabs { display: none; }
  .side { display: flex; flex-direction: column; gap: 2px; width: 232px; margin: 16px 0 16px 16px; padding: 20px 10px; position: sticky; top: 16px; height: calc(100dvh - 32px); border-radius: 26px; }
  .side .marca { font-weight: 700; font-size: 19px; letter-spacing: -.02em; padding: 0 10px 20px; display: flex; align-items: center; gap: 10px; }
  .side .marca img { width: 30px; height: 30px; border-radius: 9px; }
  .side .tab { flex-direction: row; justify-content: flex-start; gap: 12px; font-size: 15px; font-weight: 500; padding: 10px 12px; border-radius: 14px; color: var(--text); }
  .side .tab svg { width: 20px; height: 20px; color: var(--sub); }
  .side .tab.on { background: var(--pastilla); color: var(--accent); }
  .side .tab.on svg { color: var(--accent); transform: none; }
  .main { padding: 36px 40px 48px; }
}

/* ---------- Filtros ---------- */
.filtros { display: flex; flex-wrap: wrap; gap: 8px; overflow-x: auto; margin: 0 -16px 16px; padding: 0 16px; scrollbar-width: none; }
.filtros::-webkit-scrollbar { display: none; }
.seg { display: inline-flex; background: color-mix(in srgb, var(--card) 55%, transparent); border: 1px solid var(--line); border-radius: 12px; padding: 3px; flex: none; }
.seg button { padding: 6px 12px; border-radius: 9px; font-size: 13.5px; font-weight: 500; color: var(--sub); white-space: nowrap; transition: background .2s, color .2s; display: inline-flex; align-items: center; gap: 6px; }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(14,21,37,.08), 0 2px 8px -2px rgba(14,21,37,.1); }
.punto { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

/* ---------- Tarjetas ---------- */
.card { background: var(--card); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card h2 { font-size: 15px; font-weight: 650; color: var(--text); letter-spacing: -.01em; margin: 0 0 14px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card h2 small { font-size: 12px; font-weight: 500; color: var(--sub); display: flex; gap: 10px; align-items: center; }

.hero .etq { font-size: 15px; color: var(--sub); margin: 0 0 6px; }
.hero .grande { font-family: var(--redonda); font-size: clamp(44px, 13vw, 60px); font-weight: 700; letter-spacing: -.04em; line-height: 1; margin: 0; }
.hero .usd { font-family: var(--redonda); font-size: 22px; font-weight: 600; letter-spacing: -.02em; color: var(--sub); margin: 8px 0 0; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 22px; }
.stat { background: var(--card2); border-radius: 16px; padding: 11px 10px 10px; }
.stat b { display: block; font-family: var(--redonda); font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.stat span { font-size: 11.5px; color: var(--sub); }
.vivo { display: inline-flex; align-items: center; gap: 5px; }
.vivo i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(48,177,88,.6); animation: latido 2s infinite; }
@keyframes latido { 0% { box-shadow: 0 0 0 0 rgba(48,177,88,.5); } 70% { box-shadow: 0 0 0 7px rgba(48,177,88,0); } 100% { box-shadow: 0 0 0 0 rgba(48,177,88,0); } }

.grafico { display: flex; align-items: flex-end; gap: 5px; height: 120px; }
.barra { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.barra .par { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.barra .par i { width: 42%; max-width: 12px; border-radius: 4px 4px 2px 2px; min-height: 3px; transition: height .5s cubic-bezier(.2,.8,.2,1); }
.barra .par i.c { background: var(--card2); }
.barra .par i.v { background: var(--accent); }
.barra span { font-size: 10px; color: var(--faint); }
.barra.hoy span { color: var(--text); font-weight: 600; }
.leyenda i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 4px; }

.tiendas { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .tiendas { grid-template-columns: 1fr 1fr; } }
.tienda { margin: 0; position: relative; overflow: hidden; }
.tienda .cab { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.tienda .cab b { font-size: 17px; font-weight: 600; }
.tienda .cab .vivo { margin-left: auto; font-size: 12.5px; color: var(--sub); }
.tienda .linea { display: flex; justify-content: space-between; padding: 7px 0; font-size: 15px; border-top: .5px solid var(--line); }
.tienda .linea span { color: var(--sub); }
.tienda .linea b { font-weight: 600; }
.tienda::before { content: ""; position: absolute; left: 0; top: 18px; width: 4px; height: 24px; border-radius: 0 4px 4px 0; background: var(--c); }

.aviso { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--warn) 14%, var(--card)); font-size: 14px; margin-bottom: 14px; }
.aviso svg { width: 18px; height: 18px; color: var(--warn); flex: none; }

/* ---------- Listas ---------- */
.lista { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 14px; }
.grupo { font-size: 15px; font-weight: 650; letter-spacing: -.01em; color: var(--text); margin: 24px 4px 10px; }
.grupo::first-letter { text-transform: uppercase; }
.grupo:first-child { margin-top: 4px; }
.fila { display: flex; gap: 12px; align-items: center; padding: 12px 16px; position: relative; }
.fila + .fila::before { content: ""; position: absolute; top: 0; left: 64px; right: 0; border-top: .5px solid var(--line); }
.fila .ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; flex: none; }
.fila .txt { flex: 1; min-width: 0; }
.fila .txt b { display: block; font-size: 15px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fila .txt span { display: block; font-size: 13px; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.fila .txt span.multi { white-space: normal; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.fila .der { text-align: right; flex: none; }
.fila .der b { display: block; font-size: 15px; font-weight: 600; }
.fila .der span { font-size: 12px; color: var(--faint); }
.etiqueta { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--sub); }
.etiqueta .punto { width: 6px; height: 6px; }
.chip-ok { font-size: 11px; font-weight: 600; color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); padding: 2px 7px; border-radius: 6px; margin-left: 6px; }
.chip-baja { font-size: 11px; font-weight: 600; color: var(--sub); background: var(--card2); padding: 2px 7px; border-radius: 6px; margin-left: 6px; }
.acc { display: flex; gap: 8px; flex: none; }
.acc a { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--card2); }
.acc a svg { width: 17px; height: 17px; }
.acc a.wa { background: color-mix(in srgb, #25D366 16%, transparent); color: #1DA851; }

.ico.venta { background: color-mix(in srgb, var(--ok) 16%, transparent); }
.ico.checkout { background: color-mix(in srgb, var(--warn) 16%, transparent); }
.ico.lead { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.ico.opinion { background: color-mix(in srgb, #FFD60A 22%, transparent); }

.buscar { display: flex; align-items: center; gap: 8px; background: color-mix(in srgb, var(--card) 70%, transparent); border: 1px solid var(--line); border-radius: 14px; padding: 0 12px; margin-bottom: 14px; }
.buscar svg { width: 17px; height: 17px; color: var(--faint); flex: none; }
.buscar input { flex: 1; border: 0; background: none; padding: 10px 0; font-size: 16px; outline: none; }
.vacio { padding: 36px 20px; text-align: center; color: var(--sub); font-size: 15px; line-height: 1.5; }
.mas { display: block; width: 100%; padding: 14px; font-size: 15px; color: var(--accent); font-weight: 500; border-top: .5px solid var(--line); }

/* ---------- Ajustes ---------- */
.opcion { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; font-size: 16px; }
.opcion + .opcion { border-top: .5px solid var(--line); }
.opcion small { display: block; color: var(--sub); font-size: 13px; margin-top: 2px; }
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--card2); border-radius: 31px; transition: background .25s; }
.switch span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.2); transition: transform .25s cubic-bezier(.3,.7,.3,1); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 15px; border-radius: 16px; font-size: 16px; font-weight: 600; background: var(--accent); color: #fff; box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--accent) 70%, transparent); transition: transform .15s, opacity .2s; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; }
.btn.sec { background: var(--card2); color: var(--accent); }
.btn.peligro { background: var(--card2); color: var(--bad); }
.pasos { margin: 0; padding: 0 0 0 4px; list-style: none; counter-reset: p; }
.pasos li { counter-increment: p; display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; font-size: 15px; line-height: 1.4; }
.pasos li::before { content: counter(p); width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 13px; font-weight: 700; display: grid; place-items: center; flex: none; }
.pasos svg { width: 17px; height: 17px; vertical-align: -3px; color: var(--accent); }
.nota { font-size: 13px; color: var(--sub); margin: 10px 4px 0; line-height: 1.45; }
.estado { font-size: 14px; color: var(--sub); margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
.estado .punto { width: 9px; height: 9px; }

/* ---------- Login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login .caja { width: 100%; max-width: 360px; text-align: center; }
.login img { width: 72px; height: 72px; border-radius: 18px; box-shadow: 0 8px 24px rgba(0,0,0,.15); margin-bottom: 20px; }
.login h1 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 6px; }
.login p { color: var(--sub); margin: 0 0 26px; font-size: 15px; line-height: 1.45; }
.campo { width: 100%; padding: 15px 16px; border-radius: 14px; border: 0; background: var(--card); box-shadow: var(--shadow); font-size: 17px; margin-bottom: 12px; outline: none; text-align: center; }
.campo:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.campo.codigo { letter-spacing: 10px; font-size: 26px; font-weight: 600; }
.error { color: var(--bad); font-size: 14px; min-height: 20px; margin: 8px 0 0; }
.link { color: var(--accent); font-size: 15px; margin-top: 18px; display: inline-block; }

/* ---------- Varios ---------- */
.esqueleto { background: linear-gradient(90deg, var(--card2) 25%, var(--card) 50%, var(--card2) 75%); background-size: 200% 100%; animation: brillo 1.4s infinite; border-radius: 10px; }
@keyframes brillo { to { background-position: -200% 0; } }
.tirar { height: 0; overflow: hidden; display: grid; place-items: center; color: var(--faint); transition: height .2s; }
.tirar svg { width: 22px; height: 22px; }
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 24px); transform: translateX(-50%) translateY(20px); opacity: 0; background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 14px; font-size: 14px; font-weight: 500; transition: opacity .25s, transform .25s; z-index: 20; pointer-events: none; max-width: 90vw; text-align: center; }
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (min-width: 768px) { .toast { bottom: 28px; } }
.vista { animation: entrar .28s cubic-bezier(.2,.8,.2,1); }
@keyframes entrar { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Etiquetas dentro de filas (sin heredar el display:block de .txt span) */
.fila .txt span.etiqueta { display: inline-flex; margin-top: 4px; font-size: 11.5px; color: var(--sub); }
.fila .txt span.punto { display: inline-block; margin: 0; }
.fila .txt b span.chip-ok, .fila .txt b span.chip-baja { display: inline-block; margin-top: 0; vertical-align: 1px; }

/* ---------- Apariencia ---------- */
.seg.ancho { display: flex; width: 100%; }
.seg.ancho button { flex: 1; justify-content: center; padding: 9px 8px; }
.btn.sec, .btn.peligro { box-shadow: none; }
.hero { padding: 22px 20px 20px; }
body { background: transparent; }
.stat b.vivo { display: flex; align-items: center; gap: 7px; }
