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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: #f5f5f5;
    color: #1e293b;
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #2563eb 0%, #1e40af 100%);
    color: white;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 32px;
}

.logo-text h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 2px;
}

.logo-text p {
    font-size: 11px;
    opacity: 0.8;
}

.sidebar-menu {
    padding: 12px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.menu-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-left-color: white;
    font-weight: 600;
}

.menu-icon {
    font-size: 18px;
}

.menu-label {
    font-size: 14px;
}

/* MAIN CONTENT */
.main-content {
    margin-left: 260px;
    flex: 1;
    padding: 32px;
    width: calc(100% - 260px);
}

/* CONTENT HEADER */
.content-header {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
    padding: 28px 32px;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
}

.header-left h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.header-left p {
    font-size: 14px;
    opacity: 0.9;
}

.header-right {
    display: flex;
    gap: 12px;
}

.filter-select {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    background: white;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-select:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* TABS BUTTONS */
.tabs-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
}

.tab-button {
    flex: 1;
    max-width: 200px;
    padding: 16px 20px;
    border: none;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tab-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.tab-button.active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
}

.tab-button[data-tab="financial"].active {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    box-shadow: 0 4px 16px rgba(249, 115, 22, 0.4);
}

.tab-button[data-tab="actions"].active {
    background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%);
    box-shadow: 0 4px 16px rgba(168, 85, 247, 0.4);
}

.tab-icon {
    font-size: 24px;
}

.tab-text {
    text-align: left;
}

.tab-text strong {
    display: block;
    font-size: 15px;
    font-weight: 700;
}

.tab-text small {
    display: block;
    font-size: 11px;
    opacity: 0.8;
}

.tab-button:not(.active) .tab-text {
    color: #475569;
}

/* TAB CONTENT */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* SECTION */
.section {
    margin-bottom: 32px;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 20px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
}

/* CARDS GRID */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.cards-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.cards-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.cards-grid-5 {
    grid-template-columns: repeat(5, 1fr);
}

