/* =========================
   RESET
========================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --primary-soft: #eff6ff;

    --green: #16a34a;
    --green-soft: #ecfdf3;

    --red: #dc2626;
    --red-soft: #fef2f2;

    --text: #172554;
    --text-secondary: #64748b;

    --border: #dbe3ef;
    --background: #f6f8fc;
    --white: #ffffff;

    --shadow: 0 10px 30px rgba(15, 23, 42, 0.07);
}

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

body {
    font-family: "Inter", "Segoe UI", Arial, sans-serif;
    background: var(--background);
    color: var(--text);
    min-height: 100vh;
}

.container {
    width: min(94%, 1240px);
    margin: 0 auto;
}

/* =========================
   HEADER
========================= */

.header {
    background: linear-gradient(
        135deg,
        #2563eb 0%,
        #1e40af 100%
    );

    color: white;
    padding: 28px 0 78px;
}

.header-content {
    display: flex;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-icon {
    width: 52px;
    height: 52px;

    display: grid;
    place-items: center;

    border-radius: 15px;

    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.brand-icon svg {
    width: 28px;
    height: 28px;
}

.header h1 {
    font-size: clamp(28px, 4vw, 38px);
    line-height: 1.15;
    font-weight: 800;

    margin-bottom: 7px;

    letter-spacing: -0.7px;
}

.header p {
    font-size: 15px;
    line-height: 1.5;

    color: rgba(255, 255, 255, 0.88);
}

/* =========================
   CARDS
========================= */

#cards {
    display: grid;

    grid-template-columns: repeat(3, 1fr);

    gap: 22px;

    margin-top: -46px;
    margin-bottom: 30px;

    position: relative;
    z-index: 2;
}

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

    padding: 25px;

    border: 1px solid rgba(219, 227, 239, 0.85);

    border-radius: 18px;

    box-shadow: var(--shadow);

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-3px);

    box-shadow:
        0 15px 35px rgba(15, 23, 42, 0.10);
}

.card-top {
    display: flex;
    align-items: center;

    gap: 12px;

    margin-bottom: 18px;
}

.card-icon {
    width: 42px;
    height: 42px;

    border-radius: 12px;

    display: grid;
    place-items: center;
}

.card-icon svg {
    width: 23px;
    height: 23px;
}

.receita-icon {
    color: var(--green);
    background: var(--green-soft);
}

.despesa-icon {
    color: var(--red);
    background: var(--red-soft);
}

.saldo-icon {
    color: var(--primary);
    background: var(--primary-soft);
}

.card-label {
    color: #334155;

    font-size: 15px;
    font-weight: 700;
}

.card strong {
    display: block;

    font-size: clamp(25px, 3vw, 32px);

    letter-spacing: -0.5px;

    margin-bottom: 7px;
}

.card small {
    color: var(--text-secondary);

    font-size: 12px;
}

.receita strong {
    color: var(--green);
}

.despesa strong {
    color: var(--red);
}

.saldo strong {
    color: var(--primary);
}

/* =========================
   SEÇÕES
========================= */

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

    padding: 30px;

    border-radius: 18px;

    border: 1px solid rgba(219, 227, 239, 0.8);

    box-shadow: var(--shadow);

    margin-bottom: 24px;
}

.section-heading {
    display: flex;
    align-items: flex-start;

    gap: 13px;

    margin-bottom: 25px;
}

.section-heading.compact {
    margin-bottom: 22px;
}

.heading-icon {
    flex: 0 0 40px;

    width: 40px;
    height: 40px;

    display: grid;
    place-items: center;

    border-radius: 11px;

    color: var(--primary);

    background: var(--primary-soft);
}

.heading-icon svg {
    width: 21px;
    height: 21px;
}

.section-heading h2 {
    font-size: 20px;

    line-height: 1.3;

    margin-bottom: 4px;

    letter-spacing: -0.2px;
}

.section-heading p {
    color: var(--text-secondary);

    font-size: 13px;
}

/* =========================
   CAMPOS
========================= */

