/* ==========================================
   VARIÁVEIS & THEME SYSTEM (Premium & Discreet)
   ========================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Light Theme (Premium Clean) */
    --bg-body: #e2e8f0;
    --bg-surface: rgba(255, 255, 255, 0.75); /* Glassmorphism base */
    --bg-sidebar: rgba(255, 255, 255, 0.85);
    --text-main: #334155; /* Slate 700 */
    --text-muted: #8692a1; /* Slate 500 */
    --text-sidebar: #475569;
    --border-color: rgba(255, 255, 255, 0.5);
    --border-solid: #e2e8f0;
    
    /* Discreet Palette */
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: rgba(59, 130, 246, 0.1);
    
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.1);
    
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.1);
    
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.1);
    
    /* Premium Shadows & Radius */
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08);
    
    --radius-sm: 12px;
    --radius: 20px;
    --radius-full: 9999px;
    
    --glass-blur: blur(12px);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    /* Dark Theme (Modern Dark) */
    --bg-body: #0f172a; /* Slate 900 */
    --bg-surface: rgba(30, 41, 59, 0.65); /* Glassmorphism dark */
    --bg-sidebar: rgba(15, 23, 42, 0.85);
    --text-main: #f8fafc; /* Slate 50 */
    --text-muted: #94a3b8; /* Slate 400 */
    --text-sidebar: #cbd5e1;
    --border-color: rgba(255, 255, 255, 0.05);
    --border-solid: #334155;
    
    --primary: #60a5fa;
    --primary-hover: #3b82f6;
    --primary-light: rgba(96, 165, 250, 0.15);
    
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4);
}

/* ==========================================
   RESET & BASE
   ========================================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    background-image: radial-gradient(circle at top left, var(--primary-light), transparent 45%);
    color: var(--text-main);
    line-height: 1.5;
    transition: background-color var(--transition), color var(--transition);
}

.hidden { display: none !important; }

/* ==========================================
   TYPOGRAPHY & UTILITIES
   ========================================== */
h1, h2, h3, h4 { color: var(--text-main); font-weight: 600; letter-spacing: -0.02em; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); font-size: 0.875rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1.5rem; }
.ml-auto { margin-left: auto; }

/* ==========================================
   LOGIN VIEW
   ========================================== */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
    background: radial-gradient(circle at top left, var(--primary-light), transparent 50%), var(--bg-body);
}

.login-card {
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    padding: 3rem 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 380px;
    text-align: center;
    position: relative;
}

.login-header { margin-bottom: 2.5rem; }
.login-header h2 { font-size: 1.5rem; margin-top: 0.5rem; }
.login-header .logo-icon { font-size: 2.5rem; color: var(--primary); margin-bottom: 1rem; }
.logo-img {
    height: 102px; /* Ajuste a altura conforme a proporção do seu logo */
    width: auto;
    object-fit: contain;
    margin-bottom: 0.5rem;
    transition: var(--transition);
}

[data-theme="dark"] .logo-img {
    filter: invert(1);
}

/* Assinatura no Rodapé do Login */
.login-footer {
    margin-top: 2.5rem;
    font-size: 0.5rem;
    color: var(--text-muted);
    opacity: 0.5;
    letter-spacing: 0.02em;
}

/* ==========================================
   LAYOUT (SIDEBAR + MAIN)
   ========================================== */
#main-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.5rem;
    color: var(--text-sidebar);
    text-decoration: none;
    transition: var(--transition);
    font-weight: 500;
    font-size: 0.95rem;
    margin: 0 0.75rem 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
}

.nav-item:hover, .nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

.user-info { display: flex; align-items: center; gap: 0.75rem; }
.user-details { display: flex; flex-direction: column; font-size: 0.8rem; }
.user-name { color: var(--text-main); font-weight: 600; }

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-body);
}

.top-header {
    height: 70px;
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 10;
}

.header-left { display: flex; align-items: center; gap: 1rem; }

.page-container {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    scroll-behavior: smooth;
}

/* ==========================================
   COMPONENTS (Cards, Buttons, Inputs)
   ========================================== */
