:root {
    --brand: #4f46e5;
    --brand-600: #4338ca;
    --brand-50: #eef2ff;
    --brand-rgb: 79, 70, 229;
    --sidebar-bg: #1e1b4b;
    --sidebar-bg-2: #161339;
    --sidebar-fg: #e2e8f0;
    --sidebar-w: 260px;
    --surface: #ffffff;
    --bg: #f4f6fb;
    --border: #e5e7eb;
    --text: #111827;
    --muted: #6b7280;
    --radius: 14px;
    --bs-primary: var(--brand);
    --bs-primary-rgb: var(--brand-rgb);
    --bs-link-color: var(--brand);
    --bs-link-hover-color: var(--brand-600);
    --bs-body-font-family: "Inter", "Noto Sans Lao Looped", system-ui, sans-serif;
}

body { background: var(--bg); color: var(--text); font-size: .925rem; }
:lang(lo) body, body:lang(lo) { line-height: 1.65; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
/* !important: Bootstrap makes .offcanvas-lg transparent on large screens */
.sidebar {
    width: var(--sidebar-w); color: var(--sidebar-fg);
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%) !important;
    display: flex; flex-direction: column; flex-shrink: 0;
    box-shadow: 2px 0 12px rgba(15, 23, 42, .08);
}
@media (min-width: 992px) {
    .sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
}
.sidebar.offcanvas-lg { --bs-offcanvas-width: var(--sidebar-w); --bs-offcanvas-bg: var(--sidebar-bg); }
.sidebar-brand { display: flex; align-items: center; gap: .75rem; padding: 1.25rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark {
    width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
    background: var(--brand); color: #fff; font-size: 1.25rem; box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
.brand-logo { width: 42px; height: 42px; border-radius: 10px; object-fit: contain; background: #fff; padding: 3px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.brand-text strong { color: #fff; font-size: 1.05rem; font-weight: 700; }
.brand-text small { color: rgba(255,255,255,.65); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-nav { padding: .5rem .75rem 2rem; }
.nav-heading { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: rgba(255,255,255,.45); padding: 1.1rem .75rem .4rem; }
.sidebar .nav-link {
    display: flex; align-items: center; gap: .75rem; padding: .6rem .8rem; border-radius: 10px; margin-bottom: 2px;
    color: var(--sidebar-fg); font-weight: 500; text-decoration: none; transition: background .15s, color .15s;
}
.sidebar .nav-link i { font-size: 1.1rem; width: 1.3rem; text-align: center; opacity: .9; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar .nav-link.active { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(var(--brand-rgb), .4); }
.sidebar .nav-link.active i { opacity: 1; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .75rem;
    padding: .75rem 1.5rem; background: rgba(255,255,255,.85); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}
.page-title { font-size: 1.15rem; font-weight: 600; margin: 0; }
.btn-icon { border: 0; font-size: 1.4rem; padding: .25rem .5rem; }
.user-btn { display: flex; align-items: center; gap: .5rem; border: 0; }
.avatar {
    width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center;
    background: var(--brand-50); color: var(--brand); font-weight: 600;
}
.content { padding: 1.5rem; }
@media (max-width: 576px) { .content { padding: 1rem; } .topbar { padding: .6rem 1rem; } }

/* ---------- components ---------- */
.card { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header { background: transparent; border-bottom: 1px solid var(--border); padding: .9rem 1.25rem; font-weight: 600; }
.card-body { padding: 1.25rem; }
.btn { border-radius: 10px; font-weight: 500; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600); --bs-btn-active-bg: var(--brand-600); }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); }
.form-control, .form-select { border-radius: 10px; border-color: #d1d5db; }
.form-control:focus, .form-select:focus { border-color: rgba(var(--brand-rgb), .5); box-shadow: 0 0 0 .2rem rgba(var(--brand-rgb), .15); }
.form-label { font-weight: 500; font-size: .85rem; color: #374151; margin-bottom: .3rem; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.badge { font-weight: 500; padding: .4em .65em; border-radius: 999px; }

.stat-card { display: flex; gap: 1rem; align-items: center; }
.stat-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 1.35rem; flex-shrink: 0; }
.stat-label { color: var(--muted); font-size: .8rem; }
.stat-value { font-size: 1.45rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.bg-soft-primary { background: var(--brand-50); color: var(--brand); }
.bg-soft-success { background: #ecfdf5; color: #059669; }
.bg-soft-warning { background: #fffbeb; color: #d97706; }
.bg-soft-danger  { background: #fef2f2; color: #dc2626; }
.bg-soft-info    { background: #eff6ff; color: #2563eb; }

.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .65rem .75rem; border-color: #f0f1f4; vertical-align: middle; }
.table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; background: #f9fafb; white-space: nowrap; }
.table-hover tbody tr:hover { --bs-table-hover-bg: #f8f9ff; }
.table tfoot td, .table tfoot th { font-weight: 700; background: #f9fafb; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-grid input.form-control { min-width: 72px; padding: .3rem .45rem; text-align: right; font-variant-numeric: tabular-nums; }
.sticky-col { position: sticky; left: 0; background: #fff; z-index: 1; }
thead .sticky-col { background: #f9fafb; }

.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.toolbar .form-control, .toolbar .form-select { width: auto; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state i { font-size: 2.5rem; display: block; margin-bottom: .5rem; opacity: .5; }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.step { display: flex; gap: .85rem; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s; }
a.step:hover { border-color: rgba(var(--brand-rgb), .4); box-shadow: 0 4px 14px rgba(var(--brand-rgb), .1); }
.step-num { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); font-weight: 700; flex-shrink: 0; }
.step.done .step-num { background: #ecfdf5; color: #059669; }

.emp-photo { width: 96px; height: 96px; border-radius: 20px; object-fit: cover; background: var(--brand-50); display: grid; place-items: center; color: var(--brand); font-size: 2.25rem; font-weight: 600; }
.emp-thumb { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; background: var(--brand-50); display: inline-grid; place-items: center; color: var(--brand); font-weight: 600; flex-shrink: 0; }
.dl-grid { display: grid; grid-template-columns: 160px 1fr; gap: .4rem 1rem; margin: 0; }
.dl-grid dt { color: var(--muted); font-weight: 400; }
.dl-grid dd { margin: 0; }
@media (max-width: 576px) { .dl-grid { grid-template-columns: 1fr; } .dl-grid dd { margin-bottom: .5rem; } }

.chart-bars { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding-top: 1rem; }
.chart-bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.chart-bar .bar { width: 100%; max-width: 38px; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, rgba(var(--brand-rgb), .55), var(--brand)); min-height: 3px; }
.chart-bar small { color: var(--muted); font-size: .7rem; white-space: nowrap; }

/* ---------- auth ---------- */
.auth-body { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 10% -10%, var(--brand-50), transparent), radial-gradient(900px 500px at 110% 110%, var(--brand-50), transparent), var(--bg); padding: 1rem; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .card-body { padding: 2.25rem; }

/* ---------- theme picker ---------- */
.theme-swatch { display: flex; flex-direction: column; align-items: center; gap: .3rem; cursor: pointer; padding: .4rem; border-radius: 12px; border: 2px solid transparent; }
.theme-swatch input { position: absolute; opacity: 0; pointer-events: none; }
.theme-swatch span { width: 44px; height: 44px; border-radius: 12px; display: block; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.theme-swatch small { font-size: .72rem; color: var(--muted); }
.theme-swatch.active { border-color: var(--brand); background: var(--brand-50); }

/* ---------- report cards ---------- */
.report-card { background: #fff; border: 1px solid var(--border); transition: border-color .15s, box-shadow .15s, transform .15s; }
.report-card:hover { border-color: rgba(var(--brand-rgb), .45); box-shadow: 0 6px 18px rgba(var(--brand-rgb), .12); transform: translateY(-1px); }
