/* SEM SCROLL */
html, body {
   height: 100%;
   overflow: hidden; /* impede rolagem da página inteira */
   margin: 0;
}

#container {
   height: 100vh;
   display: flex;
   flex-direction: column;
   padding: 10px 15px;
   box-sizing: border-box;
}

/* Cabeçalho (logo + timer) não cresce, ocupa só o espaço que precisa */
#container > .d-flex.flex-column.flex-sm-row {
   flex: 0 0 auto;
   margin-bottom: 8px !important;
}

.titulo {
   flex: 0 0 auto;
   margin-top: 5px !important;
   margin-bottom: 5px !important;
}

/* Linha "Visão geral..." também não cresce */
#container > .text-center.small.text-muted {
   flex: 0 0 auto;
   margin-bottom: 8px !important;
}

/* Botão Imprimir */
#container > .text-right {
   flex: 0 0 auto;
   margin-bottom: 8px !important;
}

/* A linha principal (colunaGraficos + colunaMapa) ocupa todo o espaço restante */
#container > .row.mt-4 {
   flex: 1 1 auto;
   min-height: 0; /* crucial: permite que filhos flex encolham corretamente */
   display: flex;
   margin: 0 !important;
}

#colunaGraficos,
#colunaMapa {
   height: 100%;
   display: flex;
   flex-direction: column;
   min-height: 0;
}

#colunaGraficos {
   overflow: hidden;
}

/* Cards não crescem, ocupam altura mínima necessária */
#colunaGraficos > .row:first-child {
   flex: 0 0 auto;
   margin: 0 0 8px 0 !important;
}

#colunaGraficos > .row:not(:first-child) {
   min-height: 0;
   margin: 0 0 8px 0 !important;
   display: flex;
}

/* Tabela ocupa menos espaço, só o necessário pras 3 linhas + cabeçalho */
#colunaGraficos > .row.linha-tabela {
   flex: 0 0 auto;
}

/* Situação/Região e Evolução dividem o espaço restante */
#colunaGraficos > .row:not(.linha-tabela):not(:first-child) {
   flex: 1 1 0;
}

#colunaGraficos > .row:not(:first-child) > div {
   display: flex;
   flex-direction: column;
   min-height: 0;
   height: 100%;
}

.painel-grafico {
   display: flex;
   flex-direction: column;
   width: 100%;
   height: 100%;
   min-height: 0;
   padding: 10px 15px !important;
}

.painel-grafico-titulo {
   flex: 0 0 auto;
   margin-bottom: 5px !important;
   padding-bottom: 5px !important;
}

.grafico-container {
   flex: 1 1 auto;
   min-height: 0 !important; /* sobrescreve o min-height:350px fixo que tínhamos antes */
}

/* Cards mais compactos */
.card-dashboard {
   padding: 10px !important;
}
.card-dashboard-valor {
   font-size: 20px !important;
}
.card-dashboard-label {
   font-size: 11px !important;
   margin-bottom: 4px !important;
}

/* Coluna do mapa ocupa a altura toda */
#colunaMapa .painel-grafico {
   height: 100%;
}
#mapaRegionais {
   flex: 1 1 auto;
   min-height: 0 !important;
}

/* Tabela mais compacta */
#tabelaEmendasPorAno table {
   font-size: 12px;
}
#tabelaEmendasPorAno th,
#tabelaEmendasPorAno td {
   padding: 4px 8px !important;
}

/* FIM DO SEM SCROLL */

.card-dashboard {
   background: #fff;
   border: 1px solid #e0e0e0;
   border-radius: 8px;
   padding: 20px;
   text-align: center;
   box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.card-dashboard-label {
   font-size: 13px;
   color: #777;
   font-weight: bold;
   text-transform: uppercase;
   margin-bottom: 8px;
}

.card-dashboard-valor {
   font-size: 28px;
   font-weight: bold;
   color: #2c3e50;
}

.painel-grafico {
   background: #fff;
   border: 1px solid #e0e0e0;
   border-radius: 8px;
   padding: 15px;
   box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.painel-grafico-titulo {
   font-size: 14px;
   font-weight: bold;
   color: #333;
   margin-bottom: 10px;
   border-bottom: 1px solid #eee;
   padding-bottom: 8px;
}

.grafico-container {
   min-height: 350px;
}

.legenda-mapa {
   background: #ffffff;
   padding: 10px 12px;
   border-radius: 6px;
   box-shadow: 0 1px 5px rgba(0,0,0,0.4);
   font-size: 12px;
   line-height: 1.5;
   color: #333;
}

.legenda-titulo {
   font-weight: bold;
   margin-bottom: 6px;
   font-size: 13px;
}

.legenda-item {
   display: flex;
   align-items: center;
   margin-bottom: 2px;
}

.legenda-cor {
   display: inline-block;
   width: 14px;
   height: 14px;
   margin-right: 6px;
   border: 1px solid #999;
   border-radius: 2px;
}

.legenda-rodape {
   margin-top: 6px;
   font-size: 11px;
   color: #777;
   border-top: 1px solid #eee;
   padding-top: 4px;
}

/* Corrige o vazamento visual dos gráficos Highcharts sobre a linha de baixo */
.painel-grafico {
   overflow: hidden;
}
.grafico-container {
   overflow: hidden;
}

/* Remove o gutter padrão do Bootstrap nas linhas internas, alinhando tudo com o .titulo */
#areaCards,
#colunaGraficos > .row {
   margin-left: 0 !important;
   margin-right: 0 !important;
}

#areaCards > div,
#colunaGraficos > .row > div {
   padding-left: 0 !important;
   padding-right: 10px !important; /* pequeno respiro entre painéis lado a lado */
}

#areaCards > div:last-child,
#colunaGraficos > .row > div:last-child {
   padding-right: 0 !important;
}

/* A linha principal (colunaGraficos + colunaMapa) também sem gutter extra */
#container > .row.mt-4 {
   margin-left: 0 !important;
   margin-right: 0 !important;
}
#colunaGraficos {
   padding-left: 0 !important;
   padding-right: 12px !important; /* respiro entre a coluna de gráficos e o mapa */
}
#colunaMapa {
   padding-left: 0 !important;
   padding-right: 0 !important;
}

@media print {
   @page {
      size: landscape;
      margin: 12mm;
   }

   #areaTimer,
   #btImprimir {
      display: none !important;
   }

   .row {
      display: block !important;
      margin-left: 0 !important;
      margin-right: 0 !important;
   }
   .col-md-6,
   .col-md-12,
   #colunaGraficos,
   #colunaMapa {
      width: 100% !important;
      max-width: 100% !important;
      flex: none !important;
      float: none !important;
      padding-left: 0 !important;
      padding-right: 0 !important;
      box-sizing: border-box !important;
   }

   #container,
   .container-fluid {
      padding-left: 0 !important;
      padding-right: 0 !important;
      max-width: 100% !important;
   }

   .painel-grafico,
   .card-dashboard {
      page-break-inside: avoid;
      break-inside: avoid;
      margin-bottom: 20px !important;
   }

   #mapaRegionais {
      height: 500px !important;
      width: 100% !important;
      overflow: hidden !important;
   }
}