/* Telas de gestão (visão geral, linha, torre). Usa as variáveis e cartões de style.css.
   Situação da torre: cor de status + ícone + rótulo (nunca só cor). "ok" é recessivo (baixo e esmaecido)
   para os problemas saltarem aos olhos mesmo sem distinguir verde de amarelo. */
.trilha { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--text-secondary); flex-wrap: wrap; }
.trilha a { color: var(--accent); text-decoration: none; }
.trilha a:hover { text-decoration: underline; }
.trilha .sep { color: var(--text-muted); }
.tag-sim { background: var(--warning); color: #0b0b0b; font: 700 11.5px system-ui, sans-serif; padding: 3px 8px;
  border-radius: 5px; letter-spacing: .02em; }
.nota-rodape { color: var(--text-muted); font-size: 12px; padding: 0 20px 20px; }

.tiles.t5 { grid-template-columns: repeat(5, 1fr); }
.tiles.t6 { grid-template-columns: repeat(6, 1fr); }
.t-val .ic { font-size: 20px; margin-right: 6px; vertical-align: 3px; }
.ic-ok { color: var(--good); } .ic-atencao { color: var(--warning); }
.ic-alerta { color: var(--critical); } .ic-sem_dados { color: var(--text-muted); }

/* chip de situação */
.sit { display: inline-flex; gap: 5px; align-items: center; font-weight: 600; font-size: 12.5px; white-space: nowrap;
  padding: 1px 8px; border-radius: 999px; border: 1px solid var(--border); }
