:root {
  /* Verde limón encendido */
  --vivo: #8CE600; --vivo-2: #B4F51F; --vivo-osc: #5DBF00;
  --lav: #3A8A00; --lav-2: #6FCF00; --lav-claro: #EAFBD0; --lav-fondo: #F4FDE6;
  --lim: #1EC8D2; --lim-osc: #0E9AA3; --lim-claro: #DDF8FA;
  --tinta: #13240A; --gris: #5E6B55; --linea: #DDEFC8; --blanco: #fff;
  --verde: #2FA36B; --amarillo: #E9B308; --naranja: #F07F2C; --rojo: #E04A4A;
  --radio: 18px; --sombra: 0 8px 24px rgba(70, 140, 0, .12);
}
* { box-sizing: border-box; }
html { background: var(--lav-fondo); }
html, body { margin: 0; color: var(--tinta); font-family: 'Plus Jakarta Sans', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--lav); text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; width: 100%; padding: 12px 14px; border: 1.5px solid var(--linea); border-radius: 12px; background: #fff; color: var(--tinta); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--lav-2); box-shadow: 0 0 0 4px var(--lav-claro); }
label { display: block; font-size: 13px; font-weight: 600; color: var(--gris); margin: 14px 0 6px; }

.cargando { min-height: 100vh; display: grid; place-items: center; }
.gota { width: 42px; height: 42px; border-radius: 50% 50% 50% 0; background: var(--vivo); transform: rotate(-45deg); animation: lat 1s ease-in-out infinite; }
@keyframes lat { 50% { transform: rotate(-45deg) scale(.8); opacity: .6; } }

