/* ================================================================ Monitor del AS/400 en modo TV (monitor-as400-tv.js)
 * Tema oscuro de la marca (azul marino #0B1B2B y dorado #FFB200, piel live-noche de app.css); todo en «em» sobre un
 * tamaño de letra que crece con la pantalla (portátil, TV 1920×1080 y 4K). En el móvil las escenas se desplazan. */
.mas-tv-pagina { margin: 0; background: #0B1B2B; overflow: hidden; }
.tv { --tv-oro: #FFB200; --tv-fondo: #0B1B2B; --tv-caja: rgba(255, 255, 255, .045); --tv-borde: rgba(255, 255, 255, .09);
  --tv-tinta: #F7F8FA; --tv-tinta2: #C4D2E0; --tv-tenue: #8FA6BD;
  --mv-sup: #102538; --mv-tinta: var(--tv-tinta); --mv-tinta2: var(--tv-tinta2); --mv-tenue: var(--tv-tenue); --mv-rejilla: rgba(255, 255, 255, .12);
  --mv-bien: #4ade80; --mv-aviso: #FFB200; --mv-serio: #ec835a; --mv-critico: #f87171; --mv-s1: #3987e5; --mv-s2: #d95926;
  --mv-neutro: rgba(255, 255, 255, .10);
  position: relative; display: grid; grid-template-rows: auto auto minmax(0, 1fr); height: 100vh; color: var(--tv-tinta);
  font-family: "Sora", system-ui, -apple-system, "Segoe UI", sans-serif; font-size: clamp(11px, min(.98vw, 1.75vh), 40px);
  background: radial-gradient(1200px 600px at 85% -10%, rgba(92, 200, 242, .10), transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(255, 178, 0, .07), transparent 60%), var(--tv-fondo); }
.tv-cab { grid-row: 1; } .tv-alerta { grid-row: 2; } .tv-escenario { grid-row: 3; }
.tv-ico { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tv button { font: inherit; color: inherit; }

/* cabecera */
.tv-cab { position: relative; display: flex; align-items: center; gap: 1.4em; padding: .9em 1.6em .8em; border-bottom: 1px solid var(--tv-borde); flex-wrap: wrap; }
.tv-marca { display: flex; align-items: center; gap: .7em; }
.tv-marca b { display: block; font-size: 1.05em; font-weight: 800; letter-spacing: .01em; }
.tv-marca small { display: block; font-size: .62em; letter-spacing: .22em; color: var(--tv-oro); }
.tv-saturno { position: relative; display: inline-grid; place-items: center; width: 3em; height: 3em; }
.tv-saturno img { width: 100%; height: 100%; animation: tv-flota 7s ease-in-out infinite; filter: drop-shadow(0 0 .5em rgba(255, 178, 0, .25)); }
.tv-saturno::after { content: ""; position: absolute; inset: -.25em; border-radius: 50%; border: 1px solid rgba(255, 178, 0, .35); border-left-color: transparent; border-bottom-color: transparent; animation: tv-gira 9s linear infinite; }
.tv-saturno.tv-grande { width: 6em; height: 6em; }
@keyframes tv-flota { 50% { transform: translateY(-.12em) rotate(-4deg); } }
@keyframes tv-gira { to { transform: rotate(360deg); } }
.tv-titulo { min-width: 0; }
.tv-titulo small { display: block; color: var(--tv-tinta2); font-size: .85em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32em; }
.tv-titulo b { display: block; font-size: 2em; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.tv-hueco { flex: 1; }
.tv-puntos { display: flex; gap: .6em; list-style: none; margin: 0 0 0 .4em; padding: 0; align-self: flex-end; margin-bottom: .55em; }
.tv-puntos li { width: .62em; height: .62em; border-radius: 50%; background: rgba(255, 255, 255, .22); transition: background .4s, transform .4s; }
.tv-puntos li.tv-on { background: var(--tv-oro); transform: scale(1.4); }
.tv[data-modo="manual"] .tv-puntos { display: none; }
.tv-fila2 { display: none; flex-basis: 100%; order: 10; align-items: center; gap: .4em; }
.tv[data-modo="manual"] .tv-fila2 { display: flex; }
.tv-escenas { display: flex; gap: .4em; flex-wrap: wrap; }
.tv-escenas button { display: inline-flex; align-items: center; gap: .45em; padding: .45em .9em; white-space: nowrap; border: 1px solid var(--tv-borde); border-radius: 99px; background: none; cursor: pointer; color: var(--tv-tinta2); }
.tv-escenas button:hover { color: var(--tv-tinta); border-color: rgba(255, 255, 255, .3); }
.tv-escenas [aria-selected="true"] { background: var(--tv-oro); color: #0B1B2B; border-color: var(--tv-oro); font-weight: 700; }
.tv-luz, .tv-cli .tv-luz { display: inline-flex; align-items: center; gap: .5em; padding: .35em .9em .35em .7em; border-radius: 99px; font-weight: 700; background: rgba(255, 255, 255, .07); color: var(--tv-tinta2); white-space: nowrap; }
.tv-luz i { width: .7em; height: .7em; border-radius: 50%; background: currentColor; }
.tv-luz[data-estado="bien"] { background: rgba(74, 222, 128, .12); color: #86efac; }
.tv-luz[data-estado="bien"] i { animation: tv-latido 2.2s ease-in-out infinite; }
.tv-luz[data-estado="aviso"] { background: rgba(255, 178, 0, .14); color: #FFD166; }
.tv-luz[data-estado="critico"] { background: rgba(248, 113, 113, .16); color: #fca5a5; }
.tv-luz[data-estado="critico"] i { animation: tv-latido 1s ease-in-out infinite; }
.tv-luz[data-estado="apagado"] { background: rgba(143, 166, 189, .16); color: #C4D2E0; }
@keyframes tv-latido { 50% { opacity: .3; } }
.tv-lectura { display: flex; align-items: center; gap: .55em; color: var(--tv-tinta2); font-size: .85em; }
.tv-lectura svg { width: 2.1em; height: 2.1em; transform: rotate(-90deg); }
.tv-l-pista { fill: none; stroke: rgba(255, 255, 255, .1); stroke-width: 3; }
.tv-l-arco { fill: none; stroke: var(--tv-oro); stroke-width: 3; stroke-dasharray: 94.25; stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.tv-lectura b, .tv-lectura small { display: block; white-space: nowrap; }
.tv-lectura small { color: var(--tv-tenue); }
.tv-reloj { text-align: right; line-height: 1; }
.tv-reloj b { display: block; font-size: 2.6em; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.tv-reloj small { color: var(--tv-tinta2); font-size: .85em; text-transform: capitalize; }
.tv-mandos { display: flex; gap: .4em; }
.tv-btn { display: inline-flex; align-items: center; gap: .45em; padding: .5em .8em; border: 1px solid var(--tv-borde); border-radius: .7em; background: rgba(255, 255, 255, .05); cursor: pointer; white-space: nowrap; }
.tv-btn:hover { background: rgba(255, 255, 255, .12); }
a.tv-btn { color: var(--tv-tinta); text-decoration: none; }
.tv-pulso .tv-col > * { flex: 1; }
.tv-errores .mv-columnas { height: 9em; }
.tv-btn[aria-pressed="true"] { color: var(--tv-oro); border-color: rgba(255, 178, 0, .5); }
.tv-btn-modo { border-color: rgba(255, 178, 0, .55); color: var(--tv-oro); font-weight: 700; }
/* en automático, los mandos se ven solo al mover el ratón (el de «Interactivo» siempre) */
.tv[data-modo="auto"] .tv-mandos .tv-btn:not(.tv-btn-modo) { opacity: 0; pointer-events: none; transition: opacity .4s; }
.tv[data-modo="auto"].tv-movido .tv-mandos .tv-btn { opacity: 1; pointer-events: auto; }
.tv-progreso { position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; }
.tv-progreso i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--tv-oro), #F3EC92); transition: width 1s linear; }
.tv[data-modo="manual"] .tv-progreso { display: none; }

/* avisos */
.tv-alerta { display: flex; align-items: center; gap: .8em; margin: .6em 1.6em 0; padding: .6em 1em; border-radius: .8em; background: rgba(248, 113, 113, .14); color: #fecaca; border: 1px solid rgba(248, 113, 113, .4); font-size: 1.05em; overflow: hidden; }
.tv-alerta b { white-space: nowrap; color: #fca5a5; }
.tv-al-lista { display: flex; gap: 1.6em; min-width: 0; white-space: nowrap; overflow: hidden; }
.tv-al-lista span { overflow: hidden; text-overflow: ellipsis; }
.tv::after { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: 0; box-shadow: inset 0 0 0 0 rgba(248, 113, 113, 0); transition: box-shadow .6s; z-index: 50; }
.tv.tv-con-aviso::after { animation: tv-halo 2.4s ease-in-out infinite; }
@keyframes tv-halo { 0%, 100% { box-shadow: inset 0 0 0 .25em rgba(248, 113, 113, .55), inset 0 0 3em rgba(248, 113, 113, .18); } 50% { box-shadow: inset 0 0 0 .25em rgba(248, 113, 113, .15), inset 0 0 1em rgba(248, 113, 113, .05); } }
.tv.tv-destello .tv-alerta { animation: tv-sacude .5s ease-in-out 3; }
@keyframes tv-sacude { 25% { transform: translateX(-.3em); } 75% { transform: translateX(.3em); } }

/* escenario y escenas */
.tv-escenario { position: relative; min-height: 0; margin: .9em 1.6em 1.2em; }
.tv-escena { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 1em; min-height: 0; opacity: 0; visibility: hidden; transform: translateY(1em) scale(.99);
  transition: opacity .9s ease, transform .9s ease, visibility 0s .9s; }
.tv-escena.tv-activa { opacity: 1; visibility: visible; transform: none; transition: opacity .9s ease, transform .9s ease; }
.tv-escena.tv-sale { visibility: visible; opacity: 0; transform: translateY(-1em) scale(.99); }
.tv[data-modo="auto"] .tv-escenario { cursor: pointer; }
.tv-caja, .tv-losa { min-width: 0; min-height: 0; padding: 1em 1.2em; border: 1px solid var(--tv-borde); border-radius: 1.1em; background: var(--tv-caja); backdrop-filter: blur(4px); overflow: hidden; }
.tv-caja h4 { margin: 0 0 .7em; font-size: .82em; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--tv-tenue); }
.tv-losa { display: flex; flex-direction: column; gap: .25em; }
.tv-losa > small { display: flex; align-items: center; gap: .5em; font-size: .82em; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--tv-tenue); }
.tv-losa > b { font-size: 2em; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tv-losa > span { color: var(--tv-tinta2); font-size: .9em; }
.tv-losa[data-nivel="critico"], .tv-losa.critico { border-color: rgba(248, 113, 113, .5); background: rgba(248, 113, 113, .09); }
.tv-losa[data-nivel="critico"] > b, .tv-losa.critico > b { color: #fca5a5; }
.tv-losa[data-nivel="bien"] > b, .tv-losa.bien > b { color: #86efac; }
.tv-losa.apagado > b { color: var(--tv-tinta2); }
.tv-gigante { font-size: 3.6em !important; }
.tv-rejilla { display: grid; gap: 1em; min-height: 0; flex: 1; }
.tv-col { display: flex; flex-direction: column; gap: 1em; min-height: 0; min-width: 0; }
.tv-dos { display: grid; grid-template-columns: 1fr 1fr; gap: 1em; }
.tv-cuatro { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1em; }
.tv-ancha { grid-column: 1 / -1; }
.tv-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1em; }
.tv-kpi { padding: .8em 1.1em; border-radius: 1em; border: 1px solid var(--tv-borde); background: var(--tv-caja); }
.tv-kpi small { display: block; color: var(--tv-tenue); font-size: .82em; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.tv-kpi b { display: block; font-size: 2.4em; font-weight: 800; font-variant-numeric: tabular-nums; }
.tv-kpi[data-nivel="critico"] { border-color: rgba(248, 113, 113, .5); background: rgba(248, 113, 113, .1); }
.tv-kpi[data-nivel="critico"] b { color: #fca5a5; }
.tv-kpi[data-nivel="aviso"] b { color: #FFD166; }
.tv-kpi[data-nivel="bien"] b { color: #86efac; }

/* Pulso */
.tv-pulso { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.1fr); grid-template-rows: minmax(0, 1fr) auto; }
.tv-ind { display: flex; align-items: center; justify-content: center; }
.tv-ind .mv-ind { max-width: 26em; font-size: 1.25em; }
.tv-ind-peq .mv-ind { max-width: 15em; font-size: .95em; }
.tv-chispas { display: grid; grid-template-columns: 1fr 1fr; gap: 2em; }
.tv-chispas h4 { margin-bottom: 1.3em; }

/* Trabajos */
.tv-dos-col { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.tv-dos-col .mv-calor { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: minmax(5.2em, 1fr); height: calc(100% - 4.6em); }
.tv-dos-col .tv-caja { display: flex; flex-direction: column; }
.tv-dos-col .mv-celda strong { font-size: 1.8em; }

/* Disco */
.tv-disco { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr); }
.tv-mapa { display: flex; flex-direction: column; }
.tv-mapa-zona { flex: 1; min-height: 12em; }
.tv-lista { margin: .6em 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: .4em; counter-reset: tvl; }
.tv-lista li { display: flex; justify-content: space-between; gap: 1em; padding: .35em 0; border-top: 1px solid var(--tv-borde); font-size: .92em; }
.tv-lista li b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-lista li span { color: var(--tv-tinta2); white-space: nowrap; }

/* Errores */
.tv-errores { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.tv-tt { display: flex; flex-direction: column; }
.tv-tt-zona { flex: 1; min-height: 0; }
.tv-tt-zona .mv-tt-fila { font-size: .95em; }
.tv-msgw { display: grid; gap: .6em; }
.tv-msgw-t { display: grid; grid-template-columns: 1fr auto; gap: .2em 1em; padding: .7em 1em; border-radius: .9em; border: 1px solid rgba(248, 113, 113, .55); background: rgba(248, 113, 113, .1); text-align: left; cursor: pointer;
  animation: tv-msgw 2.4s ease-in-out infinite; }
.tv-msgw-t b { font-family: ui-monospace, Consolas, monospace; }
.tv-msgw-t span { grid-column: 1 / -1; color: #fecaca; font-size: .88em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-msgw-t em { grid-row: 1; grid-column: 2; font-style: normal; font-weight: 800; color: #fca5a5; }
@keyframes tv-msgw { 50% { background: rgba(248, 113, 113, .2); box-shadow: 0 0 1.4em rgba(248, 113, 113, .25); } }
.tv-g-critico { background: var(--mv-critico); }
.tv-g-serio { background: var(--mv-serio); }
.tv-g-aviso { background: var(--mv-aviso); }

/* PTF */
.tv-ptf { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.tv-ptf .mv-insignias { grid-template-columns: repeat(auto-fit, minmax(18em, 1fr)); height: 100%; align-content: center; }
.tv-ptf .mv-insignia { flex-direction: column; text-align: center; padding: 2em 1.4em; gap: 1em; background: radial-gradient(circle at 50% 0%, rgba(255, 178, 0, .10), transparent 70%), var(--tv-caja); }
.tv-ptf .mv-ins-anillo { width: 11em; height: 11em; }
.tv-ptf .mv-ins-anillo b { font-size: 2.6em; }
.tv-ptf .mv-ins-anillo small { font-size: .9em; }
.tv-ptf .mv-ins-txt b { font-size: 1.6em; }
.tv-ptf .mv-ins-txt small { white-space: normal; }
.tv-ptf .tv-caja:first-child { display: flex; flex-direction: column; }
.tv-ptf .tv-caja:first-child > div { flex: 1; }
.tv-todo-bien { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4em; height: 100%; text-align: center; color: var(--tv-tinta2); }
.tv-todo-bien .mv-ico { width: 3.4em; height: 3.4em; color: #86efac; }
.tv-todo-bien b { font-size: 1.6em; color: var(--tv-tinta); }

/* Encendidos */
.tv-encendidos { grid-template-rows: minmax(0, 1fr) auto; }
.tv-encendidos .mv-tiempo svg { max-height: 52vh; }
.tv-encendidos .mv-eje { font-size: 13px; }
.tv-nota-nd { color: var(--tv-tinta2); }

/* Todos los clientes */
.tv-clientes { display: grid; grid-template-columns: repeat(var(--tv-cols, 3), minmax(0, 1fr)); gap: 1em; height: 100%; grid-auto-rows: minmax(0, 1fr); }
.tv-cli-ind { display: grid; grid-template-columns: 1fr 1fr; gap: .6em; flex: 1; min-height: 0; align-items: center; }
.tv-cli-ind .mv-ind { font-size: .78em; max-width: 13em; }
.tv-cli-ind .mv-ind-pie span { display: none; }
.tv-cli[data-estado="apagado"] { opacity: .85; }
.tv-cli { display: flex; flex-direction: column; gap: .5em; min-height: 0; overflow: hidden; padding: 1.2em 1.3em; border: 1px solid var(--tv-borde); border-radius: 1.2em; background: var(--tv-caja); text-align: left; cursor: pointer; transition: transform .3s, border-color .3s; }
.tv-cli:hover { transform: translateY(-.15em); border-color: rgba(255, 255, 255, .3); }
.tv-cli-actual { border-color: rgba(255, 178, 0, .55); }
.tv-cli[data-estado="critico"] { border-color: rgba(248, 113, 113, .6); animation: tv-msgw 2.4s ease-in-out infinite; }
.tv-cli-cab { display: flex; align-items: center; justify-content: space-between; gap: 1em; }
.tv-cli-cab > b { font-size: 1.5em; font-weight: 800; }
.tv-cli > small { color: var(--tv-tenue); }
.tv-cli-fila { display: grid; grid-template-columns: 4em 1fr 4.5em; align-items: center; gap: .8em; }
.tv-cli-fila > span { color: var(--tv-tenue); font-size: .85em; }
.tv-cli-fila > b { text-align: right; font-variant-numeric: tabular-nums; }
.tv-cli-barra { display: block; height: .65em; border-radius: 99px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.tv-cli-barra > i { display: block; height: 100%; border-radius: 99px; background: var(--mv-bien); transition: width 1.2s; }
.tv-cli-barra[data-nivel="aviso"] > i { background: var(--mv-aviso); }
.tv-cli-barra[data-nivel="critico"] > i { background: var(--mv-critico); }
.tv-cli-cifras { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6em; }
.tv-cli-cifras small { display: block; color: var(--tv-tenue); font-size: .78em; }
.tv-cli-cifras b { font-size: 1.5em; font-variant-numeric: tabular-nums; }
.tv-cli-prox { color: var(--tv-oro); font-weight: 700; }
.tv-cli-aviso { color: #fca5a5; font-size: .88em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-cli-nd { color: var(--tv-tinta2); font-size: .9em; }

/* no disponible y leyendo */
.tv-nodisp { margin: auto; display: flex; flex-direction: column; align-items: center; gap: .6em; text-align: center; max-width: 40em; color: var(--tv-tinta2); }
.tv-nodisp > .tv-ico { width: 3em; height: 3em; color: var(--tv-oro); }
.tv-nodisp b { font-size: 1.6em; color: var(--tv-tinta); }
.tv-escena > div:empty { display: none; }

/* toque, cuenta atrás, ajustes, detalle y tablas */
.tv-toque { position: absolute; left: 50%; bottom: 1.2em; transform: translateX(-50%); display: flex; align-items: center; gap: .5em; padding: .5em 1em; border-radius: 99px; background: rgba(11, 27, 43, .85);
  border: 1px solid var(--tv-borde); color: var(--tv-tinta2); font-size: .85em; opacity: 0; transition: opacity .4s; pointer-events: none; z-index: 20; }
.tv[data-modo="auto"].tv-movido .tv-toque { opacity: 1; }
.tv-cuenta { position: absolute; left: 50%; bottom: 1.6em; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: .6em; padding: .8em 1.4em; border-radius: 99px;
  background: var(--tv-oro); color: #0B1B2B; font-weight: 700; box-shadow: 0 1em 3em rgba(0, 0, 0, .45); }
.tv-ajustes { position: absolute; right: 1.6em; top: 6em; z-index: 70; width: 22em; padding: 1.2em; border-radius: 1em; background: #102538; border: 1px solid var(--tv-borde); box-shadow: 0 1.5em 4em rgba(0, 0, 0, .5); display: flex; flex-direction: column; gap: .8em; }
.tv-ajustes h3 { margin: 0; font-size: 1.1em; }
.tv-ajustes label { display: flex; flex-direction: column; gap: .3em; font-size: .9em; color: var(--tv-tinta2); }
.tv-ajustes select { padding: .5em; border-radius: .6em; border: 1px solid var(--tv-borde); background: #0B1B2B; color: var(--tv-tinta); font: inherit; }
.tv-ajustes .tv-aj-casilla { flex-direction: row; align-items: center; gap: .6em; }
.tv-ajustes p { margin: 0; color: var(--tv-tenue); font-size: .82em; }
.tv-detalle { width: min(46em, 92vw); max-height: 86vh; padding: 0; border: 1px solid rgba(255, 255, 255, .14); border-radius: 1.2em; background: #102538; color: #F7F8FA; font-size: clamp(13px, min(.95vw, 1.7vh), 30px);
  font-family: "Sora", system-ui, sans-serif; box-shadow: 0 2em 6em rgba(0, 0, 0, .6); }
.tv-detalle::backdrop { background: rgba(0, 0, 0, .55); backdrop-filter: blur(3px); }
.tv-detalle header { display: flex; align-items: center; justify-content: space-between; gap: 1em; padding: 1em 1.3em; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.tv-detalle header small { color: #FFB200; font-size: .8em; letter-spacing: .1em; text-transform: uppercase; }
.tv-detalle h2 { margin: .1em 0 0; font-size: 1.4em; overflow-wrap: anywhere; }
.tv-detalle dl { display: grid; grid-template-columns: max-content 1fr; gap: .5em 1.2em; margin: 0; padding: 1.1em 1.3em; }
.tv-detalle dt { color: #8FA6BD; }
.tv-detalle dd { margin: 0; overflow-wrap: anywhere; }
.tv-detalle .tv-btn { color: #F7F8FA; }
.tv-det-nota, .tv-det-h, .tv-det-lista { margin: 0 1.3em 1em; color: #C4D2E0; }
.tv-det-h { font-size: 1em; color: #F7F8FA; }
.tv-det-lista { padding-left: 1.2em; }
.tv-capa-tablas { position: absolute; inset: 0; z-index: 80; display: flex; flex-direction: column; background: var(--fondo, #0B1B2B); color: var(--texto, #F7F8FA); font-size: 15px; font-family: var(--fuente, system-ui); }
.tv-capa-cab { display: flex; align-items: center; gap: 1em; padding: 12px 22px; border-bottom: 1px solid var(--borde); }
.tv-capa-cab .hueco { flex: 1; }
.tv-capa-cab .tv-btn { font-size: 15px; }
.tv-capa-cuerpo { flex: 1; overflow: auto; padding: 16px 22px 30px; }

/* portátil estrecho y móvil: las escenas se desplazan */
@media (max-width: 1100px), (max-aspect-ratio: 1/1) {
  .mas-tv-pagina { overflow: auto; }
  .tv { height: auto; min-height: 100vh; font-size: 14px; }
  .tv-escenario { min-height: 70vh; }
  .tv-escena { position: relative; inset: auto; display: none; }
  .tv-escena.tv-activa { display: flex; }
  .tv-escena.tv-sale { display: none; }
  .tv-pulso, .tv-dos-col, .tv-disco, .tv-errores, .tv-ptf { grid-template-columns: 1fr; grid-template-rows: none; }
  .tv-pulso { grid-template-columns: 1fr 1fr; }
  .tv-pulso .tv-col { grid-column: 1 / -1; }
  .tv-ind .mv-ind { font-size: .9em; }
  .tv-kpis, .tv-cuatro { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tv-mapa-zona { height: 22em; flex: none; }
  .tv-clientes { grid-template-columns: 1fr !important; height: auto; grid-auto-rows: auto; }
  .tv-escenas { flex-wrap: nowrap; overflow-x: auto; }
  .tv-lectura { display: none; }
  .tv-reloj b { font-size: 1.8em; }
  .tv-titulo b { font-size: 1.5em; }
  .tv-chispas { grid-template-columns: 1fr; }
  .tv-tt-zona { height: 30em; flex: none; }
  .mv-tt-fila { grid-template-columns: 1fr auto; }
  .mv-tt-id, .mv-tt-trabajo { display: none; }
  .mv-tt-texto { grid-column: 1 / -1; white-space: normal; }
}
@media (max-width: 560px) {
  .tv-cab { gap: .7em; padding: .7em 1em; }
  .tv-escenario { margin: .7em 1em 1em; }
  .tv-mandos .tv-btn span { display: none; }
  .tv-dos { grid-template-columns: 1fr; }
  .tv-marca span:not(.tv-saturno) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tv-saturno img, .tv-saturno::after, .tv-luz i, .tv.tv-con-aviso::after, .tv-msgw-t, .tv-cli[data-estado="critico"] { animation: none !important; }
  .tv.tv-con-aviso::after { box-shadow: inset 0 0 0 .25em rgba(248, 113, 113, .55); }
  .tv-escena, .tv-escena.tv-activa { transition: none; }
}

.tv-completa-aviso { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); z-index: 70; display: none; align-items: center; gap: .7em; padding: 1em 1.6em; border-radius: 99px;
  background: rgba(11, 27, 43, .92); border: 1px solid rgba(255, 178, 0, .6); color: var(--tv-oro); font-size: 1.3em; font-weight: 700; box-shadow: 0 1em 3em rgba(0, 0, 0, .5); pointer-events: none; }
.tv.tv-pide-completa .tv-completa-aviso { display: flex; animation: tv-latido 2.4s ease-in-out infinite; }
.tv-dos-col.tv-wrk-modo { grid-template-columns: minmax(0, 2.4fr) minmax(0, 1fr); }
.tv-dos-col.tv-wrk-modo .mv-calor { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: auto; height: auto; max-height: calc(100% - 4.6em); overflow: auto; }
.tv-dos-col .mv-celda { min-height: 5.4em; }
.tv [data-t-wrk] { flex: 1; min-height: 0; display: flex; }
.tv [data-t-wrk] .mv-wrk { flex: 1; font-size: .9em; }
.tv .mv-wrk-tabla-caja { max-height: none; flex: 1; }
.tv .mv-wrk-barra select, .tv .mv-wrk-pie select, .tv .mv-wrk-buscar { background: #0B1B2B; }
.tv .mv-wrk .btn { background: rgba(255, 255, 255, .06); color: var(--tv-tinta); border-color: var(--tv-borde); }
.tv-detalle .tv-det-lista small { color: #8FA6BD; }
.tv-ptf .mv-anillo { max-width: 15em; }
.tv-ptf .tv-col > .tv-caja { display: flex; flex-direction: column; justify-content: center; }

/* === apagados y TV fija (bifurcación) === */
/* Escena Encendidos: cinco cifras arriba y los días ocupando el resto */
.tv-encendidos { grid-template-rows: auto minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); min-width: 0; }
.tv-cinco { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1em; }
.tv-cinco .tv-losa > b { font-size: 1.7em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-dias-caja { display: flex; flex-direction: column; }
.tv-dias-zona { flex: 1; min-height: 0; display: flex; }
.tv .mvd { flex: 1; min-height: 0; min-width: 0; display: flex; flex-direction: column; font-size: .95em; --mvd-izq: 6.2em; --mvd-on: rgba(74, 222, 128, .62); --mvd-prog: rgba(196, 210, 224, .30); }
.tv .mvd-scroll { flex: 1; min-height: 0; min-width: 0; overflow: hidden; display: flex; }
.tv .mvd-tabla { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.tv .mvd-cuerpo { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.tv .mvd-cuerpo > .mvd-fila { flex: 1; height: auto; min-height: 0; }
.tv .mvd-eje { height: 1.6em; }
.tv .mvd-ipl b { background: rgba(11, 27, 43, .85); }
.tv .mvd-ahora b { background: #0B1B2B; }
@media (max-width: 1100px), (max-aspect-ratio: 1/1) {
  .tv { grid-template-columns: minmax(0, 1fr); }
  .tv-escenario, .tv-escena { min-width: 0; }
  .tv-fila2 { min-width: 0; max-width: 100%; }
  .tv-escenas { min-width: 0; flex: 1 1 auto; }
  .tv-cinco { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tv .mvd-scroll { overflow-x: auto; }
  .tv .mvd-tabla { min-width: 640px; }
  .tv .mvd-cuerpo > .mvd-fila { flex: none; height: 26px; }
}

/* Pantalla fija: nada se mueve al cambiar de escena, de modo o al refrescar (cabecera de alto fijo, escena en su hueco,
   avisos y barra de progreso superpuestos). Solo en pantallas apaisadas anchas; en el móvil, las escenas se desplazan. */
@media (min-width: 1101px) and (min-aspect-ratio: 1001/1000) {
  html:has(.mas-tv-pagina), .mas-tv-pagina { overflow: hidden; height: 100%; }
  .tv { --tv-cab-alto: 7.4em; grid-template-rows: var(--tv-cab-alto) minmax(0, 1fr); height: 100vh; overflow: hidden; }
  .tv-cab { grid-row: 1; display: grid; box-sizing: border-box; height: var(--tv-cab-alto); overflow: hidden; padding: .55em 1.6em .5em; column-gap: 1.1em; row-gap: .3em;
    grid-template-columns: auto minmax(6em, 21em) minmax(0, 1fr) 10.5em 9.2em 10.5em auto; grid-template-rows: minmax(0, 1fr) 2.7em; align-items: center; }
  .tv-cab > .tv-marca { grid-column: 1; grid-row: 1; }
  .tv-cab > .tv-titulo { grid-column: 2; grid-row: 1; overflow: hidden; }
  .tv-cab > .tv-puntos { display: none; }
  .tv-cab > .tv-hueco { grid-column: 3; grid-row: 1; }
  .tv-cab > .tv-luz { grid-column: 4; grid-row: 1; justify-content: center; overflow: hidden; font-size: .92em; }
  .tv-cab > .tv-lectura { grid-column: 5; grid-row: 1; overflow: hidden; font-variant-numeric: tabular-nums; }
  .tv-cab > .tv-reloj { grid-column: 6; grid-row: 1; overflow: hidden; }
  .tv-cab > .tv-mandos { grid-column: 7; grid-row: 1; flex-wrap: nowrap; }
  .tv-cab > .tv-fila2 { grid-column: 1 / -1; grid-row: 2; display: flex; flex-wrap: nowrap; min-width: 0; height: 2.7em; overflow: hidden; }
  .tv-titulo b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 1.7em; }
  .tv-lectura b, .tv-lectura small, .tv-reloj small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tv-reloj small { display: block; }
  .tv-reloj b { font-size: 2.3em; }
  .tv-btn-modo { width: 14em; justify-content: center; overflow: hidden; }
  .tv-escenas { flex-wrap: nowrap; overflow: hidden; min-width: 0; }
  .tv-escenas button { padding: .35em .85em; }
  /* en automático, las pestañas de escena se ven (marcan la escena actual); los botones de navegar, solo al mover el ratón */
  .tv[data-modo="auto"] .tv-fila2 .tv-btn { opacity: 0; pointer-events: none; transition: opacity .4s; }
  .tv[data-modo="auto"].tv-movido .tv-fila2 .tv-btn { opacity: 1; pointer-events: auto; }
  /* abajo queda siempre una franja fija para los avisos (así no tapan la escena ni la mueven al salir) */
  .tv-escenario { grid-row: 2; overflow: hidden; margin: .8em 1.6em 4.1em; }
  /* cambio de escena: solo fundido, sin desplazar */
  .tv-escena, .tv-escena.tv-activa, .tv-escena.tv-sale { transform: none; }
  /* avisos: superpuestos en la franja de abajo, sin ocupar sitio en el flujo */
  .tv-alerta { position: absolute; left: 1.6em; right: 1.6em; bottom: .7em; z-index: 45; margin: 0; grid-row: auto; background: rgba(58, 22, 30, .94); backdrop-filter: blur(6px); box-shadow: 0 .6em 2em rgba(0, 0, 0, .45); }
  .tv-alerta[hidden] { display: none; }
  .tv-alerta { height: 2.7em; box-sizing: border-box; padding-top: 0; padding-bottom: 0; }
  .tv-toque, .tv-cuenta { bottom: .75em; z-index: 61; }
}
.tv .mvd-dia { background: #142434; }
.tv .mvd-hoy .mvd-dia { background: color-mix(in oklab, #FFB200 14%, #142434); }
