/* =====================================================
   DASHBOARD
===================================================== */

.dashboard-page {
    position: relative;
    width: 100%;
    padding-bottom: 30px;
    color: #1e293b;
}


/* =====================================================
   CABEÇALHO
===================================================== */

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 28px;
}

.dashboard-header h1 {
    font-size: 26px;
    font-weight: 700;
    margin: 0 0 6px;
    color: #172033;
}

.dashboard-header p {
    margin: 0;
    color: #64748b;
    font-size: 14px;
}

.dashboard-header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.dashboard-status {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 600;
    color: #15803d;
    background: #dcfce7;
    padding: 8px 12px;
    border-radius: 20px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    background: #16a34a;
    border-radius: 50%;
}

.btn-atualizar-dashboard {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: #2563eb;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: .2s;
}

.btn-atualizar-dashboard:hover {
    background: #1d4ed8;
}

.btn-atualizar-dashboard:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.btn-atualizar-dashboard span {
    font-size: 19px;
}


/* =====================================================
   INDICADORES
===================================================== */

.dashboard-indicadores {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.dashboard-card {
    position: relative;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 22px;
    min-height: 145px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .035);
    transition: transform .2s, box-shadow .2s;
}

.dashboard-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 7px 18px rgba(15, 23, 42, .07);
}

.indicador-topo {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 17px;
}

.indicador-icone {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    font-size: 21px;
    font-weight: 600;
}

.indicador-label {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
}

.indicador-valor {
    font-size: 29px;
    font-weight: 750;
    color: #172033;
    letter-spacing: -.7px;
}

.indicador-valor-data {
    font-size: 17px;
    letter-spacing: 0;
}

.indicador-descricao {
    margin-top: 8px;
    font-size: 11px;
    color: #94a3b8;
}

.indicador-total .indicador-icone {
    color: #2563eb;
    background: #dbeafe;
}

.indicador-atualizados .indicador-icone {
    color: #16a34a;
    background: #dcfce7;
}

.indicador-pendentes .indicador-icone {
    color: #d97706;
    background: #fef3c7;
}

.indicador-data .indicador-icone {
    color: #7c3aed;
    background: #ede9fe;
}


/* =====================================================
   PAINÉIS
===================================================== */

.dashboard-graficos {
    display: grid;
    grid-template-columns: minmax(280px, .85fr) minmax(0, 1.65fr);
    gap: 18px;
    margin-bottom: 24px;
}

.dashboard-panel {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 22px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .035);
    min-width: 0;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 22px;
}

.panel-header h2 {
    margin: 0 0 5px;
    font-size: 16px;
    font-weight: 700;
    color: #172033;
}

.panel-header p {
    margin: 0;
    font-size: 12px;
    color: #94a3b8;
}


/* =====================================================
   GRÁFICOS
===================================================== */

.grafico-container {
    position: relative;
    width: 100%;
}

.grafico-rosca-container {
    height: 210px;
    max-width: 300px;
    margin: 0 auto;
}

.grafico-barras-container {
    height: 250px;
}

.grafico-legenda {
    display: flex;
    justify-content: center;
    gap: 22px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.legenda-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: #64748b;
}

.legenda-item strong {
    color: #172033;
    margin-left: 3px;
}

.legenda-cor {
    width: 9px;
    height: 9px;
    border-radius: 3px;
}

.legenda-atualizados {
    background: #16a34a;
}

.legenda-pendentes {
    background: #f59e0b;
}

.select-periodo {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    background: #fff;
    color: #475569;
    font-size: 12px;
    outline: none;
    cursor: pointer;
}

.select-periodo:focus {
    border-color: #2563eb;
}


/* =====================================================
   ÚLTIMAS ATUALIZAÇÕES
===================================================== */

.dashboard-ultimas-atualizacoes {
    margin-bottom: 24px;
}

.link-ver-todos {
    color: #2563eb;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.link-ver-todos:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.tabela-dashboard-container {
    width: 100%;
    overflow-x: auto;
}

