/* Aba Comparativo (Horus × ISPGeo). */

.so-adm-btn { display: none; }
:root[data-papel="adm"] .so-adm-btn { display: inline-block; }

/* todos os filtros numa linha (quebra só em telas menores) */
.cmp-filtros { flex-wrap: wrap; align-items: flex-end; }
.cmp-filtros .filtro { flex: 1 1 120px; }
.cmp-filtros .filtro:first-child { flex: 1.4 1 160px; }
.cmp-filtros .filtro > label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-filtros select, .cmp-filtros .ms-botao { width: 100%; min-width: 0; }
.cmp-filtros .filtro-acao { flex: 0 0 auto; margin-left: 0; }
.filtro-x { flex: 0 0 auto; height: 32px; display: flex; align-items: center; font-size: 18px; font-weight: 700; color: var(--series-1); }
#ms-nat .ms-painel { left: auto; right: 0; }

/* avisos sobre meses incompletos / dados parciais */
.cmp-avisos { margin: 10px 2px 14px; display: flex; flex-direction: column; gap: 4px; }
.cmp-avisos p { margin: 0; font-size: 12.5px; }
.cmp-avisos .aviso { color: #9a5b00; }
.cmp-avisos .aviso::before { content: "⚠ "; }
:root[data-theme="dark"] .cmp-avisos .aviso { color: #f0b45a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cmp-avisos .aviso { color: #f0b45a; } }
.cmp-avisos .nota { color: var(--text-muted); }

.cmp-det { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; }

/* painel por base */
.t-painel th[data-ord] { cursor: pointer; user-select: none; white-space: nowrap; }
.t-painel th[data-ord]:hover { color: var(--text-primary); }
.t-painel th.ord { color: var(--text-primary); }
.t-painel th.ord::after { content: " " attr(data-dir); }
.t-painel tbody tr { cursor: pointer; }
.t-painel tbody tr:hover { background: var(--surface-2); }
.t-painel tbody tr.selecionado { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--series-1); }
.t-painel td.nome { font-weight: 600; }
.t-painel td.mun { color: var(--text-secondary); }
/* "sem comparação": somem as colunas de variação e a situação */
.t-painel.sem-comp th:nth-child(4), .t-painel.sem-comp td:nth-child(4),
.t-painel.sem-comp th:nth-child(6), .t-painel.sem-comp td:nth-child(6),
.t-painel.sem-comp th:nth-child(9), .t-painel.sem-comp td:nth-child(9) { display: none; }
.t-painel tfoot td { font-weight: 700; border-top: 2px solid var(--grid); border-bottom: 0; }

.sit { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.sit-atencao { background: #fde2e1; color: #a1231d; }
.sit-reacao { background: #fdecd3; color: #8a4b00; }
.sit-queda { background: #dfe7f7; color: #233f8f; }
.sit-estavel { background: var(--surface-2); color: var(--text-secondary); }
.sit-favoravel { background: #dcf1dc; color: #1c6b1c; }
.sit-pouco { background: transparent; color: var(--text-muted); border: 1px dashed var(--border); }
:root[data-theme="dark"] .sit-atencao { background: #4a1d1c; color: #ffb3ae; }
:root[data-theme="dark"] .sit-reacao { background: #47320f; color: #ffcf8a; }
:root[data-theme="dark"] .sit-queda { background: #1e2a52; color: #b5c6f5; }
:root[data-theme="dark"] .sit-favoravel { background: #183d1c; color: #9de39d; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sit-atencao { background: #4a1d1c; color: #ffb3ae; }
  :root:not([data-theme="light"]) .sit-reacao { background: #47320f; color: #ffcf8a; }
  :root:not([data-theme="light"]) .sit-queda { background: #1e2a52; color: #b5c6f5; }
  :root:not([data-theme="light"]) .sit-favoravel { background: #183d1c; color: #9de39d; }
}
.legenda-sit { line-height: 2; margin-top: 10px; }

/* dia × hora lado a lado */
.cmp-calor { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.cmp-calor h3, .cmp-sub { font-size: 13px; font-weight: 600; margin: 10px 0 0; color: var(--text-secondary); }
.cmp-sub { margin-top: 18px; color: var(--text-primary); }
.t-lacunas { max-width: 640px; }
.t-lacunas tr.vazio td { color: var(--text-muted); }
@media (max-width: 900px) { .cmp-calor { grid-template-columns: minmax(0, 1fr); } }

/* impressão (o #relatorio e o @media print vêm do style.css) */
#relatorio .rel-img { width: 100%; height: auto; display: block; }
#relatorio .rel-avisos { color: #52514e; font-size: 8.5pt; margin: -4px 0 8px; }
#relatorio .rel-avisos div { margin: 1px 0; }
#relatorio .rel-kpi .d { color: #52514e; font-size: 8pt; }
#relatorio table.rel-painel { break-inside: auto; font-size: 8.5pt; }
#relatorio table.rel-painel tr { break-inside: avoid; }
#relatorio table.rel-painel td:last-child, #relatorio table.rel-painel th:last-child { white-space: nowrap; }
#relatorio table.rel-painel tfoot td { font-weight: 700; border-top: 1.5px solid #0b0b0b; }
#relatorio .rel-calor2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#relatorio h3 { font-size: 9.5pt; margin: 6px 0 2px; color: #52514e; }

/* janela da correspondência de bases */
dialog#dlg-mapa {
  border: 1px solid var(--border); border-radius: 14px; padding: 0; width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 48px); background: var(--surface-1); color: var(--text-primary); box-shadow: 0 16px 48px rgba(0, 0, 0, .3);
}
dialog#dlg-mapa::backdrop { background: rgba(0, 0, 0, .4); }
#mapa-busca { height: 32px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-1); padding: 0 8px; }
.mapa-lista { max-height: 50vh; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
#t-mapa th { position: sticky; top: 0; background: var(--surface-1); z-index: 1; }
#t-mapa td { padding: 4px 8px; }
#t-mapa td.nome { font-weight: 600; }
#t-mapa select { width: 100%; max-width: 340px; height: 30px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-1); padding: 0 6px; }
#t-mapa td.origem { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
#t-mapa td.origem-manual { color: var(--series-1); font-weight: 600; }
#t-mapa td.origem-sem-par { color: var(--delta-desce); }
.dlg-mapa .dlg-rodape { justify-content: space-between; }
.dlg-mapa .dlg-rodape > div { display: flex; gap: 8px; }