.field {
    display: flex;

    flex-direction: column;

    gap: 8px;
}

.field label {
    font-size: 12px;

    color: #475569;

    font-weight: 600;
}

#form-financeiro {
    display: grid;

    grid-template-columns:
        1.35fr
        0.8fr
        0.9fr
        0.85fr
        auto;

    gap: 14px;

    align-items: end;
}

#form-financeiro input,
#form-financeiro select,
.filters input,
.filters select {

    width: 100%;

    min-height: 46px;

    padding: 12px 14px;

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

    border-radius: 10px;

    background: white;

    color: #1e293b;

    font: inherit;

    font-size: 13px;

    outline: none;

    transition:
        border-color 0.2s,
        box-shadow 0.2s;
}

#form-financeiro input:focus,
#form-financeiro select:focus,
.filters input:focus,
.filters select:focus {

    border-color: var(--primary);

    box-shadow:
        0 0 0 3px rgba(37, 99, 235, 0.10);
}

/* =========================
   BOTÃO
========================= */

.btn-primary {

    min-height: 46px;

    padding: 0 19px;

    display: inline-flex;

    align-items: center;

    justify-content: center;

    gap: 8px;

    border: 0;

    border-radius: 10px;

    background: var(--primary);

    color: white;

    font: inherit;

    font-size: 13px;

    font-weight: 700;

    cursor: pointer;

    transition:
        background 0.2s,
        transform 0.2s;

    white-space: nowrap;
}

.btn-primary svg {
    width: 18px;
    height: 18px;
}

.btn-primary:hover {

    background: #1d4ed8;

    transform: translateY(-1px);
}

/* =========================
   PESQUISA
========================= */

.filters {

    display: grid;

    grid-template-columns:
        1.6fr
        0.8fr
        0.8fr;

    gap: 14px;
}

.input-icon {
    position: relative;
}

.input-icon svg {

    position: absolute;

    width: 17px;
    height: 17px;

    left: 13px;
    top: 50%;

    transform: translateY(-50%);

    color: #94a3b8;

    pointer-events: none;
}

.input-icon input {

    padding-left: 40px !important;
}

/* =========================
   TABELA
========================= */

.table-wrapper {

    overflow-x: auto;

    border: 1px solid #e2e8f0;

    border-radius: 12px;
}

table {

    width: 100%;

    min-width: 700px;

    border-collapse: collapse;
}

thead {

    background: #f8fafc;
}

th {

    color: #475569;

    font-size: 12px;

    font-weight: 700;

    text-align: left;

    white-space: nowrap;
}

th,
td {

    padding: 15px 16px;

    border-bottom: 1px solid #edf1f6;
}

tbody tr:last-child td {

    border-bottom: 0;
}

tbody tr {

    transition: background 0.15s;
}

tbody tr:hover {

    background: #f8fbff;
}

td {

    color: #334155;

    font-size: 13px;
}

/* =========================
   BADGES
========================= */

.tipo-badge {

    display: inline-flex;

    align-items: center;

    gap: 5px;

    padding: 6px 9px;

    border-radius: 999px;

    font-size: 11px;

    font-weight: 700;
}

.tipo-receita {

    color: #15803d;

    background: var(--green-soft);
}

.tipo-despesa {

    color: #b91c1c;

    background: var(--red-soft);
}

.valor-receita {

    color: var(--green);

    font-weight: 700;
}

.valor-despesa {

    color: var(--red);

    font-weight: 700;
}

/* ==========================================
   BOTÕES DE AÇÕES DA TABELA
========================================== */

.acoes {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}


/* Botão Editar */

.btn-editar,
.btn-excluir {
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}


/* Editar */

.btn-editar {
    background: #f3e8ff;
    color: #7c3aed;
}


.btn-editar:hover {
    background: #7c3aed;
    color: white;
    transform: translateY(-1px);
}


/* Excluir */

.btn-excluir {
    background: #fee2e2;
    color: #dc2626;
}


