/* =========================================================
   Sistema CMB · Binaria — interfaz
   Layout: barra lateral fija + área principal con tarjetas
   ========================================================= */
:root {
  --bg: #eceee9;            /* fondo general */
  --shell: #f7f8f5;         /* paneles grandes */
  --panel: #ffffff;         /* tarjetas */
  --fg: #15201a;
  --muted: #6a756e;
  --line: #e4e8e3;
  --g900: #0c3626; --g800: #124d36; --g700: #19674a; --g600: #22825c; --g500: #2a9d6f;
  --g200: #cde9db; --g100: #e7f3ec;
  --red: #e5604d; --red-100: #fcebe8;
  --amber-100: #fff5e3; --amber-fg: #7a4c06;
  --r-lg: 22px; --r-md: 16px; --r-sm: 12px;
  --sombra: 0 1px 2px rgba(16, 40, 28, .04), 0 6px 24px -12px rgba(16, 40, 28, .12);
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14.5px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--g700); }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 2.4vw, 2.1rem); font-weight: 700; }
h2 { font-size: 1.02rem; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.eyebrow { font-size: .74rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { flex: none; }
:focus-visible { outline: 2.5px solid var(--g500); outline-offset: 2px; border-radius: 6px; }
.solo-print { display: none; }

/* ---------- Barra lateral ---------- */
.side { position: fixed; inset: 14px auto 14px 14px; width: 252px; z-index: 30; }
.side-in { height: 100%; background: var(--shell); border-radius: var(--r-lg); padding: 22px 14px 14px; display: flex; flex-direction: column; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); font-weight: 800; font-size: 1.15rem; padding: 0 10px 18px; }
.brand small { display: block; font-size: .72rem; font-weight: 500; color: var(--muted); }
.brand-logo { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: radial-gradient(circle at 30% 25%, var(--g500), var(--g800)); box-shadow: 0 6px 16px -6px var(--g700); }
.brand-logo.grande { width: 56px; height: 56px; }
.nav-t { margin: 14px 12px 6px; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #9aa39d; }
.nav { display: grid; gap: 2px; }
.nav-i { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--muted); text-decoration: none; font-weight: 500; transition: background .15s, color .15s; }
.nav-i:hover { background: #eef1ec; color: var(--fg); }
.nav-i.on { color: var(--fg); font-weight: 700; }
.nav-i.on .ico { color: var(--g700); }
.nav-i.on::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--g700); }
.promo { margin-top: auto; position: relative; overflow: hidden; border-radius: 18px; padding: 18px 16px 16px; color: #fff; display: grid; gap: 6px;
  background: radial-gradient(120% 90% at 100% 0%, rgba(126, 226, 176, .35), transparent 55%), linear-gradient(160deg, var(--g800), var(--g900)); }
.promo::after { content: ""; position: absolute; inset: auto -40px -60px auto; width: 160px; height: 160px; border-radius: 50%; border: 18px solid rgba(255, 255, 255, .06); }
.promo b { font-size: 1.02rem; }
.promo p { font-size: .8rem; opacity: .8; margin-bottom: 6px; }
.promo-ico { width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, .14); display: grid; place-items: center; }
.velo { display: none; }