.sit-ok { color: var(--good-text); border-color: color-mix(in srgb, var(--good) 60%, transparent); }
.sit-atencao { color: var(--text-primary); background: color-mix(in srgb, var(--warning) 28%, transparent); border-color: var(--warning); }
.sit-alerta { color: #fff; background: var(--critical); border-color: var(--critical); }
.sit-sem_dados { color: var(--text-secondary); border-style: dashed; }
.sit-ok .i { color: var(--good); } .sit-atencao .i { color: #8a5d00; }
:root[data-theme="dark"] .sit-atencao .i { color: var(--warning); }

/* faixa de torres ao longo da linha */
.faixa { display: grid; gap: 2px; align-items: end; height: 26px; }
.faixa.grande { height: 46px; }
.faixa .c { display: flex; align-items: center; justify-content: center; border-radius: 2px; height: 100%;
  font-size: 10px; line-height: 1; cursor: pointer; color: #0b0b0b; text-decoration: none; min-width: 0; }
.faixa .c:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.faixa .c.ok { height: 38%; background: color-mix(in srgb, var(--good) 45%, transparent); }
.faixa .c.atencao { background: var(--warning); }
.faixa .c.alerta { background: var(--critical); color: #fff; }
.faixa .c.sem_dados { background: repeating-linear-gradient(135deg, var(--text-muted) 0 2px, transparent 2px 5px);
  border: 1px solid var(--text-muted); }
.faixa .c .g { display: none; }
.faixa.grande .c:not(.ok) .g { display: inline; }
.faixa .c:hover { filter: brightness(1.12); box-shadow: 0 0 0 2px var(--surface-1), 0 0 0 3px var(--text-secondary); }
.eixo-km { display: flex; justify-content: space-between; color: var(--text-muted); font-size: 11px; margin-top: 3px; }
.legenda-sit { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-secondary); margin-top: 6px; }
.legenda-sit .amostra { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: -2px; margin-right: 5px; }
.amostra.ok { background: color-mix(in srgb, var(--good) 45%, transparent); height: 5px; vertical-align: 0; }
.amostra.atencao { background: var(--warning); } .amostra.alerta { background: var(--critical); }
.amostra.sem_dados { background: repeating-linear-gradient(135deg, var(--text-muted) 0 2px, transparent 2px 5px); border: 1px solid var(--text-muted); }

/* barra empilhada de contagem por situação */
.barra { display: flex; gap: 2px; height: 10px; margin: 6px 0 2px; }
.barra span { border-radius: 2px; min-width: 3px; }
.barra .ok { background: color-mix(in srgb, var(--good) 55%, transparent); }
.barra .atencao { background: var(--warning); } .barra .alerta { background: var(--critical); }
.barra .sem_dados { background: repeating-linear-gradient(135deg, var(--text-muted) 0 2px, transparent 2px 5px); }
.contagem { display: flex; gap: 12px; font-size: 12.5px; color: var(--text-secondary); flex-wrap: wrap; }
.contagem b { color: var(--text-primary); }

/* linhas na visão geral */
.lista-linhas { display: flex; flex-direction: column; gap: 4px; }
.lin { display: grid; grid-template-columns: 290px 1fr; gap: 16px; padding: 10px 6px; border-bottom: 1px solid var(--grid); }
.lin:last-child { border-bottom: 0; }
.lin h3 { margin: 0; font-size: 14.5px; }
.lin h3 a { color: var(--text-primary); text-decoration: none; }
.lin h3 a:hover { color: var(--accent); text-decoration: underline; }
.lin .meta { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }
.lin .pior { font-size: 12.5px; color: var(--text-secondary); margin-top: 6px; }

/* listas de alertas / eventos */
.lista { list-style: none; margin: 4px 0 0; padding: 0; font-size: 13px; overflow-y: auto; }
.lista li { padding: 6px 2px; border-bottom: 1px solid var(--grid); display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; }
.lista li .sub { grid-column: 2; color: var(--text-muted); font-size: 12px; }
.lista a { color: var(--text-primary); font-weight: 600; text-decoration: none; }
.lista a:hover { color: var(--accent); text-decoration: underline; }
.lista .vazio { display: block; color: var(--text-muted); border: 0; }
.alto { max-height: 420px; } .medio { max-height: 260px; }

/* tabela de torres */
.tab-wrap { overflow-x: auto; }
table.torres { border-collapse: collapse; width: 100%; font-size: 13px; }
table.torres th { text-align: left; font-weight: 600; color: var(--text-secondary); padding: 6px 8px; border-bottom: 1px solid var(--border);
  white-space: nowrap; cursor: pointer; user-select: none; position: sticky; top: 0; background: var(--surface-1); }
table.torres th.num, table.torres td.num { text-align: right; }
table.torres th[aria-sort="ascending"]::after { content: " ▲"; font-size: 9px; }
table.torres th[aria-sort="descending"]::after { content: " ▼"; font-size: 9px; }
table.torres td { padding: 5px 8px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
table.torres td.motivo { white-space: normal; color: var(--text-secondary); min-width: 220px; }
table.torres tbody tr:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
table.torres a { color: var(--text-primary); font-weight: 600; text-decoration: none; }
table.torres a:hover { color: var(--accent); text-decoration: underline; }
.mudo { color: var(--text-muted); }
.ruim { color: var(--critical-text); font-weight: 600; }

/* info da torre */
.ficha { display: grid; grid-template-columns: auto 1fr; gap: 5px 14px; margin: 6px 0 0; font-size: 13.5px; }
.ficha dt { color: var(--text-secondary); } .ficha dd { margin: 0; font-weight: 600; }
.motivos { margin: 4px 0 0; padding-left: 18px; font-size: 13px; }
.motivos li { margin: 2px 0; }
.acoes { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.btn-link { display: inline-block; padding: 5px 12px; border: 1px solid var(--accent); border-radius: 6px; color: var(--accent);
  text-decoration: none; font-weight: 600; font-size: 13px; }
.btn-link:hover { background: var(--accent); color: #fff; }

/* tooltip das células */
#dica { position: fixed; z-index: 50; pointer-events: none; background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; max-width: 320px;
  box-shadow: 0 4px 14px rgba(0,0,0,.18); }
#dica .t { font-weight: 700; margin-bottom: 3px; }
#dica .m { color: var(--text-secondary); }

@media (max-width: 1200px) {
  .tiles.t5, .tiles.t6 { grid-template-columns: repeat(2, 1fr); }
  .lin { grid-template-columns: 1fr; }
}
