/* CONTROLE DE MÁQUINAS — Painel de TV (escuro, alto contraste, legível a distância). Tudo em vw/vh para qualquer TV. */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--txt);
  font-family: var(--fonte); font-feature-settings: "cv11", "ss01", "tnum"; -webkit-font-smoothing: antialiased; }

/* topo */
.tv-top { display: grid; grid-template-columns: auto 1fr auto auto auto; align-items: center; gap: 2vw; padding: 0 1.6vw;
  background: linear-gradient(180deg, var(--superficie-1), var(--fundo)); border-bottom: 0.25vh solid var(--verm); }
.tv-logo { height: 6vh; }
.tv-titulo { min-width: 0; }
.tv-titulo h1 { margin: 0; font-size: 1.75vw; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-sub { color: var(--sub); font-size: 0.95vw; }
.tv-kpis { display: flex; gap: 0.8vw; }
.kpi { min-width: 7.6vw; padding: 0.6vh 1vw; border-radius: 0.6vw; background: var(--painel); border: 1px solid var(--borda); text-align: center; }
.kpi span { display: block; font-size: 0.78vw; color: var(--sub); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.kpi b { display: block; font-size: 2.3vw; line-height: 1.05; font-variant-numeric: tabular-nums; }
.k-ok b { color: var(--ok); } .k-restr b { color: var(--kr, var(--ok75)); } .k-parada b { color: var(--perigo-texto); } .k-disp b { color: var(--azul); }
.tv-relogio { text-align: right; padding-left: 1.4vw; border-left: 1px solid var(--borda); }
.tv-relogio .hora { font-size: 2.9vw; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .03em; line-height: 1; }
.tv-relogio .data { font-size: 0.92vw; color: var(--sub); margin-top: 0.4vh; }

.planta { width: 100%; height: 100%; display: block; }

/* lateral */
.lat-cab { display: flex; align-items: center; justify-content: space-between; padding: 1.4vh 1.1vw; border-bottom: 1px solid var(--borda); }
.lat-cab h2 { margin: 0; font-size: 1.3vw; text-transform: uppercase; letter-spacing: .04em; }
.lat-cont { font-size: 1.5vw; font-weight: 700; color: var(--perigo-texto); }
.lat-lista { flex: 1; padding: 1vh 0.8vw; display: flex; flex-direction: column; gap: 1vh; overflow: hidden; }
.card-p { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 0.3vh 0.8vw; padding: 1.1vh 0.9vw 1.1vh 1.3vw;
  border-radius: 0.6vw; background: var(--painel2); border: 1px solid var(--borda); overflow: hidden; }
.card-p::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 0.45vw; background: var(--c); }
.card-p .nm { font-size: 1.12vw; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-p .cod { font-size: 0.78vw; color: var(--sub); font-weight: 700; }
.card-p .tm { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-size: 1.95vw; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--cl, var(--c)); }
.card-p .mot { grid-column: 1 / -1; display: flex; align-items: center; gap: 0.5vw; font-size: 0.98vw; font-weight: 700; }
.card-p .niv { padding: 0.15vh 0.5vw; border-radius: 99px; font-size: 0.72vw; font-weight: 700; background: var(--c); color: var(--t); white-space: nowrap; }
.card-p .det { grid-column: 1 / -1; display: flex; justify-content: space-between; color: var(--sub); font-size: 0.8vw; }
.lat-vazio { margin: auto; text-align: center; color: var(--ok); font-size: 1.4vw; font-weight: 600; }
.lat-vazio small { display: block; color: var(--sub); font-weight: 600; font-size: 0.9vw; margin-top: 0.6vh; }

/* indicadores */
.widgets { height: 100%; display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; gap: 1vw; }
.wg { background: var(--painel2); border: 1px solid var(--borda); border-radius: 0.7vw; padding: 1.4vh 1vw; display: flex; flex-direction: column; min-height: 0; }
.wg h3 { margin: 0 0 1vh; font-size: 1.05vw; text-transform: uppercase; letter-spacing: .05em; color: var(--sub); }
.wg .wc { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.wg .wc svg { width: 100%; height: 100%; }
.wg.dest .wc { flex-direction: column; }
.wg.dest .big { font-size: 7vw; font-weight: 700; color: var(--ok); line-height: 1; }
.wg.dest .lbl { font-size: 1.3vw; color: var(--sub); font-weight: 700; margin-top: 1vh; text-align: center; }
.grafico { overflow: visible; }
.g-rot { fill: var(--texto-2); font-size: 15.5px; font-weight: 600; }
.g-val { fill: var(--branco); font-size: 15px; font-weight: 600; }
.r-num { fill: var(--branco); font-size: 34px; font-weight: 700; }
.r-lab { fill: var(--texto-3); font-size: 14px; font-weight: 700; }
.vazio { color: var(--sub); font-size: 1vw; }
.leg-r { display: flex; flex-wrap: wrap; gap: 0.5vh 1vw; justify-content: center; font-size: 0.85vw; color: var(--sub); margin-top: 0.8vh; }
.leg-r i { display: inline-block; width: 0.8vw; height: 0.8vw; border-radius: 3px; margin-right: 0.3vw; vertical-align: -0.1vw; }

/* rodapé */
.tv-rodape { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1.2vw; padding: 0 1vw; background: var(--fundo); border-top: 1px solid var(--borda); }
.legenda { display: flex; gap: 1vw; font-size: 0.9vw; font-weight: 700; white-space: nowrap; }
.legenda span { display: inline-flex; align-items: center; gap: 0.35vw; }
.legenda i { width: 1.2vw; height: 1.2vw; border-radius: 0.25vw; display: inline-block; }
.ticker { overflow: hidden; white-space: nowrap; mask-image: linear-gradient(90deg, transparent, var(--preto) 4%, var(--preto) 96%, transparent); }
.ticker-in { display: inline-block; padding-left: 100%; font-size: 1.15vw; font-weight: 700; color: var(--aviso-texto); animation: rolar 45s linear infinite; }
.ticker-in span { margin-right: 6vw; }
@keyframes rolar { to { transform: translateX(-100%); } }
.conexao { display: flex; align-items: center; gap: 0.4vw; font-size: 0.8vw; color: var(--sub); }
.conexao i { width: 0.7vw; height: 0.7vw; border-radius: 50%; background: var(--ok); }
.conexao.off i { background: var(--parada); } .conexao.off span { color: var(--perigo-texto); }

/* aviso de tela cheia */
.tv-fs { position: fixed; inset: 0; display: none; align-items: flex-end; justify-content: center; padding-bottom: 7vh; pointer-events: none; }
.tv-fs.vis { display: flex; }
.fs-box { display: flex; align-items: center; gap: 1vw; padding: 1vh 1.4vw; background: var(--vidro-topo); border: 1px solid var(--azul); border-radius: 0.8vw; font-size: 1vw; }
.fs-box img { height: 3vh; }
.tv-fs.oculto-fs { display: none !important; }
.wg.col .wc { flex-direction: column; }
.wg.col .wc svg { height: auto; max-height: 74%; width: auto; }

/* v1.1 — layouts configuráveis */
.tv-rodape { grid-template-columns: auto auto 1fr auto; }
.credito { font-size: 0.78vw; color: var(--texto-3); white-space: nowrap; padding-left: 1vw; border-left: 1px solid var(--borda); }
.credito b { color: var(--texto-2); font-weight: 700; }
.widgets { grid-template-columns: repeat(var(--gc, 3), 1fr); grid-template-rows: repeat(var(--gr, 2), 1fr); grid-auto-rows: 0; }
body.layout-dividido .wg h3 { font-size: 0.95vw; margin-bottom: 0.6vh; }
.wg .wc > svg.grafico { max-height: 100%; }
.resumo { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 1vh 1vw; }
.resumo div { background: var(--superficie-2); border: 1px solid var(--borda); border-radius: 0.5vw; padding: 0.8vh 0.7vw; }
.resumo span { display: block; font-size: 0.72vw; color: var(--sub); text-transform: uppercase; font-weight: 700; letter-spacing: .04em; }
.resumo b { font-size: 1.9vw; font-variant-numeric: tabular-nums; }
.card-p .nc { font-size: 0.68vw; color: var(--cor-cinza); border: 1px solid var(--borda); border-radius: 99px; padding: 0 0.4vw; margin-left: 0.3vw; }

/* quadros sempre contidos no espaço */
.wg { overflow: hidden; }
.wg .wc { overflow: hidden; }
.wg .wc > svg.grafico { width: 100%; height: 100%; }
.wg.col .wc { flex-direction: row; gap: 1vw; }
.wg.col .wc svg { height: 100%; max-height: 100%; width: auto; max-width: 55%; flex: 0 0 auto; }
.wg.col .leg-r { flex-direction: column; align-items: flex-start; justify-content: center; margin: 0; font-size: 0.85vw; flex-wrap: nowrap; }
.resumo { height: 100%; grid-template-columns: repeat(2, 1fr); grid-auto-rows: 1fr; }
.resumo div { display: flex; flex-direction: column; justify-content: center; min-height: 0; }
.resumo b { font-size: 1.6vw; white-space: nowrap; }
body.layout-dividido .resumo span { font-size: 0.66vw; }
.tv-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.resumo b { font-size: 1.35vw; }
.wg.col .leg-r { display: grid; grid-template-columns: 1fr; gap: 0.2vh 0.8vw; font-size: 0.78vw; }
body.layout-dividido .wg.col .leg-r { grid-template-columns: 1fr 1fr; }

/* v2 — visual moderno (Inter), tela cheia, categorias */
.tv-titulo h1 { text-transform: none; letter-spacing: -.01em; font-weight: 650; }
.kpi span { font-weight: 500; letter-spacing: .04em; }
.kpi b { font-weight: 650; }
.lat-cab h2 { text-transform: none; letter-spacing: -.005em; font-weight: 650; }
.wg h3 { text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--texto-2); }
.card-p .nm { font-weight: 650; } .card-p .tm { font-weight: 700; }
.card-p .mot { font-weight: 500; flex-wrap: nowrap; min-width: 0; }
.card-p .mot .mt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.card-p .niv { font-weight: 650; }
.card-p .cat { padding: 0.15vh 0.5vw; border-radius: 99px; font-size: 0.72vw; font-weight: 600; white-space: nowrap; }
.g-rot { font-weight: 500; } .r-lab { font-weight: 500; }
.legenda { font-weight: 500; }
.ticker-in { font-weight: 500; }
.btn-fs { align-self: center; width: 3.2vw; height: 3.2vw; min-width: 34px; min-height: 34px; border-radius: 0.6vw; border: 1px solid var(--borda); background: var(--painel); color: var(--txt); font-size: 1.5vw; cursor: pointer; line-height: 1; }
.btn-fs:hover, .btn-fs:focus { border-color: var(--azul); outline: none; }
body.sem-cursor, body.sem-cursor * { cursor: none !important; }
.tv-fs { pointer-events: none; }

/* v2 — legenda da rosca compacta: cor · rótulo curto · número */
.wg.col .leg-r, body.layout-dividido .wg.col .leg-r { display: grid; grid-template-columns: auto; gap: 0.5vh; font-size: 0.95vw; }
.wg.col .leg-r span { display: grid; grid-template-columns: 0.9vw 3.4vw 2.2vw; align-items: center; gap: 0.5vw; white-space: nowrap; }
.wg.col .leg-r i { margin: 0; width: 0.9vw; height: 0.9vw; }
.wg.col .leg-r em { font-style: normal; color: var(--sub); font-weight: 600; }
.wg.col .leg-r b { color: var(--txt); text-align: right; font-variant-numeric: tabular-nums; }
.wg.col.cat .leg-r span { grid-template-columns: 0.9vw minmax(0, 9vw) auto; }
.wg.col.cat .leg-r em { overflow: hidden; text-overflow: ellipsis; }
.wg.col .wc { gap: 1.2vw; justify-content: center; }
.wg.col .wc svg { max-width: 46%; }
/* v2 — legenda ocupa o espaço que sobra ao lado da rosca */
.wg.col .wc svg { max-width: 44%; flex: 0 0 auto; }
.wg.col .leg-r, body.layout-dividido .wg.col .leg-r { flex: 1 1 auto; min-width: 0; }
.wg.col .leg-r span, .wg.col.cat .leg-r span { grid-template-columns: 0.9vw minmax(0, 1fr) auto; }
.wg.col.cat .wc { justify-content: flex-start; }
.wg.col.cat .wc svg { max-width: 36%; }
.wg.col.cat .leg-r { font-size: 0.85vw; }
.wg.col.cat .leg-r em { overflow: visible; text-overflow: clip; }
.wg.col .leg-r span, .wg.col.cat .leg-r span { grid-template-columns: 0.9vw max-content max-content; }
.wg.col.cat .leg-r { font-size: 0.8vw; }
.wg.col .leg-r, body.layout-dividido .wg.col .leg-r { display: grid; grid-template-columns: 0.9vw auto auto; column-gap: 0.5vw; row-gap: 0.6vh; align-items: center; flex: 0 1 auto; }
.wg.col .leg-r span, .wg.col.cat .leg-r span { display: contents; }
.wg.col.cat .wc svg { max-width: 30%; }
.wg.col.cat .leg-r { font-size: 0.75vw; }
body .wg.col.cat .leg-r { font-size: 0.72vw; column-gap: 0.4vw; }
body .wg.col.cat .wc { gap: 0.8vw; }

/* rodapé: legenda + desenvolvedor empilhados à esquerda (compactos) → os avisos ganham a largura toda */
.tv-rodape { grid-template-columns: auto 1fr auto; gap: 1.2vw; }
.rod-esq { display: flex; flex-direction: column; justify-content: center; gap: 0.25vh; padding-right: 1.2vw; border-right: 1px solid var(--borda); }
.rod-esq .legenda { font-size: 0.72vw; gap: 0.8vw; font-weight: 500; color: var(--sub); }
.rod-esq .legenda i { width: 0.8vw; height: 0.8vw; border-radius: 0.18vw; }
.rod-esq .credito { font-size: 0.62vw; padding: 0; border: 0; color: var(--texto-3); }
.rod-esq .credito b { font-weight: 600; }
.ticker-in { font-size: 1.25vw; }

/* P05A — ícone de forma na legenda e na lista; barra do modo ajuste */
.rod-esq .legenda i { width: 1.05vw; height: 1.05vw; display: inline-flex; align-items: center; justify-content: center; }
.rod-esq .legenda i .forma { width: 76%; height: 76%; }
.card-p .niv { display: inline-flex; align-items: center; gap: 0.25vw; }
body.ajustar #pilha { cursor: grab; touch-action: none; user-select: none; }
body.ajustar #pilha:active { cursor: grabbing; }
.ajuste { position: fixed; right: 0; bottom: 0; height: 5.2vh; min-height: 34px; display: flex; align-items: center; gap: 0.7vw; padding: 0 1vw; background: var(--superficie-1); border-top: 2px solid var(--azul); border-left: 1px solid var(--borda); z-index: 3; font-size: max(12px, 0.85vw); white-space: nowrap; }
.ajuste[hidden], .aj-aviso[hidden] { display: none; }
.ajuste button { font: inherit; font-weight: 600; color: var(--txt); background: var(--painel2); border: 1px solid var(--borda); border-radius: 0.4vw; padding: 0.7vh 0.9vw; cursor: pointer; }
.ajuste button.pri { background: var(--primaria); border-color: var(--azul); }
.ajuste button:disabled { opacity: .7; }
.ajuste a, .aj-aviso a { color: var(--azul); }
.aj-aviso { position: fixed; left: 50%; bottom: 7vh; transform: translateX(-50%); z-index: 4; background: var(--sucesso-fundo); border: 1px solid var(--ok); border-radius: 0.5vw; padding: 1.2vh 1.4vw; font-size: max(14px, 1vw); font-weight: 600; }
.aj-aviso.erro { background: var(--perigo-fundo); border-color: var(--perigo-texto); }

/* ================================================================ P05B — roteiro de telas e áreas configuráveis */
body.tv { display: grid; grid-template-rows: 9.6vh minmax(0, 1fr) var(--hrod, 5.2vh); }
.tv-corpo { display: grid; gap: 1vw; padding: 1.2vh 1vw; min-height: 0; min-width: 0; grid-template: "principal lateral" minmax(0, 1fr) / minmax(0, 1fr) var(--pw, 26vw); }
.tv-corpo[data-pos=esquerda] { grid-template: "lateral principal" minmax(0, 1fr) / var(--pw, 26vw) minmax(0, 1fr); }
.tv-corpo[data-pos=inferior] { grid-template: "principal" minmax(0, var(--fp, 70fr)) "lateral" minmax(0, var(--fl, 30fr)) / minmax(0, 1fr); }
.tv-corpo[data-pos=oculto] { grid-template: "principal" minmax(0, 1fr) / minmax(0, 1fr); }
.tv-corpo[data-pos=oculto] .tv-lateral { display: none; }

.tv-principal { grid-area: principal; display: flex; flex-direction: column; background: var(--painel); border: 1px solid var(--borda); border-radius: 0.8vw; overflow: hidden; min-height: 0; min-width: 0; }
.tv-conteudo { position: relative; flex: var(--fc, 1) 1 0; min-height: 0; }
.tv-conteudo.vazio-area, .area-indicadores[hidden], .area-avisos[hidden] { display: none; }
.tela { position: absolute; inset: 0; visibility: hidden; padding: 0.8vh 0.7vw; }
.tela.ativa { visibility: visible; }
.area-indicadores { flex: var(--fi, 0) 1 0; min-height: 0; padding: 0.4vh 0.7vw 0.8vh; }
.entra { animation: entra .4s ease; }
@keyframes entra { from { opacity: 0; } to { opacity: 1; } }
body.leve .entra { animation: none; }

/* rodízio: nome da tela atual, próxima e barra de progresso */
.rodizio { flex: none; }
.rod-nomes { display: flex; align-items: center; justify-content: space-between; gap: 1vw; padding: 0.5vh 0.9vw; font-size: max(12px, 0.95vw); border-top: 1px solid var(--borda); white-space: nowrap; }
.rodizio.simples .rod-nomes { display: none; }
.rod-atual { font-weight: 700; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.rod-prox { color: var(--sub); overflow: hidden; text-overflow: ellipsis; min-width: 0; margin-left: auto; }
.rod-pausa { color: var(--aviso-texto); font-weight: 600; }
.rod-pausa[hidden] { display: none; }
.tela-progresso { height: 0.45vh; background: var(--superficie-2); }
.tela-progresso i { display: block; height: 100%; width: 0; background: var(--azul); }

/* setores em blocos (1 a 4) */
.grade-setores { display: grid; width: 100%; height: 100%; gap: 0.7vw; grid-template: minmax(0, 1fr) / minmax(0, 1fr); }
.grade-setores.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grade-setores.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grade-setores.n4 { grid-template: repeat(2, minmax(0, 1fr)) / repeat(2, minmax(0, 1fr)); }
.bloco { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--painel2); border: 1px solid var(--borda); border-radius: 0.6vw; overflow: hidden; }
.bloco[hidden] { display: none; }
.bloco h3 { display: flex; justify-content: space-between; align-items: baseline; gap: 1vw; margin: 0; padding: 0.6vh 0.8vw; font-size: 1.25vw; font-weight: 650; border-bottom: 1px solid var(--borda); white-space: nowrap; }
.bloco h3 span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.bloco h3 small { font-size: 0.95vw; font-weight: 600; color: var(--ok); }
.bloco h3 small.tem { color: var(--perigo-texto); }
.bloco-area { position: relative; flex: 1; min-height: 0; }
.bloco-area .planta-pilha { position: absolute; inset: 0; }
.bloco-vazio { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 1vw; color: var(--sub); font-size: 1.1vw; }
.bloco-vazio[hidden] { display: none; }

/* quadro de chamados por status */
.quadro { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0.7vw; height: 100%; }
.coluna { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--painel2); border: 1px solid var(--borda); border-top: 0.55vh solid var(--c); border-radius: 0.6vw; overflow: hidden; }
.coluna h3 { display: flex; justify-content: space-between; gap: 0.5vw; margin: 0; padding: 0.8vh 0.6vw; font-size: 1.05vw; font-weight: 700; border-bottom: 1px solid var(--borda); }
.coluna h3 span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.col-lista { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 0.8vh; padding: 0.8vh 0.4vw; }
.chm { flex: none; background: var(--painel); border: 1px solid var(--borda); border-left: 0.35vw solid var(--c); border-radius: 0.4vw; padding: 0.7vh 0.5vw; font-size: 0.9vw; line-height: 1.3; }
.chm b, .chm span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chm b { font-size: 1.05vw; font-weight: 650; }
.chm span { color: var(--sub); }
.chm .chm-t { color: var(--txt); font-size: 1.35vw; font-weight: 700; font-variant-numeric: tabular-nums; }
.col-mais { flex: none; text-align: center; padding: 0.4vh; color: var(--sub); font-size: 0.9vw; font-weight: 600; }
.quadro-vazio { grid-column: 1 / -1; margin: auto; color: var(--ok); font-size: 2vw; font-weight: 650; }

