:root {
    --fundo: #f4f7fb;
    --card: #ffffff;

    --texto: #172033;
    --texto-secundario: #6f7b91;

    --azul: #1769e0;
    --azul-claro: #eaf2ff;

    --borda: #e5eaf1;

    --verde: #17a673;
    --amarelo: #d99b15;
    --vermelho: #d64545;

    --sombra:
        0 8px 30px rgba(25, 45, 75, 0.06);
}


* {
    box-sizing: border-box;
}


html,
body {
    margin: 0;
    padding: 0;

    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background: var(--fundo);
    color: var(--texto);
}


body {
    min-height: 100vh;
}


.dashboard {
    width: min(1180px, calc(100% - 40px));

    margin: 0 auto;
    padding: 38px 0 60px;
}


/* TOPO */

.topo {
    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 30px;

    margin-bottom: 28px;
}


.subtitulo {
    display: block;

    margin-bottom: 6px;

    color: var(--azul);

    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.12em;
}


.topo h1 {
    margin: 0;

    font-size: clamp(1.55rem, 3vw, 2.15rem);
    font-weight: 700;
    letter-spacing: -0.035em;
}


.topo p {
    margin: 7px 0 0;

    color: var(--texto-secundario);

    font-size: 0.93rem;
}


.status {
    display: flex;
    align-items: center;

    gap: 10px;

    min-width: 190px;
}


.status > div {
    display: flex;
    flex-direction: column;

    gap: 3px;
}


.status strong {
    font-size: 0.88rem;
}


.status span:last-child {
    color: var(--texto-secundario);

    font-size: 0.76rem;
}


.status-dot {
    width: 10px;
    height: 10px;

    border-radius: 50%;

    background: #adb5c2;

    box-shadow:
        0 0 0 5px rgba(173, 181, 194, 0.12);
}


.status-dot.ok {
    background: var(--verde);

    box-shadow:
        0 0 0 5px rgba(23, 166, 115, 0.12);
}


.status-dot.atencao {
    background: var(--amarelo);

    box-shadow:
        0 0 0 5px rgba(217, 155, 21, 0.13);
}


.status-dot.erro {
    background: var(--vermelho);

    box-shadow:
        0 0 0 5px rgba(214, 69, 69, 0.13);
}


/* CARDS */

.cards {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 18px;

    margin-bottom: 20px;
}


.card {
    background: var(--card);

    border: 1px solid var(--borda);
    border-radius: 18px;

    padding: 22px 24px;

    box-shadow: var(--sombra);
}


.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    color: var(--texto-secundario);

    font-size: 0.83rem;
    font-weight: 650;
}


.card-icon {
    display: grid;
    place-items: center;

    width: 31px;
    height: 31px;

    border-radius: 9px;

    background: var(--azul-claro);
    color: var(--azul);

    font-size: 1.1rem;
    font-weight: 700;
}


.card-value {
    display: flex;
    align-items: baseline;

    gap: 8px;

    margin: 18px 0 10px;
}


.card-value strong {
    font-size: clamp(2rem, 4vw, 2.65rem);

    line-height: 1;

    letter-spacing: -0.055em;
}


.card-value span {
    color: var(--texto-secundario);

    font-size: 0.92rem;
    font-weight: 600;
}


.card-footer {
    color: var(--texto-secundario);

    font-size: 0.75rem;
}


/* GRÁFICO */

.grafico-card {
    background: var(--card);

    border: 1px solid var(--borda);
    border-radius: 18px;

    padding: 24px;

    box-shadow: var(--sombra);
}


.grafico-topo {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}


.grafico-topo h2 {
    margin: 0;

    font-size: 1.25rem;
}


.grafico-topo p {
    margin: 5px 0 0;

    color: var(--texto-secundario);

    font-size: 0.8rem;
}


/* ABAS */

.abas-dias {
    display: flex;

    gap: 8px;

    margin: 22px 0 20px;

    padding-bottom: 4px;

    overflow-x: auto;

    scrollbar-width: thin;

    scroll-behavior: smooth;
}


.abas-dias::-webkit-scrollbar {
    height: 5px;
}


