/* ===========================
   GLOBAL
   =========================== */
* {
    box-sizing: border-box;
}

body {
    background: #f5f7fb;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    color: #111827;
    margin: 0;
    padding: 0;
}

.layout {
    display: flex;
    min-height: 100vh;
    background: linear-gradient(145deg, #f5f7fb 0%, #ffffff 40%, #f5f7fb 100%);
}

/* ===========================
   SIDEBAR (PICPAY STYLE)
   =========================== */
.sidebar {
    width: 240px;
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    align-self: flex-start;
}

.logo-area {
    text-align: center;
    margin-bottom: 24px;
}

.logo-text {
    font-size: 22px;
    font-weight: 800;
    color: #21C25E;
    letter-spacing: 0.02em;
}

/* MENU LINKS */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nav-menu .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f3f4f6;
    padding: 11px 13px;
    border-radius: 999px;
    text-decoration: none;
    color: #111827;
    font-weight: 600;
    font-size: 14px;
    transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.nav-menu .nav-link span:first-child {
    font-size: 16px;
}

.nav-menu .nav-link:hover {
    background: #21C25E;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(33, 194, 94, 0.25);
}

.nav-link-active {
    background: #21C25E !important;
    color: #ffffff !important;
    box-shadow: 0 6px 14px rgba(33, 194, 94, 0.3);
}

/* Logout */
.nav-logout {
    margin-top: auto;
    background: #fee2e2;
    color: #b91c1c !important;
    font-weight: 600;
}

.nav-logout:hover {
    background: #ef4444;
    color: #ffffff !important;
    box-shadow: 0 6px 14px rgba(239, 68, 68, 0.3);
}

/* MOBILE SIDEBAR / BOTTOM NAV */
@media (max-width: 768px) {
    .layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        flex-direction: row;
        align-items: center;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
        padding: 10px 10px 8px;
        position: sticky;
        bottom: 0;
        top: auto;
        z-index: 10;
        background: #ffffff;
    }

    .logo-area {
        display: none;
    }

    .nav-menu {
        flex-direction: row;
        flex: 1;
        justify-content: space-between;
        gap: 6px;
    }

    .nav-menu .nav-link {
        flex: 1;
        justify-content: center;
        border-radius: 999px;
        font-size: 12px;
        padding: 8px 6px;
    }

    .nav-menu .nav-link span:last-child {
        display: none; /* mostra só o ícone no mobile */
    }

    .nav-logout {
        max-width: 80px;
    }
}

/* ===========================
   MAIN CONTENT
   =========================== */
.main-content {
    flex: 1;
    padding: 26px 30px 30px;
}

/* Page Header */
.page-header {
    margin-bottom: 20px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
    color: #111827;
}

.page-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

/* Conteúdo */
.page-content {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

/* ===========================
   DASHBOARD CARDS
   =========================== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 10px;
}

.card {
    background: #ffffff;
    border-radius: 18px;
    padding: 18px 18px 16px;
    box-shadow: 0 12px 35px rgba(15, 23, 42, 0.06);
    border: 1px solid #e5e7eb;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top left, rgba(33, 194, 94, 0.12), transparent 55%);
    pointer-events: none;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.card-value {
    font-size: 22px;
    font-weight: 800;
    color: #111827;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #ecfdf5;
    color: #166534;
    font-size: 11px;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.badge-negative {
    background: #fef2f2;
    color: #b91c1c;
}

/* ===========================
   GRÁFICOS
   =========================== */
.chart-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.chart-card {
    flex: 1 1 320px;
    background: #ffffff;
    border-radius: 18px;
    padding: 18px 18px 16px;
    box-shadow: 0 12px 35px rgba(15, 23, 42, 0.06);
    border: 1px solid #e5e7eb;
}

.chart-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #111827;
}

.chart-subtitle {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 14px;
}

.chart-card canvas {
    width: 100% !important;
    max-height: 280px;
}

