:root {
    --primary: #2c5e4f;
    --primary-dark: #1e433a;
    --accent: #c9a04d;
    --bg: #f4f6f5;
    --card-bg: #ffffff;
    --text: #26312e;
    --muted: #6b7a75;
    --danger: #b3261e;
    --success: #2e7d32;
    --border: #e1e6e3;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Segoe UI', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Auth pages */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-box {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 420px;
}
.auth-box h1 { font-size: 1.3rem; color: var(--primary-dark); margin-top: 0; }
.auth-box label { display: block; margin-top: 1rem; font-size: 0.85rem; color: var(--muted); }
.auth-box input, .auth-box select {
    width: 100%; padding: 0.6rem; margin-top: 0.25rem;
    border: 1px solid var(--border); border-radius: 6px; font-size: 0.95rem;
}
.auth-box button, button, .btn {
    display: inline-block;
    background: var(--primary);
    color: #fff; border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    margin-top: 1.2rem;
}
button:hover, .btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn-danger { background: var(--danger); }
.btn-secondary { background: #6b7a75; }

/* App layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: 220px; background: var(--primary-dark); color: #fff;
    padding: 1.5rem 0; flex-shrink: 0;
}
.sidebar h2 { font-size: 1.1rem; padding: 0 1.2rem 1rem; margin: 0; border-bottom: 1px solid rgba(255,255,255,0.15); }
.sidebar a {
    display: block; color: #d9e2df; padding: 0.65rem 1.2rem; font-size: 0.9rem;
}
.sidebar a:hover, .sidebar a.active { background: var(--primary); color: #fff; text-decoration: none; }
.main { flex: 1; padding: 1.8rem 2.2rem; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.topbar .user { font-size: 0.9rem; color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.card {
    background: var(--card-bg); border-radius: 10px; padding: 1.2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05); border-left: 4px solid var(--primary);
}
.card.expense { border-left-color: var(--danger); }
.card.balance { border-left-color: var(--accent); }
.card h3 { margin: 0 0 0.4rem; font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.card .value { font-size: 1.6rem; font-weight: 600; }

.panel { background: var(--card-bg); border-radius: 10px; padding: 1.5rem; box-shadow: 0 2px 8px rgba(0,0,0,0.05); margin-bottom: 1.5rem; }
.panel h2 { margin-top: 0; font-size: 1.1rem; color: var(--primary-dark); }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; }
tr:hover { background: #fafcfb; }
.text-right { text-align: right; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.form-grid label { display: block; margin-bottom: 0.3rem; font-size: 0.85rem; color: var(--muted); }
.form-grid input, .form-grid select, .form-grid textarea {
    width: 100%; padding: 0.55rem; border: 1px solid var(--border); border-radius: 6px; font-size: 0.9rem;
}

.alert { padding: 0.7rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.9rem; }
.alert-success { background: #e6f4ea; color: var(--success); }
.alert-error { background: #fbe9e7; color: var(--danger); }

.badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 20px; font-size: 0.75rem; }
.badge-income { background: #e6f4ea; color: var(--success); }
.badge-expense { background: #fbe9e7; color: var(--danger); }

@media print {
    .sidebar, .topbar, .no-print { display: none !important; }
    .main { padding: 0; }
}