.tabela-dashboard {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

.tabela-dashboard thead {
    background: #f8fafc;
}

.tabela-dashboard th {
    padding: 13px 14px;
    text-align: left;
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    border-bottom: 1px solid #e2e8f0;
}

.tabela-dashboard td {
    padding: 14px;
    font-size: 12px;
    color: #475569;
    border-bottom: 1px solid #f1f5f9;
}

.tabela-dashboard tbody tr:hover {
    background: #f8fafc;
}

.tabela-dashboard tbody tr:last-child td {
    border-bottom: none;
}

.tabela-dashboard td:first-child {
    color: #2563eb;
    font-weight: 650;
}

.dashboard-loading {
    text-align: center !important;
    padding: 30px !important;
    color: #94a3b8 !important;
}

.dashboard-vazio {
    text-align: center;
    padding: 35px 15px;
}

.vazio-icone {
    font-size: 35px;
    color: #cbd5e1;
    margin-bottom: 10px;
}

.dashboard-vazio h3 {
    margin: 0 0 6px;
    font-size: 15px;
    color: #475569;
}

.dashboard-vazio p {
    margin: 0;
    font-size: 12px;
    color: #94a3b8;
}


/* =====================================================
   ACESSO RÁPIDO
===================================================== */

.dashboard-atalhos {
    margin-bottom: 15px;
}

.atalhos-header {
    margin-bottom: 16px;
}

.atalhos-header h2 {
    margin: 0 0 5px;
    font-size: 17px;
    font-weight: 700;
    color: #172033;
}

.atalhos-header p {
    margin: 0;
    color: #94a3b8;
    font-size: 12px;
}

.atalhos-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.atalho-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 18px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    text-decoration: none;
    transition: .2s;
}

.atalho-card:hover {
    border-color: #bfdbfe;
    background: #f8fbff;
    transform: translateY(-2px);
    box-shadow: 0 5px 14px rgba(15, 23, 42, .05);
}

.atalho-icone {
    flex-shrink: 0;
    width: 43px;
    height: 43px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 24px;
    font-weight: 600;
}

.atalho-icone-consulta {
    background: #dbeafe;
    color: #2563eb;
}

.atalho-icone-importacao {
    background: #dcfce7;
    color: #16a34a;
}

.atalho-icone-atualizacao {
    background: #fef3c7;
    color: #d97706;
}

.atalho-icone-relatorios {
    background: #ede9fe;
    color: #7c3aed;
}

.atalho-conteudo {
    flex: 1;
    min-width: 0;
}

.atalho-conteudo h3 {
    margin: 0 0 5px;
    font-size: 13px;
    font-weight: 700;
    color: #334155;
}

.atalho-conteudo p {
    margin: 0;
    font-size: 11px;
    color: #94a3b8;
    line-height: 1.5;
}

.atalho-seta {
    font-size: 20px;
    color: #94a3b8;
    transition: .2s;
}

.atalho-card:hover .atalho-seta {
    color: #2563eb;
    transform: translateX(4px);
}


/* =====================================================
   LOADING GERAL
===================================================== */

.dashboard-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(248, 250, 252, .75);
    backdrop-filter: blur(2px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
}

.dashboard-spinner {
    width: 38px;
    height: 38px;
    border: 4px solid #dbeafe;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: dashboardSpin .8s linear infinite;
}

@keyframes dashboardSpin {
    to {
        transform: rotate(360deg);
    }
}


/* =====================================================
   RESPONSIVIDADE
===================================================== */

@media (max-width: 1100px) {

    .dashboard-indicadores {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-graficos {
        grid-template-columns: 1fr;
    }

    .grafico-rosca-container {
        max-width: 280px;
    }
}


@media (max-width: 700px) {

    .dashboard-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-header-actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .dashboard-header h1 {
        font-size: 22px;
    }

    .dashboard-indicadores {
        gap: 12px;
    }

    .dashboard-card {
        padding: 16px;
        min-height: 135px;
    }

    .indicador-valor {
        font-size: 24px;
    }

    .indicador-label {
        font-size: 11px;
    }

    .dashboard-panel {
        padding: 16px;
    }

    .panel-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .grafico-barras-container {
        height: 220px;
    }

    .atalhos-grid {
        grid-template-columns: 1fr;
    }

    .tabela-dashboard {
        min-width: 850px;
    }
}


@media (max-width: 420px) {

    .dashboard-indicadores {
        grid-template-columns: 1fr;
    }

    .dashboard-card {
        min-height: auto;
    }

    .dashboard-header-actions {
        align-items: flex-start;
        flex-direction: column;
    }

    .btn-atualizar-dashboard {
        width: 100%;
        justify-content: center;
    }

    .grafico-legenda {
        flex-direction: column;
        align-items: center;
    }
}