.card {
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

/* KPIs Premium */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.kpi-card {
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

/* Gradiente sutil no fundo do KPI */
.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 4px;
    background: var(--text-muted);
    opacity: 0.5;
}
.kpi-card.success::before { background: var(--success); opacity: 1; }
.kpi-card.danger::before { background: var(--danger); opacity: 1; }
.kpi-card.primary::before { background: var(--primary); opacity: 1; }

.kpi-card h3 { 
    font-size: 0.75rem; 
    color: var(--text-muted); 
    text-transform: uppercase; 
    letter-spacing: 0.05em; 
    font-weight: 600;
}

.kpi-card p { 
    font-size: 2rem; 
    font-weight: 700; 
    letter-spacing: -0.03em;
    color: var(--text-main);
}

/* Reduz o tamanho geral dos KPIs */
.kpi-card { padding: 1.1rem; gap: 0.3rem; }
.kpi-card h3 { font-size: 0.7rem; }
.kpi-card p { font-size: 1.5rem; }

/* Grid 2 colunas + 1 linha cheia (Entradas/Saídas lado a lado, Saldo abaixo) */
.kpi-grid-2-1 {
    grid-template-columns: 1fr 1fr;
}
.kpi-grid-2-1 .kpi-full-row {
    grid-column: 1 / -1;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-full); /* Botões bem arredondados */
    border: none;
    font-family: inherit;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); box-shadow: var(--shadow-md); transform: translateY(-1px); }

.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }

.btn-outline { 
    background: transparent; 
    border: 1px solid var(--border-solid); 
    color: var(--text-main); 
    box-shadow: none;
}
.btn-outline:hover { background: var(--bg-body); }
.btn-outline.active { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

.btn-block { width: 100%; }
.btn-icon { background: transparent; border: none; color: inherit; cursor: pointer; display: flex; box-shadow: none; padding: 0.5rem; border-radius: 50%; }
.btn-icon:hover { background: var(--bg-body); }

/* Forms */
.form-group { margin-bottom: 0.75rem; display: flex; flex-direction: column; }
.form-group label { font-size: 0.85rem; font-weight: 500; margin-bottom: 0.5rem; color: var(--text-muted); }

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.filter-bar .form-group { margin-bottom: 0; }

.button-group {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5rem;
}

input, select, textarea {
    padding: 0.875rem 1rem;
    border: 1px solid var(--border-solid);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}

input:focus, select:focus, textarea:focus { 
    border-color: var(--primary); 
    box-shadow: 0 0 0 3px var(--primary-light); 
}

/* ==========================================
   TABLES
   ========================================== */
.table-responsive { overflow-x: auto; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; text-align: left; } #statement-table { white-space: normal; }
th, td { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border-solid); font-size: 0.8rem; }
th { font-weight: 600; color: var(--text-muted); background: var(--bg-body); text-transform: uppercase; font-size: 0.68rem; letter-spacing: 0.05em; }
tbody tr { transition: var(--transition); }
tbody tr:hover { background: var(--bg-body); }

/* ==========================================
   MODALS (Glassmorphism & Soft Shadows)
   ========================================== */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: var(--transition);
}

