/* Tema SIG: densidade compacta estilo BI. Carregado por último; sobrescreve sem tocar nas views. */

/* Eu reduzo tudo com zoom porque boa parte de larguras e espaçamentos do sistema está em px, não em rem */
html { font-size: 80% }
:root { --z: .85 }
body { zoom: var(--z) }
/* Com zoom, 100vh encolhe junto; compenso para a sidebar e o shell ocuparem a tela inteira */
.app { min-height: calc(100vh / var(--z)) }
.side { height: calc(100vh / var(--z)) }
body { font-size: .95rem; line-height: 1.45; letter-spacing: -.005em }

:root {
  --r: 8px;
  --sombra: 0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.03);
  --sombra-hover: 0 6px 18px rgba(15,23,42,.08);
  --side-w: 212px;
}

/* Shell: sidebar mais estreita e handle acompanhando */
.app { grid-template-columns: var(--side-w) 1fr }
.side-handle { left: var(--side-w); width: 22px; height: 40px }
.nav { padding: 7px 12px; font-size: .9rem; border-radius: 6px }
.side input { padding: 7px 10px; font-size: .9rem }

/* Topo enxuto */
.top { padding: 10px 20px; min-height: 0; gap: 12px }
.top h1 { font-size: 1.2rem; font-weight: 600; letter-spacing: -.2px }
.filter { padding: 4px 10px }
.filter select { font-size: .9rem }
.who { font-size: .85rem }

/* Área de conteúdo: respiro menor e largura máxima confortável em telas grandes */
.body { padding: 16px 20px }
.body > * { max-width: 1680px }

/* Cards, painéis e KPIs */
.panel { padding: 14px 16px; border-radius: var(--r); box-shadow: var(--sombra) }
.panel h3 { font-size: .95rem; margin-bottom: 10px }
.kpis { gap: 10px }
.kpi { padding: 12px 14px; border-radius: var(--r); box-shadow: var(--sombra) }
.kpi .val { font-size: 1.6rem; letter-spacing: -.4px }
.kpi.clickable:hover { transform: translateY(-1px); box-shadow: var(--sombra-hover) }
.notice { padding: 8px 12px; margin-top: 10px }

/* Tabelas densas, padrão grid de BI */
table th { padding: 7px 10px; font-size: .75rem; letter-spacing: .4px }
table td { padding: 6px 10px; font-size: .875rem }

/* Controles */
.btn, button.btn { padding: 6px 12px; font-size: .875rem; border-radius: 6px }
input, select, textarea { font-size: .9rem }
.tag { padding: 2px 8px; font-size: .7rem }
.modal .card { padding: 20px 22px }

/* Mapas: card nunca rola (o Leaflet mede errado) e as colunas respeitam a largura disponível */
.mc-shell { gap: 12px }
.mc-intro { padding: 8px 12px; font-size: .85rem }
.mc-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px }
.mc-grid > * { min-width: 0 }
/* Eu forço as telas em coluna única (RH, mapas) a ocupar a largura toda: em produção o card encolhia
   até o tamanho do cabeçalho; a mesma regra resolveu a Hierarquia. */
.rh-shell, .mc-shell { grid-template-columns: minmax(0, 1fr) !important; width: 100% !important; max-width: none !important }
.rh-shell > *, .mc-shell > * { grid-column: 1 / -1 !important; width: 100% !important; max-width: none !important;
  justify-self: stretch !important; min-width: 0; box-sizing: border-box }
.mc-grid > .mc-card { width: 100% !important; max-width: none !important; justify-self: stretch !important; box-sizing: border-box }
.mc-card { overflow: hidden !important; border-radius: 10px }
.mc-card-head { padding: 10px 14px; gap: 10px; flex-wrap: wrap }
.mc-card-head h3 { font-size: .95rem }
.mc-search { flex: 1 1 auto; justify-content: flex-end; min-width: 0 }
.mc-search input { flex: 1; width: auto; min-width: 140px; max-width: 260px }
.mc-hero .kpi { padding: 10px 14px }
.mc-tab { overflow-x: auto }
.mc-tab tbody td { padding: 7px 10px }
.mc-legend { padding: 8px 14px }
.leaflet-touch .leaflet-bar a, .leaflet-bar a { width: 26px; height: 26px; line-height: 26px; font-size: 15px }

@media (min-width: 1025px) {
  #map { height: 480px }
  .mc-map { height: calc(100vh / var(--z) - 290px); min-height: 420px }
  .mc-tab { max-height: calc(100vh / var(--z) - 290px) }
}
@media (max-width: 1100px) {
  .mc-grid { grid-template-columns: 1fr }
}
@media (max-width: 1024px) {
  .app.on, .app.on.side-off { grid-template-columns: 0 1fr }
  .body { padding: 12px }
}