.btn-excluir:hover {
    background: #dc2626;
    color: white;
    transform: translateY(-1px);
}


/* Clique */

.btn-editar:active,
.btn-excluir:active {
    transform: scale(0.96);
}


/* ==========================================
   RESPONSIVO
========================================== */

@media (max-width: 600px) {

    .acoes {
        flex-direction: column;
        gap: 5px;
    }

    .btn-editar,
    .btn-excluir {
        width: 100%;
        padding: 7px 10px;
        font-size: 12px;
    }

}

/* =========================
   ESTADO VAZIO
========================= */

.empty-state {

    text-align: center;

    padding: 38px 15px !important;

    color: #94a3b8;
}

.table-footer {

    padding-top: 14px;

    color: #64748b;

    font-size: 12px;
}

/* =========================
   GRÁFICO
========================= */

.chart-area {

    display: grid;

    grid-template-columns:
        minmax(260px, 1fr)
        minmax(250px, 0.8fr);

    align-items: center;

    gap: 30px;

    min-height: 320px;
}

.chart-box {

    width: min(100%, 390px);

    height: 290px;

    margin: 0 auto;
}

#graficoFinanceiro {

    width: 100% !important;

    height: 100% !important;
}

.chart-info {

    display: grid;

    gap: 12px;
}

.info-item {

    display: flex;

    align-items: center;

    gap: 12px;

    padding: 16px;

    border: 1px solid #e5eaf2;

    border-radius: 12px;

    background: #fbfcfe;
}

.info-item small {

    display: block;

    color: #64748b;

    font-size: 11px;

    margin-bottom: 4px;
}

.info-item strong {

    display: block;

    font-size: 16px;
}

.dot {

    width: 11px;
    height: 11px;

    border-radius: 50%;

    flex: 0 0 11px;
}

.dot.green {
    background: #22c55e;
}

.dot.red {
    background: #ef4444;
}

.dot.blue {
    background: #2563eb;
}

/* =========================
   FOOTER
========================= */

.footer {

    margin-top: 18px;

    padding: 30px 15px 35px;

    text-align: center;

    color: #64748b;

    font-size: 12px;

    border-top: 1px solid #e2e8f0;
}

.footer p {

    color: #334155;

    font-weight: 600;

    margin-bottom: 5px;
}

/* =========================
   RESPONSIVO
========================= */

@media (max-width: 980px) {

    #form-financeiro {

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

    #form-financeiro .btn-primary {

        width: 100%;
    }

    .filters {

        grid-template-columns:
            1fr 1fr;
    }

    .search-field {

        grid-column: 1 / -1;
    }

    .chart-area {

        grid-template-columns: 1fr;
    }
}

@media (max-width: 650px) {

    .container {

        width: 94%;
    }

    .header {

        padding: 22px 0 62px;
    }

    .brand {

        align-items: flex-start;
    }

    .brand-icon {

        width: 45px;
        height: 45px;

        flex-basis: 45px;
    }

    .header h1 {

        font-size: 26px;
    }

    .header p {

        font-size: 13px;
    }

    #cards {

        grid-template-columns: 1fr;

        gap: 14px;

        margin-bottom: 20px;
    }

    .card {

        padding: 20px;
    }

    .card strong {

        font-size: 27px;
    }

    .section-card {

        padding: 20px;

        border-radius: 15px;

        margin-bottom: 18px;
    }

    .section-heading h2 {

        font-size: 18px;
    }

    .section-heading p {

        font-size: 12px;
    }

    #form-financeiro,
    .filters {

        grid-template-columns: 1fr;
    }

    .search-field {

        grid-column: auto;
    }

    .btn-primary {

        width: 100%;
    }

    .chart-area {

        min-height: auto;

        gap: 18px;
    }

    .chart-box {

        height: 260px;
    }

    .table-wrapper {

        margin-inline: -4px;
    }

    th,
    td {

        padding: 13px 12px;

        font-size: 12px;
    }

    .footer {

        padding-bottom: 28px;
    }
}