/* =====================================================================
   Estadísticas de ejemplo (estadisticas.html) y su adelanto en la portada.
   Se carga después de site.css y usa sus variables.
   ===================================================================== */
.nav-links a[aria-current="page"] { opacity: 1; font-weight: 700; }
.est-head { padding: calc(var(--nav-h) + 64px) 0 72px; position: relative; overflow: hidden; }
.est-head-in { text-align: center; }
.est-head .h2 { color: #fff; margin: 0 auto; }
.est-head .hero-lead { margin-top: 18px; }
.est-head .pill { margin-bottom: 22px; }
.est-body { padding: 0 0 72px; }
.est-body .wrap { margin-top: -40px; }
.wrap-ancho { max-width: 1240px; }
.est-aviso { margin: 22px auto 0; max-width: 780px; text-align: center; font-size: 14.5px; color: var(--dia-suave); }

.soon {
  display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; vertical-align: middle;
  background: #fef3c7; color: #92400e; font: 800 10px/1.6 var(--display); letter-spacing: .06em; text-transform: uppercase;
}

/* El dashboard es una ventana clara, igual en día y noche */
.dash {
  --pista: #e8edf4; --txt: #0f172a; --suave: #64748b; --linea: #e2e8f0;
  position: relative; z-index: 2;
  background: #fff; color: var(--txt); border: 1px solid var(--linea); border-radius: 20px; overflow: hidden;
  box-shadow: 0 30px 80px -30px rgba(15, 23, 42, .35), 0 -20px 60px -30px rgba(37, 99, 235, .4);
  font-size: 14px; line-height: 1.45;
}
.dash-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; padding: 22px 26px 6px; }
.dash-kicker { font: 800 22px/1.2 var(--display); }
.dash-alcance { margin-top: 2px; color: var(--suave); font-size: 13px; }
.dash-filtro { display: flex; flex-direction: column; gap: 3px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--suave); }
.dash-filtro select {
  min-width: 240px; padding: 9px 12px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; color: var(--txt);
  font: 600 14px var(--body); text-transform: none; letter-spacing: 0; cursor: pointer;
}
.dash-tabs { display: flex; gap: 4px; padding: 12px 20px 0; border-bottom: 1px solid var(--linea); overflow-x: auto; scrollbar-width: thin; }
.dash-tabs button {
  flex: none; padding: 11px 14px; border: 0; border-bottom: 3px solid transparent; background: none; cursor: pointer;
  font: 700 14px var(--body); color: var(--suave); white-space: nowrap; border-radius: 8px 8px 0 0;
}
.dash-tabs button:hover { color: var(--txt); background: #f5f7fb; }
.dash-tabs button.on { color: var(--azul-hover); border-bottom-color: var(--azul); }
.dash-body { padding: 22px 26px 28px; background: #f8fafc; min-height: 420px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { padding: 16px 18px; background: #fff; border: 1px solid var(--linea); border-radius: 14px; }
.kpi-v { font: 900 30px/1.1 var(--display); color: var(--azul); font-variant-numeric: tabular-nums; }
.kpi-alerta .kpi-v { color: #dc2626; }
.kpi-l { margin-top: 6px; font-weight: 700; font-size: 13px; }
.kpi-l .soon { margin-left: 6px; }
.kpi-n { margin-top: 2px; font-size: 12px; color: var(--suave); }

.pns { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.pn { grid-column: span 2; min-width: 0; padding: 18px 20px 16px; background: #fff; border: 1px solid var(--linea); border-radius: 14px; }
.pn-dos { grid-column: span 4; }
.pn-mitad { grid-column: span 3; }
.pn-completo { grid-column: 1 / -1; }
.pn-h { margin-bottom: 12px; }
.pn-h h3 { font: 800 16px/1.3 var(--display); }
.pn-h p { margin-top: 2px; font-size: 12.5px; color: var(--suave); }

/* Gráficos */
.g { width: 100%; height: auto; overflow: visible; }
.g-grid { stroke: #e8edf4; stroke-width: 1; }
.g-eje { fill: #64748b; font: 11px var(--body); }
.g-eje.g-futuro { fill: #cbd5e1; }
.g-bar { transition: opacity .15s ease; }
.g-bar:hover { opacity: .85; }
.chips { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 12.5px; color: var(--suave); }
.chips i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.dona-caja { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: center; }
.g-dona { width: 150px; height: 150px; flex: none; }
.g-dona circle[data-tip] { transition: stroke-width .15s ease; }
.g-dona circle[data-tip]:hover { stroke-width: 26; }
.g-centro { font: 900 24px var(--display); fill: var(--txt); }
.g-sub { font: 600 11px var(--body); fill: #64748b; }
.leyenda { list-style: none; margin: 0; padding: 0; flex: 1 1 150px; display: flex; flex-direction: column; gap: 7px; font-size: 13px; }
.leyenda li { display: grid; grid-template-columns: 1fr auto 40px; align-items: center; gap: 8px; position: relative; }
.leyenda li i { position: absolute; left: 0; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; }
.leyenda li span { padding-left: 16px; }
.leyenda b { font-variant-numeric: tabular-nums; }
.leyenda em { font-style: normal; color: var(--suave); text-align: right; font-size: 12px; }

.anillo-caja { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.g-anillo { width: 140px; height: 140px; flex: none; }
.ctx { font-size: 14px; max-width: 300px; }
.ctx-suave { margin-top: 8px; font-size: 12.5px; color: var(--suave); }

.hb { display: flex; flex-direction: column; gap: 10px; }
.hb-row { display: grid; grid-template-columns: minmax(130px, 1.3fr) 1.4fr auto auto; align-items: center; gap: 10px; }
.hb-l { font-weight: 600; font-size: 13px; line-height: 1.25; min-width: 0; }
.hb-l small { display: block; font-weight: 400; font-size: 11.5px; color: var(--suave); }
.hb-t { height: 10px; border-radius: 999px; background: var(--pista); overflow: hidden; }
.hb-t i { display: block; height: 100%; border-radius: 999px; transform-origin: left; animation: crece .6s cubic-bezier(.2, .7, .2, 1) both; }
.hb-row b { font-variant-numeric: tabular-nums; font-size: 13px; text-align: right; }
.hb-row em { font-style: normal; font-size: 12px; color: var(--suave); min-width: 52px; text-align: right; font-variant-numeric: tabular-nums; }
.hb-nota { margin-top: 10px; font-size: 11.5px; color: var(--suave); text-align: right; }
@keyframes crece { from { transform: scaleX(0); } }

.barra-plan { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.barra-plan-v { font: 900 30px/1 var(--display); color: var(--azul); white-space: nowrap; }
.barra-plan-v span { font: 600 13px var(--body); color: var(--suave); }
.barra { flex: 1; height: 12px; border-radius: 999px; background: var(--pista); overflow: hidden; }
.barra i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #22c55e, #16a34a); animation: crece .7s cubic-bezier(.2, .7, .2, 1) both; transform-origin: left; }
.meses { display: grid; grid-template-columns: repeat(12, 1fr); gap: 8px; }
.mes { padding: 8px 4px; border-radius: 10px; text-align: center; background: #f1f5f9; border: 1px solid #e2e8f0; }
.mes small { display: block; font-size: 11px; font-weight: 700; color: var(--suave); text-transform: uppercase; letter-spacing: .04em; }
.mes b { font-size: 13px; font-variant-numeric: tabular-nums; }
.mes-completo { background: #dcfce7; border-color: #86efac; color: #166534; }
.mes-riesgo { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
.mes-perdido { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.mes-curso { background: #e0f2fe; border-color: #7dd3fc; color: #075985; }
.mes-futuro, .mes-vacio { color: #94a3b8; }
.mes-completo small, .mes-riesgo small, .mes-perdido small, .mes-curso small { color: inherit; opacity: .8; }

.tb { width: 100%; border-collapse: collapse; }
.tb td { padding: 9px 4px; border-bottom: 1px solid #eef2f7; vertical-align: middle; font-size: 13px; }
.tb tr:last-child td { border-bottom: 0; }
.tb small { display: block; font-size: 11.5px; color: var(--suave); }
.tb .tr { text-align: right; white-space: nowrap; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.tag-rojo { background: #fee2e2; color: #991b1b; }
.tag-azul { background: #dbeafe; color: #1e40af; }
.tag-ambar { background: #fef3c7; color: #92400e; }
.vacio { padding: 20px 0; text-align: center; color: var(--suave); }

/* Línea de tiempo de equipos detenidos */
.tl { display: flex; flex-direction: column; gap: 4px; overflow-x: auto; }
.tl-row { display: grid; grid-template-columns: minmax(150px, 210px) minmax(420px, 1fr); gap: 12px; align-items: center; }
.tl-l { font-size: 12.5px; font-weight: 600; line-height: 1.25; }
.tl-l small { display: block; font-weight: 400; color: var(--suave); font-size: 11px; }
.tl-track {
  position: relative; height: 24px; border-radius: 6px; border: 1px solid #e8edf4; background-color: #f8fafc;
  background-image: repeating-linear-gradient(90deg, transparent 0, transparent calc(100% / 12 - 1px), #e8edf4 calc(100% / 12 - 1px), #e8edf4 calc(100% / 12));
}
.tl-meses { display: grid; grid-template-columns: repeat(12, 1fr); height: auto; border: 0; background: none; }
.tl-meses b { font-size: 11px; font-weight: 700; color: #64748b; text-align: center; }
.tl-meses b.g-futuro { color: #cbd5e1; }
.tl-head { margin-bottom: 2px; }
.tl-off { position: absolute; top: 3px; bottom: 3px; border-radius: 4px; background: #dc2626; cursor: pointer; }
.tl-mp { position: absolute; top: 6px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: #2563eb; border: 2px solid #fff; box-shadow: 0 0 0 1px #2563eb; cursor: pointer; text-decoration: none; }
.tl-nota { margin-top: 10px; font-size: 12.5px; color: var(--suave); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tl-key { position: static; display: inline-block; width: 18px; height: 10px; margin: 0 4px 0 0; border-radius: 3px; vertical-align: middle; }
.tl-key.tl-off { background: #dc2626; }
.tl-key.tl-mp { width: 10px; margin-left: 10px; border-radius: 50%; }

.burbuja {
  position: fixed; z-index: 200; max-width: 280px; padding: 9px 12px; border-radius: 10px; pointer-events: none;
  background: #0f172a; color: #f8fafc; font-size: 12.5px; line-height: 1.45; white-space: pre-line;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .35);
}
.burbuja[hidden] { display: none; }

/* Glosario de indicadores */
.gloss { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 48px; }
.gloss-card { padding: 26px; border-radius: var(--radio); border: 1px solid var(--dia-borde); background: #fff; }
.gloss-card h3 { font-size: 19px; font-weight: 800; }
.gloss-k { margin: 8px 0 10px; font: 800 12px/1.4 var(--display); letter-spacing: .06em; text-transform: uppercase; color: var(--azul); }
.gloss-card p:last-child { font-size: 15.5px; color: var(--dia-suave); }

/* Adelanto en la portada */
.adel { display: grid; grid-template-columns: 1fr 1.1fr; gap: 56px; align-items: center; }
.adel .checks li { color: var(--noche-suave); }
.adel .checks li::before { background-color: rgba(34, 197, 94, .16); }
.adel-cta { margin-top: 32px; display: flex; gap: 12px; flex-wrap: wrap; }
.adel-card { background: #fff; color: var(--tinta); border-radius: 18px; padding: 20px 22px 22px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .1); }
.adel-card .soon { margin-left: 6px; }
.adel-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.adel-kpi { padding: 12px 14px; border-radius: 12px; background: #f5f8ff; }
.adel-kpi b { display: block; font: 900 24px/1.1 var(--display); color: var(--azul); }
.adel-kpi.rojo b { color: #dc2626; }
.adel-kpi.verde b { color: #16a34a; }
.adel-kpi span { font-size: 12px; font-weight: 700; color: #475569; }
.adel-t { margin: 18px 0 8px; font: 800 13px var(--display); color: #475569; display: flex; justify-content: space-between; }
.adel-t small { font-weight: 600; color: #94a3b8; }
.adel-tl { display: flex; flex-direction: column; gap: 6px; }
.adel-tl div { display: grid; grid-template-columns: 96px 1fr; gap: 10px; align-items: center; font-size: 11.5px; color: #475569; font-weight: 600; }
.adel-tl span { position: relative; height: 14px; border-radius: 4px; background-color: #f1f5f9; background-image: repeating-linear-gradient(90deg, transparent 0, transparent calc(100% / 12 - 1px), #e2e8f0 calc(100% / 12 - 1px), #e2e8f0 calc(100% / 12)); }
.adel-tl i { position: absolute; top: 2px; bottom: 2px; border-radius: 3px; background: #dc2626; }
.adel-tl u { position: absolute; top: 3px; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: #2563eb; border: 1.5px solid #fff; text-decoration: none; }
.adel-bars { display: flex; align-items: flex-end; gap: 6px; height: 74px; }
.adel-bars i { flex: 1; display: flex; flex-direction: column-reverse; border-radius: 3px 3px 0 0; overflow: hidden; }
.adel-bars b { display: block; background: #2563eb; }
.adel-bars s { display: block; background: #dc2626; text-decoration: none; }
.adel-bars-l { display: flex; gap: 6px; margin-top: 4px; font-size: 10px; color: #94a3b8; font-weight: 700; text-align: center; }
.adel-bars-l span { flex: 1; }

@media (max-width: 1020px) {
  .pn, .pn-mitad { grid-column: span 3; }
  .pn-dos { grid-column: 1 / -1; }
  .gloss { grid-template-columns: repeat(2, 1fr); }
  .adel { grid-template-columns: 1fr; gap: 40px; }
}
@media (max-width: 700px) {
  .pns, .gloss { grid-template-columns: 1fr; }
  .pn, .pn-mitad, .pn-dos, .pn-completo { grid-column: auto; }
  .dash-top, .dash-body { padding-left: 16px; padding-right: 16px; }
  .dash-tabs { padding-left: 8px; padding-right: 8px; }
  .dash-filtro, .dash-filtro select { width: 100%; }
  .meses { grid-template-columns: repeat(6, 1fr); }
  .tl-row { grid-template-columns: 1fr; gap: 4px; margin-bottom: 8px; }
  .tl-head > span { display: none; }
  .tl-l small { display: inline; margin-left: 6px; }
  .hb-row { grid-template-columns: 1fr auto auto; }
  .hb-row .hb-t { grid-column: 1 / -1; grid-row: 2; }
  .adel-kpis { grid-template-columns: 1fr 1fr; }
  .adel-tl div { grid-template-columns: 70px 1fr; }
}
@media (prefers-reduced-motion: reduce) { .hb-t i, .barra i { animation: none; } }

/* ---- Segunda pasada: movimiento del dashboard y simulador ---- */
.dash-acciones { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.dash-btn {
  padding: 9px 14px; border-radius: 10px; border: 1px solid #cbd5e1; background: #fff; color: var(--txt); cursor: pointer;
  font: 700 13.5px var(--body); transition: background-color .15s ease, border-color .15s ease, transform .1s ease;
}
.dash-btn:hover:not(:disabled) { background: #f1f5f9; }
.dash-btn:active:not(:disabled) { transform: translateY(1px); }
.dash-btn:disabled { opacity: .45; cursor: default; }
.dash-btn .bolt { vertical-align: -3px; margin-right: 2px; }
.dash-btn-sim { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.dash-btn-sim:hover:not(:disabled) { background: #fee2e2; }
.dash-aviso {
  position: fixed; left: 50%; bottom: 22px; z-index: 70; width: min(560px, calc(100vw - 32px)); margin: 0; padding: 14px 18px; border-radius: 14px;
  background: #0f172a; color: #f8fafc; font-size: 13.5px; line-height: 1.5; box-shadow: 0 20px 50px rgba(2, 6, 23, .45);
  transform: translate(-50%, 160%); opacity: 0; pointer-events: none; transition: transform .35s cubic-bezier(.2, .7, .2, 1), opacity .25s ease;
}
.dash-aviso.on { transform: translate(-50%, 0); opacity: 1; }

.kpi-flash { animation: destello 1.4s ease; }
@keyframes destello { 0% { background: #fef9c3; box-shadow: 0 0 0 4px rgba(250, 204, 21, .5); } 100% { background: #fff; box-shadow: none; } }

.dash-body > * { animation: entra-panel .5s cubic-bezier(.2, .7, .2, 1) both; }
.dash-body .pns { animation-delay: .08s; }
@keyframes entra-panel { from { opacity: 0; transform: translateY(10px); } }
.g-bar { transform-box: fill-box; transform-origin: bottom; animation: crece-y .65s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes crece-y { from { transform: scaleY(0); } }
.g-linea > path, .g-linea > circle[data-tip] { animation: trazo 1.1s cubic-bezier(.4, 0, .2, 1) both; }
@keyframes trazo { from { clip-path: inset(0 100% 0 0); opacity: .4; } to { clip-path: inset(0 0 0 0); } }
.g-dona { animation: gira-dona .9s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes gira-dona { from { transform: rotate(-90deg) scale(.85); opacity: 0; } }
.g-anillo circle:nth-of-type(2) { animation: llena 1.2s cubic-bezier(.4, 0, .2, 1) both; }
@keyframes llena { from { stroke-dasharray: 0 400; } }
.mes { animation: entra-panel .45s ease both; }
.mes:nth-child(2) { animation-delay: .04s; } .mes:nth-child(3) { animation-delay: .08s; } .mes:nth-child(4) { animation-delay: .12s; }
.mes:nth-child(5) { animation-delay: .16s; } .mes:nth-child(6) { animation-delay: .2s; } .mes:nth-child(7) { animation-delay: .24s; }
.mes:nth-child(8) { animation-delay: .28s; } .mes:nth-child(9) { animation-delay: .32s; } .mes:nth-child(10) { animation-delay: .36s; }
.mes:nth-child(11) { animation-delay: .4s; } .mes:nth-child(12) { animation-delay: .44s; }
.tl-off { animation: aparece .5s ease both .3s; }
@keyframes aparece { from { transform: scaleY(0); } }
.kpi { transition: transform .2s ease, box-shadow .2s ease; }
.kpi:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -14px rgba(15, 23, 42, .35); }
.dash-tabs button.on { animation: entra-panel .3s ease both; }
@media (max-width: 700px) { .dash-acciones { width: 100%; } .dash-acciones .dash-filtro { flex: 1 1 100%; } }
@media (prefers-reduced-motion: reduce) {
  .dash-body > *, .g-bar, .g-linea > path, .g-linea > circle, .g-dona, .g-anillo circle, .mes, .tl-off, .kpi-flash, .dash-tabs button.on { animation: none; }
  .dash-aviso { transition: none; }
}
.dash-body.sin-anim > *, .dash-body.sin-anim .pns *, .dash-body.sin-anim .kpis > :not(.kpi-flash) { animation: none; }