/* Mobile */
@media (max-width: 768px) {
    .main-content {
        padding: 14px 12px 70px; /* espaço pro menu embaixo */
    }

    .card-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .card {
        padding: 14px 14px 12px;
    }

    .card-value {
        font-size: 18px;
    }

    .chart-row {
        flex-direction: column;
    }
}

/* ===========================
   CARDS / BOXES GENÉRICOS
   =========================== */
.table-card,
.card-box {
    background: #ffffff;
    padding: 20px 18px;
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
    margin-bottom: 18px;
    border: 1px solid #e5e7eb;
}

.table-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #111827;
}

.table-subtitle {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 12px;
}

/* ===========================
   TABLES
   =========================== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: thin;
}

.table-responsive::-webkit-scrollbar {
    height: 6px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 999px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.table th {
    font-weight: 600;
    background: #f3f4f6;
    padding: 10px 12px;
    font-size: 13px;
    color: #4b5563;
    text-align: left;
}

.table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 13px;
    color: #111827;
    vertical-align: middle;
}

.table tr:last-child td {
    border-bottom: none;
}

/* TAGS */
.tag {
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}

.tag-income {
    background: #dcfce7;
    color: #166534;
}

.tag-expense {
    background: #fee2e2;
    color: #b91c1c;
}

/* ===========================
   FORMULÁRIOS
   =========================== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.form-row {
    display: flex;
    flex-direction: column;
}

.label {
    font-size: 13px;
    margin-bottom: 5px;
    font-weight: 600;
    color: #374151;
}

.input,
.select {
    padding: 11px 12px;
    border-radius: 12px;
    font-size: 14px;
    border: 1px solid #e5e7eb;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
    outline: none;
    background: #ffffff;
}

.input::placeholder,
.select::placeholder {
    color: #9ca3af;
}

.input:focus,
.select:focus {
    border-color: #21C25E;
    box-shadow: 0 0 0 2px rgba(33, 194, 94, 0.18);
    background: #f9fffc;
}

/* BOTÕES */
.btn-primary {
    background: #21C25E;
    color: white;
    padding: 11px 20px;
    border-radius: 999px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.16s ease, transform 0.12s ease, box-shadow 0.16s ease;
}

.btn-primary:hover {
    background: #1aa84f;
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(33, 194, 94, 0.35);
}

.btn-ghost {
    background: none;
    color: #374151;
    padding: 8px 14px;
    border-radius: 999px;
    text-decoration: none;
    cursor: pointer;
    font-size: 13px;
    border: 1px solid transparent;
    transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.btn-ghost:hover {
    background: #f3f4f6;
    border-color: #e5e7eb;
}

/* Textos auxiliares */
.text-center {
    text-align: center;
}

/* ===========================
   LOGIN
   =========================== */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: radial-gradient(circle at top, #21C25E 0, #111827 55%);
}

.login-card {
    background: #ffffff;
    padding: 32px 28px 26px;
    width: 360px;
    border-radius: 22px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top left, rgba(33, 194, 94, 0.18), transparent 50%);
    pointer-events: none;
}

.login-title {
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 20px;
    text-align: center;
    color: #21C25E;
}

/* Ajuste genérico de alertas (Django messages) */
.alert {
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 12px;
}

.alert-danger {
    background: #fee2e2;
    color: #b91c1c;
}

/* Inputs de login reaproveitam as classes principais */
.login-card .form-group {
    margin-bottom: 12px;
}
.chart-card {
    position: relative;
}

.chart-card canvas {
    width: 100% !important;
    height: 260px !important;  /* <-- altura real */
    display: block;
}
/* ============================
   AJUSTE: CENTRALIZAR CONTEÚDO
   ============================ */

/* Área principal da direita */
.main-content {
    flex: 1;
    padding: 32px 40px;
}

/* Centraliza o header e o conteúdo no "meio" da tela principal */
.page-header,
.page-content {
    max-width: 1100px;      /* largura máxima do miolo */
    margin-left: auto;      /* centraliza horizontalmente */
    margin-right: auto;
}

/* Garante que os cards ocupem toda a largura do container central */
.page-content .card {
    width: 100%;
}

