:root {
    /* Tema Escuro (Padrão) */
    --bg: #0b0d12;
    --panel: #131722;
    --panel-2: #171c28;
    --line: rgba(255, 255, 255, 0.08);
    --text: #f8fafc;
    --muted: #94a3b8;
    --green: #16c784;
    --red: #ff5c5c;
    --purple: #8b5cf6;
    --radius: 20px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    --modal-bg: rgba(0, 0, 0, 0.7);
}

/* Tema Claro */
[data-theme="light"] {
    --bg: #f1f5f9;
    --panel: #ffffff;
    --panel-2: #f8fafc;
    --line: rgba(0, 0, 0, 0.08);
    --text: #0f172a;
    --muted: #64748b;
    --green: #059669;
    --red: #e11d48;
    --purple: #7c3aed;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    --modal-bg: rgba(255, 255, 255, 0.7);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg);
    background-image: radial-gradient(circle at top, var(--panel-2) 0%, var(--bg) 45%);
    color: var(--text);
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

.container { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--panel);
    border-right: 1px solid var(--line);
    padding: 24px;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s, border-color 0.3s;
}

.logo { display: flex; align-items: center; gap: 12px; margin-bottom: 40px; font-size: 20px; font-weight: 800; }
.sidebar nav a {
    display: flex; align-items: center; gap: 12px; color: var(--muted); text-decoration: none;
    padding: 12px 16px; border-radius: 12px; margin-bottom: 8px; font-weight: 500; transition: 0.2s;
}
.sidebar nav a:hover, .sidebar nav a.active {
    background: rgba(139, 92, 246, 0.1); color: var(--text); border-left: 3px solid var(--purple);
}
.sidebar-footer { margin-top: auto; }

/* Main Content */
.main-content { flex: 1; padding: 32px 40px; overflow-y: auto; }
.top-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px; }
.top-header h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; }
.subtitle { color: var(--muted); font-size: 14px; margin-top: 4px; }
.header-actions { display: flex; gap: 16px; }

/* Buttons */
button { cursor: pointer; font-family: 'Inter', sans-serif; transition: 0.2s; }
.btn-primary { background: linear-gradient(135deg, var(--purple) 0%, #6d5efc 100%); color: white; border: none; border-radius: 12px; padding: 12px 20px; font-weight: 600; }
.btn-primary:hover { box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4); transform: translateY(-1px); }
.btn-secondary { background: transparent; border: 1px solid var(--line); color: var(--text); border-radius: 12px; padding: 12px 20px; font-weight: 600; }
.btn-secondary:hover { background: rgba(139, 92, 246, 0.1); }
.btn-danger { background: var(--red); color: white; border: none; border-radius: 12px; padding: 12px 20px; font-weight: 600; }
.btn-ghost { background: transparent; color: var(--muted); border: none; padding: 12px; width: 100%; text-align: left; }
.btn-ghost:hover { color: var(--text); }
.w-100 { width: 100%; margin-top: 16px; }

/* Cards Genéricos */
.card {
    background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: 24px; box-shadow: var(--shadow); transition: transform 0.3s ease, background 0.3s, border-color 0.3s;
}
.card:hover { transform: translateY(-2px); border-color: rgba(139, 92, 246, 0.3); }
.card h3 { font-size: 16px; font-weight: 600; margin-bottom: 20px; color: var(--muted); }

/* KPI Grid */
.kpi-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 24px; margin-bottom: 24px; }
.kpi-label { font-size: 13px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-value { font-size: 48px; font-weight: 800; margin: 12px 0; color: var(--text); letter-spacing: -1px; }
.kpi-value-small { font-size: 28px; font-weight: 700; margin-top: 12px; }
.kpi-trend { font-size: 13px; color: var(--green); display: flex; align-items: center; gap: 6px; }

/* Charts Grid */
.analytics-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; margin-bottom: 24px; }
.chart-wrapper { position: relative; height: 220px; width: 100%; display: flex; justify-content: center; }

/* Bottom Grid (Lists & Goals) */
.bottom-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
.transaction-list { list-style: none; }
.transaction-list li { display: flex; justify-content: space-between; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); }
.transaction-list li:last-child { border-bottom: none; }
.t-info strong { display: block; font-size: 15px; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.t-info small { color: var(--muted); font-size: 13px; background: var(--line); padding: 4px 8px; border-radius: 6px; }
.t-value { font-weight: 700; font-size: 16px; color: var(--red); }
.t-value.positive { color: var(--green); }

/* Goals */
.goal-item { margin-bottom: 20px; }
.goal-info { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 8px; font-weight: 500; }
.goal-info span:last-child { color: var(--muted); }
.progress-bar { width: 100%; height: 8px; background: var(--line); border-radius: 10px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--purple); border-radius: 10px; transition: width 0.5s ease; }

/* Modals */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--modal-bg); backdrop-filter: blur(5px);
    display: none; justify-content: center; align-items: center; z-index: 1000;
}
.modal-content {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 32px; width: 100%; max-width: 400px; box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    animation: modalSlideIn 0.3s ease-out;
}
@keyframes modalSlideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.modal-header h3 { font-size: 20px; font-weight: 700; color: var(--text); }
.close-btn { background: transparent; border: none; color: var(--muted); font-size: 20px; padding: 4px; }
.close-btn:hover { color: var(--text); }
.input-group { margin-bottom: 16px; }
.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.input-group label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; font-weight: 500; }
.input-group input, .input-group select {
    width: 100%; background: var(--bg); border: 1px solid var(--line); color: var(--text);
    padding: 14px; border-radius: 10px; font-size: 15px; outline: none; transition: 0.2s;
}
.input-group input:focus, .input-group select:focus { border-color: var(--purple); }
.resultado-simulacao { margin-top: 16px; font-size: 16px; font-weight: 700; color: var(--green); text-align: center; }

/* Lixeira */
.btn-delete {
    background: transparent; border: none; color: var(--muted);
    cursor: pointer; transition: 0.2s; margin-left: 12px; font-size: 14px;
}
.btn-delete:hover { color: var(--red); }

/* Responsividade Mobile */
@media (max-width: 992px) {
    .container { flex-direction: column; }
    .sidebar { width: 100%; flex-direction: row; justify-content: space-between; align-items: center; padding: 16px; border-right: none; border-bottom: 1px solid var(--line); }
    .logo { margin-bottom: 0; }
    .sidebar nav, .sidebar-footer { display: none; }
    .main-content { padding: 20px; }
    .kpi-grid, .analytics-grid, .bottom-grid { grid-template-columns: 1fr; }
    .header-actions { flex-direction: column; width: 100%; gap: 8px; margin-top: 16px; }
    .top-header { flex-direction: column; align-items: flex-start; }
}