/* ============================================================
   PLATAFORMA DE INCENTIVOS — Loyalty Rewards Latinoamérica
   Sistema de diseño v1 · tokens idénticos al sitio público
   ============================================================ */
:root {
  --ink: #061e3f; --ink-2: #0d3a6e;
  --blue: #1565c0; --blue-l: #1e88e5;
  --sky: #00b4d8; --sky-l: #48cae4;
  --white: #ffffff; --off: #f0f6ff;
  --surface: #e8f0fe; --ghost: #f5f9ff;
  --muted: #607d8b; --body: #2c3e5a; --text: #0a1628;
  --gold: #f5a623; --gold-l: #ffd166;
  --green: #00c896; --red: #e5484d;
  --r-sm: 8px; --r: 14px; --r-lg: 20px; --r-xl: 28px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 4px 16px rgba(6,30,63,.08), 0 1px 4px rgba(6,30,63,.04);
  --shadow-lg: 0 16px 48px rgba(6,30,63,.14), 0 4px 12px rgba(6,30,63,.06);
  --shadow-xl: 0 32px 80px rgba(6,30,63,.22), 0 8px 24px rgba(6,30,63,.1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
}
* { margin:0; padding:0; box-sizing:border-box; }
html { -webkit-text-size-adjust:100%; }
body {
  font-family:'DM Sans',sans-serif; font-size:15px; line-height:1.6;
  color:var(--body); background:var(--ghost); min-height:100dvh;
}
h1,h2,h3,h4 { font-family:'Sora',sans-serif; color:var(--text); line-height:1.25; }
button { font:inherit; border:0; background:none; cursor:pointer; color:inherit; }
a { color:var(--blue); text-decoration:none; }
input,select,textarea { font:inherit; }
.mono { font-family:'DM Mono',monospace; }
:focus-visible { outline:3px solid var(--sky); outline-offset:2px; border-radius:6px; }
::selection { background:var(--sky-l); color:var(--ink); }

/* ---------- Shell: sidebar + contenido ---------- */
.app { display:grid; grid-template-columns:250px 1fr; min-height:100dvh; }
.sidebar {
  background:linear-gradient(180deg,var(--ink) 0%,#04162f 100%);
  color:#fff; display:flex; flex-direction:column; position:sticky; top:0;
  height:100dvh; padding:22px 16px calc(16px + env(safe-area-inset-bottom));
}
.brand { display:flex; align-items:center; gap:10px; padding:2px 8px 20px;
  border-bottom:1px solid rgba(255,255,255,.08); margin-bottom:16px; }
.brand-name strong { display:block; font-family:'Sora',sans-serif; font-weight:700; font-size:13.5px; color:#fff; }
.brand-name small { font-size:9px; color:var(--sky); letter-spacing:3px; text-transform:uppercase; }
.nav { display:flex; flex-direction:column; gap:2px; flex:1; }
.nav button, .nav a {
  display:flex; align-items:center; gap:11px; width:100%; padding:11px 12px;
  border-radius:11px; font-size:13.5px; font-weight:500; color:rgba(255,255,255,.62);
  transition:all .18s var(--ease-out); text-align:left;
}
.nav svg { width:17px; height:17px; flex:none; opacity:.8; }
.nav button:hover, .nav a:hover { color:#fff; background:rgba(255,255,255,.06); }
.nav button.on {
  color:#fff; background:rgba(0,180,216,.13);
  box-shadow:inset 3px 0 0 var(--sky);
}
.nav-tag { margin-left:auto; font-size:9px; font-weight:700; letter-spacing:1px;
  padding:2px 7px; border-radius:20px; background:rgba(245,166,35,.16); color:var(--gold-l); text-transform:uppercase; }
.side-user { border-top:1px solid rgba(255,255,255,.08); padding-top:14px; display:flex; align-items:center; gap:10px; }
.avatar { width:34px; height:34px; border-radius:50%; flex:none; display:grid; place-items:center;
  background:linear-gradient(135deg,var(--sky),var(--blue)); font-family:'Sora',sans-serif; font-weight:700; font-size:13px; color:#fff; }
.side-user b { display:block; font-size:12.5px; color:#fff; font-weight:600; line-height:1.3; }
.side-user small { font-size:10.5px; color:rgba(255,255,255,.45); }
.salir { margin-left:auto; opacity:.55; padding:8px; border-radius:9px; transition:.18s; }
.salir:hover { opacity:1; background:rgba(255,255,255,.08); }

.main { padding:26px clamp(18px,3.5vw,44px) 90px; max-width:1180px; width:100%; }
.tophead { display:flex; align-items:flex-end; justify-content:space-between; gap:16px; flex-wrap:wrap; margin-bottom:24px; }
.tophead h1 { font-size:clamp(21px,2.4vw,27px); font-weight:800; letter-spacing:-.02em; }
.tophead p { color:var(--muted); font-size:13.5px; margin-top:3px; }
.chip-empresa { display:inline-flex; align-items:center; gap:8px; padding:8px 15px;
  background:var(--white); border:1px solid var(--surface); border-radius:50px;
  font-size:12.5px; font-weight:600; color:var(--ink); box-shadow:var(--shadow-sm); }
.chip-empresa i { width:8px; height:8px; border-radius:50%; background:var(--green); box-shadow:0 0 0 3px rgba(0,200,150,.18); }

/* ---------- Tarjetas y stats ---------- */
.card { background:var(--white); border:1px solid var(--surface); border-radius:var(--r-lg);
  box-shadow:var(--shadow); padding:22px; }
.grid-stats { display:grid; grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); gap:14px; margin-bottom:24px; }
.stat { position:relative; overflow:hidden; }
.stat small { display:block; font-size:10.5px; font-weight:700; letter-spacing:1.6px;
  text-transform:uppercase; color:var(--muted); margin-bottom:8px; }
.stat b { font-family:'DM Mono',monospace; font-size:30px; font-weight:500; color:var(--ink); letter-spacing:-.02em; }
.stat span.sub { display:block; font-size:12px; color:var(--muted); margin-top:4px; }
.stat::after { content:''; position:absolute; right:-22px; top:-22px; width:74px; height:74px;
  background:radial-gradient(circle,rgba(0,180,216,.09),transparent 70%); border-radius:50%; }

/* ---------- Módulos (tablero central con switches) ---------- */
.modulos { display:grid; grid-template-columns:repeat(auto-fit,minmax(268px,1fr)); gap:16px; }
.mod { position:relative; overflow:hidden; display:flex; flex-direction:column; gap:14px;
  padding:24px; transition:transform .28s var(--ease-out), box-shadow .28s var(--ease-out); }
.mod:hover { transform:translateY(-3px); box-shadow:var(--shadow-lg); }
.mod .hexbg { position:absolute; right:-34px; bottom:-42px; width:150px; height:150px; opacity:.05; pointer-events:none;
  transition:opacity .3s, transform .5s var(--ease-out); }
.mod.encendida .hexbg { opacity:.1; transform:rotate(8deg) scale(1.04); }
.mod-head { display:flex; align-items:center; gap:13px; }
.mod-ico { width:46px; height:46px; border-radius:14px; display:grid; place-items:center; flex:none;
  color:#fff; box-shadow:var(--shadow); }
.mod-ico svg { width:22px; height:22px; }
.mod-ico.i-dig { background:linear-gradient(135deg,var(--sky),var(--blue)); }
.mod-ico.i-fis { background:linear-gradient(135deg,var(--gold),#e8901a); }
.mod-ico.i-kit { background:linear-gradient(135deg,var(--ink-2),var(--ink)); }
.mod h3 { font-size:15.5px; font-weight:700; }
.mod-estado { display:flex; align-items:center; gap:7px; font-size:11px; font-weight:700;
  letter-spacing:1.2px; text-transform:uppercase; color:var(--muted); }
.mod-estado i { width:8px; height:8px; border-radius:50%; background:#c3cfdd; }
.mod.encendida .mod-estado { color:var(--green); }
.mod.encendida .mod-estado i { background:var(--green); animation:pulso 2.2s infinite; }
@keyframes pulso { 0%{box-shadow:0 0 0 0 rgba(0,200,150,.45)} 70%{box-shadow:0 0 0 8px rgba(0,200,150,0)} 100%{box-shadow:0 0 0 0 rgba(0,200,150,0)} }
.mod p { font-size:13px; color:var(--muted); line-height:1.55; flex:1; }
.mod-pie { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.mod-pie small { font-size:12px; color:var(--muted); }

/* Switch */
.sw { position:relative; width:52px; height:29px; flex:none; }
.sw input { position:absolute; inset:0; opacity:0; cursor:pointer; z-index:2; margin:0; }
.sw i { position:absolute; inset:0; border-radius:30px; background:#d5dfec; transition:background .25s var(--ease-out); }
.sw i::after { content:''; position:absolute; top:3px; left:3px; width:23px; height:23px; border-radius:50%;
  background:#fff; box-shadow:var(--shadow-sm); transition:transform .25s var(--ease-out); }
.sw input:checked + i { background:linear-gradient(135deg,var(--sky),var(--blue)); }
.sw input:checked + i::after { transform:translateX(23px); }
.sw input:focus-visible + i { outline:3px solid var(--sky-l); outline-offset:2px; }
.sw input:disabled + i { opacity:.5; cursor:not-allowed; }

/* ---------- Botones ---------- */
.btn { display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:12px 22px; min-height:44px; border-radius:12px; font-family:'Sora',sans-serif;
  font-size:13.5px; font-weight:700; letter-spacing:.01em;
  background:linear-gradient(135deg,var(--blue),var(--blue-l)); color:#fff;
  box-shadow:0 6px 18px rgba(21,101,192,.28); transition:all .2s var(--ease-out); }
.btn:hover { transform:translateY(-1px); box-shadow:0 10px 26px rgba(21,101,192,.36); }
.btn:active { transform:translateY(0); }
.btn:disabled { opacity:.55; transform:none; cursor:wait; box-shadow:none; }
.btn-ghost { background:var(--white); color:var(--ink); border:1.5px solid var(--surface); box-shadow:var(--shadow-sm); }
.btn-ghost:hover { border-color:var(--sky-l); box-shadow:var(--shadow); }
.btn-sm { padding:8px 14px; min-height:36px; font-size:12.5px; border-radius:10px; }
.btn svg { width:16px; height:16px; }

/* ---------- Secciones / tabs internos ---------- */
.seccion { display:none; animation:aparece .35s var(--ease-out); }
.seccion.viva { display:block; }
@keyframes aparece { from{opacity:0; transform:translateY(8px)} to{opacity:1; transform:none} }
.barra-seccion { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; margin:26px 0 14px; }
.barra-seccion h2 { font-size:17px; font-weight:700; }
.buscar { display:flex; align-items:center; gap:8px; background:var(--white); border:1.5px solid var(--surface);
  border-radius:11px; padding:0 12px; height:42px; min-width:220px; box-shadow:var(--shadow-sm); }
.buscar input { border:0; outline:0; background:none; width:100%; font-size:13.5px; color:var(--text); }
.buscar svg { width:15px; height:15px; color:var(--muted); flex:none; }

/* ---------- Tabla ---------- */
.tabla-wrap { background:var(--white); border:1px solid var(--surface); border-radius:var(--r-lg);
  box-shadow:var(--shadow); overflow:auto; }
table { width:100%; border-collapse:collapse; min-width:680px; }
thead th { position:sticky; top:0; background:var(--off); font-family:'Sora',sans-serif; font-size:10.5px;
  font-weight:700; letter-spacing:1.4px; text-transform:uppercase; color:var(--muted);
  text-align:left; padding:13px 16px; border-bottom:1px solid var(--surface); z-index:1; }
tbody td { padding:13px 16px; border-bottom:1px solid var(--ghost); font-size:13.5px; vertical-align:middle; }
tbody tr:last-child td { border-bottom:0; }
tbody tr { transition:background .15s; }
tbody tr:hover { background:var(--ghost); }
td .p-nombre { font-weight:600; color:var(--text); }
td .p-mail { font-size:12px; color:var(--muted); }
.pill { display:inline-flex; align-items:center; gap:5px; padding:3px 10px; border-radius:20px;
  font-size:10.5px; font-weight:700; letter-spacing:.6px; text-transform:uppercase; }
.pill.dig { background:rgba(0,180,216,.12); color:#0077a3; }
.pill.fis { background:rgba(245,166,35,.14); color:#b06e00; }
.pill.kit { background:var(--surface); color:var(--ink-2); }
.pill.ok { background:rgba(0,200,150,.12); color:#00775a; }
.pill.off { background:#eef2f7; color:var(--muted); }
.pill.adm { background:rgba(13,58,110,.1); color:var(--ink-2); }
.puntos-num { font-family:'DM Mono',monospace; font-weight:500; color:var(--ink); }
.fila-acciones { display:flex; gap:6px; justify-content:flex-end; }
.mini { padding:7px 10px; border-radius:9px; border:1.5px solid var(--surface); background:var(--white);
  font-size:12px; font-weight:600; color:var(--ink-2); transition:.18s; display:inline-flex; align-items:center; gap:6px; }
.mini:hover { border-color:var(--sky-l); background:var(--ghost); }
.mini svg { width:13px; height:13px; }

/* ---------- Formularios ---------- */
.campo { margin-bottom:15px; }
.campo label { display:block; font-size:12px; font-weight:700; color:var(--ink); margin-bottom:6px;
  font-family:'Sora',sans-serif; }
.campo input, .campo select, .campo textarea {
  width:100%; min-height:44px; padding:10px 14px; border:1.5px solid var(--surface); border-radius:11px;
  background:var(--ghost); color:var(--text); font-size:14px; transition:border .2s, background .2s; }
.campo textarea { min-height:110px; resize:vertical; font-family:'DM Mono',monospace; font-size:12.5px; line-height:1.7; }
.campo input:focus, .campo select:focus, .campo textarea:focus {
  outline:0; border-color:var(--sky); background:var(--white); box-shadow:0 0 0 4px rgba(0,180,216,.12); }
.campo .ayuda { font-size:11.5px; color:var(--muted); margin-top:5px; }
.campo-error { color:var(--red); font-size:12px; margin-top:5px; display:none; }
.dos-col { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.checks { display:flex; gap:8px; flex-wrap:wrap; }
.check-pill { position:relative; }
.check-pill input { position:absolute; inset:0; opacity:0; cursor:pointer; margin:0; }
.check-pill span { display:inline-flex; align-items:center; gap:6px; padding:9px 15px; border-radius:11px;
  border:1.5px solid var(--surface); background:var(--white); font-size:12.5px; font-weight:600; color:var(--muted);
  transition:.18s; user-select:none; }
.check-pill input:checked + span { border-color:var(--sky); background:rgba(0,180,216,.08); color:var(--ink); }
.check-pill input:focus-visible + span { outline:3px solid var(--sky-l); outline-offset:2px; }

/* ---------- Modal ---------- */
dialog { border:0; border-radius:var(--r-xl); box-shadow:var(--shadow-xl); padding:0;
  width:min(520px, calc(100vw - 32px)); background:var(--white); }
dialog::backdrop { background:rgba(6,30,63,.45); backdrop-filter:blur(3px); }
.modal-head { display:flex; align-items:center; justify-content:space-between; padding:22px 26px 0; }
.modal-head h3 { font-size:17px; font-weight:800; }
.modal-x { width:34px; height:34px; border-radius:10px; display:grid; place-items:center; color:var(--muted); transition:.18s; }
.modal-x:hover { background:var(--ghost); color:var(--ink); }
.modal-cuerpo { padding:18px 26px 26px; }
.modal-pie { display:flex; gap:10px; justify-content:flex-end; margin-top:6px; }

/* ---------- Toast ---------- */
#toasts { position:fixed; bottom:calc(18px + env(safe-area-inset-bottom)); left:50%; transform:translateX(-50%);
  display:flex; flex-direction:column; gap:8px; z-index:99; width:min(430px, calc(100vw - 28px)); }
.toast { display:flex; align-items:center; gap:10px; background:var(--ink); color:#fff;
  padding:13px 18px; border-radius:13px; box-shadow:var(--shadow-lg); font-size:13.5px; font-weight:500;
  animation:sube .35s var(--ease-out); }
.toast.mal { background:#5c1a1e; }
.toast i { width:8px; height:8px; border-radius:50%; background:var(--green); flex:none; }
.toast.mal i { background:#ff8a8e; }
@keyframes sube { from{opacity:0; transform:translateY(14px)} to{opacity:1; transform:none} }

/* ---------- Estados vacíos y carga ---------- */
.vacio { text-align:center; padding:52px 24px; color:var(--muted); }
.vacio svg { width:44px; height:44px; color:var(--sky-l); margin-bottom:12px; }
.vacio b { display:block; font-family:'Sora',sans-serif; font-size:15px; color:var(--ink); margin-bottom:5px; }
.vacio p { font-size:13px; max-width:340px; margin:0 auto 16px; }
.esqueleto { border-radius:var(--r); background:linear-gradient(90deg,var(--surface) 25%,var(--off) 45%,var(--surface) 65%);
  background-size:220% 100%; animation:brillo 1.4s infinite; }
@keyframes brillo { to{background-position:-120% 0} }
.aviso-fase { display:flex; align-items:center; gap:10px; background:rgba(245,166,35,.1);
  border:1px solid rgba(245,166,35,.3); color:#8a5a00; border-radius:12px; padding:12px 16px; font-size:13px; }
.aviso-fase svg { width:16px; height:16px; flex:none; }

/* ---------- Login ---------- */
.login-fondo { min-height:100dvh; display:grid; place-items:center; padding:24px;
  background:radial-gradient(1100px 620px at 78% -10%, rgba(0,180,216,.16), transparent 60%),
             radial-gradient(900px 560px at -10% 108%, rgba(21,101,192,.14), transparent 55%), var(--ink); }
.login-caja { width:min(430px,100%); background:var(--white); border-radius:var(--r-xl);
  box-shadow:var(--shadow-xl); padding:38px 36px 32px; animation:aparece .5s var(--ease-out); }
.login-caja .brand { border:0; padding:0 0 20px; margin:0; }
.login-caja .brand-name strong { color:var(--ink); font-size:15px; }
.login-caja h1 { font-size:21px; font-weight:800; margin-bottom:6px; }
.login-caja > p { font-size:13.5px; color:var(--muted); margin-bottom:22px; }
.nota-legal { margin-top:20px; text-align:center; font-size:11px; color:var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width:920px) {
  .app { grid-template-columns:1fr; }
  .sidebar { position:sticky; top:0; z-index:20; height:auto; flex-direction:row; align-items:center;
    gap:6px; padding:10px 12px; padding-left:calc(12px + env(safe-area-inset-left)); }
  .brand { border:0; margin:0; padding:0 8px 0 0; }
  .brand-name small { display:none; }
  .nav { flex-direction:row; overflow-x:auto; scrollbar-width:none; gap:4px; }
  .nav::-webkit-scrollbar { display:none; }
  .nav button, .nav a { width:auto; padding:9px 12px; white-space:nowrap; font-size:12.5px; }
  .nav button.on { box-shadow:inset 0 -3px 0 var(--sky); }
  .nav svg { display:none; }
  .side-user { border:0; padding:0; margin-left:auto; }
  .side-user > div { display:none; }
  .main { padding:20px 16px 80px; }
  .dos-col { grid-template-columns:1fr; }
}
@media (prefers-reduced-motion:reduce) {
  *, *::before, *::after { animation-duration:.01ms !important; transition-duration:.01ms !important; }
}
