.relatorio-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
}

.relatorio-card {
    position: relative;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    flex: 1 1 300px;
    box-sizing: border-box;
    transition: background-color 1.5s ease;
}

.relatorio-card:hover {
    background-color: #eeeeee;
    transition: background-color 0.5s ease;
}

.relatorio-canvas-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 380px;
    height: 380px;
}

.relatorio-canvas-wrap-grande {
    display: flex;
    width: 1024px;
}

.relatorio-canvas-wrap canvas {
    max-width: 100%;
    max-height: 100%;
}

.relatorio-card canvas {
    max-width: 100% !important;
    height: auto !important;
}

.relatorio-footer {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
    width: 100%;
    display: flex;
    justify-content: center;
}

.relatorio-card-duplo {
    flex: 1 1 45%;      /* Permite crescer e encolher */
    width: 100%;         /* Tenta ocupar o espaço disponível */
    max-width: 600px;    /* Define um tamanho grande, mas limitado */
    min-width: 300px;
    margin: 0 auto;      /* Centraliza o card na tela */
}

.relatorio-card-duplo h2 {
    text-align: center;
    width: 100%; /* Garante que o h2 ocupe a largura total para centralizar o texto */
    margin-bottom: 20px; /* Opcional: espaçamento abaixo do título */
}

/* ── Card expansível ─────────────────────────────────────────── */
.card-expansivel {
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: hidden;
    max-height: 640px;
    transition: max-height 0.5s ease-in-out;
    position: relative;
}

.card-expansivel.expandido {
    max-height: none !important;
    overflow-x: hidden;
    overflow-y: visible;
}

/* min-width:0 permite que o flex item encolha — sem isso overflow-x:auto não funciona */
.card-expansivel .conteudo-expansivel {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0;
}

/* ── Wrapper do botão ────────────────────────────────────────── */
.btn-toggle-wrapper {
    z-index: 2;
    width: 100%;
    text-align: center;
    transition: background 0.35s ease, backdrop-filter 0.35s ease;
    box-sizing: border-box;
    flex-shrink: 0;
}

.card-expansivel.expandido .btn-toggle-wrapper {
    position: sticky;
    bottom: 0;
    background: #ffffff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-top: 1px solid #e0e0e0;
    padding: 15px 0;
    display: flex;
    justify-content: center;
}

.card-expansivel:not(.expandido) .btn-toggle-wrapper {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;               /* estica até a borda direita do card sem vazar */
    height: 120px;
    border-top: none;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 20px;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(255, 255, 255, 0.4) 30%,
        rgba(255, 255, 255, 0.9) 70%,
        #ffffff 100%
    );
    backdrop-filter: blur(1.5px);
    -webkit-backdrop-filter: blur(1.5px);
}

/* Onde o conteúdo vive */
#conteudo-relatorio {
    flex: 1;
    overflow-y:hidden; /* Adiciona barra de rolagem se o conteúdo for muito grande */
    padding-bottom: 20px;
}


/* ------------------------- CELULARES ----------------------*/

@media screen and (max-width: 1024px) {

    .relatorio-canvas-wrap-grande {
        display: flex;
        width: 320px;
    }
}