/* METRIC CARD - COLORIDO (ESTILO V1) */
.metric-card {
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
    min-height: 160px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* CARDS COLORIDOS SÓLIDOS */
.metric-card.solid-red {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.metric-card.solid-green {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.metric-card.solid-blue {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.metric-card.solid-orange {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: white;
}

/* CARDS BRANCOS/CLAROS */
.metric-card.light {
    background: white;
    color: #1e293b;
    border: 1px solid #e2e8f0;
}

.metric-card-header {
    margin-bottom: 16px;
}

.metric-card-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
    opacity: 0.95;
}

.metric-card-subtitle {
    font-size: 12px;
    opacity: 0.8;
}

.metric-card-value {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 12px;
    line-height: 1;
}

.metric-card-unit {
    font-size: 14px;
    font-weight: 600;
    opacity: 0.9;
    margin-left: 4px;
}

.metric-card-desc {
    font-size: 13px;
    opacity: 0.85;
    line-height: 1.4;
}

/* VALORES COLORIDOS EM CARDS CLAROS */
.metric-card.light .value-red { color: #dc2626; }
.metric-card.light .value-green { color: #059669; }
.metric-card.light .value-blue { color: #2563eb; }
.metric-card.light .value-orange { color: #ea580c; }
.metric-card.light .value-gray { color: #64748b; }

.metric-card-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    margin-top: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-card-badge.red { background: rgba(220, 38, 38, 0.2); color: white; }
.metric-card-badge.green { background: rgba(5, 150, 105, 0.2); color: white; }
.metric-card-badge.yellow { background: rgba(234, 88, 12, 0.2); color: white; }
.metric-card-badge.blue { background: rgba(37, 99, 235, 0.2); color: white; }

/* LOADING */
.loading {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
}

.spinner {
    border: 3px solid #e2e8f0;
    border-top: 3px solid #2563eb;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ERROR */
.error {
    background: #fee2e2;
    border: 2px solid #fecaca;
    border-radius: 8px;
    padding: 16px;
    color: #991b1b;
    margin: 20px 0;
}

/* GRÁFICOS */
.chart-container {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 24px;
}

.chart-header {
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
}

.chart-title {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
}

.chart-subtitle {
    font-size: 13px;
    color: #64748b;
}

.chart-canvas-wrapper {
    position: relative;
    height: 300px;
    margin-top: 20px;
}

.chart-canvas-wrapper.tall {
    height: 400px;
}

.chart-canvas-wrapper canvas {
    max-height: 100%;
}

.charts-grid-2 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

/* SPARKLINES */
.sparkline-container {
    margin-top: 12px;
    height: 40px;
    width: 100%;
}

.sparkline-wrapper {
    position: relative;
    height: 40px;
}

.sparkline-wrapper canvas {
    width: 100% !important;
    height: 40px !important;
}

/* GAUGE CHART */
.gauge-container {
    margin-top: 16px;
    height: 180px;
    position: relative;
}

.gauge-wrapper {
    position: relative;
    height: 180px;
}

.gauge-wrapper canvas {
    width: 100% !important;
    height: 180px !important;
}

.gauge-label {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    font-size: 11px;
    color: #64748b;
    font-weight: 600;
}

@media (max-width: 1024px) {
    .charts-grid-2 {
        grid-template-columns: 1fr;
    }
}

/* RESPONSIVE */
@media (max-width: 1400px) {
    .cards-grid-5 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    .cards-grid-4,
    .cards-grid-5 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .content-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    
    .tabs-buttons {
        flex-wrap: wrap;
    }
    
    .tab-button {
        max-width: none;
    }
}

@media (max-width: 768px) {
    .cards-grid,
    .cards-grid-3,
    .cards-grid-4,
    .cards-grid-5 {
        grid-template-columns: 1fr;
    }
    
    .main-content {
        padding: 16px;
    }
}

/* PÁGINAS ADICIONAIS */
.page-content {
    animation: fadeIn 0.3s ease-in-out;
}

.page-container {
    padding: 40px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    min-height: 400px;
}

.page-container h1 {
    font-size: 32px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 24px;
}

.page-container p {
    font-size: 16px;
    color: #64748b;
}

/* OUTRAS DESPESAS - CARDS */
.despesa-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    transition: all 0.2s ease;
}

.despesa-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.despesa-categoria-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    background: #f1f5f9;
    color: #475569;
}

.despesa-tipo-recorrente {
    color: #059669;
    background: #d1fae5;
}

.despesa-tipo-pontual {
    color: #2563eb;
    background: #dbeafe;
}

.btn-icon {
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
}

.btn-icon:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: scale(1.05);
}

/* ANIMAÇÕES */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================ */
/* MODAL - OUTRAS DESPESAS */
/* ============================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex !important;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-close {
    cursor: pointer;
    transition: all 0.2s;
}

.modal-close:hover {
    transform: scale(1.1);
}

/* Inputs e Selects */
.modal input[type="text"],
.modal input[type="number"],
.modal input[type="date"],
.modal input[type="month"],
.modal select,
.modal textarea {
    font-family: inherit;
    transition: all 0.2s;
}

.modal input:focus,
.modal select:focus,
.modal textarea:focus {
    outline: none;
    border-color: #4f46e5 !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.modal input:hover,
.modal select:hover,
.modal textarea:hover {
    border-color: #9ca3af;
}


/* ============================================ */
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-field,
.form-field-full {
    margin-bottom: 0;
}

.form-field-full {
    grid-column: 1 / -1;
    margin-bottom: 20px;
}

.form-field label,
.form-field-full label {
    display: block;
    font-weight: 600;
    color: #334155;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-field input,
.form-field select,
.form-field textarea,
.form-field-full input,
.form-field-full select,
.form-field-full textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: white;
    color: #1e293b;
}

.form-field textarea,
.form-field-full textarea {
    resize: vertical;
    min-height: 80px;
}

.form-help {
    font-size: 12px;
    color: #6b7280;
    margin-top: 6px;
    line-height: 1.5;
}

.modal-form {
    padding: 24px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
    margin-top: 20px;
}

.btn-primary {
    padding: 10px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    padding: 10px 24px;
    background: white;
    color: #64748b;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