.modal-overlay:not(.hidden) {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    width: 100%; max-width: 450px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    max-height: 90vh; overflow-y: auto;
    transform: scale(0.95);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-lg { max-width: 650px; }

.modal-header {
    padding: 1.5rem; 
    border-bottom: 1px solid var(--border-color);
    display: flex; justify-content: space-between; align-items: center;
}
.modal-header h3 { font-size: 1.1rem; }

.modal-body { padding: 1.5rem; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.full-width { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 1rem; margin-top: 1.5rem; }

/* ==========================================
   TOAST GLASSMORPHISM (showToast)
   ========================================== */
.glass-modal {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 2000;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    min-width: 280px;
    max-width: 360px;
    padding: 1rem 1.25rem;
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    transform: translateX(120%);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.glass-modal.active {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
}

.glass-modal-icon {
    flex-shrink: 0;
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
}
.glass-modal-icon.success { background: var(--success-light); color: var(--success); }
.glass-modal-icon.danger { background: var(--danger-light); color: var(--danger); }
.glass-modal-icon.warning { background: var(--warning-light); color: var(--warning); }

.glass-modal-text { flex: 1; }
.glass-modal-text strong { display: block; font-size: 0.95rem; margin-bottom: 0.2rem; }
.glass-modal-text p { font-size: 0.85rem; color: var(--text-muted); margin: 0; }

.glass-modal-close {
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .glass-modal {
        top: 1rem; right: 1rem; left: 1rem;
        max-width: none;
    }
}

/* ==========================================
   CUSTOM ALERT/ERROR MODAL (Substitui o alert() do navegador)
   ========================================== */
.alert-modal {
    text-align: center;
    padding: 2rem 1.5rem;
}
.alert-icon {
    width: 60px; height: 60px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1.5rem auto;
    font-size: 1.5rem;
}
.alert-icon.error { background: var(--danger-light); color: var(--danger); }
.alert-icon.success { background: var(--success-light); color: var(--success); }
.alert-icon.warning { background: var(--warning-light); color: var(--warning); }

.alert-title { font-size: 1.25rem; margin-bottom: 0.5rem; }
.alert-message { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 2rem; }

/* ==========================================
   RESPONSIVE (Mobile First Adjustments)
   ========================================== */
.mobile-only { display: none; }

@media (max-width: 768px) {
    .mobile-only { display: flex; }
    
    .top-header { padding: 0 1rem; height: 60px; }
    .page-container { padding: 1rem; }
    
    .form-grid { grid-template-columns: 1fr; }
    
    .kpi-grid { gap: 0.75rem; }
    .kpi-grid:not(.kpi-grid-2-1):not(.kpi-grid-2x2):not(.lancamentos-grid):not(.contas-grid) {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .kpi-grid-2-1 { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
    .kpi-card { padding: 0.85rem; }
    .kpi-card h3 { font-size: 0.62rem; }
    .kpi-card p { font-size: 1.15rem; }
    
    .modal { margin: 1rem; }
    
    /* Ajustes para botões no mobile ficarem mais fáceis de tocar */
    .btn { padding: 0.875rem 1.25rem; width: 100%; justify-content: center; }
    .form-actions { flex-direction: column-reverse; }
    .form-actions .btn { width: 100%; }
}

/* Logos */
.custom-logo {
    max-height: 40px;
    width: auto;
    object-fit: contain;
}
.login-header .custom-logo {
    max-height: 80px;
    margin-bottom: 1rem;
}

/* ==========================================
   CARROSSEL DASHBOARD
   ========================================== */
.carousel-card { padding: 0; overflow: hidden; }

.carousel-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1200 / 500;
    overflow: hidden;
    border-radius: var(--radius);
}

.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(15, 23, 42, 0.45);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    z-index: 2;
}
.carousel-nav:hover { background: rgba(15, 23, 42, 0.7); }
.carousel-nav-prev { left: 0.75rem; }
.carousel-nav-next { right: 0.75rem; }

@media (max-width: 480px) {
    .carousel-nav { width: 30px; height: 30px; }
}

.carousel-track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.6s ease-in-out;
}

.carousel-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    flex-shrink: 0;
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 7px;
    padding: 10px 0 4px;
}
.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-solid);
    cursor: pointer;
    transition: background 0.3s, transform 0.3s;
}
.carousel-dot.active {
    background: var(--primary);
    transform: scale(1.3);
}

.table-scroll-y {
    max-height: 480px;
    overflow-y: auto;
}
.table-scroll-y thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}

/* ==========================================
   BOTÕES GRANDES - PÁGINA LANÇAMENTOS
   ========================================== */
