:root {
    --cream: #F5F0E8;
    --warm-white: #FAF8F4;
    --ink: #0F0F0E;
    --gold: #C9A84C;
    --gold-light: #E8D5A3;
    --sage: #5A6E5C;
    --rust: #B85C38;
    --muted: #7A776E;
    --border: #E2DDD5;
    --card-shadow: 0 2px 8px rgba(15,15,14,0.06);
}

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

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--cream);
    color: var(--ink);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4 {
    font-family: 'Playfair Display', serif;
    font-weight: 600;
}

/* Navigation */
.nav {
    background: var(--ink);
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand { display: flex; align-items: baseline; gap: 0.75rem; }
.nav-title { color: var(--gold); font-size: 1.25rem; font-weight: 700; }
.nav-subtitle { color: var(--muted); font-size: 0.85rem; font-weight: 300; }

.nav-links { display: flex; gap: 0.25rem; flex: 1; }
.nav-link {
    color: #ccc;
    text-decoration: none;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,0.08); }
.nav-link.active { color: var(--gold); background: rgba(201,168,76,0.12); }

.nav-user { display: flex; align-items: center; gap: 1rem; }
.nav-username { color: var(--gold-light); font-size: 0.85rem; }
.nav-logout {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--muted);
    border-radius: 4px;
    transition: all 0.2s;
}
.nav-logout:hover { color: #fff; border-color: #fff; }

/* Main */
.main {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

/* Flash messages */
.flash-messages { margin-bottom: 1.5rem; }
.flash {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}
.flash-success { background: rgba(90,110,92,0.12); color: var(--sage); border: 1px solid var(--sage); }
.flash-error { background: rgba(184,92,56,0.1); color: var(--rust); border: 1px solid var(--rust); }
.flash-info { background: rgba(201,168,76,0.1); color: var(--gold); border: 1px solid var(--gold); }
.flash-warning { background: rgba(184,92,56,0.1); color: var(--rust); border: 1px solid var(--rust); }

/* Cards */
.card {
    background: var(--warm-white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card { text-align: center; }
.stat-value {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 0.25rem;
}
.stat-value.positive { color: var(--sage); }
.stat-value.negative { color: var(--rust); }
.stat-value.gold { color: var(--gold); }
.stat-label {
    font-size: 0.85rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Page headers */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.page-title { font-size: 1.5rem; }

/* Tables */
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
th {
    text-align: left;
    padding: 0.75rem;
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
tr:hover { background: rgba(201,168,76,0.04); }

.amount { font-family: 'DM Sans', monospace; font-weight: 500; text-align: right; }
.amount.debit { color: var(--rust); }
.amount.credit { color: var(--sage); }

/* Badges */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-business { background: rgba(201,168,76,0.15); color: var(--gold); }
.badge-personal { background: rgba(122,119,110,0.15); color: var(--muted); }
.badge-uncategorized { background: rgba(184,92,56,0.1); color: var(--rust); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'DM Sans', sans-serif;
}
.btn-primary { background: var(--gold); color: #fff; }
.btn-primary:hover { background: #b8993f; }
.btn-secondary { background: transparent; color: var(--ink); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--gold); color: var(--gold); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}
.form-input, .form-select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: 'DM Sans', sans-serif;
    background: #fff;
    transition: border-color 0.2s;
}
.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201,168,76,0.15);
}

/* Filters bar */
.filters {
    display: flex;
    gap: 0.75rem;
    align-items: end;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--warm-white);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.filters .form-group { margin-bottom: 0; min-width: 140px; }
.filters .form-label { font-size: 0.75rem; text-transform: uppercase; color: var(--muted); }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 1.5rem;
}
.pagination a, .pagination span {
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    text-decoration: none;
    color: var(--ink);
    border: 1px solid var(--border);
}
.pagination a:hover { border-color: var(--gold); color: var(--gold); }
.pagination .current { background: var(--gold); color: #fff; border-color: var(--gold); }

/* Footer */
.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

/* Login page */
.login-container {
    max-width: 400px;
    margin: 4rem auto;
}
.login-card {
    background: var(--warm-white);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: var(--card-shadow);
    text-align: center;
}
.login-title {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
    color: var(--gold);
}
.login-subtitle {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

/* Report-specific */
.report-section { margin-bottom: 2rem; }
.report-total {
    font-weight: 700;
    font-size: 1.1rem;
    padding-top: 0.5rem;
    border-top: 2px solid var(--ink);
}
.report-net { font-size: 1.2rem; }
.report-net.positive { color: var(--sage); }
.report-net.negative { color: var(--rust); }

/* Responsive */
@media (max-width: 768px) {
    .nav { flex-wrap: wrap; padding: 0.5rem 1rem; }
    .nav-links { order: 3; width: 100%; overflow-x: auto; }
    .main { padding: 1rem; }
    .cards-grid { grid-template-columns: repeat(2, 1fr); }
    .filters { flex-direction: column; }
}
