:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --text: #1b2430;
    --muted: #667085;
    --border: #d8dee9;
    --primary: #1d4ed8;
    --primary-hover: #1e40af;
    --success-bg: #ecfdf3;
    --success-text: #027a48;
    --error-bg: #fef3f2;
    --error-text: #b42318;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    --radius: 16px;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
    width: min(1100px, calc(100% - 2rem));
    margin: 0 auto;
}

.site-header {
    background: #111827;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
}

.brand {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
}
.brand:hover { text-decoration: none; }

.main-nav {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.nav-link {
    color: #d1d5db;
    padding: 0.65rem 0.9rem;
    border-radius: 10px;
}

.nav-link:hover,
.nav-link.active {
    color: #fff;
    background: rgba(255,255,255,0.12);
    text-decoration: none;
}

.page-content {
    padding: 2rem 0 3rem;
}

.card {
    background: var(--surface);
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.card-body { padding: 1.5rem; }
.narrow { max-width: 760px; margin: 0 auto; }

h1, h2 { margin-top: 0; }
h1 { font-size: 2rem; margin-bottom: 0.4rem; }
h2 { font-size: 1.2rem; margin-bottom: 1rem; }
.muted { color: var(--muted); }
.no-margin { margin: 0; }

.stack-form,
.field {
    display: flex;
    flex-direction: column;
}

.stack-form { gap: 1rem; }
label {
    margin-bottom: 0.45rem;
    font-weight: 600;
}

input[type="datetime-local"],
input[type="number"],
input[type="month"],
input[type="file"] {
    width: 100%;
    padding: 0.85rem 0.95rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    font-size: 1rem;
}

input:focus {
    outline: 3px solid rgba(29, 78, 216, 0.15);
    border-color: var(--primary);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 12px;
    padding: 0.85rem 1.1rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
}

.button.primary {
    color: #fff;
    background: var(--primary);
}
.button.primary:hover {
    background: var(--primary-hover);
    text-decoration: none;
}
.button.secondary,
.link-button {
    color: var(--text);
    background: #eef2ff;
}
.button.secondary:hover,
.link-button:hover {
    background: #e0e7ff;
    text-decoration: none;
}

.actions { padding-top: 0.25rem; }
.actions.compact { align-self: end; }

.alert {
    padding: 1rem 1.1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    font-weight: 600;
}
.alert-success { background: var(--success-bg); color: var(--success-text); }
.alert-error { background: var(--error-bg); color: var(--error-text); }

.page-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.month-filter,
.budget-form {
    display: grid;
    gap: 1rem;
}

.month-filter {
    grid-template-columns: minmax(180px, 220px) auto;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-label {
    color: var(--muted);
    font-size: 0.95rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
}

.text-success { color: #047857; }
.text-danger { color: #b91c1c; }
.inline-note { color: var(--muted); }

.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
}
thead th {
    text-align: left;
    background: #f8fafc;
}
th, td {
    padding: 0.9rem 0.8rem;
    border-bottom: 1px solid #e5e7eb;
}

tbody tr:hover { background: #fafcff; }

.site-footer {
    border-top: 1px solid #e5e7eb;
    background: #fff;
    color: var(--muted);
}
.site-footer .container { padding: 1rem 0; }
.site-footer p { margin: 0; }

@media (max-width: 800px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .month-filter {
        grid-template-columns: 1fr;
        width: 100%;
    }

    .header-inner {
        flex-direction: column;
        align-items: flex-start;
    }
}
