:root {
    --bg: #f0f2f5;
    --sidebar-bg: #1e1e2d;
    --white: #ffffff;
    --text-dark: #333;
    --text-light: #888;
    --green: #2ecc71;
    --red: #e74c3c;
    --blue: #3498db;
    --shadow: 0 5px 15px rgba(0,0,0,0.05);
}

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

body {
    background-color: var(--bg);
    color: var(--text-dark);
    height: 100vh;
    overflow: hidden; /* Prevent full page scroll, scroll inside main */
}

.dashboard-container {
    display: flex;
    height: 100%;
}

/* --- Sidebar --- */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--white);
    display: flex;
    flex-direction: column;
    padding: 30px 20px;
    transition: 0.3s;
}

.sidebar .logo {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 50px;
    color: var(--white);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    color: #a2a3b7;
    text-decoration: none;
    border-radius: 10px;
    transition: 0.3s;
    margin-bottom: 5px;
}

.sidebar nav a:hover, .sidebar nav a.active {
    background: rgba(255,255,255,0.1);
    color: var(--white);
}

.user-profile {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 15px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.avatar {
    width: 40px;
    height: 40px;
    background: var(--blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.btn-clear {
    background: none;
    border: 1px solid var(--red);
    color: var(--red);
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    transition: 0.3s;
}

.btn-clear:hover { background: var(--red); color: white; }

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    padding: 25px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.stat-card h3 { font-size: 14px; color: var(--text-light); margin-bottom: 10px; }
.stat-card h2 { font-size: 28px; font-weight: 700; }

.icon-bg {
    position: absolute;
    right: 20px;
    bottom: 20px;
    font-size: 40px;
    opacity: 0.1;
}

.income h2 { color: var(--green); }
.expense h2 { color: var(--red); }

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}

/* Chart Section */
.chart-section {
    background: var(--white);
    padding: 25px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    height: 400px; /* Fixed height for consistency */
    display: flex;
    flex-direction: column;
}

.chart-container {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
}

/* Transaction Form Section */
.transaction-section {
    background: var(--white);
    padding: 25px;
    border-radius: 15px;
    box-shadow: var(--shadow);
}

.transaction-section h3 { margin-bottom: 20px; }

.form-control { margin-bottom: 15px; }

.form-control label { display: block; margin-bottom: 5px; font-weight: 600; font-size: 14px;}
.hint { font-size: 12px; color: var(--text-light); margin-bottom: 5px; }

.form-control input {
    width: 100%;
    padding: 12px;
    border: 1px solid #eee;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: 0.3s;
}

.form-control input:focus { border-color: var(--blue); }

.btn {
    width: 100%;
    background: var(--sidebar-bg);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.3s;
}

.btn:hover { background: var(--blue); }

/* History List */
.recent-history { margin-top: 30px; height: 200px; overflow-y: auto; }

.list { list-style: none; }

.list li {
    background-color: #f9f9f9;
    color: var(--text-dark);
    display: flex;
    justify-content: space-between;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 5px;
    border-right: 5px solid transparent;
    font-size: 14px;
}

.list li.plus { border-right-color: var(--green); }
.list li.minus { border-right-color: var(--red); }

@media (max-width: 900px) {
    .content-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr; }
    .sidebar { position: fixed; left: -260px; z-index: 100; height: 100%; }
    .main-content { margin-left: 0; }
}