.kpi-grid.lancamentos-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.kpi-grid.lancamentos-grid .kpi-card {
    padding: 2rem 1.5rem !important;
    min-height: 165px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.kpi-grid.lancamentos-grid .kpi-card h3 {
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.kpi-grid.lancamentos-grid .kpi-card p {
    font-size: 1.6rem !important;
    font-weight: 700 !important;
    color: var(--text-main);
}

@media (max-width: 480px) {
    .kpi-grid.lancamentos-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
    .kpi-grid.lancamentos-grid .kpi-card {
        padding: 1.5rem 0.75rem !important;
        min-height: 130px;
    }
    .kpi-grid.lancamentos-grid .kpi-card h3 { font-size: 0.65rem !important; }
    .kpi-grid.lancamentos-grid .kpi-card p { font-size: 1.2rem !important; }
}

/* ==========================================
   KPIs QUADRADOS 2x2 - PÁGINA REPARTIÇÃO
   ========================================== */
.kpi-grid-2x2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-grid-2x2 .kpi-card {
    height: 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.5rem 1rem;
}

.kpi-grid-2x2 .kpi-card h3 {
    font-size: 0.7rem;
    margin-bottom: 0.25rem;
    line-height: 1.1;
}

.kpi-grid-2x2 .kpi-card p {
    font-size: 1.15rem;
}

@media (max-width: 480px) {
    .kpi-grid-2x2 {
        gap: 0.6rem;
    }
    .kpi-grid-2x2 .kpi-card {
        height: 80px;
    }
}

/* ==========================================
   BOTÕES EXPORTAR/VISUALIZAR PDF - sempre em linha
   ========================================== */
.pdf-actions {
    display: flex;
    flex-direction: row;
    gap: 0.75rem;
}
.pdf-actions .btn {
    flex: 1;
}

/* ==========================================
   TABELA DE CONSULTA - colunas compactas
   ========================================== */
#statement-table {
    table-layout: fixed;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

#statement-table thead th:first-child {
    border-radius: 10px 0 0 0;
}

#statement-table thead th:last-child {
    border-radius: 0 10px 0 0;
}

#statement-table th,
#statement-table td {
    padding: 0.55rem 0.5rem;
    font-size: 0.78rem;
    white-space: normal;
}

#statement-table th:nth-child(1), #statement-table td:nth-child(1) { width: 18%; }
#statement-table th:nth-child(2), #statement-table td:nth-child(2) { width: 52%; }
#statement-table th:nth-child(3), #statement-table td:nth-child(3) { width: 30%; text-align: right; }

#statement-table td:nth-child(2) strong,
#statement-table td:nth-child(2) small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


#statement-table td:nth-child(2) strong {
    font-size: 0.8rem;
    line-height: 1;
    margin-bottom: 0;
    display: block;
}

#statement-table td:nth-child(2) small {
    font-size: 0.68rem;
    line-height: 1;
    margin-top: 1px;
    display: block;
}

#statement-table td:nth-child(2) br {
    display: none;
}

.table-scroll-y {
    max-height: 480px;
    overflow-y: auto;
}
.table-scroll-y thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}

@media (max-width: 480px) {
    .pdf-actions {
        gap: 0.5rem;
    }
    .pdf-actions .btn {
        padding: 0.7rem 0.5rem !important;
        font-size: 0.78rem;
    }
    .pdf-actions .btn .material-symbols-outlined {
        font-size: 1.1rem;
    }
    #statement-table th, #statement-table td {
        padding: 0.45rem 0.35rem;
        font-size: 0.7rem;
    }
    #statement-table td:nth-child(2) strong { font-size: 0.72rem; }
    #statement-table td:nth-child(2) small { font-size: 0.58rem; }
}

/* ==========================================
   DASHBOARD - cabeçalho do gráfico com filtros
   ========================================== */
.chart-header-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}
.chart-header-row h3 { margin: 0; }

/* ==========================================
   DASHBOARD - totalizadores por conta
   ========================================== */
.contas-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.conta-kpi {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    gap: 0.75rem;
    padding: 1rem;
}

.conta-kpi-icon {
    width: 36px;
    height: 36px;
    object-fit: contain;
    flex-shrink: 0;
}


