/* Tablero de carga · identidad Nivolty (modo oscuro: navy 900, nunca negro). Sora para cifras y títulos, Inter para texto.
   Colores de estado solo como estados; el cian solo para lo «en vivo». Sin librerías ni CDN: todo es local.
   Dos vistas: Presentación (.pres, para clientes; al final del archivo) y Detalle técnico (.app, tecla T). */
@font-face { font-family: "Sora"; font-weight: 600; src: url("/fuentes/Sora-SemiBold.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Sora"; font-weight: 700; src: url("/fuentes/Sora-Bold.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Inter"; font-weight: 400; src: url("/fuentes/Inter-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Inter"; font-weight: 600; src: url("/fuentes/Inter-SemiBold.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Inter"; font-weight: 700; src: url("/fuentes/Inter-Bold.ttf") format("truetype"); font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #0A1E3A;          /* Nivolty Blue 900 */
  --surface: #122D4D;
  --surface-2: #1A3A5C;
  --borde: #234B6E;
  --texto: #F0F6FC;
  --texto-2: #8BACC8;
  --acento: #5BA0E0;      /* azul de marca ajustado para oscuro */
  --vivo: #06B6D4;        /* Electric Cyan: solo lo en vivo */
  --ok: #22C55E;
  --cerca: #F59E0B;
  --mal: #F87171;         /* #EF4444 aclarado: el rojo de marca no llega a AA como texto sobre el navy */
  --mal-relleno: #EF4444;
  --display: "Sora", "Inter", system-ui, sans-serif;
  --texto-f: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { background: var(--bg); color: var(--texto); font-family: var(--texto-f); font-size: 1rem; line-height: 1.35; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
ul { list-style: none; }

.app { display: flex; flex-direction: column; gap: 14px; padding: 16px 32px; min-height: 100vh; }

/* ---------- Cabecera ---------- */
.cab { display: grid; grid-template-columns: auto minmax(0, 1fr) 520px auto; align-items: center; gap: 48px; min-height: 128px; flex: none; }
.logo { display: block; height: 48px; width: auto; }
.rotulo { display: block; font-size: 1rem; font-weight: 600; color: var(--texto-2); letter-spacing: .02em; }
.acto-nombre { font-family: var(--display); font-weight: 700; font-size: 2.75rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acto-desc { font-size: 1.125rem; color: var(--texto-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.5em; }
.cab-acto { min-width: 0; }
.reloj-fila { display: flex; align-items: baseline; gap: 16px; }
.cifra.reloj { font-size: 3.5rem; min-width: 5.2ch; }
.reloj-de { font-size: 1.25rem; color: var(--texto-2); font-variant-numeric: tabular-nums; }
.barra { height: 10px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.barra > i { display: block; height: 100%; width: 0; background: var(--acento); border-radius: 6px; transition: width .9s linear; }
.barra-acto { margin-top: 8px; }
.barra-acto.pasado > i { background: var(--cerca); }
.cab-estado { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 10px; padding: 8px 18px; border-radius: 999px; background: var(--surface); border: 1px solid var(--borde); font-weight: 700; font-size: 1.25rem; white-space: nowrap; }
.punto { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--texto-2); flex: none; }
.pill[data-e="vivo"] .punto { background: var(--vivo); animation: latido 1.6s ease-in-out infinite; }
.pill[data-e="vivo"] { color: var(--vivo); }
.pill[data-e="mal"] { color: var(--mal); }
.pill[data-e="mal"] .punto { background: var(--mal-relleno); }
.pill[data-e="espera"] { color: var(--texto); }
.corrida { font-size: 1rem; color: var(--texto-2); font-variant-numeric: tabular-nums; }
.sim { background: var(--cerca); color: #0A1E3A; font-weight: 700; font-size: 1rem; letter-spacing: .06em; text-transform: uppercase; padding: 4px 12px; border-radius: 6px; }

/* ---------- Tarjetas ---------- */
.cuerpo { position: relative; flex: 1 1 auto; min-height: 0; display: grid; gap: 14px; grid-template-columns: 540px minmax(0, 1fr) 520px;
  grid-template-rows: 310px minmax(0, 1fr) 190px; grid-template-areas: "usr lat odoo" "rps ped bd" "son ped pdf"; }
.card { background: var(--surface); border: 1px solid var(--borde); border-radius: 14px; padding: 18px 22px; min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.card h2 { font-family: var(--texto-f); font-size: 1.125rem; font-weight: 600; color: var(--texto-2); margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.a-usr { grid-area: usr; } .a-lat { grid-area: lat; } .a-odoo { grid-area: odoo; } .a-rps { grid-area: rps; }
.a-ped { grid-area: ped; } .a-bd { grid-area: bd; } .a-son { grid-area: son; } .a-pdf { grid-area: pdf; }

.cifra { font-family: var(--display); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.01em; display: inline-block; }
.cifra.xl { font-size: 5.5rem; }
.cifra.lg { font-size: 4rem; }
.cifra.md { font-size: 3rem; }
.cifra-s { font-family: var(--display); font-weight: 600; font-size: 2rem; line-height: 1; font-variant-numeric: tabular-nums; }
.cifra.sd, .cifra-s.sd { font-family: var(--texto-f); font-weight: 600; font-size: 1.5rem; letter-spacing: 0; color: var(--texto-2); }
.sd + em, .sd ~ em { display: none; }
em { font-style: normal; font-size: 1.5rem; font-weight: 600; color: var(--texto-2); margin-left: 6px; }
.nota { font-size: 1rem; color: var(--texto-2); margin-top: auto; }
.card > h2, .card > .nota, .card > .par { flex: none; }  /* el título y las notas no se encogen: lo que cede es la curva */
#e-det { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nota-2 { margin-top: 2px !important; }
.cifra.ok { color: var(--ok); } .cifra.mal { color: var(--mal); }
.de { font-size: 1.25rem; color: var(--texto-2); font-variant-numeric: tabular-nums; }

.usr-fila { display: flex; align-items: baseline; gap: 18px; min-height: 5.5rem; }
.a-usr .barra { margin: 14px 0 16px; }
.chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: auto; }
.chips li { background: var(--bg); border-radius: 10px; padding: 8px 12px; }
.chip-n { display: block; font-family: var(--display); font-weight: 700; font-size: 1.75rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.chip-t { font-size: 1rem; color: var(--texto-2); }

.par { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dato { min-width: 0; }
.dato .rotulo { margin-bottom: 6px; min-height: 1.35em; }
.dato > span:last-child, .dato > b { display: block; }
.trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.trio.dos { grid-template-columns: 1fr 1fr; margin-top: 14px; }

.spark { width: 100%; height: 56px; margin-top: 12px; display: block; flex: 0 1 56px; min-height: 20px; }
.spark .linea { fill: none; stroke: var(--acento); stroke-width: 2.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.spark .area { fill: var(--acento); opacity: .14; stroke: none; }
.spark-vivo .linea { stroke: var(--vivo); } .spark-vivo .area { fill: var(--vivo); }
.a-odoo .nota, .a-bd .nota, .a-rps .nota { margin-top: 10px; }

/* ---------- Latencia ---------- */
.tabla-lat { display: flex; flex-direction: column; flex: 1; }
.fila { display: grid; grid-template-columns: 120px 120px 190px minmax(0, 1fr); gap: 12px; align-items: center; }
.cab-fila { font-size: 1rem; font-weight: 600; color: var(--texto-2); height: 26px; }
.fila.lat { height: 53px; border-top: 1px solid var(--borde); }
.fila .g { font-size: 1.5rem; font-weight: 600; }
.p95 { display: flex; align-items: baseline; }
.um { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.um-t { font-size: 1rem; color: var(--texto-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barra-lat { position: relative; height: 12px; overflow: visible; }
.barra-lat > i { background: var(--acento); }
.barra-lat > u { position: absolute; top: -4px; bottom: -4px; width: 3px; background: var(--texto); border-radius: 2px; left: 66.6%; text-decoration: none; }
.lat[data-e="ok"] .barra-lat > i { background: var(--ok); }
.lat[data-e="cerca"] .barra-lat > i { background: var(--cerca); }
.lat[data-e="mal"] .barra-lat > i { background: var(--mal-relleno); }
.lat[data-e="ok"] .n95 { color: var(--ok); } .lat[data-e="cerca"] .n95 { color: var(--cerca); } .lat[data-e="mal"] .n95 { color: var(--mal); }

/* ---------- Pedidos y animación ---------- */
.a-ped .dato .rotulo { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tuberia { flex: 1; min-height: 120px; display: grid; grid-template-columns: 110px minmax(0, 1fr) 150px minmax(0, 1fr) 110px; align-items: stretch; margin-top: 16px; }
.nodo { align-self: center; height: 78px; border: 2px solid var(--borde); border-radius: 12px; background: var(--bg); display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 600; font-size: 1.25rem; }
.canal { position: relative; align-self: center; height: 4px; background: var(--borde); border-radius: 2px; }
.canal .bola { position: absolute; top: -7px; width: 18px; height: 18px; border-radius: 50%; background: var(--acento); left: 0; will-change: transform; }
.canal.sale .bola { background: var(--ok); }
.tanque { position: relative; border: 2px solid var(--borde); border-radius: 12px; background: var(--bg); overflow: hidden; }
.nivel { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: var(--acento); opacity: .75; transition: height .9s ease; }
.tanque-t { position: absolute; left: 0; right: 0; top: 8px; text-align: center; font-weight: 700; font-size: 1.125rem; font-variant-numeric: tabular-nums; }

/* ---------- Pie ---------- */
.pie { display: flex; align-items: center; gap: 24px; min-height: 72px; flex: none; }
.actos { display: flex; gap: 12px; }
.btn { height: 52px; padding: 0 28px; border-radius: 10px; border: 2px solid var(--acento); background: var(--acento); color: #0A1E3A; font-weight: 700; font-size: 1.25rem; cursor: pointer; transition: background .2s, border-color .2s; }
.btn:hover { background: #7DB6EA; border-color: #7DB6EA; }
.btn.sec { background: transparent; color: var(--texto); border-color: var(--borde); }
.btn.sec:hover { background: var(--surface-2); }
.btn:focus-visible { outline: 3px solid var(--texto); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.actos .btn { background: transparent; color: var(--texto); border-color: var(--borde); }
.actos .btn:hover { background: var(--surface-2); }
.actos .btn[aria-pressed="true"] { background: var(--acento); border-color: var(--acento); color: #0A1E3A; }
.btn.sec[aria-pressed="true"] { background: var(--surface-2); border-color: var(--acento); }
.aviso { flex: 1; min-width: 0; font-size: 1.125rem; color: var(--texto-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aviso.mal { color: var(--mal); }
.fuentes { display: flex; gap: 18px; font-size: 1rem; font-weight: 600; }
.fuente { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.fuente[data-e="ok"] .punto { background: var(--ok); }
.fuente[data-e="mal"] .punto { background: var(--mal-relleno); }
.fuente[data-e="mal"]::after { content: "sin datos"; color: var(--mal); font-weight: 400; }
.fuente[data-e="ok"]::after { content: "al día"; color: var(--texto-2); font-weight: 400; }

/* ---------- Confirmación ---------- */
.velo { position: fixed; inset: 0; background: rgba(10, 30, 58, .82); display: flex; align-items: center; justify-content: center; z-index: 10; }
.modal { width: min(640px, calc(100vw - 48px)); background: var(--surface); border: 1px solid var(--borde); border-radius: 16px; padding: 32px; box-shadow: 0 20px 60px rgba(0, 0, 0, .45); }
.modal h2 { font-family: var(--display); font-size: 2rem; margin-bottom: 14px; }
.modal p { font-size: 1.25rem; color: var(--texto-2); margin-bottom: 28px; line-height: 1.5; }
.modal-bt { display: flex; justify-content: flex-end; gap: 14px; }

/* ---------- Cuadro final ---------- */
.final { position: absolute; inset: 0; z-index: 5; background: var(--bg); border: 1px solid var(--borde); border-radius: 14px; padding: 22px 28px; display: flex; flex-direction: column; gap: 16px; overflow: hidden; }
.final-cab { display: flex; align-items: baseline; justify-content: space-between; }
.final-cab h2 { font-family: var(--display); font-size: 2.25rem; font-weight: 700; }
.final-cuenta { font-size: 1.5rem; font-weight: 600; color: var(--texto-2); }
.final-pedidos { display: grid; grid-template-columns: 1fr 48px 1fr 1fr; gap: 20px; align-items: center; background: var(--surface); border: 1px solid var(--borde); border-radius: 14px; padding: 18px 26px; }
.igual { font-family: var(--display); font-size: 3.5rem; font-weight: 700; color: var(--texto-2); text-align: center; }
.perdidos[data-e="cerca"] .cifra { color: var(--cerca); } .perdidos[data-e="ok"] .cifra { color: var(--ok); } .perdidos[data-e="mal"] .cifra { color: var(--mal); }
.criterios { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; gap: 12px 20px; flex: 1; min-height: 0; }
.crit { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--borde); border-left-width: 6px; border-radius: 12px; padding: 8px 18px; min-height: 0; }
.crit[data-e="cumple"] { border-left-color: var(--ok); } .crit[data-e="no_cumple"] { border-left-color: var(--mal-relleno); }
.crit[data-e="midiendo"] { border-left-color: var(--cerca); } .crit[data-e="sin_datos"] { border-left-color: var(--texto-2); }
.crit .c-nombre { font-size: 1.125rem; color: var(--texto-2); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; grid-column: 1; }
.crit .c-valor { font-family: var(--display); font-weight: 700; font-size: 1.75rem; line-height: 1.15; grid-column: 1; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crit .c-umbral { font-size: 1rem; color: var(--texto-2); grid-column: 1; }
.crit .c-badge { grid-column: 2; grid-row: 1 / span 3; font-weight: 700; font-size: 1.25rem; padding: 6px 14px; border-radius: 8px; white-space: nowrap; }
.crit[data-e="cumple"] .c-badge { background: var(--ok); color: #0A1E3A; }
.crit[data-e="no_cumple"] .c-badge { background: var(--mal-relleno); color: #0A1E3A; }
.crit[data-e="midiendo"] .c-badge { background: var(--cerca); color: #0A1E3A; }
.crit[data-e="sin_datos"] .c-badge { background: var(--surface-2); color: var(--texto); }
.crit .c-umbral { grid-row: 3; }

/* ---------- Animaciones ---------- */
@keyframes latido { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.5); opacity: .55; } }
@keyframes entra-acto { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.acto-nombre.nuevo { animation: entra-acto .6s ease-out; }
@keyframes aparece { from { opacity: 0; } to { opacity: 1; } }
.final:not([hidden]) { animation: aparece .5s ease-out; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Pantalla de 1920×1080: todo cabe, sin scroll ---------- */
@media (min-width: 1700px) and (min-height: 1000px) {
  .app { height: 100vh; min-height: 0; overflow: hidden; }
}

/* ---------- Pantallas más chicas: se apila y se permite scroll vertical (nunca horizontal) ---------- */
@media (max-width: 1699px), (max-height: 999px) {
  .cab { grid-template-columns: auto minmax(0, 1fr) minmax(280px, 380px) auto; gap: 24px; }
  .cuerpo { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: none; grid-auto-rows: minmax(250px, auto);
    grid-template-areas: "usr lat" "rps ped" "odoo bd" "son pdf"; }
  .a-ped { min-height: 460px; }
  .a-lat { min-height: 330px; }
  .final { overflow-y: auto; }  /* cubre el cuerpo apilado (más alto que la pantalla): el cuadro se lee bajando la página */
  .criterios { flex: none; grid-auto-rows: minmax(104px, auto); }
  .pie { flex-wrap: wrap; }
}
@media (max-width: 1100px) {
  .cab { grid-template-columns: 1fr; }
  .cab-estado { align-items: flex-start; }
  .cuerpo { grid-template-columns: minmax(0, 1fr); grid-template-areas: "usr" "lat" "rps" "ped" "odoo" "bd" "son" "pdf"; }
  .fila { grid-template-columns: 90px 90px 150px minmax(0, 1fr); }
  .criterios { grid-template-columns: 1fr; }
}

/* =====================================================================================================================
   Vista Presentación: dueños y directores, en proyector. Una sola pantalla sin desplazamiento a 1920×1080 y 1366×768.
   --u es el tamaño del texto: 20 px a 1920×1080 y nunca menos de 16 px; todo lo demás se mide en múltiplos de --u.
   ===================================================================================================================== */
.pres {
  --u: clamp(16px, min(100vw / 96, 100vh / 54), 20px);
  --g: calc(var(--u) * .75);
  --radio: 14px;
  --ok-fondo: #143C4F; --atento-fondo: #2D3B45; --mal-fondo: #33304C;
  --punto-quieto: #4F86BD; --punto-fuera: #2E5A86; --punto-vivo: #22D3EE;
  height: 100vh; overflow: hidden; font-size: var(--u); line-height: 1.3;
  display: grid; gap: var(--g); padding: calc(var(--u) * .9) calc(var(--u) * 1.4);
  grid-template-columns: minmax(0, 1fr) minmax(0, 32%);
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  grid-template-areas: "cab cab" "linea linea" "salud salud" "empresa feed" "cifras cifras";
}
.pres h1, .pres h2, .pres h3, .pres p { margin: 0; }

/* ---------- Encabezado: qué se está viendo, reloj del acto y estado de la conexión ---------- */
.p-cab { grid-area: cab; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: calc(var(--u) * 1.6); }
.p-logo { display: block; height: calc(var(--u) * 2.1); width: auto; }
.p-titulo { min-width: 0; }
.p-titulo h1 { font-family: var(--display); font-weight: 700; font-size: calc(var(--u) * 1.8); line-height: 1.12; }
.p-sub { font-size: calc(var(--u) * 1.1); color: var(--texto-2); font-weight: 600; }
.p-sub b { color: var(--texto); font-weight: 700; }
.p-reloj { display: flex; align-items: baseline; gap: .45em; white-space: nowrap; }
.p-reloj-n { font-family: var(--display); font-weight: 700; font-size: calc(var(--u) * 2.3); line-height: 1; font-variant-numeric: tabular-nums; }
.p-reloj-de { font-size: var(--u); color: var(--texto-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.p-estado { display: grid; justify-items: end; gap: calc(var(--u) * .35); }
.p-estado-fila { display: flex; gap: .6em; align-items: center; }
.p-conexion { display: inline-flex; align-items: center; gap: .5em; font-weight: 700; font-size: var(--u); white-space: nowrap; color: var(--texto); }
.p-punto { display: inline-block; width: .6em; height: .6em; border-radius: 50%; background: var(--texto-2); flex: none; will-change: transform, opacity; }
.p-conexion[data-e="vivo"] { color: var(--vivo); }
.p-conexion[data-e="vivo"] .p-punto { background: var(--vivo); animation: latido 1.6s ease-in-out infinite; }
.p-conexion[data-e="reconectando"] { color: var(--cerca); }
.p-conexion[data-e="reconectando"] .p-punto { background: var(--cerca); animation: latido .9s ease-in-out infinite; }
.p-conexion[data-e="ejemplo"] .p-punto { background: var(--acento); }
.p-sim { background: var(--cerca); color: #0A1E3A; font-weight: 700; font-size: var(--u); letter-spacing: .05em; padding: .1em .55em; border-radius: 6px; white-space: nowrap; }
.p-btn-tec { background: transparent; border: 1px solid var(--borde); border-radius: 8px; color: var(--texto-2); font-size: var(--u); font-weight: 600; padding: .1em .7em; cursor: pointer; }
.p-btn-tec:hover { color: var(--texto); border-color: var(--acento); }
.p-btn-tec:focus-visible { outline: 3px solid var(--texto); outline-offset: 2px; }

/* ---------- Línea de tiempo con los eventos y el momento actual ---------- */
.p-linea { grid-area: linea; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: end; gap: var(--u); }
.p-linea[hidden] { display: none !important; }
.p-linea-ext { font-size: var(--u); color: var(--texto-2); font-weight: 600; line-height: 1; padding-bottom: calc(var(--u) * .2); white-space: nowrap; }
.p-pista { position: relative; height: calc(var(--u) * 2.4); }
.p-pista-base { position: absolute; left: 0; right: 0; bottom: calc(var(--u) * .35); height: calc(var(--u) * .6); background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.p-hecho { display: block; height: 100%; width: 100%; background: #23507E; transform-origin: 0 50%; transform: scaleX(0); transition: transform .9s linear; }
.p-eventos { position: absolute; inset: 0; }
.p-ev { position: absolute; bottom: calc(var(--u) * .35); height: calc(var(--u) * .6); background: #6F93BA; border-radius: 4px; }
.p-ev[data-e="pasado"] { background: #9DB8D4; }
.p-ev[data-e="activo"] { background: var(--vivo); box-shadow: 0 0 0 3px rgba(6, 182, 212, .35); }
.p-ev-t { position: absolute; bottom: calc(var(--u) * 1.2); font-size: var(--u); line-height: 1.1; white-space: nowrap; color: var(--texto-2); font-weight: 600; }
.p-ev-t[data-e="activo"] { color: var(--texto); font-weight: 700; }
.p-ev-t[data-e="activo"]::before { content: ""; display: inline-block; will-change: transform, opacity; width: .55em; height: .55em; border-radius: 50%; background: var(--vivo); margin-right: .35em; vertical-align: .08em; animation: latido 1.2s ease-in-out infinite; }
.p-marca { position: absolute; left: 0; bottom: calc(var(--u) * .15); width: 4px; height: calc(var(--u) * .95); margin-left: -2px; background: var(--texto); border-radius: 2px; transition: transform .9s linear; will-change: transform; }
.p-marca::after { content: ""; position: absolute; left: 50%; bottom: calc(var(--u) * -.2); width: calc(var(--u) * .55); height: calc(var(--u) * .55); margin-left: calc(var(--u) * -.275); border-radius: 50%; background: var(--texto); }

/* ---------- Semáforo general y momento actual ---------- */
.p-salud { grid-area: salud; display: flex; align-items: center; gap: var(--u); min-width: 0; padding: calc(var(--u) * .55) calc(var(--u) * 1.1);
  border-radius: var(--radio); background: var(--surface); border: 1px solid var(--borde); border-left: calc(var(--u) * .5) solid var(--texto-2);
  transition: background-color .6s ease, border-color .6s ease; }
.p-salud[data-nivel="bien"] { background: var(--ok-fondo); border-left-color: var(--ok); }
.p-salud[data-nivel="atento"] { background: var(--atento-fondo); border-left-color: var(--cerca); }
.p-salud[data-nivel="mal"] { background: var(--mal-fondo); border-left-color: var(--mal-relleno); }
.p-icono { flex: none; width: calc(var(--u) * 2.5); height: calc(var(--u) * 2.5); }
.p-icono svg, .p-ico-s svg { display: block; width: 100%; height: 100%; }
.p-salud-txt { min-width: 0; flex: 1 1 auto; }
.p-frase { font-family: var(--display); font-weight: 700; font-size: calc(var(--u) * 1.75); line-height: 1.15; }
.p-motivos { font-size: var(--u); color: var(--texto); margin-top: .15em; }
.p-momento { flex: 0 1 auto; max-width: 46%; display: flex; align-items: center; gap: .55em; padding: .45em 1em; border-radius: 12px;
  font-size: calc(var(--u) * 1.1); font-weight: 700; line-height: 1.2; background: #0E3A52; border: 2px solid var(--vivo); color: #E6FBFF; }
.p-momento .p-punto { background: var(--vivo); animation: latido 1.2s ease-in-out infinite; }
.p-momento[data-activo="false"] { background: transparent; border-color: var(--borde); color: var(--texto-2); font-weight: 600; font-size: var(--u); }
.p-momento[data-activo="false"] .p-punto { background: var(--texto-2); animation: none; }
.p-momento.entra { animation: entra-momento .7s ease-out; }
@keyframes entra-momento { from { opacity: 0; transform: translateY(-.4em) scale(.97); } to { opacity: 1; transform: none; } }

/* ---------- La empresa trabajando: cada área con sus puntos y lo último que hizo ---------- */
.p-empresa, .p-feed { min-height: 0; min-width: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--borde);
  border-radius: var(--radio); padding: calc(var(--u) * .6) calc(var(--u) * 1) calc(var(--u) * .5); }
.p-empresa { grid-area: empresa; contain: layout paint; }
.p-area { contain: layout paint; }
.p-feed { grid-area: feed; contain: layout paint; }
.p-h2 { flex: none; font-size: var(--u); font-weight: 600; color: var(--texto-2); line-height: 1.3; margin-bottom: calc(var(--u) * .35); }
.p-emp-n { font-family: var(--display); font-weight: 700; color: var(--texto); font-size: calc(var(--u) * 1.3); font-variant-numeric: tabular-nums; }
#p-emp-de { color: var(--texto); font-weight: 700; }
.p-areas { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column;
  --col-grupo: calc(var(--u) * 6.6); --col-nombre: calc(var(--u) * 10); --col-n: calc(var(--u) * 2.2); --col-puntos: 25%; }
.p-grupo { display: grid; grid-template-columns: var(--col-grupo) minmax(0, 1fr); column-gap: calc(var(--u) * .6); border-top: 1px solid var(--borde); padding: calc(var(--u) * .12) 0; }
.p-grupo:first-child { border-top: 0; padding-top: 0; }
.p-grupo-t { align-self: center; font-size: var(--u); line-height: 1.15; }
.p-grupo-t b { display: block; font-family: var(--display); font-weight: 700; color: var(--texto); }
.p-grupo-t span { color: var(--texto-2); font-weight: 600; }
.p-area { display: grid; grid-template-columns: var(--col-nombre) var(--col-n) var(--col-puntos) minmax(0, 1fr); column-gap: calc(var(--u) * .6); align-items: center; min-height: 0; }
.p-area-t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: var(--u); }
.p-area-n { text-align: right; color: var(--texto-2); font-weight: 600; font-variant-numeric: tabular-nums; font-size: var(--u); white-space: nowrap; }
.p-area-c { display: block; width: 100%; height: 100%; min-height: 0; will-change: transform; }  /* capa propia: sus destellos no repintan lo demás */
.p-area-u { color: var(--texto); font-size: var(--u); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-area-u.sin { color: var(--texto-2); }
.p-area-u.nueva { color: #A5F3FC; }

/* ---------- Actividad en vivo ---------- */
.p-feed-lista { list-style: none; flex: 1 1 auto; min-height: 0; overflow: hidden; position: relative; margin: 0; padding: 0; }
.p-feed-lista li { padding: calc(var(--u) * .2) calc(var(--u) * .3); margin: 0 calc(var(--u) * -.3); border-top: 1px solid #1D4063; font-size: var(--u); line-height: 1.28; border-radius: 6px; }
.p-feed-lista li:first-child { border-top: 0; }
.p-feed-lista li[hidden] { display: block !important; visibility: hidden; }
.f-area { color: #B4CBE0; font-weight: 700; margin-right: .4em; }
.f-txt { color: var(--texto); }
.f-cod { white-space: nowrap; }
.p-feed-lista li.falla .f-txt::after { content: " · no se completó"; color: var(--cerca); font-weight: 600; }
.p-feed-lista li.nuevo { animation: entra-renglon .6s ease-out; }
@keyframes entra-renglon { from { background: rgba(6, 182, 212, .18); } to { background: rgba(6, 182, 212, 0); } }
.p-feed-lista li.p-feed-vacio { color: var(--texto-2); font-size: var(--u); margin: 0; padding-left: 0; padding-right: 0; }
.p-hasta { flex: none; font-size: var(--u); color: var(--texto-2); border-top: 1px solid var(--borde); padding-top: calc(var(--u) * .35); margin-top: calc(var(--u) * .2); }
.p-hasta b { color: var(--texto); font-weight: 700; }

/* ---------- Cuatro cifras grandes con su frase ---------- */
.p-cifras { grid-area: cifras; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--g); }
.p-cifra { contain: layout paint; position: relative; min-width: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--borde);
  border-top: calc(var(--u) * .3) solid var(--texto-2); border-radius: var(--radio); padding: calc(var(--u) * .55) calc(var(--u) * 1) calc(var(--u) * .6); overflow: hidden; }
.p-cifra[data-nivel="bien"] { border-top-color: var(--ok); }
.p-cifra[data-nivel="atento"] { border-top-color: var(--cerca); }
.p-cifra[data-nivel="mal"] { border-top-color: var(--mal-relleno); }
.p-cifra h3 { display: flex; align-items: center; gap: .4em; font-size: var(--u); font-weight: 600; color: var(--texto-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-ico-s { flex: none; width: 1.05em; height: 1.05em; }
.p-num { display: flex; align-items: baseline; gap: .3em; margin-top: calc(var(--u) * .2); white-space: nowrap; }
.p-n { font-family: var(--display); font-weight: 700; font-size: calc(var(--u) * 2.9); line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.p-u { font-size: calc(var(--u) * 1.15); font-weight: 700; color: var(--texto-2); }
.p-cifra[data-nivel="mal"] .p-n { color: var(--mal); }
.p-cifra[data-nivel="atento"] .p-n { color: #FCD34D; }
.p-regla { position: relative; height: calc(var(--u) * .45); background: var(--surface-2); border-radius: 999px; margin: calc(var(--u) * .45) 0 calc(var(--u) * .25); }
.p-regla-v { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; border-radius: 999px; background: var(--acento); transform-origin: 0 50%; transform: scaleX(0); transition: transform .8s ease, background-color .6s ease; }
.p-cifra[data-nivel="bien"] .p-regla-v { background: var(--ok); }
.p-cifra[data-nivel="atento"] .p-regla-v { background: var(--cerca); }
.p-cifra[data-nivel="mal"] .p-regla-v { background: var(--mal-relleno); }
.p-regla-lim { position: absolute; top: calc(var(--u) * -.3); bottom: calc(var(--u) * -.3); width: 3px; margin-left: -1px; background: var(--texto); border-radius: 2px; text-decoration: none; }
.p-tubo { position: relative; height: calc(var(--u) * .45); margin: calc(var(--u) * .45) 0 calc(var(--u) * .25);
  background: linear-gradient(var(--surface-2), var(--surface-2)) center / 100% 2px no-repeat; }
.p-tubo i { position: absolute; top: 50%; left: 0; width: calc(var(--u) * .7); height: calc(var(--u) * .7); margin-top: calc(var(--u) * -.35); border-radius: 50%;
  background: var(--vivo); will-change: transform, opacity; }
.p-det { font-size: var(--u); font-weight: 600; color: var(--texto); }
.p-cf { font-size: var(--u); color: var(--texto-2); margin-top: calc(var(--u) * .1); }

/* Un dato que ya no es de ahora no se presenta como actual */
.p-cifra.viejo .p-n, .p-cifra.viejo .p-regla, .p-cifra.viejo .p-tubo { opacity: .4; }
.p-viejo { color: var(--cerca) !important; font-weight: 600; }
.pres.sin-conexion .p-n, .pres.sin-conexion .p-area-c, .pres.sin-conexion .p-reloj-n, .pres.sin-conexion .p-regla, .pres.sin-conexion .p-tubo,
.pres.sin-conexion .p-ev, .pres.sin-conexion .p-marca, .pres.sin-conexion .p-emp-n { opacity: .4; }
.pres.sin-conexion .p-ico-s { opacity: .5; filter: grayscale(1); }
.pres.sin-conexion .p-ev-t[data-e="activo"] { color: var(--texto-2); font-weight: 600; }   /* sin datos no hay «ahora» */
.pres.sin-conexion .p-ev-t[data-e="activo"]::before { animation: none; background: var(--texto-2); }
.pres.sin-conexion .p-cifra { border-top-color: var(--texto-2); }

/* 1366×768 y menores: lo mismo, más apretado (el texto nunca baja de 16 px) */
@media (max-height: 860px), (max-width: 1500px) {
  .pres { --g: calc(var(--u) * .6); padding: calc(var(--u) * .7) calc(var(--u) * 1); grid-template-columns: minmax(0, 1fr) minmax(0, 29%); }
  .p-hasta { display: none; }
  .p-cab { gap: var(--u); }
  .p-titulo h1 { font-size: calc(var(--u) * 1.55); }
  .p-sub { font-size: var(--u); }
  .p-reloj-n { font-size: calc(var(--u) * 2); }
  .p-logo { height: calc(var(--u) * 1.8); }
  .p-frase { font-size: calc(var(--u) * 1.5); }
  .p-icono { width: calc(var(--u) * 2.1); height: calc(var(--u) * 2.1); }
  .p-momento { font-size: var(--u); }
  .p-n { font-size: calc(var(--u) * 2.5); }
  .p-cifra { padding: calc(var(--u) * .45) calc(var(--u) * .8) calc(var(--u) * .5); }
  .p-areas { --col-grupo: calc(var(--u) * 5); --col-nombre: calc(var(--u) * 9.6); --col-n: calc(var(--u) * 2); --col-puntos: 24%; }
  .p-empresa, .p-feed { padding: calc(var(--u) * .45) calc(var(--u) * .8) calc(var(--u) * .4); }
}

/* Detalle técnico: botón para volver */
#btn-pres { white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .p-hecho, .p-marca, .p-regla-v { transition: none !important; }
}