/* ---------- Área principal ---------- */
.shell { margin-left: 280px; padding: 14px 14px 32px 0; min-height: 100vh; }
.topbar { display: flex; align-items: center; gap: 12px; background: var(--shell); border-radius: var(--r-lg); padding: 12px 14px 12px 18px; }
.search { flex: 1; max-width: 420px; display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px 6px 4px 16px; color: var(--muted); }
.search:focus-within { border-color: var(--g500); box-shadow: 0 0 0 4px var(--g100); }
.search input { border: 0; outline: 0; padding: 7px 0; background: none; flex: 1; min-width: 0; font: inherit; color: var(--fg); }
.search kbd { font: 600 .72rem var(--font); color: var(--muted); background: #f0f2ef; border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px; }
.search-sp { flex: 1; }
.me { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.me-t { display: grid; line-height: 1.25; }
.me-t b { font-size: .9rem; }
.me-t small { color: var(--muted); font-size: .76rem; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main { background: var(--shell); border-radius: var(--r-lg); margin-top: 14px; padding: 28px; display: grid; gap: 20px; min-width: 0; }
.topbar .menu-btn { display: none; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head .muted { margin-top: 4px; }
.head-acc { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 600 .9rem var(--font); border-radius: 999px; padding: 11px 20px; border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, transform .15s var(--ease), box-shadow .15s; }
.btn:active { transform: scale(.98); }
.btn-pri { background: var(--g700); color: #fff; box-shadow: 0 8px 18px -10px var(--g700); }
.btn-pri:hover { background: var(--g800); }
.btn-sec { background: var(--panel); color: var(--g800); border-color: #cfd8d1; }
.btn-sec:hover { border-color: var(--g600); }
.btn-claro { background: #fff; color: var(--g800); }
.btn-claro:hover { background: var(--g100); }
.btn-peligro { background: var(--red); color: #fff; }
.btn-full { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: .82rem; }
.btn[disabled] { opacity: .75; cursor: progress; }
.btn.cargando .ico { animation: subir 1s ease-in-out infinite; }
@keyframes subir { 50% { transform: translateY(-3px); } }
.ibtn { width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; border: 1px solid var(--line); background: var(--panel); color: var(--fg); cursor: pointer; }
.ibtn:hover { border-color: var(--g500); }
.ibtn-peligro { color: var(--red); }
.ibtn-peligro:hover { background: var(--red-100); border-color: #f3c4bc; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; border: 1px solid #cfd8d1; color: var(--g800); text-decoration: none; font-weight: 600; font-size: .78rem; background: var(--panel); }
.pill:hover { border-color: var(--g600); }
.link { font-weight: 600; font-size: .82rem; text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ---------- Tarjetas ---------- */
.card { background: var(--panel); border-radius: var(--r-lg); padding: 20px 22px; display: grid; gap: 14px; align-content: start; min-width: 0; box-shadow: var(--sombra); }
.card-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-oscura { color: #fff; background:
  radial-gradient(90% 70% at 100% 0%, rgba(126, 226, 176, .28), transparent 60%),
  repeating-radial-gradient(circle at 110% 120%, rgba(255,255,255,.05) 0 2px, transparent 2px 22px),
  linear-gradient(160deg, var(--g800), var(--g900)); }
.card-oscura .muted { color: rgba(255,255,255,.7); }
.tag { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 6px; font-size: .74rem; font-weight: 700; background: var(--g100); color: var(--g700); }
.tag-mal { background: var(--red-100); color: #b23a28; }
.tag-gris { background: #eff1ee; color: var(--muted); }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { position: relative; background: var(--panel); border-radius: var(--r-lg); padding: 18px 20px; display: grid; gap: 6px; color: var(--fg); text-decoration: none; box-shadow: var(--sombra); transition: transform .2s var(--ease), box-shadow .2s; }
a.kpi:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -18px rgba(16, 40, 28, .35); }
.kpi-t { font-weight: 600; font-size: .92rem; padding-right: 44px; }
.kpi-v { font-size: clamp(2.2rem, 3.4vw, 2.9rem); font-weight: 700; line-height: 1.05; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-n { font-size: .78rem; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kpi-ir { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; transition: transform .2s var(--ease); }
a.kpi:hover .kpi-ir { transform: rotate(45deg); }
.kpi-dest { color: #fff; background: radial-gradient(110% 80% at 100% 0%, rgba(126, 226, 176, .35), transparent 55%), linear-gradient(150deg, var(--g700), var(--g900)); }
.kpi-dest .kpi-n { color: rgba(255,255,255,.85); }
.kpi-dest .kpi-ir { background: #fff; color: var(--g800); border-color: #fff; }
.kpi-dest .tag { background: rgba(255,255,255,.18); color: #fff; }

/* Rejilla del panel */
.dash { display: grid; gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-areas: "caps caps ult sec" "top top gauge dif"; }
.a-caps { grid-area: caps; } .a-ult { grid-area: ult; } .a-sec { grid-area: sec; }
.a-top { grid-area: top; } .a-gauge { grid-area: gauge; } .a-dif { grid-area: dif; }
.dash-rep { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-areas: "caps caps gauge" "grupos grupos hall"; }
.r-caps { grid-area: caps; } .r-gauge { grid-area: gauge; } .r-grupos { grid-area: grupos; } .r-hall { grid-area: hall; }
.dash-rep:not(:has(.r-grupos)) { grid-template-areas: "caps caps gauge" "hall hall hall"; }

/* Gráfico de cápsulas */
.caps { display: flex; align-items: flex-end; gap: clamp(8px, 2vw, 22px); height: 230px; padding-top: 4px; }
.cap { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.cap-val { font-weight: 700; font-size: .95rem; text-align: center; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cap-val small { display: block; font-size: .7rem; font-weight: 600; color: var(--muted); }
.cap-track { position: relative; flex: 1; width: min(60px, 100%); border-radius: 999px; overflow: hidden;
  background: repeating-linear-gradient(135deg, #f1f3f0 0 5px, #dfe4df 5px 7px); }
.cap-track i { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 999px; background: var(--c); transform-origin: bottom; }
@media (prefers-reduced-motion: no-preference) { .cap-track i { animation: crecer .8s var(--ease) both; } }
@keyframes crecer { from { transform: scaleY(0); } }
.cap-lbl { font-size: .75rem; font-weight: 700; color: var(--muted); }

/* Leyendas */
.ley { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px 14px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); font-size: .8rem; color: var(--muted); }
.ley-h { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.ley li { display: flex; align-items: center; gap: 7px; }
.ley b { color: var(--fg); }
.ley i { width: 11px; height: 11px; border-radius: 4px; background: var(--c); flex: none; }
.c-bien { --c: var(--g700); background: var(--g700) !important; }
.c-mal { --c: var(--red); background: var(--red) !important; }
.c-blanco { background: repeating-linear-gradient(135deg, #e3e7e3 0 4px, #b9c2bc 4px 6px) !important; color: var(--fg) !important; }

/* Medidor */
.gauge-box { position: relative; max-width: 340px; width: 100%; margin: 4px auto 0; }
.gauge { display: block; width: 100%; height: auto; }
.gauge path { fill: none; stroke-width: 24; }
.g-fondo { stroke: #eef1ee; }
.g-bien { stroke: var(--g700); }
.g-mal { stroke: var(--red); }
.g-blanco { stroke: url(#rayas); }
.gauge-v { position: absolute; left: 0; right: 0; bottom: 2px; text-align: center; display: grid; }
.gauge-v b { font-size: clamp(2rem, 3.6vw, 2.6rem); line-height: 1; letter-spacing: -.02em; }
.gauge-v span { font-size: .78rem; color: var(--muted); }

/* Listas del panel */
.grados { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.grados a { display: flex; justify-content: space-between; align-items: center; color: inherit; text-decoration: none; margin-bottom: 6px; }
.grados a:hover b { color: var(--g700); }
.grados-t, .people-t, .item-t, .fila-t { display: grid; line-height: 1.3; min-width: 0; }
.grados-t small, .people-t small, .item-t small, .fila-t small { color: var(--muted); font-size: .76rem; }
.grados-v { font-weight: 700; font-size: 1.15rem; text-align: right; line-height: 1.1; font-variant-numeric: tabular-nums; }
.grados-v small { display: block; font-size: .68rem; color: var(--muted); font-weight: 600; }
.items, .people { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.items li, .people li { display: flex; align-items: center; gap: 12px; }
.people .chip { margin-left: auto; }
.item-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: .85rem; flex: none; background: var(--g100); color: var(--g700); }
.item-ico.r1 { background: var(--g700); color: #fff; }
.item-ico.r2 { background: var(--g500); color: #fff; }
.item-ico.r3 { background: var(--g200); color: var(--g800); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; font-size: .78rem; flex: none; color: var(--g900); background: var(--g200); }
.avatar.a1 { background: #fde6c8; color: #7a4c06; }
.avatar.a2 { background: #dfe7fb; color: #23407a; }
.avatar.a3 { background: #f6dde4; color: #7a2341; }
.avatar.a4 { background: #e4f0d3; color: #3f5a14; }
.dif { display: flex; align-items: center; gap: 16px; }
.dif b { font-size: 3.2rem; line-height: 1; letter-spacing: -.03em; }
.dif span { font-size: .85rem; opacity: .85; }
.mini-bars { display: flex; align-items: flex-end; gap: 4px; height: 64px; }
.mini-bars span { flex: 1; border-radius: 999px; background: rgba(255,255,255,.22); min-height: 4px; }
.mini-bars span.on { background: #8ff0bf; }

/* Chips de nivel */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px; font-size: .74rem; font-weight: 700; white-space: nowrap;
  color: color-mix(in srgb, var(--c) 72%, #000); background: color-mix(in srgb, var(--c) 14%, #fff); }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.punto { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin-right: 5px; }

/* Barras apiladas */
.stack { display: flex; height: 28px; border-radius: 999px; overflow: hidden; background: #eef1ee; width: 100%; gap: 2px; }
.stack span { background: var(--c); color: #fff; font-size: .72rem; font-weight: 700; display: grid; place-items: center; min-width: 0; overflow: hidden; }
.stack.vacia { background: repeating-linear-gradient(135deg, #f1f3f0 0 5px, #e2e6e1 5px 7px); }
.filas { display: grid; gap: 12px; }
.fila { display: grid; grid-template-columns: minmax(130px, 210px) 1fr; gap: 14px; align-items: center; color: inherit; text-decoration: none; border-radius: 12px; }
a.fila:hover b { color: var(--g700); }

/* Hallazgos */
.hall { margin: 0; padding-left: 18px; display: grid; gap: 10px; font-size: .9rem; }
.hall li::marker { color: #8ff0bf; }

/* ---------- Reportes: barra de herramientas ---------- */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; background: var(--panel); padding: 4px; border-radius: 999px; box-shadow: var(--sombra); }
.seg a { padding: 8px 16px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .85rem; }
.seg a:hover { color: var(--fg); background: #f2f4f1; }
.seg a.on { background: var(--g700); color: #fff; }
.filtros { display: flex; flex-wrap: wrap; gap: 8px; }
.sel { display: inline-flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 2px 4px 2px 14px; font-size: .78rem; color: var(--muted); font-weight: 600; }
.sel:focus-within { border-color: var(--g500); box-shadow: 0 0 0 3px var(--g100); }
.sel select { border: 0; background: transparent; font: 600 .85rem var(--font); color: var(--fg); padding: 7px 8px; outline: 0; cursor: pointer; max-width: 180px; }
.sel-ev select { font: 600 .85rem var(--font); border: 1px solid #cfd8d1; border-radius: 999px; padding: 10px 14px; background: var(--panel); color: var(--fg); max-width: 260px; }

/* Avisos */
.aviso { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--r-md); background: var(--g100); color: var(--g900); }
.aviso.error { background: var(--red-100); color: #7d2416; }
details.aviso { display: block; background: var(--amber-100); color: var(--amber-fg); }
details.aviso summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
details.aviso summary::-webkit-details-marker { display: none; }
.aviso-mas { margin-left: auto; font-weight: 700; font-size: .78rem; text-decoration: underline; }
details.aviso p { margin: 10px 0 2px 28px; font-size: .86rem; }
details.aviso a { color: inherit; font-weight: 700; margin-left: 6px; }
.busqueda { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--muted); }

/* Tablas */
.tabla-box { overflow: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
.tabla { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .88rem; }
.tabla th, .tabla td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.tabla tbody tr:last-child td { border-bottom: 0; }
.tabla th { font-size: .74rem; color: var(--muted); font-weight: 700; background: #f8f9f7; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.tabla tbody tr { transition: background .12s; }
.tabla tbody tr:hover { background: #f6f8f5; }
.tabla .num { text-align: right; }
.tabla small { color: var(--muted); font-weight: 500; }
.tabla tr.subtotal td { background: #f3f6f2; font-weight: 700; }
.tabla tr.total td { background: var(--g100); font-weight: 800; color: var(--g900); }
.tabla.cruzada th { white-space: normal; min-width: 76px; }
.tabla.calor td { text-align: center; min-width: 58px; background: var(--cel, transparent); }
.tabla.calor td.ok { box-shadow: inset 0 0 0 2px var(--g600); font-weight: 800; border-radius: 8px; }
.tabla.calor td.trampa { color: #b23a28; font-weight: 800; }
.tabla.lista td.nombre { min-width: 260px; }
.tabla-niv td { padding: 7px 12px; }
.persona { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; }
.persona .avatar { width: 30px; height: 30px; font-size: .7rem; }
.pts { font-size: 1rem; }
.neg { color: #c2402c; }
.medalla { display: inline-grid; place-items: center; min-width: 28px; height: 28px; border-radius: 50%; font-weight: 700; font-size: .78rem; background: #f0f2ef; }
.medalla.m1 { background: #f8e3a3; color: #6b4d00; }
.medalla.m2 { background: #e3e7ea; color: #3c4650; }
.medalla.m3 { background: #f2d2b8; color: #6a3a14; }
.t-link { display: inline-flex; align-items: center; gap: 10px; color: var(--fg); text-decoration: none; }
.t-link:hover b { color: var(--g700); }
.acciones { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.acciones form { display: inline; }
.patron { display: inline-flex; gap: 2px; vertical-align: middle; }
.patron i { width: 8px; height: 16px; border-radius: 3px; display: inline-block; }
.patron i.B { background: var(--g600); }
.patron i.M { background: var(--red); }
.patron i.O { background: #d3d9d4; }
.patron i.sep { width: 5px; background: none; }
.hoja-h { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.hoja-h .muted { margin-top: 2px; }
.hoja-barra { flex: 1 1 260px; max-width: 440px; }
.no-rindieron { padding: 10px 14px; border-radius: var(--r-sm); background: var(--amber-100); color: var(--amber-fg); font-size: .84rem; }

/* Estados vacíos */
.vacio { background: var(--panel); border-radius: var(--r-lg); padding: 48px 24px; text-align: center; display: grid; justify-items: center; gap: 10px; box-shadow: var(--sombra); }
.vacio p { color: var(--muted); max-width: 46ch; }
.vacio .btn { margin-top: 8px; }
.vacio-in { box-shadow: none; padding: 28px 16px; }
.vacio-ico { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--g100); color: var(--g700); margin-bottom: 4px; }

/* Formularios */
.form { display: grid; gap: 14px; }
.form-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 14px; }
.campo { display: grid; gap: 6px; font-size: .82rem; font-weight: 600; color: var(--fg); }
.campo small { color: var(--muted); font-weight: 500; }
.campo input { font: 500 .95rem var(--font); color: var(--fg); background: #fbfcfa; border: 1px solid #d9dfd9; border-radius: var(--r-sm); padding: 11px 14px; width: 100%; transition: border-color .15s, box-shadow .15s; }
.campo input:focus { outline: 0; border-color: var(--g500); box-shadow: 0 0 0 4px var(--g100); background: #fff; }
.pass { position: relative; display: block; }
.pass input { padding-right: 78px; }
.pass-ver { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: #eef1ec; color: var(--g800); font: 700 .75rem var(--font); border-radius: 8px; padding: 6px 10px; cursor: pointer; }
.drop { position: relative; display: grid; justify-items: center; gap: 6px; text-align: center; padding: 28px 16px; border: 2px dashed #c9d3cb; border-radius: 18px; background: #fafbf9; cursor: pointer; transition: border-color .15s, background .15s; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop:hover, .drop.sobre { border-color: var(--g500); background: var(--g100); }
.drop:focus-within { border-color: var(--g500); box-shadow: 0 0 0 4px var(--g100); }
.drop.lleno { border-style: solid; border-color: var(--g500); background: var(--g100); }
.drop.mal { border-color: var(--red); background: var(--red-100); }
.drop-ico { width: 52px; height: 52px; border-radius: 50%; background: #fff; display: grid; place-items: center; color: var(--g700); box-shadow: var(--sombra); }
.drop small { color: var(--muted); }
.grid-ev { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; }
.reglas { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.reglas li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 14px; border-radius: var(--r-md); background: #f7f9f6; }
.regla-n { font-weight: 800; margin-right: auto; }

/* Página de niveles */
.escala { display: flex; height: 48px; border-radius: 999px; overflow: hidden; gap: 3px; }
.escala span { background: var(--c); display: grid; place-items: center; color: #fff; font-size: .8rem; min-width: 0; }
.escala-ej { position: relative; height: 18px; font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.escala-ej span { position: absolute; transform: translateX(-50%); }
.escala-ej span:first-child { transform: none; }
.escala-ej span:last-child { transform: translateX(-100%); }
.niv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 12px; }
.niv { padding: 16px; border-radius: var(--r-md); background: color-mix(in srgb, var(--c) 9%, #fff); display: grid; gap: 6px; }
.niv-cod { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--c); color: #fff; font-weight: 800; font-size: .78rem; }
.niv h3 { font-size: .98rem; }
.niv-r { color: var(--muted); font-size: .85rem; font-weight: 600; }

/* Notificación y diálogo */
.toast { position: fixed; top: 22px; right: 22px; z-index: 60; display: flex; align-items: center; gap: 10px; max-width: min(440px, calc(100vw - 32px)); padding: 12px 12px 12px 16px; border-radius: var(--r-md); background: var(--panel); box-shadow: 0 18px 40px -16px rgba(16, 40, 28, .35); border: 1px solid var(--line); color: var(--fg); font-weight: 500; transition: opacity .3s, transform .3s var(--ease); }
.toast .ico { color: var(--g600); }
.toast.error .ico { color: var(--red); }
.toast.fuera { opacity: 0; transform: translateY(-10px); pointer-events: none; }
.toast-x { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 8px; display: grid; }
@media (prefers-reduced-motion: no-preference) { .toast { animation: entra .35s var(--ease); } }
@keyframes entra { from { opacity: 0; transform: translateY(-10px); } }
.dlg { border: 0; border-radius: var(--r-lg); padding: 26px; width: min(420px, calc(100vw - 32px)); box-shadow: 0 30px 60px -20px rgba(10, 30, 20, .4); color: var(--fg); }
.dlg::backdrop { background: rgba(10, 30, 20, .4); backdrop-filter: blur(3px); }
.dlg form { display: grid; gap: 10px; }
.dlg p { color: var(--muted); }
.dlg-ico { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--red-100); color: var(--red); }
.dlg-acc { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }

/* ---------- Inicio de sesión / instalación ---------- */
body.auth { background: var(--bg); }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 14px; padding: 14px; }
.auth-arte { border-radius: 28px; color: #fff; display: flex; align-items: flex-end; padding: clamp(28px, 5vw, 56px); position: relative; overflow: hidden;
  background: radial-gradient(70% 60% at 85% 10%, rgba(126, 226, 176, .4), transparent 60%),
             repeating-radial-gradient(circle at 115% 115%, rgba(255,255,255,.06) 0 2px, transparent 2px 30px),
             linear-gradient(160deg, var(--g700), var(--g900)); }
.auth-arte-in { display: grid; gap: 16px; max-width: 480px; }
.auth-arte h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 800; letter-spacing: -.02em; }
.auth-arte p { opacity: .85; font-size: 1rem; }
.auth-arte .brand-logo { background: rgba(255,255,255,.16); box-shadow: none; }
.auth-mini { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.auth-mini div { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.14); border-radius: 16px; padding: 12px 16px; display: grid; }
.auth-mini b { font-size: 1.4rem; }
.auth-mini span { font-size: .76rem; opacity: .8; }
.auth-main { display: grid; place-items: center; align-content: center; gap: 18px; padding: 24px 16px; }
.auth-card { width: min(400px, 100%); display: grid; gap: 14px; }
.auth-card h1 { font-size: 1.9rem; margin-top: 6px; }
.auth-card .btn-full { margin-top: 6px; padding: 13px 20px; }
.auth-pie { color: var(--muted); font-size: .78rem; }

/* ---------- Adaptable ---------- */
@media (max-width: 1280px) {
  .dash { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "caps caps" "ult sec" "top gauge" "dif dif"; }
  .dash-rep, .dash-rep:not(:has(.r-grupos)) { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "caps caps" "gauge hall" "grupos grupos"; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .side { transform: translateX(calc(-100% - 20px)); transition: transform .3s var(--ease); }
  .nav-open .side { transform: none; }
  .nav-open .velo { display: block; position: fixed; inset: 0; background: rgba(10, 30, 20, .35); z-index: 25; }
  .shell { margin-left: 0; padding: 10px 10px 24px; }
  .topbar .menu-btn { display: inline-grid; }
  .main { padding: 20px 16px; margin-top: 10px; }
  .grid-ev { grid-template-columns: 1fr; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-arte { min-height: 220px; }
  .auth-mini { display: none; }
}
@media (max-width: 680px) {
  .dash, .dash-rep, .dash-rep:not(:has(.r-grupos)) { grid-template-columns: 1fr; grid-template-areas: "caps" "gauge" "ult" "sec" "top" "dif" "grupos" "hall"; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-ir { display: none; }
  .kpi-t { padding-right: 0; font-size: .82rem; }
  .me-t { display: none; }
  .search kbd { display: none; }
  .fila { grid-template-columns: 1fr; gap: 6px; }
  .caps { height: 190px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .seg { border-radius: var(--r-md); }
  .seg a { flex: 1 1 auto; text-align: center; }
  .head-acc .btn { flex: 1 1 auto; }
}

/* ---------- Impresión / PDF ---------- */
@page { size: A4; margin: 12mm; }
@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { background: #fff; font-size: 10.5px; }
  .no-print, .side, .topbar, .velo, .toast, .dlg { display: none !important; }
  .solo-print { display: block; }
  .shell { margin: 0; padding: 0; }
  .main { background: none; padding: 0; margin: 0; gap: 12px; border-radius: 0; }
  .card, .kpi, .vacio { box-shadow: none; border: 1px solid #dfe4df; break-inside: avoid; }
  .card.hoja { break-before: page; break-inside: auto; border: 0; padding: 0; }
  .card.hoja:first-of-type { break-before: auto; }
  .tabla-box { overflow: visible; border-radius: 0; }
  .tabla th { position: static; }
  .tabla th, .tabla td { padding: 4px 6px; }
  .tabla tr { break-inside: avoid; }
  .tabla thead { display: table-header-group; }
  .dash, .dash-rep { grid-template-columns: 1fr 1fr !important; grid-template-areas: "caps caps" "gauge hall" "grupos grupos" !important; }
  .kpis { grid-template-columns: repeat(4, 1fr) !important; }
  .cap-track i { animation: none; }
  details.aviso p { display: block; }
  a { color: inherit; text-decoration: none; }
}