.conta-kpi .kpi-data h3 {
    font-size: 0.65rem;
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.conta-kpi .kpi-data p {
    font-size: 0.95rem;
}

@media (max-width: 768px) {
    .contas-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .contas-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    .conta-kpi {
        padding: 0.7rem;
        gap: 0.5rem;
    }
    .conta-kpi-icon {
        width: 28px;
        height: 28px;
    }
}

/* Borda degradê individual por banco */
.conta-kpi {
    border: 1.5px solid transparent;
    background-clip: padding-box;
}

.contas-grid .kpi-card:nth-child(1) { /* CEF | CX ADM - azul */
    background:
        linear-gradient(var(--bg-surface), var(--bg-surface)) padding-box,
        linear-gradient(135deg, #1d4ed8, #93c5fd) border-box;
}
.contas-grid .kpi-card:nth-child(2) { /* CEF | APLICAÇÃO - verde */
    background:
        linear-gradient(var(--bg-surface), var(--bg-surface)) padding-box,
        linear-gradient(135deg, #059669, #6ee7b7) border-box;
}
.contas-grid .kpi-card:nth-child(3) { /* CC | CASAS ORAÇÃO - roxo */
    background:
        linear-gradient(var(--bg-surface), var(--bg-surface)) padding-box,
        linear-gradient(135deg, #7c3aed, #c4b5fd) border-box;
}
.contas-grid .kpi-card:nth-child(4) { /* BB | CC BRASIL - amarelo */
    background:
        linear-gradient(var(--bg-surface), var(--bg-surface)) padding-box,
        linear-gradient(135deg, #d97706, #fde68a) border-box;
}

#coletasChart {
    width: 100% !important;
    height: 220px !important;
    display: block;
}

#reparticao-view .table-card table {
    table-layout: fixed;
    width: 100%;
}

#reparticao-view .table-card th,
#reparticao-view .table-card td {
    width: 33.33%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}   

#reparticao-view .form-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.75rem;
}

#reparticao-view .form-actions .btn {
    width: auto;
    flex: 0 0 auto;
}

#reparticao-view .form-actions .ml-auto {
    margin-left: auto;
}

@media (max-width: 768px) {
    #reparticao-view .form-actions {
        flex-direction: row;
        flex-wrap: wrap;
    }

    #reparticao-view .form-actions .btn {
        width: auto;
        flex: 1 1 auto;
    }

    #reparticao-view .form-actions .ml-auto {
        margin-left: 0;
        order: 99;
        width: 100%;
        flex: 1 1 100%;
    }
}

/* ==========================================
   HEADER NOVO
   ========================================== */
.top-header {
    height: 64px;
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border-color);
    border-radius: 0 0 20px 20px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 1.25rem;
    z-index: 50;
    position: sticky;
    top: 0;
}

.header-left  { display: flex; align-items: center; justify-content: flex-start; }
.header-center { display: flex; align-items: center; justify-content: center; }
.header-right { display: flex; align-items: center; justify-content: flex-end; }

.header-logo-img {
    height: 48px;
    width: auto;
    object-fit: contain;
}

[data-theme="dark"] .header-logo-img { filter: invert(1); }

.top-header .header-center h2 {
    font-size: 1.1rem;
    font-weight: 00;
    letter-spacing: -0.01em;
    color: var(--text-main);
    margin: 0;
}

/* ==========================================
   BOTTOM NAV
   ========================================== */
.bottom-nav {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 2rem);
    max-width: 480px;
    height: 64px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 9999px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 0.5rem;
    z-index: 200;
}

[data-theme="dark"] .bottom-nav {
    background: rgba(15, 23, 42, 0.35);
    border-color: rgba(255, 255, 255, 0.06);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 0.4rem 0.75rem;
    border-radius: 9999px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.6rem;
    font-weight: 500;
    transition: var(--transition);
    flex: 1;
}

.bottom-nav-item span.material-symbols-outlined {
    font-size: 1.4rem;
    transition: var(--transition);
}

.bottom-nav-item.active {
    color: var(--primary);
    background: var(--primary-light);
}

.bottom-nav-item.active span.material-symbols-outlined {
    font-variation-settings: 'FILL' 1;
}

/* Espaço para o bottom nav não cobrir conteúdo */
.page-container {
    padding-bottom: 6rem;
}

/* ==========================================
   MODAL PERFIL
   ========================================== */
.modal-perfil-backdrop {
    position: fixed;
    inset: 0;
    z-index: 299;
}

