:root {
  --fondo: #0d0c18; --sup: #17152a; --sup2: #201d38; --linea: #2d2a4a; --texto: #f2f1fa; --suave: #a9a6c6;
  --a1: #8f7cff; --a2: #2fd3ea; --rojo: #ff5d73; --amarillo: #ffc24b; --verde: #3ee6a0;
  --grad: linear-gradient(135deg, var(--a1), var(--a2));
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fondo); color: var(--texto); font: 15px/1.45 Montserrat, system-ui, sans-serif; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
h2 { font-weight: 800; font-size: 1.35rem; margin: 18px 0 10px; letter-spacing: -0.01em; }
h3 { font-weight: 800; font-size: 1.02rem; margin: 18px 0 8px; }
.sub { color: var(--suave); font-size: 0.88rem; margin: 4px 0; }
.error { color: var(--rojo); min-height: 1.2em; margin: 6px 0 0; }

.entrar { min-height: 100dvh; display: grid; align-content: center; gap: 10px; padding: 24px; max-width: 420px; margin: 0 auto; }
.marca { font-weight: 800; font-size: 2.2rem; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.tarjeta { background: var(--sup); border: 1px solid var(--linea); border-radius: 16px; padding: 14px; display: grid; gap: 10px; }
label { display: grid; gap: 4px; font-size: 0.85rem; color: var(--suave); }
input, select, textarea { width: 100%; background: var(--fondo); border: 1px solid var(--linea); border-radius: 12px; padding: 12px; font-size: 16px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible { outline: 2px solid var(--a2); outline-offset: 2px; }
button { cursor: pointer; border: 1px solid var(--linea); background: var(--sup2); border-radius: 999px; padding: 10px 16px; font-weight: 600; touch-action: manipulation; user-select: none; }
button:active { transform: scale(0.97); }
.primario { background: var(--grad); border: 0; color: #0d0c18; font-weight: 800; }
.peligro { border-color: var(--rojo); color: var(--rojo); background: transparent; }
.chico { padding: 7px 12px; font-size: 0.85rem; }
.fila { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.barra { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: rgba(13, 12, 24, 0.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--linea); }
.empresa { font-weight: 800; }
.quien { color: var(--suave); font-size: 0.8rem; }
.campana { position: relative; padding: 8px; border-radius: 12px; background: transparent; border: 0; }
#badge { position: absolute; top: 2px; right: 2px; background: var(--rojo); color: #fff; font-size: 0.7rem; font-weight: 800; border-radius: 99px; min-width: 18px; padding: 0 5px; }

main { padding: 4px 16px calc(150px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; }

.nav { position: fixed; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(5, 1fr); background: rgba(13, 12, 24, 0.96); border-top: 1px solid var(--linea); padding-bottom: env(safe-area-inset-bottom); z-index: 6; }
.nav button { border: 0; border-radius: 0; background: transparent; padding: 13px 4px; color: var(--suave); font-size: 0.8rem; }
.nav button.activo { color: var(--texto); box-shadow: inset 0 2px 0 var(--a2); }

.leo-dock { position: fixed; left: 0; right: 0; bottom: calc(52px + env(safe-area-inset-bottom)); display: flex; justify-content: center; pointer-events: none; z-index: 6; padding: 10px; }
.leo-boton { pointer-events: auto; display: flex; gap: 10px; align-items: center; background: var(--grad); color: #0d0c18; border: 0; font-weight: 800; padding: 10px 20px 10px 10px; box-shadow: 0 8px 30px rgba(143, 124, 255, 0.35); }
.leo-cara { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #0d0c18; color: var(--a2); font-weight: 800; }
.leo-cara.grande { width: 44px; height: 44px; font-size: 1.2rem; }
.leo-titulo { display: flex; gap: 12px; align-items: center; }

.hoja { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); z-index: 10; display: flex; align-items: flex-end; }
.hoja-in { background: var(--sup); width: 100%; max-width: 720px; margin: 0 auto; border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); max-height: 90dvh; overflow: auto; overscroll-behavior: contain; display: grid; gap: 12px; animation: sube 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes sube { from { transform: translateY(30px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .hoja-in { animation: none; } }
.cerrar { justify-self: center; background: transparent; }
.mic.escuchando { border-color: var(--rojo); color: var(--rojo); animation: late 1s infinite alternate; }
@keyframes late { to { opacity: 0.5; } }

.item { background: var(--sup); border: 1px solid var(--linea); border-radius: 16px; padding: 12px 14px; margin: 8px 0; display: grid; gap: 6px; }
.item.vencida { border-color: var(--rojo); }
.item .t { font-weight: 600; }
.item .meta { color: var(--suave); font-size: 0.82rem; }
.borrador { background: var(--fondo); border: 1px dashed var(--linea); border-radius: 12px; padding: 8px 10px; font-size: 0.88rem; color: var(--suave); }
a.chip { color: var(--texto); text-decoration: none; padding: 7px 12px; font-size: 0.85rem; border-radius: 99px; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 0.75rem; font-weight: 600; background: var(--sup2); border: 1px solid var(--linea); }
.chip.rojo { color: var(--rojo); border-color: var(--rojo); }
.chip.amarillo { color: var(--amarillo); border-color: var(--amarillo); }
.chip.verde { color: var(--verde); border-color: var(--verde); }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.kpi { background: var(--sup); border: 1px solid var(--linea); border-radius: 16px; padding: 12px; }
.kpi .v { font-weight: 800; font-size: 1.5rem; }
.kpi .l { color: var(--suave); font-size: 0.8rem; }
.kpi.grande { grid-column: span 2; background: linear-gradient(135deg, rgba(143, 124, 255, 0.18), rgba(47, 211, 234, 0.12)); }
.barra-meta { height: 10px; background: var(--fondo); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.barra-meta > div { height: 100%; background: var(--grad); }
.fuga { border-left: 3px solid var(--a1); }
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--linea); }
th { color: var(--suave); font-weight: 600; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
.vacio { color: var(--suave); text-align: center; padding: 22px 8px; }
.notif { border-left: 3px solid var(--linea); }
.notif.recordatorio { border-left-color: var(--amarillo); }
.notif.alerta, .notif.escalado { border-left-color: var(--rojo); }
.notif.nueva { background: var(--sup2); }
.resp-leo { background: var(--fondo); border: 1px solid var(--linea); border-radius: 14px; padding: 12px; }
.resp-leo ul { margin: 8px 0 0; padding-left: 18px; color: var(--suave); font-size: 0.88rem; }
.toast { position: fixed; top: calc(70px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); background: var(--sup2); border: 1px solid var(--a1); padding: 10px 16px; border-radius: 14px; z-index: 20; max-width: 90vw; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); }
