:root {
    --brand: #f5b800;
    --brand-dark: #c99700;
    --ink: #1e293b;
    --muted: #64748b;
    --line: #e5e9f0;
    --surface: #ffffff;
    --canvas: #f4f6fa;
    --side: #0f172a;
    --side-hover: #1e293b;
    --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --bs-body-color: var(--ink);
    --bs-primary: #2f5bea;
    --bs-primary-rgb: 47, 91, 234;
    --bs-link-color: #2f5bea;
    --bs-border-color: var(--line);
    --bs-border-radius: .5rem;
}

body { background: var(--canvas); font-size: .9rem; }
h1, h2, h3, h4, h5, h6 { color: var(--ink); font-weight: 650; letter-spacing: -.01em; }
h4 { font-size: 1.35rem; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 252px; flex: 0 0 252px; background: var(--side); color: #cbd5e1;
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand { display: flex; align-items: center; gap: .65rem; padding: 1.15rem 1.25rem; color: #fff; font-weight: 700; font-size: 1.05rem; }
.sidebar .brand:hover { text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: #0f172a; display: grid; place-items: center; font-size: 1.1rem; }
.nav-group { padding: .9rem 1.25rem .35rem; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: #64748b; font-weight: 600; }
.sidebar .nav-link {
    display: flex; align-items: center; gap: .7rem; color: #cbd5e1; padding: .5rem 1.25rem; margin: 1px .6rem;
    border-radius: .5rem; font-weight: 500;
}
.sidebar .nav-link i { font-size: 1.05rem; opacity: .85; }
.sidebar .nav-link:hover { background: var(--side-hover); color: #fff; text-decoration: none; }
.sidebar .nav-link.active { background: rgba(245, 184, 0, .14); color: var(--brand); }
.sidebar .nav-link.active i { opacity: 1; }
.sidebar-footer { margin-top: auto; padding: 1rem 1.25rem; border-top: 1px solid #1e293b; font-size: .8rem; }

.content-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    background: var(--surface); border-bottom: 1px solid var(--line); padding: .6rem 1.75rem;
    display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10;
}
.topbar .crumb { color: var(--muted); font-size: .85rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #e0e7ff; color: #3730a3; display: grid; place-items: center; font-weight: 600; font-size: .8rem; }
main.page { padding: 1.75rem; flex: 1; overflow-x: auto; }
.page-footer { padding: 1rem 1.75rem; color: var(--muted); font-size: .78rem; border-top: 1px solid var(--line); background: var(--surface); }

@media (max-width: 991.98px) {
    .sidebar { position: fixed; z-index: 1045; left: -260px; transition: left .2s; }
    .sidebar.open { left: 0; box-shadow: 0 0 40px rgba(0,0,0,.4); }
    .topbar, main.page { padding-left: 1rem; padding-right: 1rem; }
}

/* ---------- page header ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head h4 { margin: 0; }
.page-head .sub { color: var(--muted); margin: .15rem 0 0; }
main.page > h4:first-child, main.page > .d-flex:first-child h4 { margin-bottom: 1rem; }

/* ---------- cards, tables, forms ---------- */
.card { border: 1px solid var(--line); border-radius: .75rem; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); background: var(--surface); }
.card-header { background: #fafbfd; border-bottom: 1px solid var(--line); font-weight: 600; padding: .75rem 1rem; border-radius: .75rem .75rem 0 0 !important; }
.card.card-body { padding: 1.25rem; }

.table { --bs-table-bg: transparent; margin-bottom: 0; color: var(--ink); }
table.table.bg-white, .card > .table { background: var(--surface) !important; }
.table-bordered { border: 1px solid var(--line); border-collapse: separate; border-spacing: 0; border-radius: .75rem; overflow: hidden; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.table-bordered > :not(caption) > * > * { border-width: 0 0 1px 0; padding: .7rem .9rem; }
.table-bordered > tbody > tr:last-child > * { border-bottom: 0; }
.table thead th, .table-warning, .table-warning > th, .table-warning > tr > th {
    background: #f8fafc !important; color: var(--muted) !important; font-size: .72rem; text-transform: uppercase;
    letter-spacing: .05em; font-weight: 650; border-bottom: 1px solid var(--line) !important;
}
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f8faff; }
.table-sm > :not(caption) > * > * { padding: .55rem .8rem; }
.table-success { --bs-table-bg: #f0fdf4; }
.table tfoot td, .table tfoot th { background: #fafbfd; }

.form-label { font-weight: 600; font-size: .82rem; color: #334155; margin-bottom: .3rem; }
.form-control, .form-select { border-color: #d6dce6; border-radius: .5rem; padding: .5rem .75rem; }
.form-control:focus, .form-select:focus { border-color: #2f5bea; box-shadow: 0 0 0 .2rem rgba(47, 91, 234, .15); }
.form-text { color: var(--muted); }
fieldset legend { font-weight: 600; color: #334155; }

.btn { border-radius: .5rem; font-weight: 550; padding: .45rem .95rem; }
.btn-sm { padding: .25rem .6rem; font-size: .8rem; }
.btn-primary { background: #2f5bea; border-color: #2f5bea; }
.btn-primary:hover { background: #2548c4; border-color: #2548c4; }
.btn-outline-secondary { color: #475569; border-color: #d6dce6; }
.btn-outline-secondary:hover { background: #f1f5f9; color: var(--ink); border-color: #cbd5e1; }
.btn-link { text-decoration: none; }

.badge { font-weight: 600; padding: .38em .65em; border-radius: 999px; }
.alert { border: 0; border-radius: .6rem; }
.alert-success { background: #ecfdf3; color: #067647; }
.alert-danger { background: #fef3f2; color: #b42318; }

/* ---------- tabs ---------- */
.nav-tabs { border-bottom: 1px solid var(--line); gap: .25rem; flex-wrap: wrap; }
.nav-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 550; padding: .6rem .9rem; border-radius: 0; }
.nav-tabs .nav-link:hover { color: var(--ink); text-decoration: none; }
.nav-tabs .nav-link.active { color: #2f5bea; border-bottom-color: #2f5bea; background: transparent; }
.nav-tabs .nav-link.disabled { color: #b6bfcc; }

/* ---------- stat cards ---------- */
.stat { display: flex; flex-direction: row; gap: 1rem; align-items: center; padding: 1.1rem 1.25rem; }
.stat .icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; flex: none; }
.stat .label { color: var(--muted); font-size: .8rem; font-weight: 550; }
.stat .value { font-size: 1.55rem; font-weight: 700; line-height: 1.2; letter-spacing: -.02em; }
.icon-blue { background: #e8eeff; color: #2f5bea; }
.icon-amber { background: #fff4d1; color: #b07d00; }
.icon-green { background: #e3f7ec; color: #12875a; }
.icon-rose { background: #ffe8ec; color: #d12c4d; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-art { background: linear-gradient(145deg, #0f172a 0%, #1e293b 55%, #334155 100%); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; }
.auth-art h2 { color: #fff; font-size: 2rem; max-width: 22rem; line-height: 1.25; }
.auth-art p { color: #94a3b8; max-width: 24rem; }
.auth-form { display: grid; place-items: center; padding: 2rem; background: var(--surface); }
.auth-form .box { width: 100%; max-width: 380px; }
@media (max-width: 767.98px) { .auth-wrap { grid-template-columns: 1fr; } .auth-art { display: none; } }

img.thumb { border-radius: .5rem; border: 1px solid var(--line); }
code { background: #f1f5f9; color: #334155; padding: .15rem .4rem; border-radius: .35rem; }
.pagination { margin: 1rem 0 0; }

/* key/value tables inside cards */
.card .table > tbody > tr > th { font-weight: 500; color: var(--muted); white-space: nowrap; }
.card .table > tbody > tr:last-child > * { border-bottom: 0; }