.modal-perfil {
    position: fixed;
    top: 72px;
    right: 1rem;
    width: 260px;
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    z-index: 300;
    overflow: hidden;
    transform: scale(0.95) translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.modal-perfil:not(.hidden) {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.modal-perfil-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-perfil-avatar .material-symbols-outlined {
    font-size: 2.5rem;
    color: var(--primary);
}

.modal-perfil-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.modal-perfil-info strong {
    font-size: 0.9rem;
    color: var(--text-main);
}

.perfil-cpf {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.modal-perfil-body {
    padding: 0.5rem;
}

.modal-perfil-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
}

.modal-perfil-item:hover { background: var(--bg-body); }

.modal-perfil-item.danger { color: var(--danger); }
.modal-perfil-item.danger:hover { background: var(--danger-light); }

/* Layout sem sidebar */
#main-layout {
    flex-direction: column;
}

/* ==========================================
   LANÇAMENTOS - Cards Modernos
   ========================================== */
.lanc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.lanc-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    padding: 1.75rem 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    min-height: 130px;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.lanc-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.lanc-danger  { background: linear-gradient(135deg, rgba(239,68,68,0.18) 0%, rgba(239,68,68,0.06) 100%); border: 1px solid rgba(239,68,68,0.2); }
.lanc-success { background: linear-gradient(135deg, rgba(16,185,129,0.18) 0%, rgba(16,185,129,0.06) 100%); border: 1px solid rgba(16,185,129,0.2); }
.lanc-warning { background: linear-gradient(135deg, rgba(245,158,11,0.18) 0%, rgba(245,158,11,0.06) 100%); border: 1px solid rgba(245,158,11,0.2); }
.lanc-primary { background: linear-gradient(135deg, rgba(59,130,246,0.18) 0%, rgba(59,130,246,0.06) 100%); border: 1px solid rgba(59,130,246,0.2); }

.lanc-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    z-index: 1;
}

.lanc-label {
    font-size: 1.40rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

.lanc-sub {
    font-size: 1.0rem;
    font-weight: 500;
    color: var(--text-muted);
}

.lanc-icon-bg {
    position: absolute;
    right: -0.5rem;
    bottom: -0.5rem;
    font-size: 5.5rem;
    opacity: 0.08;
    line-height: 1;
    pointer-events: none;
    font-variation-settings: 'FILL' 1;
}

.lanc-danger  .lanc-icon-bg { color: var(--danger); }
.lanc-success .lanc-icon-bg { color: var(--success); }
.lanc-warning .lanc-icon-bg { color: var(--warning); }
.lanc-primary .lanc-icon-bg { color: var(--primary); }

@media (max-width: 480px) {
    .lanc-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
    .lanc-card { min-height: 110px; padding: 1.25rem 1rem; }
    .lanc-label { font-size: 1rem; }
    .lanc-sub   { font-size: 0.7rem; }
    .lanc-icon-bg { font-size: 4rem; }
}

/* ==========================================
   KPI - Ícone de fundo discreto
   ========================================== */
.kpi-card {
    position: relative;
    overflow: hidden;
}

.kpi-icon-bg {
    position: absolute;
    right: -0.5rem;
    bottom: -0.5rem;
    font-size: 4.5rem;
    opacity: 0.07;
    pointer-events: none;
    font-variation-settings: 'FILL' 1;
    color: currentColor;
}

/* ==========================================
   RODAPÉ ASSINATURA
   ========================================== */
.page-footer {
    text-align: center;
    padding: 1.5rem 0 0.5rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.5;
    letter-spacing: 0.04em;
}

/* ==========================================
   CONTROLE DE GASTOS
   ========================================== */
.gastos-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: start;
}

.gastos-indicador {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-solid);
    background: var(--bg-body);
}

.gastos-ind-icon {
    font-size: 2rem;
    font-variation-settings: 'FILL' 1;
    flex-shrink: 0;
}

.gastos-ind-ok   { color: var(--success); }
.gastos-ind-alto { color: var(--danger);  }

@media (max-width: 480px) {
    .gastos-grid { grid-template-columns: 1fr; }
}