/* Panel Kino Táchira · estilos (paleta y tipografía de las medidas HTML del Power BI) */
:root {
  --fondo: #F5F4F9;
  --tarjeta: #FFFFFF;
  --borde: #E6E3EF;
  --borde-fuerte: #D8D3E8;
  --texto: #242231;
  --suave: #726F82;
  --tenue: #9895A6;
  --tenue2: #A6A3B2;
  --pista: #F1EFF7;
  --lienzo: #FAFAFC;
  --morado: #7C63C9;
  --morado-osc: #6550B5;
  --azul: #4E9BC7;
  --oro: #C9A227;
  --verde: #3F8C5F;
  --rojo: #C0524A;
  --rosa: #C9587C;
  --fb: #6B7FD7;
  --sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  --radio: 12px;
  --sombra: 0 1px 2px rgba(36, 34, 49, .04), 0 6px 18px rgba(36, 34, 49, .04);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans); font-size: 14px; line-height: 1.4; color: var(--texto); background: var(--fondo);
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%;
}
button { font-family: inherit; }
a { color: var(--morado); }
:focus-visible { outline: 2px solid #7C63C9AA; outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ---------------- Estructura ---------------- */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.menu {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: #FFFFFF; border-right: 1px solid var(--borde);
  display: flex; flex-direction: column; padding: 18px 14px 14px;
}
.marca { display: flex; align-items: center; gap: 11px; padding: 2px 6px 18px; border-bottom: 1px solid var(--pista); margin-bottom: 8px; }
.marca-sello {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #7C63C9, #9E8AE2); color: #fff; font-family: var(--serif); font-weight: 700; font-size: 20px;
  box-shadow: 0 6px 16px rgba(124, 99, 201, .30);
}
.marca-sello.grande { width: 46px; height: 46px; font-size: 24px; border-radius: 13px; }
.marca-logo { max-width: 130px; max-height: 42px; object-fit: contain; }
.marca-txt b { display: block; font-size: 15px; letter-spacing: .1px; }
.marca-txt span { font-size: 11.5px; color: var(--suave); }
.menu-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.menu-grupo { font-size: 10.5px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase; color: var(--tenue2); padding: 16px 10px 6px; }
.menu-nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--suave);
  text-decoration: none; font-weight: 600; font-size: 13.5px; transition: background .15s, color .15s;
}
.menu-nav a:hover { background: var(--pista); color: var(--texto); }
.menu-nav a.activo { background: #7C63C914; color: var(--morado); }
.menu-nav a.activo svg { stroke: var(--morado); }
.menu-usuario { border-top: 1px solid var(--pista); padding-top: 14px; margin-top: 14px; }
.usuario-fila { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: #4E9BC71F; color: var(--azul); font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.usuario-txt { min-width: 0; }
.usuario-txt b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usuario-txt span { font-size: 11px; color: var(--suave); }
.usuario-acciones { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-top: 8px; padding-left: 44px; }
.usuario-acciones form { margin: 0; }
.menu-pie { font-size: 10.5px; color: var(--tenue2); padding: 14px 6px 0; }
.menu-cerrar { display: none; margin-left: auto; border: 0; background: transparent; font-size: 24px; line-height: 1; color: var(--suave); cursor: pointer; }
.menu-velo { display: none; }

.principal { min-width: 0; display: flex; flex-direction: column; }
.barra { display: flex; align-items: center; gap: 12px; padding: 14px 28px 0; min-height: 44px; }
.barra-marca { display: none; font-weight: 700; }
.menu-abrir {
  display: none; width: 38px; height: 38px; border: 1px solid var(--borde); background: #fff; border-radius: 9px;
  flex-direction: column; justify-content: center; align-items: center; gap: 4px; cursor: pointer; flex-shrink: 0;
}
.menu-abrir span { width: 16px; height: 2px; background: var(--texto); border-radius: 2px; }
.frescura { margin-left: auto; font-size: 12px; color: var(--suave); display: flex; align-items: center; gap: 7px; text-align: right; }
.punto { width: 8px; height: 8px; border-radius: 50%; background: var(--verde); box-shadow: 0 0 0 3px #3F8C5F22; flex-shrink: 0; }
.punto.rojo { background: var(--rojo); box-shadow: 0 0 0 3px #C0524A22; }
#vista { padding: 6px 28px 44px; }

.pag-cab h1 { font-family: var(--serif); font-size: 27px; font-weight: 600; margin: 2px 0 2px; letter-spacing: -.2px; }
.pag-sub { margin: 0 0 16px; color: var(--suave); font-size: 13px; min-height: 18px; }
.cargando { padding: 70px 20px; text-align: center; color: var(--suave); }
.cargando::before {
  content: ""; display: block; width: 28px; height: 28px; margin: 0 auto 14px; border-radius: 50%;
  border: 3px solid var(--pista); border-top-color: var(--morado); animation: girar .8s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

/* ---------------- Filtros ---------------- */
.filtros {
  display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: flex-start; background: #fff; border: 1px solid var(--borde);
  border-radius: var(--radio); padding: 14px 18px 16px; margin-bottom: 18px; box-shadow: var(--sombra);
}
.filtro { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.f-tit { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--suave); }
.f-sorteos { flex: 1 1 420px; }
.f-zonas { flex: 0 1 300px; }
.f-regiones { flex: 1 1 460px; }
.f-meses { flex: 1 1 100%; }

.rango { display: grid; grid-template-columns: auto minmax(160px, 1fr); grid-template-areas: "nums slider" ". fechas"; gap: 2px 16px; align-items: center; }
.rango-nums { grid-area: nums; display: flex; align-items: center; gap: 6px; color: var(--suave); font-size: 12px; }
.rango-nums input {
  width: 66px; padding: 7px 6px; border: 1px solid var(--borde-fuerte); border-radius: 8px; font: inherit; font-size: 13px;
  text-align: center; color: var(--texto); background: #fff;
}
.rango-slider { grid-area: slider; position: relative; height: 30px; }
.rango-pista { position: absolute; left: 10px; right: 10px; top: 13px; height: 4px; background: var(--pista); border-radius: 2px; }
.rango-sel { position: absolute; top: 0; bottom: 0; background: var(--texto); border-radius: 2px; }
.rango-slider input[type=range] {
  position: absolute; left: 0; width: 100%; top: 5px; height: 20px; margin: 0; background: transparent;
  pointer-events: none; -webkit-appearance: none; appearance: none;
}
.rango-slider input[type=range]::-webkit-slider-runnable-track { background: transparent; height: 20px; }
.rango-slider input[type=range]::-moz-range-track { background: transparent; }
.rango-slider input[type=range]::-webkit-slider-thumb {
  pointer-events: auto; -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 2px solid var(--texto); cursor: grab; box-shadow: 0 1px 4px rgba(0, 0, 0, .15);
}
.rango-slider input[type=range]::-moz-range-thumb {
  pointer-events: auto; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid var(--texto); cursor: grab;
}
.rango-fechas { grid-area: fechas; display: flex; justify-content: space-between; font-size: 11.5px; color: var(--suave); padding: 0 2px; }
.atajos { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--borde); background: #fff; color: var(--suave); border-radius: 20px; padding: 5px 12px;
  font-size: 12px; font-weight: 600; cursor: pointer; transition: all .15s;
}
.chip:hover { border-color: #CFC9E3; color: var(--texto); }
.chip.activo { background: var(--morado); border-color: var(--morado); color: #fff; }

.desplegable { position: relative; }
.selector {
  width: 100%; min-width: 250px; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 12px;
  border: 1px solid var(--borde-fuerte); border-radius: 9px; background: #fff; font-size: 13.5px; color: var(--texto); cursor: pointer; text-align: left;
}
.selector b { color: var(--suave); font-weight: 400; }
.panel {
  position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; width: max(100%, 300px); max-height: 440px; overflow: auto;
  background: #fff; border: 1px solid var(--borde); border-radius: 12px; box-shadow: 0 18px 44px rgba(36, 34, 49, .16); padding: 8px;
}
.panel label { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 7px; cursor: pointer; font-size: 13px; }
.panel label:hover { background: var(--pista); }
.panel input[type=checkbox] { accent-color: var(--morado); width: 15px; height: 15px; margin: 0; }
.panel .todas { font-weight: 600; border-bottom: 1px solid var(--pista); border-radius: 7px 7px 0 0; margin-bottom: 4px; }
.nodo-cab { display: flex; align-items: center; }
.nodo-cab label { flex: 1; }
.nodo-cab i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.expandir { width: 24px; height: 24px; border: 0; background: transparent; cursor: pointer; color: var(--suave); font-size: 12px; border-radius: 6px; }
.expandir:hover { background: var(--pista); }
.cuenta { font-size: 11px; color: var(--tenue); padding-right: 6px; }
.hijos { padding-left: 30px; }
.panel-pie { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--pista); margin-top: 6px; padding: 8px 4px 2px; }

.mosaicos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.mosaico {
  min-height: 42px; white-space: nowrap; border: 1px solid var(--borde); background: #fff; border-radius: 10px; font-size: 13px;
  color: var(--texto); cursor: pointer; padding: 8px 12px; transition: all .15s;
}
.mosaico::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--c); margin-right: 7px; vertical-align: 1px; }
.mosaico:hover { border-color: var(--c); }
.mosaico.activo { border-color: var(--c); background: color-mix(in srgb, var(--c) 11%, #fff); box-shadow: inset 0 0 0 1px var(--c); font-weight: 600; }

.meses { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.anio { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.anio-et { border: 0; background: transparent; font-size: 13px; font-weight: 700; color: var(--texto); cursor: pointer; padding: 4px; border-radius: 6px; }
.anio-et:hover { background: var(--pista); }

/* ---------------- Rejillas ---------------- */
.contenido { display: flex; flex-direction: column; gap: 16px; }
.grid { display: grid; gap: 16px; align-items: stretch; }
.g2 { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fila-kpis { display: grid; gap: 14px; }
.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.k6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.fila-tiles { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.fila-alertas { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.par { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------------- Tarjetas ---------------- */
.tarjeta {
  background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); padding: 16px 18px; min-width: 0;
  box-shadow: var(--sombra); display: flex; flex-direction: column;
}
.entrando .tarjeta, .entrando .tile, .entrando .alerta { animation: aparecer .45s ease both; }
@keyframes aparecer { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.t-cab { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; min-width: 0; flex-wrap: wrap; }
.t-ico { width: 24px; height: 24px; border-radius: 7px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: transform .18s ease; }
.tarjeta:hover .t-ico, .tile:hover .tile-ico, .alerta:hover .tile-ico { transform: scale(1.08) rotate(-4deg); }
.t-tit { font-size: 11px; font-weight: 600; color: var(--suave); text-transform: uppercase; letter-spacing: .5px; }
.t-cab .insignia { margin-left: auto; }
.t-nota { font-size: 9.5px; color: var(--tenue2); margin: -6px 0 10px 32px; }
.t-nota-pie { margin: 10px 0 0; }
.centrado { text-align: center; }
.vacio { padding: 28px 12px; text-align: center; color: var(--tenue); font-size: 12.5px; }
.insignia { font-size: 10px; font-weight: 700; padding: 3px 10px; border-radius: 20px; white-space: nowrap; }

.kpi { justify-content: center; transition: transform .18s ease, box-shadow .18s ease; }
.kpi:hover, .tile:hover, .alerta:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(36, 34, 49, .10); }
.kpi-valor { font-family: var(--serif); font-size: 26px; font-weight: 600; line-height: 1.15; overflow-wrap: anywhere; }
.kpi-pie { font-size: 11px; color: var(--suave); margin-top: 6px; }
.kpi-barra { height: 5px; background: var(--pista); border-radius: 3px; overflow: hidden; margin-top: 10px; }
.kpi-barra > div { height: 100%; border-radius: 3px; }

.tile, .alerta {
  background: #fff; border: 1px solid var(--borde); border-radius: 12px; padding: 14px 16px; box-shadow: var(--sombra); min-width: 0;
  display: flex; flex-direction: column; justify-content: center; transition: transform .18s ease, box-shadow .18s ease;
}
.tile-cab { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.tile-ico { width: 22px; height: 22px; border-radius: 6px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: transform .18s ease; }
.tile-tit { font-size: 10.5px; font-weight: 600; line-height: 1.25; }
.tile-valor { font-family: var(--serif); font-size: 21px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.tile-sub { font-size: 10px; color: var(--suave); margin-top: 4px; }

.alerta-cab { display: flex; align-items: flex-start; gap: 7px; margin-bottom: 8px; }
.alerta-tit { flex: 1; font-size: 10.5px; font-weight: 600; line-height: 1.25; padding-top: 3px; }
.alerta-ins {
  font-size: 8.5px; font-weight: 700; color: var(--suave); background: var(--pista); padding: 2px 7px; border-radius: 8px;
  text-transform: uppercase; letter-spacing: .4px; white-space: nowrap;
}
.alerta-valor { font-family: var(--serif); font-size: 21px; font-weight: 600; }
.alerta-txt { font-size: 10.5px; color: var(--suave); margin-top: 5px; line-height: 1.4; }

/* Resumen por región */
.rr { display: flex; align-items: stretch; flex: 1; }
.rr-col { flex: 1; min-width: 0; text-align: center; padding: 0 6px; border-right: 1px solid var(--pista); display: flex; flex-direction: column; justify-content: center; }
.rr-col:last-child { border-right: 0; }
.rr-reg { font-size: 11px; font-weight: 700; margin-bottom: 8px; }
.rr-coloc { font-family: var(--serif); font-size: 18px; font-weight: 600; color: var(--morado); }
.rr-et { font-size: 9px; color: var(--suave); margin-bottom: 8px; }
.rr-zona { font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr-part { font-size: 12px; font-weight: 600; color: var(--azul); }

/* Barras horizontales */
.hbars { display: flex; flex-direction: column; gap: 7px; flex: 1; justify-content: center; }
.hbars.grande { gap: 11px; }
.hbar { display: flex; align-items: center; gap: 8px; }
.hbar-et { font-size: 11px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-pista { flex: 1; height: 14px; background: var(--pista); border-radius: 3px; overflow: hidden; }
.hbars.grande .hbar-pista { height: 16px; }
.hbars.grande .hbar-et, .hbars.grande .hbar-val { font-size: 12px; }
.hbar-relleno { height: 100%; border-radius: 3px; transition: filter .15s; }
.hbar:hover .hbar-relleno { filter: brightness(1.13); }
.hbar-val { width: 46px; text-align: right; font-size: 11px; color: var(--suave); flex-shrink: 0; }

/* Mapa de calor */
.hm { display: flex; flex-direction: column; gap: 3px; flex: 1; justify-content: center; }
.hm-fila { display: flex; gap: 3px; align-items: stretch; }
.hm-et { width: 72px; flex-shrink: 0; display: flex; align-items: center; gap: 5px; font-size: 9.5px; }
.hm-et i { width: 7px; height: 7px; border-radius: 2px; flex-shrink: 0; }
.hm-num { flex: 1; text-align: center; font-size: 8.5px; color: var(--tenue2); cursor: default; }
.hm-celda {
  flex: 1; min-width: 0; border-radius: 3px; display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 600; padding: 6px 0; cursor: default; transition: transform .12s;
}
.hm-celda:hover { transform: scale(1.08); box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
.hm-vacia { background: var(--pista); color: var(--tenue2); }

/* Gráficos de línea */
.lienzo { position: relative; width: 100%; aspect-ratio: 2.2 / 1; background: var(--lienzo); border-radius: 6px; cursor: crosshair; touch-action: pan-y; }
.lienzo svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }
.lienzo-carrera { aspect-ratio: 2.3 / 1; }
.lienzo-evolucion { aspect-ratio: auto; height: 190px; }
.cruz { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(124, 99, 201, .5); pointer-events: none; }
.marca-graf {
  position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .28); pointer-events: none;
}
.eje-fechas { position: relative; height: 14px; margin-top: 5px; font-size: 9.5px; color: var(--tenue); }
.eje-fechas span { position: absolute; top: 0; white-space: nowrap; }
.leyenda { display: flex; flex-wrap: wrap; gap: 5px 12px; margin-top: 8px; font-size: 10px; color: var(--suave); }
.leyenda i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }

/* Alertas por estado */
.ae { display: flex; flex-direction: column; flex: 1; justify-content: center; }
.ae-fila { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--pista); }
.ae-fila:last-child { border-bottom: 0; }
.ae-ico { width: 26px; height: 26px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ae-txt { flex: 1; min-width: 0; }
.ae-nom { font-size: 11.5px; font-weight: 600; }
.ae-det { font-size: 9.5px; color: var(--suave); }
.ae-val { font-family: var(--serif); font-size: 15px; font-weight: 600; text-align: right; white-space: nowrap; }

.variacion .t-cab { margin-bottom: 6px; }
.variacion .t-nota { margin: -4px 0 6px; }
.ve-fila { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--pista); font-size: 11.5px; }
.ve-fila:last-child { border-bottom: 0; }
.ve-fila b { font-family: var(--serif); font-size: 12.5px; white-space: nowrap; }

/* Dona */
.dona-cuerpo { display: flex; align-items: center; justify-content: center; gap: 26px; flex-wrap: wrap; flex: 1; padding: 6px 0; }
.dona-graf { position: relative; width: min(270px, 62%); aspect-ratio: 1; }
.dona-graf svg { width: 100%; height: 100%; display: block; }
.dona-seg { transition: stroke-width .15s; }
.dona-seg:hover { stroke-width: 19; }
.dona-centro { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.dona-centro b { font-family: var(--serif); font-size: 22px; font-weight: 600; }
.dona-centro span { font-size: 10px; color: var(--suave); }
.dona-leyenda { min-width: 150px; }
.dona-ley { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 12px; }
.dona-ley i { width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; }
.dona-ley span { flex: 1; }
.dona-ley b { font-family: var(--serif); font-size: 13px; }

/* Red destacada */
.destacada { border-left-width: 5px; border-radius: 14px; padding: 20px 22px; }
.dest-cab { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.dest-cab .t-cab { margin: 0; }
.dest-cuerpo { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.dest-avatar {
  width: 52px; height: 52px; border-radius: 50%; border: 2px solid; display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 22px; font-weight: 700; flex-shrink: 0;
}
.dest-nombre { flex: 1; min-width: 180px; }
.dest-nombre div { font-family: var(--serif); font-size: 19px; font-weight: 700; }
.dest-nombre span { font-size: 11.5px; color: var(--suave); }
.dest-delta { text-align: right; margin-left: auto; }
.dest-delta div { font-family: var(--serif); font-size: 30px; font-weight: 700; line-height: 1; }
.dest-delta span { font-size: 10.5px; color: var(--tenue); }
.dest-otras { margin-top: 14px; }
.dest-fila { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid var(--pista); font-size: 12px; flex-wrap: wrap; }
.dest-fila i { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dest-red { font-weight: 600; width: 76px; }
.dest-pct { font-size: 10.5px; color: var(--tenue); }
.dest-30 { margin-left: auto; font-size: 10px; color: var(--tenue); }

/* Demografía */
.demo { display: flex; flex-direction: column; gap: 7px; padding: 4px 0; flex: 1; justify-content: space-evenly; }
.demo-fila { display: grid; grid-template-columns: 1fr 40px 1fr; align-items: center; gap: 4px; }
.demo-h { display: flex; justify-content: flex-end; }
.demo-h div { height: 11px; background: var(--fb); opacity: .55; border-radius: 2px 0 0 2px; }
.demo-m div { height: 11px; background: var(--fb); border-radius: 0 2px 2px 0; }
.demo-h div:hover, .demo-m div:hover { filter: brightness(1.1); }
.demo-edad { font-size: 9.5px; color: var(--suave); text-align: center; }

/* Top publicaciones */
.tp-enc, .tp-fila { display: flex; align-items: center; gap: 10px; }
.tp-enc { font-size: 10px; font-weight: 600; color: var(--tenue); text-transform: uppercase; letter-spacing: .4px; padding: 0 4px 6px; }
.tp-fila { padding: 9px 4px; border-bottom: 1px solid var(--pista); }
.tp-fila:hover { background: var(--lienzo); }
.tp-rank { width: 20px; font-family: var(--serif); font-size: 14px; color: #B4B0C4; flex-shrink: 0; }
.tp-fila i, .tp-enc i { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.tp-red { width: 70px; font-size: 11px; font-weight: 600; color: var(--suave); flex-shrink: 0; }
.tp-tit { flex: 1; min-width: 0; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-tit a { color: var(--texto); text-decoration: none; }
.tp-tit a:hover { color: var(--morado); text-decoration: underline; }
.tp-vis { width: 92px; text-align: right; font-family: var(--serif); font-size: 13px; font-weight: 600; flex-shrink: 0; }
.tp-int { width: 84px; text-align: right; font-size: 10.5px; color: var(--suave); flex-shrink: 0; }

/* Radar */
.radar-cont { display: flex; justify-content: center; align-items: center; padding: 36px 0 30px; flex: 1; }
.radar-graf { position: relative; width: min(220px, 64%); aspect-ratio: 1; }
.radar-graf svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.radar-punto {
  position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: var(--morado);
  border: 1.5px solid #fff; transition: transform .15s; cursor: default;
}
.radar-punto:hover { transform: scale(1.8); }
.radar-et { position: absolute; transform: translate(-50%, -50%); text-align: center; font-size: 10.5px; font-weight: 600; white-space: nowrap; cursor: default; }
.radar-et span { display: block; font-size: 9.5px; color: var(--suave); font-weight: 400; }

/* Pareto (concentración) */
.pareto { position: relative; height: 220px; flex: 1; min-height: 200px; }
.pareto-barras { position: absolute; inset: 0; display: flex; align-items: stretch; }
.vbar { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; cursor: default; }
.concentracion { container-type: inline-size; }
.vbar-zona { flex: 1; width: 100%; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-top: 16px; }
.vbar-val { font-size: 8.5px; color: var(--suave); white-space: nowrap; margin-bottom: 3px; line-height: 1; }
.v-corto { display: none; }
.vbar-relleno { width: 64%; background: var(--morado); border-radius: 4px 4px 0 0; transition: filter .15s; min-height: 2px; }
.vbar:hover .vbar-relleno { filter: brightness(1.13); }
.vbar-et { font-size: 9.5px; text-align: center; line-height: 1.15; height: 26px; margin-top: 6px; width: 100%; position: relative; }
@container (max-width: 560px) {
  .v-largo { display: none; }
  .v-corto { display: inline; }
  .pareto { height: 250px; }
  .vbar-et { height: 54px; }
  .vbar-et span { position: absolute; top: 2px; right: 50%; transform-origin: top right; transform: rotate(-42deg); white-space: nowrap; }
  .pareto-linea { bottom: 60px; }
}
.pareto-linea { position: absolute; left: 0; right: 0; top: 16px; bottom: 32px; pointer-events: none; }
.pareto-linea svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.cum-punto {
  position: absolute; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: var(--rosa);
  border: 1.5px solid #fff; pointer-events: auto; transition: transform .15s; cursor: default;
}
.cum-punto:hover { transform: scale(1.7); }

/* Tooltip */
.tip {
  position: fixed; z-index: 100; max-width: 300px; background: #242231; color: #fff; font-size: 11px; line-height: 1.5;
  padding: 7px 10px; border-radius: 8px; box-shadow: 0 8px 22px rgba(36, 34, 49, .28); pointer-events: none;
}
.tip b { display: block; margin-bottom: 2px; }
.tip i { display: inline-block; width: 7px; height: 7px; border-radius: 2px; margin-right: 6px; }

/* ---------------- Botones, campos y avisos ---------------- */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--morado); background: var(--morado);
  color: #fff; font-size: 13px; font-weight: 600; padding: 9px 16px; border-radius: 9px; cursor: pointer; text-decoration: none; transition: background .15s;
}
.boton:hover { background: var(--morado-osc); }
.boton.secundario { background: #fff; color: var(--morado); border-color: #CFC9E3; }
.boton.secundario:hover { background: #7C63C90F; }
.boton.chico { padding: 6px 12px; font-size: 12px; }
.boton.ancho { width: 100%; padding: 11px; font-size: 14px; margin-top: 4px; }
.boton:disabled, .boton.ocupado { opacity: .6; cursor: progress; }
.boton-texto { border: 0; background: transparent; color: var(--morado); font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 4px 2px; text-decoration: none; }
.boton-texto:hover { text-decoration: underline; }
.boton-texto.peligro { color: var(--rojo); }

.campo { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--suave); }
.campo input, .campo select, .campo textarea, .nuevo-usuario input, .nuevo-usuario select {
  font: inherit; font-size: 14px; font-weight: 400; color: var(--texto); padding: 10px 12px; border: 1px solid var(--borde-fuerte); border-radius: 9px; background: #fff; width: 100%;
}
.campo textarea { font-family: ui-monospace, "Cascadia Code", Menlo, Consolas, monospace; font-size: 11.5px; line-height: 1.45; resize: vertical; background: var(--lienzo); }
.campo input:focus, .campo select:focus, .campo textarea:focus, .nuevo-usuario input:focus { outline: 2px solid #7C63C955; border-color: var(--morado); }
.campo.corto { max-width: 240px; }
.clave-caja { position: relative; display: flex; }
.clave-caja input { flex: 1; padding-right: 72px; }
.ver-clave {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: var(--pista); color: var(--suave);
  font-size: 11px; font-weight: 600; padding: 5px 9px; border-radius: 6px; cursor: pointer;
}
.msj { background: #C0524A12; border: 1px solid #C0524A33; color: #9E3D36; font-size: 12.5px; padding: 9px 12px; border-radius: 9px; margin-bottom: 12px; }
.msj.info { background: #4E9BC712; border-color: #4E9BC733; color: #2F6E92; }
.msj.ok { background: #3F8C5F12; border-color: #3F8C5F33; color: #2E6B48; }
.nota { font-size: 12px; color: var(--suave); margin: 4px 0 0; }
.aviso { background: #C9A2271A; border: 1px solid #C9A22744; color: #6F5A12; padding: 10px 14px; border-radius: 10px; font-size: 12.5px; margin: 12px 0 0; }
.aviso ul { margin: 6px 0 0; padding-left: 18px; }
.aviso li + li { margin-top: 4px; }
.aviso.ok { background: #3F8C5F12; border-color: #3F8C5F33; color: #2E6B48; }
.aviso-error { background: #C0524A12; border: 1px solid #C0524A33; color: #8E3730; padding: 12px 14px; border-radius: 10px; font-size: 12.5px; margin: 12px 0 0; }
.aviso-error p { margin: 6px 0 12px; }

/* ---------------- Administración ---------------- */
.admin { display: flex; flex-direction: column; gap: 16px; max-width: 1100px; }
.adm h2 { font-family: var(--serif); font-size: 19px; font-weight: 600; margin: 0 0 12px; }
.adm-estado { display: flex; flex-wrap: wrap; gap: 14px 36px; }
.adm-estado .et { display: block; font-size: 11px; color: var(--suave); text-transform: uppercase; letter-spacing: .4px; font-weight: 700; }
.adm-estado b { font-size: 14px; }
.adm-filas { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.dato-chip { font-size: 11.5px; background: var(--pista); border-radius: 20px; padding: 4px 10px; color: var(--suave); }
.dato-chip b { color: var(--texto); font-weight: 600; }
.adm-acciones { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; }
.adm .campo { margin-top: 14px; }
.pasos { margin: 0; padding-left: 20px; font-size: 13px; color: var(--texto); line-height: 1.55; }
.pasos li + li { margin-top: 4px; }
.resultado { margin-top: 14px; font-size: 12.5px; padding: 10px 14px; border-radius: 10px; background: var(--pista); color: var(--texto); }
.resultado.ok { background: #3F8C5F12; color: #2E6B48; }
.resultado.error { background: #C0524A12; color: #8E3730; }
.resultado ul { margin: 6px 0 0; padding-left: 18px; }
.cron { margin-top: 16px; font-size: 12.5px; color: var(--suave); }
.cron summary { cursor: pointer; font-weight: 600; color: var(--texto); }
.cron code { display: block; margin-top: 6px; padding: 10px 12px; background: var(--lienzo); border: 1px solid var(--borde); border-radius: 8px; font-size: 11.5px; overflow-x: auto; white-space: nowrap; color: var(--texto); }
.tabla-cont { overflow-x: auto; }
.tabla { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabla th { text-align: left; font-size: 11px; color: var(--suave); text-transform: uppercase; letter-spacing: .4px; font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--borde); }
.tabla td { padding: 10px; border-bottom: 1px solid var(--pista); vertical-align: middle; }
.tabla .sub { font-size: 11.5px; color: var(--suave); }
.tabla.compacta td { padding: 6px 10px; font-size: 12px; }
.acciones { text-align: right; white-space: nowrap; }
.acciones .boton-texto + .boton-texto { margin-left: 10px; }
.et-yo { font-size: 10px; background: #7C63C91A; color: var(--morado); border-radius: 10px; padding: 1px 7px; font-weight: 700; }
.estado { font-size: 11px; font-weight: 700; border-radius: 10px; padding: 2px 9px; white-space: nowrap; }
.estado.verde { background: #3F8C5F18; color: var(--verde); }
.estado.amarillo { background: #C9A2271F; color: #8A6E10; }
.estado.gris { background: var(--pista); color: var(--suave); }
.nuevo-usuario { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--pista); }
.nuevo-usuario b { width: 100%; font-size: 13px; }
.nuevo-usuario input, .nuevo-usuario select { width: auto; flex: 1 1 180px; padding: 8px 10px; font-size: 13px; }

/* ---------------- Diálogos ---------------- */
dialog { border: 0; padding: 0; border-radius: 16px; box-shadow: 0 30px 80px rgba(36, 34, 49, .25); width: min(440px, calc(100vw - 32px)); color: var(--texto); }
dialog::backdrop { background: rgba(36, 34, 49, .38); }
.dlg { padding: 22px 24px; display: flex; flex-direction: column; gap: 12px; margin: 0; }
.dlg h2 { font-family: var(--serif); margin: 0; font-size: 20px; font-weight: 600; }
.dlg p { margin: 0; font-size: 13px; color: var(--suave); line-height: 1.5; }
.dlg .msj { margin: 0; }
.dlg-acciones { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; flex-wrap: wrap; }
.clave-temporal {
  font-family: ui-monospace, "Cascadia Code", Menlo, Consolas, monospace; font-size: 22px; letter-spacing: 1px; background: var(--pista);
  padding: 14px; border-radius: 10px; text-align: center; user-select: all; overflow-wrap: anywhere;
}

/* ---------------- Pantallas de acceso ---------------- */
body.acceso {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px;
  background: radial-gradient(1100px 560px at 8% -10%, #E7E1FA 0%, transparent 60%), radial-gradient(900px 520px at 108% 110%, #D9ECF7 0%, transparent 55%), var(--fondo);
}
.acceso-caja { width: 100%; max-width: 410px; background: #fff; border: 1px solid var(--borde); border-radius: 18px; padding: 30px 30px 26px; box-shadow: 0 24px 60px rgba(36, 34, 49, .10); }
.acceso-marca { display: flex; align-items: center; gap: 13px; margin-bottom: 24px; }
.acceso-marca > div b { display: block; font-size: 16px; }
.acceso-marca > div span { font-size: 12px; color: var(--suave); }
.acceso-logo { max-width: 150px; max-height: 50px; object-fit: contain; }
.acceso h1 { font-family: var(--serif); font-size: 25px; font-weight: 600; margin: 0 0 14px; }
.acceso-form { display: flex; flex-direction: column; gap: 14px; }
.acceso-nota { font-size: 11.5px; color: var(--tenue); margin: 0; line-height: 1.5; }
.acceso-form + .acceso-nota { margin-top: 16px; }
.acceso-intro { color: var(--suave); font-size: 13px; margin: -6px 0 16px; line-height: 1.5; }
.acceso-salir { margin: 12px 0 0; text-align: center; }
.acceso-pie { font-size: 11.5px; color: var(--tenue); margin: 18px 0 0; display: flex; align-items: center; gap: 8px; }
.acceso-logo-agencia { max-height: 22px; }

/* ---------------- Adaptación a pantallas ---------------- */
@media (max-width: 1440px) {
  .fila-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1320px) {
  .k6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fila-alertas { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .g2 { grid-template-columns: minmax(0, 1fr); }
  .k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .menu {
    position: fixed; z-index: 60; left: 0; top: 0; bottom: 0; width: 280px; max-width: 86vw; transform: translateX(-102%);
    transition: transform .22s ease; box-shadow: 0 0 40px rgba(36, 34, 49, .2);
  }
  body.menu-abierto .menu { transform: none; }
  body.menu-abierto .menu-velo { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(36, 34, 49, .35); }
  .menu-abrir { display: flex; }
  .menu-cerrar { display: block; }
  .barra { position: sticky; top: 0; z-index: 30; background: rgba(245, 244, 249, .94); backdrop-filter: blur(6px); padding: 10px 16px; border-bottom: 1px solid var(--borde); }
  .barra-marca { display: inline; }
  .frescura { font-size: 11px; }
  #vista { padding: 14px 16px 36px; }
  .pag-cab h1 { font-size: 23px; }
}
@media (max-width: 720px) {
  .g3, .par { grid-template-columns: minmax(0, 1fr); }
  .g3 > :last-child:nth-child(odd) { grid-column: auto; }
  .k6, .fila-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fila-alertas { grid-template-columns: minmax(0, 1fr); }
  .rango { grid-template-columns: minmax(0, 1fr); grid-template-areas: "nums" "slider" "fechas"; }
  .f-sorteos, .f-zonas, .f-regiones { flex: 1 1 100%; }
  .selector { min-width: 0; }
  .kpi-valor { font-size: 22px; }
  .tile-valor { font-size: 19px; }
  .tp-red, .tp-int { display: none; }
  .tp-vis { width: 76px; }
  .rr { flex-wrap: wrap; row-gap: 14px; }
  .rr-col { flex: 1 1 30%; }
  .rr-col:nth-child(3) { border-right: 0; }
  .frescura { display: none; }
  .acciones { white-space: normal; }
}
@media (max-width: 420px) {
  .kpi { padding: 14px; }
  .kpi-valor { font-size: 19px; }
  .t-tit { font-size: 10px; letter-spacing: .3px; }
  .mosaicos { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mosaico { padding: 8px 6px; font-size: 12.5px; }
  .acceso-caja { padding: 24px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