/* Layout */
.shell { max-width: 1100px; margin: 0 auto; padding: 0 16px 110px; }
.top { position: sticky; top: 0; z-index: 10; overflow: hidden; background: linear-gradient(135deg, var(--vivo-2), var(--vivo) 55%, var(--vivo-osc)); color: var(--tinta); padding: 18px 16px 22px; border-radius: 0 0 26px 26px; box-shadow: var(--sombra); }
.top .fila, .top .saludo { position: relative; z-index: 1; }
.top .fila { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.marca { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; }
.marca img { width: 34px; height: 34px; }
.quien { text-align: right; font-size: 12px; opacity: .9; }
.quien b { display: block; font-size: 14px; opacity: 1; }
.saludo { max-width: 1100px; margin: 14px auto 0; font-size: 22px; font-weight: 800; }
.saludo small { display: block; font-size: 13px; font-weight: 500; opacity: .85; }

nav.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: #fff; border-top: 1px solid var(--linea); display: flex; justify-content: space-around; padding: 8px 6px calc(8px + env(safe-area-inset-bottom)); }
nav.tabs a { flex: 1; text-align: center; font-size: 11px; font-weight: 600; color: var(--gris); padding: 6px 2px; border-radius: 12px; }
nav.tabs a .ico { display: block; font-size: 21px; margin-bottom: 2px; }
nav.tabs a.on { color: var(--lav); background: var(--lav-claro); }
@media (min-width: 900px) {
  nav.tabs { top: 96px; bottom: auto; left: max(16px, calc(50% - 550px)); right: auto; width: 190px; flex-direction: column; border: 0; background: transparent; gap: 4px; }
  nav.tabs a { text-align: left; font-size: 14px; padding: 12px 14px; display: flex; gap: 10px; align-items: center; }
  nav.tabs a .ico { display: inline; margin: 0; font-size: 18px; }
  .shell { padding-left: 226px; padding-bottom: 40px; }
}

/* Componentes */
h2 { font-size: 18px; margin: 26px 0 12px; display: flex; align-items: center; justify-content: space-between; }
h3 { font-size: 15px; margin: 0 0 8px; }
.card { background: #fff; border-radius: var(--radio); padding: 18px; box-shadow: var(--sombra); margin-bottom: 14px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.muted { color: var(--gris); font-size: 13px; }
.num { font-size: 30px; font-weight: 800; letter-spacing: -.5px; }
.num small { font-size: 14px; font-weight: 600; color: var(--gris); }
.btn { border: 0; border-radius: 14px; padding: 13px 18px; font-weight: 800; background: var(--vivo); color: var(--tinta); box-shadow: 0 4px 0 var(--vivo-osc); display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--vivo-osc); }
.btn.sec { background: var(--lav-claro); color: var(--lav); box-shadow: none; }
.btn.lim { background: var(--lim); color: #fff; box-shadow: 0 4px 0 var(--lim-osc); }
.btn.peligro { background: #FDECEC; color: var(--rojo); box-shadow: none; }
.btn.wa { background: #25D366; color: #fff; box-shadow: 0 4px 0 #1A9E4C; }
.btn.full { width: 100%; }
.btn.chico { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.chip::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.e-activa, .s-verde { background: #E3F6EC; color: var(--verde); }
.e-sin_venta_7, .s-amarillo { background: #FDF5D8; color: #A67C00; }
.e-sin_venta_15 { background: #FDEBDD; color: var(--naranja); }
.e-baja, .s-rojo { background: #FDECEC; color: var(--rojo); }
.e-inactiva { background: #EFEFF3; color: var(--gris); }

.semaforo { display: flex; align-items: center; gap: 14px; }
.luz { width: 54px; height: 54px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 22px; color: #fff; box-shadow: inset 0 -4px 0 rgba(0,0,0,.12); }
.luz.verde { background: var(--verde); } .luz.amarillo { background: var(--amarillo); } .luz.rojo { background: var(--rojo); } .luz.gris { background: #D5E3C4; }
.barra { height: 12px; background: var(--lav-claro); border-radius: 99px; overflow: hidden; margin: 10px 0 6px; }
.barra > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--vivo-2), var(--vivo-osc)); transition: width .8s cubic-bezier(.2,.8,.2,1); }
.barra.ok > i { background: linear-gradient(90deg, var(--lim), var(--lim-osc)); }

.lista { list-style: none; margin: 0; padding: 0; }
.lista li { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--linea); }
.lista li:last-child { border-bottom: 0; }
.avatar { width: 42px; height: 42px; border-radius: 14px; flex: none; display: grid; place-items: center; font-weight: 800; color: var(--lav); background: var(--lav-claro); }
.avatar.lider { background: var(--lim-claro); color: var(--lim-osc); }
.avatar.emprendedora { background: #FFF1E6; color: var(--naranja); }
.li-main { flex: 1; min-width: 0; }
.li-main b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.codigo { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--gris); background: var(--lav-fondo); padding: 2px 6px; border-radius: 6px; }

.filtros { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; }
.filtros button { border: 1.5px solid var(--linea); background: #fff; border-radius: 999px; padding: 8px 14px; font-weight: 600; font-size: 13px; white-space: nowrap; color: var(--gris); }
.filtros button.on { background: var(--vivo); border-color: var(--vivo); color: var(--tinta); }

.linea-tiempo { position: relative; padding-left: 26px; }
.linea-tiempo::before { content: ''; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--linea); }
.evento { position: relative; padding: 0 0 18px; }
.evento::before { content: attr(data-ico); position: absolute; left: -26px; top: 0; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 2px solid var(--lav-2); font-size: 10px; display: grid; place-items: center; }
.evento b { font-size: 14px; }
.evento .muted { font-size: 12px; }

table.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla th { text-align: left; font-size: 12px; color: var(--gris); font-weight: 600; padding: 8px 6px; border-bottom: 1.5px solid var(--linea); }
.tabla td { padding: 10px 6px; border-bottom: 1px solid var(--linea); }
.tabla input, .tabla select { padding: 8px 10px; border-radius: 10px; }
.scroll-x { overflow-x: auto; }

.login { position: relative; overflow: hidden; min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 10%, var(--vivo-2), var(--vivo) 50%, var(--vivo-osc)); }
.login .card { position: relative; z-index: 1; }
.login .card { width: 100%; max-width: 380px; padding: 28px; border-radius: 26px; }
.login .logo { text-align: center; margin-bottom: 10px; }
.login .logo img { width: 64px; }
.login h1 { text-align: center; margin: 6px 0 2px; font-size: 24px; }

.modal-fondo { position: fixed; inset: 0; background: rgba(31, 26, 46, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.modal { background: #fff; width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; border-radius: 26px 26px 0 0; padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); animation: sube .25s cubic-bezier(.2,.8,.2,1); }
@media (min-width: 700px) { .modal-fondo { align-items: center; } .modal { border-radius: 26px; } }
@keyframes fade { from { opacity: 0; } } @keyframes sube { from { transform: translateY(40px); opacity: 0; } }
.fila-btns { display: flex; gap: 10px; margin-top: 18px; } .fila-btns .btn { flex: 1; }
.repetible { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-bottom: 8px; }

#toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(20px); background: var(--tinta); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 60; max-width: 90vw; }
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--rojo); }

.confeti { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.confeti i { position: absolute; top: -10px; width: 9px; height: 14px; border-radius: 2px; animation: cae 2.4s linear forwards; }
@keyframes cae { to { transform: translateY(110vh) rotate(720deg); } }
.vacio { text-align: center; padding: 26px 10px; color: var(--gris); }
.vacio .ico { font-size: 34px; display: block; margin-bottom: 6px; }

/* Burbujas de limpio */
.burbujas { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.burbujas.fijas { position: fixed; z-index: -1; }
.burbujas span { position: absolute; bottom: -80px; border-radius: 50%;
  background: radial-gradient(circle at 30% 28%, rgba(255,255,255,.95) 0 8%, rgba(255,255,255,.35) 12%, rgba(255,255,255,.08) 55%, rgba(255,255,255,.25) 70%, rgba(255,255,255,0) 72%);
  border: 1.5px solid rgba(255,255,255,.55); box-shadow: inset -4px -6px 10px rgba(255,255,255,.25), 0 0 12px rgba(255,255,255,.25);
  animation: burbuja linear infinite; }
.burbujas.fijas span { border-color: rgba(110, 200, 0, .25); background: radial-gradient(circle at 30% 28%, rgba(255,255,255,.95) 0 8%, rgba(200,245,140,.35) 14%, rgba(180,240,100,.10) 55%, rgba(140,230,0,.18) 70%, rgba(140,230,0,0) 72%); }
@keyframes burbuja {
  0% { transform: translate(0, 0) scale(.8); opacity: 0; }
  10% { opacity: 1; }
  50% { transform: translate(18px, -55vh) scale(1); }
  100% { transform: translate(-12px, -115vh) scale(1.08); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .burbujas span { animation: none; display: none; } }

/* Presupuesto del mes */
.presupuesto { border-left: 6px solid #D5E3C4; }
.presupuesto.p-verde { border-left-color: var(--verde); }
.presupuesto.p-amarillo { border-left-color: var(--amarillo); }
.presupuesto.p-rojo { border-left-color: var(--rojo); }
.pct-grande { font-size: 34px; font-weight: 800; letter-spacing: -1px; color: var(--lav); }
.p-amarillo .pct-grande { color: #A67C00; } .p-rojo .pct-grande { color: var(--rojo); }
.barra-mes { position: relative; height: 22px; background: var(--lav-claro); border-radius: 99px; margin: 14px 0 26px; }
.barra-mes > i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 99px; overflow: hidden;
  background: repeating-linear-gradient(-45deg, rgba(255,255,255,.28) 0 10px, rgba(255,255,255,0) 10px 20px), linear-gradient(90deg, var(--vivo-2), var(--vivo-osc));
  background-size: 28px 28px, 100% 100%; animation: rayas 1s linear infinite; transition: width 1.4s cubic-bezier(.2,.8,.2,1); }
.p-amarillo .barra-mes > i { background-color: var(--amarillo); background-image: repeating-linear-gradient(-45deg, rgba(255,255,255,.3) 0 10px, rgba(255,255,255,0) 10px 20px), linear-gradient(90deg, #F7D44A, var(--amarillo)); }
.p-rojo .barra-mes > i { background-image: repeating-linear-gradient(-45deg, rgba(255,255,255,.3) 0 10px, rgba(255,255,255,0) 10px 20px), linear-gradient(90deg, #F27A7A, var(--rojo)); }
@keyframes rayas { to { background-position: 28px 0, 0 0; } }
.barra-mes .hoy { position: absolute; top: -5px; bottom: -5px; width: 3px; margin-left: -1.5px; background: var(--tinta); border-radius: 2px; }
.barra-mes .hoy span { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 4px; font-size: 11px; font-weight: 700; white-space: nowrap; color: var(--gris); }

.card.destacada { background: linear-gradient(135deg, var(--vivo-2), var(--vivo)); }
.card.destacada .muted { color: #2B4A0F; }
.tabla.semanas td, .tabla.semanas th { white-space: nowrap; }
.tabla.semanas tr.en_curso td { background: #FBFFEF; }
.tabla.semanas tr.en_curso td:first-child { box-shadow: inset 4px 0 0 var(--vivo); }
.tabla.semanas tr.futura td { opacity: .55; }
.tabla.semanas tr.fuera td:first-child::after { content: ' ·'; color: var(--gris); }
.tabla.semanas tr.totales td { border-top: 2px solid var(--linea); background: var(--lav-fondo); }

.tabla.resultado .der { text-align: right; white-space: nowrap; }
.tabla.resultado tr.det td:first-child { padding-left: 22px; color: var(--gris); }
.tabla.resultado tr.sub td { font-size: 12px; font-weight: 700; color: var(--gris); text-transform: uppercase; letter-spacing: .4px; padding-top: 14px; border-bottom: 0; }
.tabla.resultado tr.total td { border-top: 2px solid var(--linea); background: var(--lav-fondo); }
.tabla.resultado tr.final td { border-top: 2px solid var(--tinta); background: var(--lav-claro); font-size: 16px; }
.tabla.resultado tr.grupo td { font-size: 15px; }
