:root {
    --topbar-h: 56px;
    --sidebar-w: 240px;
    --brand: #1a73e8;
    --brand-dark: #174ea6;
    --sidebar-bg: #ffffff;
    --sidebar-border: #e3e6ea;
    --amber: #fff3cd;
}

* { box-sizing: border-box; }

body.app-shell {
    margin: 0;
    background: #f6f8fb;
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- Topbar ---------- */
.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: var(--brand);
    color: #fff;
    z-index: 1040;
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.topbar-brand {
    color: #fff;
    font-weight: 600;
    font-size: 1.05rem;
    text-decoration: none;
}
.topbar-brand:hover { color: #fff; }

/* ---------- Sidebar ---------- */
.sidebar {
    position: fixed;
    top: var(--topbar-h);
    bottom: 0;
    left: 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    overflow-y: auto;
    padding: .5rem 0 2rem;
    z-index: 1035;
}
.sidebar .nav-section {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #80868b;
    padding: .9rem 1.25rem .25rem;
    font-weight: 700;
}
.sidebar .nav-link {
    color: #3c4043;
    padding: .5rem 1.25rem;
    border-radius: 0 20px 20px 0;
    margin-right: .75rem;
    display: flex;
    align-items: center;
    gap: .65rem;
    font-size: .92rem;
}
.sidebar .nav-link i { width: 1.1rem; text-align: center; color: #5f6368; }
.sidebar .nav-link:hover { background: #f1f3f4; }
.sidebar .nav-link.active {
    background: #e8f0fe;
    color: var(--brand-dark);
    font-weight: 600;
}
.sidebar .nav-link.active i { color: var(--brand-dark); }

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: var(--topbar-h) 0 0 0;
    background: rgba(0,0,0,.35);
    z-index: 1030;
}

/* ---------- Main ---------- */
.main-content {
    margin-left: var(--sidebar-w);
    margin-top: var(--topbar-h);
    padding: 1.5rem 1.75rem 3rem;
    min-height: calc(100vh - var(--topbar-h));
}

.page-title { font-size: 1.4rem; font-weight: 600; margin-bottom: 1rem; }
.card { border: 1px solid #e6e9ed; box-shadow: 0 1px 2px rgba(0,0,0,.04); }

/* ---------- Mobile ---------- */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
    .sidebar.open { transform: translateX(0); }
    .sidebar-backdrop.show { display: block; }
    .main-content { margin-left: 0; }
}

/* ---------- Accounting bits ---------- */
.amount { font-variant-numeric: tabular-nums; text-align: right; }
.wrong-side { background: var(--amber) !important; }
.totals-bar {
    position: sticky; bottom: 0;
    background: #fff; border-top: 2px solid #dee2e6;
    padding: .75rem 1rem;
}
.diff-ok { color: #198754; font-weight: 600; }
.diff-bad { color: #dc3545; font-weight: 600; }
.lock-icon { color: #b08900; }

/* ---------- Auth shell ---------- */
body.auth-shell {
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a73e8 0%, #174ea6 100%);
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.auth-card {
    background: #fff; border-radius: 12px; padding: 2rem;
    width: 100%; max-width: 400px; box-shadow: 0 10px 40px rgba(0,0,0,.25);
}
.auth-brand {
    display: flex; align-items: center; justify-content: center; gap: .5rem;
    font-size: 1.25rem; font-weight: 600; color: var(--brand-dark); margin-bottom: 1.5rem;
}
.auth-brand i { font-size: 1.5rem; }
