:root {
    --navy: #102a43;
    --navy-2: #243b53;
    --blue: #1976d2;
    --cyan: #0f9d8a;
    --bg: #f4f7fb;
    --card-border: #e6edf5;
    --muted: #6b7c93;
    --danger: #c0392b;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: #243b53; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: .94rem; }
a { text-decoration: none; }
.app-shell { min-height: 100vh; }
.sidebar { width: 255px; background: linear-gradient(180deg, var(--navy), var(--navy-2)); color: #d9e2ec; position: fixed; inset: 0 auto 0 0; z-index: 1030; flex-direction: column; padding: 1.1rem .85rem; height: 100vh; overflow: hidden; }
.brand { display: flex; align-items: center; gap: .7rem; color: #fff; padding: .25rem .55rem 1.4rem; flex: 0 0 auto; }
.brand strong { display: block; font-size: 1.05rem; letter-spacing: .01em; }
.brand small { display: block; color: #9fb3c8; font-size: .7rem; margin-top: .1rem; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: #1f8fce; color: #fff; font-size: 1.2rem; }
.sidebar .nav-link { color: #b7c6d5; border-radius: 9px; padding: .65rem .75rem; display: flex; align-items: center; gap: .75rem; font-weight: 500; }
.sidebar .nav-link i { font-size: 1.05rem; width: 20px; text-align: center; }
.sidebar .nav-link:hover, .sidebar .nav-link.active { color: #fff; background: rgba(255,255,255,.13); }
.sidebar .nav-link.active { box-shadow: inset 3px 0 #51c4b0; }
.sidebar-bottom { margin-top: auto; border-top: 1px solid rgba(255,255,255,.12); padding-top: .7rem; flex: 0 0 auto; }
/* The nav is the only part that scrolls, so the brand and Logout stay put when
   the menu grows taller than the viewport. min-height:0 lets the flex child
   shrink below its content height, which is what enables the scroll. */
.sidebar > .nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-right: .2rem; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.28) transparent; }
.sidebar > .nav::-webkit-scrollbar { width: 7px; }
.sidebar > .nav::-webkit-scrollbar-track { background: transparent; }
.sidebar > .nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.28); border-radius: 99px; }
.sidebar > .nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.45); }
.main-wrapper { margin-left: 255px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { height: 76px; background: #fff; border-bottom: 1px solid var(--card-border); display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0 1.6rem; position: sticky; top: 0; z-index: 1000; }
.page-title { font-size: 1.3rem; font-weight: 700; color: var(--navy); }
.page-subtitle { font-size: .76rem; color: var(--muted); margin-top: .15rem; }
.topbar-meta { display: flex; align-items: center; gap: .8rem; color: #486581; font-size: .78rem; }
.user-chip { display: flex; align-items: center; gap: .45rem; padding-left: .25rem; }
.user-chip i { font-size: 1.6rem; color: var(--cyan); }
.user-chip strong, .user-chip small { display: block; }
.user-chip small { color: var(--muted); font-size: .7rem; }
.content-area { flex: 1; padding: 1.5rem 1.6rem; max-width: 1900px; width: 100%; }
.footer { padding: 1rem 1.6rem; color: var(--muted); font-size: .75rem; display: flex; justify-content: space-between; gap: 1rem; }
.card { border: 1px solid var(--card-border); border-radius: 13px; box-shadow: 0 3px 12px rgba(16,42,67,.035); }
.card-header { background: #fff; border-bottom: 1px solid var(--card-border); font-weight: 700; color: var(--navy); }
.stat-card { border-radius: 13px; color: #fff; min-height: 112px; position: relative; overflow: hidden; box-shadow: 0 7px 18px rgba(16,42,67,.1); }
.stat-card .label { font-size: .72rem; opacity: .88; text-transform: uppercase; letter-spacing: .04em; }
.stat-card .value { font-size: 1.35rem; font-weight: 800; margin-top: .5rem; }
.stat-card i { position: absolute; right: 1rem; bottom: .9rem; font-size: 2.4rem; opacity: .2; }
.bg-stat-blue { background: linear-gradient(135deg, #1769aa, #2c8ac9); }
.bg-stat-teal { background: linear-gradient(135deg, #087f73, #16a394); }
.bg-stat-indigo { background: linear-gradient(135deg, #4f46a5, #706bd4); }
.bg-stat-emerald { background: linear-gradient(135deg, #147d53, #25a36f); }
.bg-stat-orange { background: linear-gradient(135deg, #c65a12, #eb8c34); }
.bg-stat-rose { background: linear-gradient(135deg, #a52b4a, #d45c79); }
.table { margin-bottom: 0; vertical-align: middle; }
.table thead th { background: #f7f9fc; color: #52667a; font-size: .7rem; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; border-bottom: 1px solid var(--card-border); }
.table td { border-color: #edf1f6; }
.table-wrap { overflow-x: auto; }
.amount { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.form-label { font-size: .78rem; font-weight: 700; color: #486581; }
.form-control, .form-select { border-color: #d8e1eb; border-radius: 8px; }
.form-control:focus, .form-select:focus { border-color: #51a5d8; box-shadow: 0 0 0 .2rem rgba(25,118,210,.12); }
.btn { border-radius: 8px; font-weight: 600; }
.btn-primary { background: #1976d2; border-color: #1976d2; }
.btn-success { background: #12866b; border-color: #12866b; }
.badge-soft { display: inline-flex; align-items: center; padding: .3rem .55rem; border-radius: 999px; font-size: .7rem; font-weight: 700; }
.badge-soft-success { color: #0b6b4f; background: #d9f5e9; }
.badge-soft-warning { color: #8a5a00; background: #fff1c2; }
.badge-soft-danger { color: #a12828; background: #ffe0e1; }
.badge-soft-info { color: #145b8c; background: #dff1ff; }
.audit-total { background: #eef7f6; border: 2px solid #138d7c; color: #075e55; }
.audit-negative { color: #a12828; font-weight: 700; }
.audit-positive { color: #0b6b4f; font-weight: 700; }
.empty-state { padding: 3rem 1rem; text-align: center; color: var(--muted); }
.empty-state i { display: block; font-size: 2.5rem; color: #b8c5d3; margin-bottom: .6rem; }
.search-highlight { background: #fff1b8; padding: 0 .15rem; border-radius: 3px; }
.login-page { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #102a43 0%, #1e4966 55%, #0f766e 100%); padding: 1rem; }
.login-card { width: min(100%, 430px); border: 0; border-radius: 18px; overflow: hidden; }
.login-brand { background: #fff; text-align: center; padding: 2rem 1.5rem 1rem; }
.login-brand .brand-mark { margin: 0 auto .8rem; }
.login-brand h1 { font-size: 1.35rem; color: var(--navy); }
.login-brand p { color: var(--muted); margin: 0; font-size: .82rem; }
.login-body { padding: 1rem 1.7rem 1.7rem; }
@media (max-width: 991.98px) { .main-wrapper { margin-left: 0; } .topbar { padding: 0 1rem; } .content-area { padding: 1rem; } .footer { padding: 1rem; } .mobile-sidebar { width: 275px; } }
@media (max-width: 575.98px) { .page-title { font-size: 1.1rem; } .topbar-meta .vr { display: none; } .footer { flex-direction: column; } }
/* Short viewports (laptops, split screens): tighten the menu so more items fit
   before the nav has to scroll. */
@media (min-width: 992px) and (max-height: 860px) { .sidebar > .nav { gap: .25rem !important; } .sidebar .nav-link { padding: .45rem .75rem; } .brand { padding-bottom: .9rem; } }
@media (min-width: 992px) and (max-height: 700px) { .sidebar > .nav { gap: 0 !important; } .sidebar .nav-link { padding: .3rem .75rem; } .brand { padding-bottom: .6rem; } .brand-mark { width: 32px; height: 32px; font-size: 1rem; } }
@media print { .sidebar, .topbar, .footer, .no-print, .offcanvas { display: none !important; } .main-wrapper { margin: 0; } .content-area { padding: 0; } .card { border: 0; box-shadow: none; } }