/* tela de mensagem */
.msg-tela { height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 3vh; padding: 2vh 4vw; overflow: hidden; }
.msg-tela h2 { margin: 0; font-size: 4vw; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.msg-tela p { margin: 0; font-size: 2.2vw; color: var(--texto-2); white-space: pre-line; line-height: 1.4; overflow-wrap: anywhere; }

/* painel de paradas e intermitentes: posição, tamanho dos cards, colunas e campos */
.tv-lateral { grid-area: lateral; display: flex; flex-direction: column; background: var(--painel); border: 1px solid var(--borda); border-radius: 0.8vw; min-height: 0; min-width: 0; overflow: hidden; }
.lat-cab { gap: 0.8vw; justify-content: flex-start; flex: none; white-space: nowrap; }
.lat-cab h2 { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.lat-filtro { color: var(--azul); font-size: 0.85vw; font-weight: 600; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.lat-pag { color: var(--sub); font-size: 0.8vw; margin-left: auto; }
.tv-corpo[data-pos=inferior] .lat-cab { padding: 0.6vh 1vw; }
/* painel lateral estreito: o título nunca é cortado; filtro e página descem para a linha de baixo */
.lat-cab span:empty { display: none; }
.tv-corpo[data-pos=direita] .lat-cab, .tv-corpo[data-pos=esquerda] .lat-cab { flex-wrap: wrap; row-gap: 0.4vh; }
.tv-corpo[data-pos=direita] .lat-cab h2, .tv-corpo[data-pos=esquerda] .lat-cab h2 { flex: 1 1 0; white-space: normal; line-height: 1.2; }
.tv-corpo[data-pos=direita] .lat-cont, .tv-corpo[data-pos=esquerda] .lat-cont { order: 1; }
.tv-corpo[data-pos=direita] .lat-filtro, .tv-corpo[data-pos=esquerda] .lat-filtro { order: 2; flex: 1 1 100%; }
.tv-corpo[data-pos=direita] .lat-pag, .tv-corpo[data-pos=esquerda] .lat-pag { order: 3; flex: 1 1 100%; margin: 0; text-align: right; }
.lat-lista { --cf: 1; flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr)); grid-auto-rows: max-content; align-content: start; gap: 1vh 0.7vw; padding: 1vh 0.8vw; overflow: hidden; }
.lat-lista.sem { grid-auto-rows: minmax(0, 1fr); align-content: stretch; }
.lat-lista .lat-vazio { grid-column: 1 / -1; align-self: center; justify-self: center; margin: 0; }
.card-p { min-width: 0; align-content: start; grid-template-columns: minmax(0, 1fr) auto; gap: calc(0.3vh * var(--cf)) calc(0.8vw * var(--cf)); padding: calc(1.1vh * var(--cf)) calc(0.9vw * var(--cf)) calc(1.1vh * var(--cf)) calc(1.3vw * var(--cf)); line-height: 1.25; }
.card-p .nm { grid-column: 1; font-size: calc(1.12vw * var(--cf)); }
.card-p .cod { grid-column: 1 / -1; font-size: calc(0.78vw * var(--cf)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-p .tm { grid-row: 1; font-size: calc(1.95vw * var(--cf)); }
/* motivo longo: ganha a própria linha em vez de ser cortado */
.lat-lista.quebra .card-p .mot { flex-wrap: wrap; }
.lat-lista.quebra .card-p .mot .mt { flex: 1 0 100%; }
.card-p.sem-maq .tm { grid-row: auto; grid-column: 1 / -1; }
.card-p .mot { font-size: calc(0.98vw * var(--cf)); }
.card-p .niv, .card-p .cat { font-size: calc(0.72vw * var(--cf)); }
.card-p .nc { font-size: calc(0.68vw * var(--cf)); }
.card-p .det { font-size: calc(0.8vw * var(--cf)); gap: 0.5vw; white-space: nowrap; min-width: 0; }
.card-p .det span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* faixa de chamado novo */
.faixa-alerta { position: fixed; left: 0; right: 0; top: 9.6vh; z-index: 5; display: flex; align-items: center; justify-content: center; gap: 1.4vw; height: 7vh; padding: 0 2vw; background: var(--perigo); border-bottom: 0.4vh solid var(--perigo-texto); font-size: 2.1vw; font-weight: 650; white-space: nowrap; animation: entra .4s ease; }
.faixa-alerta[hidden] { display: none; }
.faixa-alerta b { font-weight: 800; }
.faixa-alerta span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.faixa-alerta em { font-style: normal; font-size: 1.4vw; opacity: .9; }

/* legenda no rodapé: a altura (%) vem da tela do roteiro; os símbolos acompanham */
.rod-esq .legenda { font-size: calc(0.72vw * var(--le, 1)); }
.rod-esq .legenda i { width: calc(1.05vw * var(--le, 1)); height: calc(1.05vw * var(--le, 1)); }
.rod-esq .legenda[hidden] { display: none; }
.ajuste { height: var(--hrod, 5.2vh); }

/* ================================================================ P05D — avisos, indicadores em cima, cards com tamanho à mão, prévia */
.principal-linha { flex: 1 1 0; display: flex; min-height: 0; min-width: 0; }
.principal-linha.avisos-esq { flex-direction: row-reverse; }
.principal-col { flex: var(--fcol, 100) 1 0; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.principal-col.ind-cima .area-indicadores { order: -1; padding: 0.8vh 0.7vw 0.4vh; }
.area-avisos { flex: var(--fa, 0) 1 0; min-width: 0; display: flex; flex-direction: column; padding: 0.8vh 0.7vw; border-left: 1px solid var(--borda); overflow: hidden; }
.principal-linha.avisos-esq .area-avisos { border-left: 0; border-right: 1px solid var(--borda); }
.area-avisos h3 { margin: 0 0 1vh; font-size: 1.25vw; font-weight: 700; color: var(--aviso-texto); }
.area-avisos ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 1vh; overflow: hidden; }
.area-avisos li { font-size: 1.05vw; line-height: 1.35; padding: 0.8vh 0.7vw; background: var(--painel2); border-left: 0.3vw solid var(--aviso-texto); border-radius: 0.4vw; }
.area-avisos li.vazio { color: var(--sub); border-left-color: var(--borda); }
.bloco h3 { border-left: 0.45vw solid var(--sc, var(--borda)); }
.bloco-vazio { flex-direction: column; gap: 1vh; }
.bloco-vazio b { color: var(--aviso-texto); font-size: 1.3vw; }
.bloco-vazio span { font-size: 0.95vw; }
/* cards: --u = 1 px de uma TV 1920×1080; --ft/--fn/--fd = fontes do tempo, do nome e dos detalhes; --ch = altura fixa (0 = automática) */
.lat-lista { --u: calc(100vh / 1080); grid-template-columns: repeat(var(--cols, 1), var(--colw, minmax(0, 1fr))); }
.card-p { padding: calc(var(--u) * 9 * var(--cf)) calc(var(--u) * 12 * var(--cf)) calc(var(--u) * 9 * var(--cf)) calc(var(--u) * 20 * var(--cf)); gap: calc(var(--u) * 3 * var(--cf)) calc(var(--u) * 12 * var(--cf)); }
.card-p .nm { grid-column: 1; grid-row: 1; font-size: calc(var(--u) * var(--fn, 19) * var(--cf)); }
.card-p .tm { grid-column: 2; grid-row: 1; align-self: center; font-size: calc(var(--u) * var(--ft, 30) * var(--cf)); }
.card-p .cod { grid-column: 1 / -1; font-size: calc(var(--u) * var(--fd, 14) * var(--cf)); }
.card-p .mot { font-size: calc(var(--u) * var(--fd, 14) * 1.12 * var(--cf)); }
.card-p .niv, .card-p .cat { font-size: calc(var(--u) * var(--fd, 14) * 0.92 * var(--cf)); }
.card-p .nc { font-size: calc(var(--u) * var(--fd, 14) * 0.85 * var(--cf)); }
.card-p .det { font-size: calc(var(--u) * var(--fd, 14) * var(--cf)); }
.lat-lista.alt-fixa .card-p { height: calc(var(--u) * var(--ch)); overflow: hidden; }
/* prévia dentro dos Cadastros */
body.previa .tv-fs, body.previa .btn-fs { display: none !important; }

/* ================================================================ P05E — blocos livres em % (prancheta) e auto-ajuste
   A área dos blocos fica entre o cabeçalho e a faixa do rodízio, sempre do mesmo tamanho (na TV e na prancheta). */
body.tv { grid-template-rows: 9.6vh minmax(0, 1fr) 3.2vh var(--hrod, 5.2vh); }
.tv-area { position: relative; min-height: 0; min-width: 0; margin: 0; }
.blk { position: absolute; padding: 0.45vh; min-width: 0; min-height: 0; line-height: 1.25; }
.blk[hidden] { display: none; }
.blk-in { position: relative; width: 100%; height: 100%; overflow: hidden; background: var(--painel); border: 1px solid var(--borda); border-radius: 0.8vh; }
.caber { width: 100%; height: 100%; overflow: hidden; }
[data-t] { overflow: hidden; overflow-wrap: anywhere; min-width: 0; }
.sem-sec [data-sec] { display: none !important; }
[data-item][hidden] { display: none !important; }
.mais-n { color: var(--sub); font-weight: 600; font-size: 1em; text-align: center; }

.rodizio { height: 3.2vh; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; }
.rod-nomes { border-top: 0; padding: 0 1vw; font-size: max(11px, 1.5vh); flex: 1; min-height: 0; }

.blk-planta .planta-pilha { position: absolute; inset: 0.5vh; width: auto; height: auto; }

/* setor */
.bloco { display: block; background: none; border: 0; border-radius: 0; overflow: visible; }
.bloco .blk-in { display: flex; flex-direction: column; background: var(--painel2); }
.bloco h3 { flex-wrap: wrap; row-gap: 0; font-size: 1.7vh; padding: 0.3em 0.6em; line-height: 1.2; border-left: 0.45em solid var(--sc, var(--borda)); white-space: normal; }
.bloco h3 span { overflow: visible; text-overflow: clip; }
.bloco h3 small { font-size: 1em; }
.bloco-vazio { padding: 0.6em; font-size: inherit; }
.bloco-vazio .caber { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 0.5em; }
.bloco-vazio b, .bloco-vazio span { font-size: 1em; }

/* paradas e intermitentes */
.tv-lateral { grid-area: auto; display: block; background: none; border: 0; border-radius: 0; overflow: visible; }
.tv-lateral > .blk-in { display: flex; flex-direction: column; }
.tv-lateral .lat-cab { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.1em 0.7em; padding: 0.3em 0.7em; line-height: 1.2; white-space: normal; }
.tv-lateral .lat-cab h2 { font-size: 1em; overflow: visible; text-overflow: clip; white-space: normal; }
.tv-lateral .lat-cont { font-size: 1.1em; }
.tv-lateral .lat-filtro, .tv-lateral .lat-pag { font-size: 1em; font-weight: 500; }
.tv-lateral .lat-pag { margin-left: auto; }
.tv-lateral.baixo .lat-cab { padding-top: 0.1em; padding-bottom: 0.1em; }
.tv-lateral.baixo .lat-filtro { display: none; }
.lat-lista { padding: 0.6vh; gap: 0.7vh; }
.lat-lista.sem { grid-auto-rows: minmax(0, 1fr); }
.lat-vazio { margin: 0; display: flex; flex-direction: column; justify-content: center; font-size: 1.7vh; }
.lat-vazio b { font-weight: 600; }
.lat-vazio small { font-size: 1em; }
.card-p { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-content: start; align-items: center; gap: 0.15em 0.6em;
  padding: 0.4vh 0.8vh 0.4vh 1.5vh; font-size: var(--fd); line-height: 1.2; }
.card-p .nm { grid-column: 1; grid-row: 1; font-size: var(--fn); white-space: normal; text-overflow: clip; }
/* o tempo reserva o lugar do formato mais longo ("99d 23h 59m"): trocar o texto não mexe no resto */
.card-p .tm { grid-column: 2; grid-row: 1; font-size: var(--ft); min-width: 7ch; text-align: right; white-space: nowrap; line-height: 1.2; }
.card-p .cod { grid-column: 1 / -1; font-size: var(--fd); white-space: normal; }
.card-p .mot { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 0.15em 0.5em; font-size: var(--fd); }
.card-p .mot .mt { flex: 1 1 8em; white-space: normal; text-overflow: clip; }
.card-p .niv, .card-p .cat { font-size: var(--fd); line-height: 1.15; white-space: nowrap; }
.card-p .nc { font-size: var(--fd); }
.card-p .det { grid-column: 1 / -1; font-size: var(--fd); white-space: normal; flex-wrap: wrap; gap: 0 0.6em; }
.card-p .det span { text-overflow: clip; }
.card-p.f-linha { display: flex; gap: 0.6em; }
.card-p.f-linha .cod, .card-p.f-linha .nm { flex: 1 1 auto; font-size: var(--fn); font-weight: 650; color: var(--txt); }
.card-p.f-linha .niv { flex: 0 1 auto; }
.card-p.f-linha .tm { flex: 0 0 auto; margin-left: auto; }
.lat-lista.alt-fixa .card-p { height: var(--ch); overflow: hidden; }

/* indicadores */
.area-indicadores { flex: none; }
.area-indicadores > .blk-in { background: none; border: 0; border-radius: 0; }
.widgets { display: grid; gap: 0.7vh; grid-auto-rows: 0; }
.wg { display: flex; flex-direction: column; gap: 0.3em; padding: 0.4em 0.6em; min-width: 0; min-height: 0; overflow: hidden; border-radius: 0.8vh; }
.wg h3, body.layout-dividido .wg h3 { flex: none; margin: 0; font-size: 1em; line-height: 1.2; }
.wg .wc { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; justify-content: center; align-items: stretch; overflow: hidden; }
.wg .vazio { font-size: 1em; text-align: center; }
.widgets > .vazio { align-self: center; justify-self: center; font-size: 1.7vh; }
.barras { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) auto; gap: 0.2em 0.5em; align-items: center; }
.barras .br { display: contents; }
.barras .br[hidden] > * { display: none; }
.barras .br span { font-weight: 500; color: var(--texto-2); line-height: 1.15; }
.barras .br i { display: block; height: 0.75em; }
.barras .br i b { display: block; height: 100%; border-radius: 0.2em; }
.barras .br em { font-style: normal; font-weight: 600; white-space: nowrap; text-align: right; }
.barras + .mais-n { grid-column: 1 / -1; }
.wg.col .wc { flex-direction: row; align-items: center; justify-content: center; gap: 0.8em; }
.wg.col .wc svg.rosca { flex: 0 1 38%; max-width: 38%; height: 100%; max-height: 100%; min-height: 0; width: auto; }
.wg.col .leg-r, body.layout-dividido .wg.col .leg-r, body .wg.col .leg-r { display: grid; grid-template-columns: 0.7em minmax(0, 1fr) auto; gap: 0.15em 0.4em; font-size: 1em; flex: 1 1 auto; min-width: 0; margin: 0; align-content: center; align-items: center; }
.wg.col .leg-r span { display: contents; }
.wg.col .leg-r span[hidden] > * { display: none; }
.wg.col .leg-r i { width: 0.7em; height: 0.7em; margin: 0; }
.wg.col .leg-r em { font-style: normal; color: var(--sub); font-weight: 600; line-height: 1.15; overflow: hidden; text-overflow: clip; }
.wg.col .leg-r b { white-space: nowrap; text-align: right; }
.wg.col.sem-sec .wc svg.rosca { display: none; }
.colunas { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0.25em; height: 100%; min-height: 0; }
.colunas > div { display: flex; flex-direction: column; align-items: center; min-width: 0; min-height: 0; }
.colunas em { font-style: normal; font-weight: 600; white-space: nowrap; max-width: 100%; }
.colunas i { flex: 1 1 0; min-height: 0.4em; width: 62%; display: flex; flex-direction: column; justify-content: flex-end; }
.colunas i b { display: block; background: var(--azul); border-radius: 0.2em 0.2em 0 0; }
.colunas span { font-weight: 500; color: var(--texto-2); white-space: nowrap; max-width: 100%; }
.resumo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(0, auto); gap: 0.3em; height: auto; width: 100%; }
.resumo div { padding: 0.15em 0.4em; }
.resumo span, body.layout-dividido .resumo span { font-size: 1em; text-transform: none; letter-spacing: 0; line-height: 1.15; }
.resumo b { font-size: 1.35em; white-space: nowrap; line-height: 1.2; }
.wg.dest .wc { align-items: center; text-align: center; }
.wg.dest .big { font-size: 2em; font-weight: 700; color: var(--ok); line-height: 1.2; max-width: 100%; white-space: nowrap; }
.wg.dest .lbl { font-size: 1em; margin: 0; max-width: 100%; }

/* avisos, legenda, quadro e mensagem */
.area-avisos { border: 0; flex: none; }
.area-avisos .caber { display: flex; flex-direction: column; gap: 0.5em; padding: 0.5em 0.6em; }
.area-avisos h3 { margin: 0; font-size: 1.1em; }
.area-avisos ul { gap: 0.4em; overflow: visible; }
.area-avisos li { font-size: 1em; padding: 0.35em 0.5em; line-height: 1.25; }
.legenda-bloco { display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 0.4em 1.2em; padding: 0.3em; font-weight: 600; }
.legenda-bloco span { display: inline-flex; align-items: center; gap: 0.35em; white-space: nowrap; }
.legenda-bloco i { width: 1.2em; height: 1.2em; border-radius: 0.25em; display: inline-flex; align-items: center; justify-content: center; }
.legenda-bloco i .forma { width: 76%; height: 76%; }
.quadro { padding: 0.5vh; font-size: 1.7vh; }
.coluna h3 { font-size: 1.05em; }
.coluna h3 span { white-space: normal; text-overflow: clip; }
.chm { font-size: 1em; }
.chm b, .chm span { white-space: normal; text-overflow: clip; }
.chm b { font-size: 1.08em; }
.chm .chm-t { font-size: 1.3em; white-space: nowrap; }
.col-mais { font-size: 1em; }
.quadro-vazio { font-size: 1.6em; }
.msg-tela { gap: 0.8em; padding: 0.5em 1em; }
.msg-tela h2 { font-size: 2em; max-width: 100%; }
.msg-tela p { font-size: 1.2em; max-width: 100%; }

/* nem no tamanho mínimo coube: fica só o título (o aviso aparece na prancheta) */
.nao-coube .wc { visibility: hidden; }
.nao-coube [data-item] { visibility: hidden; }
/* só na prancheta: quadro no tamanho mínimo */
body.previa .wg.no-minimo, body.previa .wg.nao-coube { outline: 0.4vh solid var(--cor-peca); outline-offset: -0.4vh; }
