:root { --sidebar-w: 248px; --sidebar-w-collapsed: 64px; --brand: #1f4e79; }
body { background: var(--bs-tertiary-bg); font-size: .925rem; }
[data-bs-theme="dark"] body { background: #12161b; }
.text-bg-danger, .text-bg-success, .text-bg-warning, .text-bg-info { color: #fff !important; }

/* Auth pages */
.auth-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.auth-wrap { width: 100%; max-width: 420px; }
.auth-card { border-radius: .6rem; }

/* App shell */
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar { width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); background: var(--sidebar-bg, #14283d); color: #cfd8e3; transition: width .15s; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 1040; }
.sidebar-brand { display: flex; align-items: center; gap: .6rem; padding: 1rem 1.1rem; color: #fff; text-decoration: none; font-weight: 600; font-size: 1.05rem; white-space: nowrap; }
.sidebar-brand i { font-size: 1.4rem; }
.nav-link-item { display: flex; align-items: center; gap: .7rem; padding: .6rem 1.1rem; color: #b6c3d1; text-decoration: none; white-space: nowrap; border-left: 3px solid transparent; }
.nav-link-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link-item.active { background: rgba(255,255,255,.1); color: #fff; border-left-color: #4ea1e8; }
.nav-link-item.sub { padding-left: 2.6rem; font-size: .88rem; }
.nav-link-item .caret { margin-left: auto; font-size: .7rem; }
.nav-link-item i:first-child { font-size: 1.1rem; width: 1.2rem; text-align: center; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar { display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; background: var(--bs-body-bg); border-bottom: 1px solid var(--bs-border-color); position: sticky; top: 0; z-index: 1030; }
.app-content { padding: 1.25rem; }
.stat-card .stat-icon { width: 46px; height: 46px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: rgba(31,78,121,.12); color: var(--brand); font-size: 1.4rem; }
[data-bs-theme="dark"] .stat-card .stat-icon { color: #6db3f2; background: rgba(78,161,232,.15); }
.stat-value { font-size: 1.5rem; font-weight: 600; line-height: 1.1; }
.table-responsive { -webkit-overflow-scrolling: touch; }

/* Collapsed (desktop) */
.sidebar-collapsed .app-sidebar { width: var(--sidebar-w-collapsed); flex-basis: var(--sidebar-w-collapsed); }
.sidebar-collapsed .app-sidebar .label { display: none; }
.sidebar-collapsed .app-sidebar .collapse { display: none !important; }

/* Mobile: off-canvas sidebar */
.app-backdrop { display: none; }
@media (max-width: 991.98px) {
  .app-sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; width: var(--sidebar-w) !important; }
  .sidebar-collapsed .app-sidebar .label { display: inline; }
  .sidebar-collapsed .app-sidebar .collapse.show { display: block !important; }
  .sidebar-open .app-sidebar { transform: none; }
  .sidebar-open .app-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1035; }
  .app-content { padding: .9rem; }
}

.brand-logo { height: 28px; max-width: 120px; object-fit: contain; background: #fff; border-radius: 4px; padding: 2px; }
.hub-tile { transition: border-color .12s, box-shadow .12s; }
.hub-tile:hover { border-color: var(--brand); box-shadow: 0 .25rem .75rem rgba(0,0,0,.08); }

.acct-nav .nav-link { white-space: nowrap; }
@media print { .acct-nav, .app-sidebar, .app-topbar, .no-print { display: none !important; } .app-content { padding: 0 !important; } .app-shell { display: block; } }

/* Dashboard charts (inline SVG from SvgChart; colours follow the theme) */
.chart { width: 100%; height: auto; max-height: 300px; display: block; }
.chart .grid { stroke: var(--bs-border-color); stroke-width: 1; }
.chart .axis { fill: var(--bs-secondary-color); font-size: 11px; }
.chart .centre { fill: var(--bs-body-color); font-size: 15px; font-weight: 600; }
.chart .c1 { fill: #2f6fb0; stroke: none; } .chart .c2 { fill: #2e9e6b; stroke: none; } .chart .c3 { fill: #8a63c9; stroke: none; }
.chart .c4 { fill: #d9663a; stroke: none; } .chart .c5 { fill: #d4a017; stroke: none; } .chart .c6 { fill: #3aa3b8; stroke: none; }
.chart circle.c1,.chart circle.c2,.chart circle.c3,.chart circle.c4,.chart circle.c5,.chart circle.c6 { stroke: var(--bs-body-bg); stroke-width: 2; }
.chart .line { fill: none !important; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.c1 { stroke: #2f6fb0; } .chart .line.c2 { stroke: #2e9e6b; } .chart .line.c3 { stroke: #8a63c9; } .chart .line.c4 { stroke: #d9663a; }
.chart .area { opacity: .12; }
.chart rect:hover, .chart path:hover { opacity: .8; }
[data-bs-theme="dark"] .chart .c1 { fill: #5aa2e6; } [data-bs-theme="dark"] .chart .line.c1 { stroke: #5aa2e6; }
[data-bs-theme="dark"] .chart .c2 { fill: #4cc790; } [data-bs-theme="dark"] .chart .line.c2 { stroke: #4cc790; }
[data-bs-theme="dark"] .chart .c3 { fill: #b79af0; } [data-bs-theme="dark"] .chart .line.c3 { stroke: #b79af0; }
[data-bs-theme="dark"] .chart .c4 { fill: #f08a60; } [data-bs-theme="dark"] .chart .line.c4 { stroke: #f08a60; }
.stat-card .stat-value { font-size: 1.35rem; font-weight: 700; line-height: 1.2; }
a.stat-card:hover { border-color: var(--brand); }
.min-w-0 { min-width: 0; }
@media print { .app-sidebar, .app-topbar, .btn { display: none !important; } .chart .c1, .chart .c2, .chart .c3, .chart .c4 { print-color-adjust: exact; } }

/* whole table row opens its record (see app.js) */
tr.row-link { cursor: pointer; }
tr.row-link:hover > * { --bs-table-bg-state: var(--bs-table-hover-bg); }