.abas-dias::-webkit-scrollbar-thumb {
    background: #d8deea;

    border-radius: 20px;
}


.dia-btn {
    flex: 0 0 auto;

    border: 1px solid var(--borda);

    background: #ffffff;
    color: var(--texto-secundario);

    padding: 8px 13px;

    border-radius: 10px;

    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 650;

    cursor: pointer;

    transition:
        background 0.18s ease,
        color 0.18s ease,
        border 0.18s ease,
        transform 0.18s ease;
}


.dia-btn:hover {
    border-color: #cbd6e6;

    transform: translateY(-1px);
}


.dia-btn.ativo {
    color: var(--azul);

    background: var(--azul-claro);

    border-color: #bdd4f5;
}


/* ÁREA DO GRÁFICO */

.grafico-container {
    position: relative;

    width: 100%;
    height: 420px;
}


.grafico-loading {
    position: absolute;
    inset: 0;

    z-index: 2;

    display: grid;
    place-items: center;

    background: rgba(255, 255, 255, 0.86);

    color: var(--texto-secundario);

    font-size: 0.85rem;

    transition: opacity 0.2s ease;
}


.grafico-loading.oculto {
    opacity: 0;
    pointer-events: none;
}


/* RESPONSIVO */

@media (max-width: 700px) {

    .dashboard {
        width: min(100% - 24px, 1180px);

        padding-top: 24px;
    }


    .topo {
        align-items: flex-start;
        flex-direction: column;

        gap: 16px;
    }


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


    .card {
        padding: 20px;
    }


    .grafico-card {
        padding: 20px 16px;
    }


    .grafico-container {
        height: 360px;
    }


    .abas-dias {
        margin-left: -2px;
        margin-right: -2px;
    }

}

/* ===========================
   VAZÃO EM 3 UNIDADES
=========================== */

.vazao-unidades {
    display: grid;
    grid-template-columns: 1.35fr 1fr 1fr;

    gap: 12px;

    margin: 18px 0 14px;
}


.vazao-unidade {
    display: flex;
    flex-direction: column;

    justify-content: center;

    min-height: 72px;

    padding: 12px 14px;

    border: 1px solid var(--borda);
    border-radius: 12px;

    background: #fafcff;
}


.vazao-unidade strong {
    font-size: 1.35rem;

    letter-spacing: -0.035em;
}


.vazao-unidade span {
    margin-top: 4px;

    color: var(--texto-secundario);

    font-size: 0.76rem;
    font-weight: 600;
}


.vazao-principal {
    background: var(--azul-claro);

    border-color: #c9dcf8;
}


.vazao-principal strong {
    font-size: 2rem;

    color: var(--azul);
}


/* ===========================
   GRÁFICO + UNIDADES
=========================== */

.grafico-conteudo {
    display: grid;

    grid-template-columns: 58px minmax(0, 1fr);

    gap: 15px;

    align-items: stretch;
}


.unidades-grafico {
    display: flex;
    flex-direction: column;

    gap: 8px;

    padding-top: 12px;
}


.unidade-btn {
    width: 58px;

    padding: 9px 5px;

    border: 1px solid var(--borda);
    border-radius: 9px;

    background: #ffffff;

    color: var(--texto-secundario);

    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 700;

    cursor: pointer;

    transition:
        background 0.18s ease,
        color 0.18s ease,
        border-color 0.18s ease,
        transform 0.18s ease;
}


.unidade-btn:hover {
    transform: translateY(-1px);

    border-color: #b9cae3;
}


.unidade-btn.ativo {
    background: var(--azul);

    border-color: var(--azul);

    color: #ffffff;
}

@media (max-width: 700px) {

    .vazao-unidades {
        grid-template-columns: 1fr 1fr;
    }


    .vazao-principal {
        grid-column: 1 / -1;
    }


    .grafico-conteudo {
        grid-template-columns: 1fr;

        gap: 8px;
    }


    .unidades-grafico {
        flex-direction: row;

        padding-top: 0;
    }


    .unidade-btn {
        width: auto;

        min-width: 64px;
    }

}