:root {
    --accent: #5f8a6e;
    --accent-dark: #4a6f59;
    --accent-soft: #eef4f0;
    --ink: #2f3a34;
    --muted: #7a867f;
    --line: #e6ebe8;
    --bs-body-bg: #fafbfa;
    --bs-body-color: var(--ink);
    --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --bs-link-color: var(--accent-dark);
    --bs-link-hover-color: var(--accent);
    --bs-border-color: var(--line);
}

.btn-accent {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--accent);
    --bs-btn-border-color: var(--accent);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--accent-dark);
    --bs-btn-hover-border-color: var(--accent-dark);
    --bs-btn-focus-shadow-rgb: 95, 138, 110;
    --bs-btn-active-bg: var(--accent-dark);
    --bs-btn-active-border-color: var(--accent-dark);
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 .2rem rgba(95, 138, 110, .2);
}

.form-control {
    padding: .7rem .9rem;
}

.text-muted-green { color: var(--muted); }
.brand-text { color: var(--accent-dark); }

/* Layout */
.app-shell { min-height: 100vh; }

.sidebar {
    width: 260px;
    flex: 0 0 260px;
    background: #fff;
    border-right: 1px solid var(--line);
    padding: 2rem 1.25rem;
}

.sidebar .brand {
    font-weight: 600;
    font-size: 1.15rem;
    color: var(--accent-dark);
    padding: 0 .75rem;
    margin-bottom: 2.5rem;
    letter-spacing: .01em;
}

.sidebar .nav-link {
    color: var(--ink);
    padding: .7rem .75rem;
    border-radius: .6rem;
    margin-bottom: .25rem;
    display: flex;
    align-items: center;
    gap: .75rem;
}

.sidebar .nav-link:hover { background: var(--accent-soft); }

.sidebar .nav-link.active {
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-weight: 600;
}

.sidebar .nav-link svg { width: 1.1rem; height: 1.1rem; flex: none; }

.content { flex: 1; padding: 3rem clamp(1.5rem, 5vw, 4rem); min-width: 0; }

.page-title { font-weight: 600; font-size: 1.75rem; margin-bottom: .5rem; }

.section-title {
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--accent-dark);
    margin-bottom: 1rem;
}

.coa-table { --bs-table-bg: transparent; table-layout: fixed; min-width: 720px; }
.coa-table th:nth-child(3) { width: 140px; }
.coa-table th:nth-child(4) { width: 220px; }
.coa-table th:nth-child(5) { width: 130px; }
.coa-table th { font-weight: 500; color: var(--muted); font-size: .85rem; border-bottom-color: var(--line); }
.coa-table td { padding: .9rem .5rem; }
.coa-table .col-code { width: 90px; }

.badge-soft { background: var(--accent-soft); color: var(--accent-dark); font-weight: 500; }

.data-table { --bs-table-bg: transparent; }
.data-table th { font-weight: 500; color: var(--muted); font-size: .85rem; }
.data-table td { padding: .9rem .5rem; }
.income { color: #3f7a55; }
.expense { color: #a4474a; }
.journal-table .col-amount { width: 150px; }
.journal-table .entry-head td { background: var(--accent-soft); border-bottom: 0; padding: .75rem .75rem; }
.journal-table tbody { border-top: 0; }

.stat { background: #fff; border: 1px solid var(--line); border-radius: 1rem; padding: 1.5rem 1.75rem; }
.stat-label { color: var(--muted); font-size: .85rem; margin-bottom: .5rem; }
.stat-value { font-size: 1.3rem; font-weight: 600; overflow-wrap: anywhere; }
.form-narrow { max-width: 520px; }
.form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 .2rem rgba(95, 138, 110, .2); }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.empty-state { background: #fff; border: 1px dashed var(--line); border-radius: 1rem; padding: 4rem 2rem; }
.btn-link { color: var(--accent-dark); }

/* Login */
.auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 1rem;
    padding: 3rem 2.5rem;
}

@media (min-width: 768px) {
    .sidebar { position: sticky; top: 0; height: 100vh; align-self: flex-start; }
}

@media (max-width: 767.98px) {
    .app-shell { flex-direction: column; }
    .mobile-bar {
        position: sticky;
        top: 0;
        z-index: 1020;
        background: #fff;
        border-bottom: 1px solid var(--line);
        padding: .85rem 1.25rem;
    }
    .sidebar { --bs-offcanvas-width: 260px; }
    .content { padding: 2rem 1.25rem; }
}

/* Dashboard */
.panel { background: #fff; border: 1px solid var(--line); border-radius: 1rem; padding: 1.75rem; }
.stat-note { color: var(--muted); font-size: .8rem; margin-top: .35rem; }

.chart { width: 100%; height: auto; display: block; }
.chart-text { fill: var(--muted); font-size: 11px; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-bar { fill: var(--accent); }
.chart-bar:hover { fill: var(--accent-dark); }

.bar-svg { width: 100%; height: 6px; display: block; border-radius: 3px; overflow: hidden; }
.bar-bg { fill: var(--accent-soft); }
.bar-fill { fill: var(--accent); }

.sheet-table { --bs-table-bg: transparent; }
.sheet-table td, .sheet-table th { padding: .45rem 0; border-bottom: 0; }
.sheet-head th { padding-top: 1.1rem; font-size: .8rem; font-weight: 600; color: var(--accent-dark); text-transform: uppercase; letter-spacing: .06em; }
.sheet-total td { font-weight: 600; border-top: 1px solid var(--line); padding-top: .6rem; }

/* Receivables & debts */
.table-wide { min-width: 720px; }
.badge-overdue { background: #f6e3e3; color: #a4474a; font-weight: 500; }
.filter-links { display: flex; gap: .25rem; padding: .25rem; background: #fff; border: 1px solid var(--line); border-radius: .7rem; }
.filter-link { padding: .3rem .8rem; border-radius: .5rem; color: var(--muted); text-decoration: none; font-size: .9rem; }
.filter-link:hover { background: var(--accent-soft); }
.filter-link.active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
.bar-svg { display: block; width: 100%; height: .5rem; border-radius: .25rem; overflow: hidden; }
.bar-bg { fill: var(--accent-soft); }
.bar-fill { fill: var(--accent); }
