:root {
    --bg-body: #f3f6fb;
    --bg-card: rgba(255,255,255,.92);
    --border-soft: rgba(15,23,42,.08);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-soft: #eff6ff;
    --success-soft: #ecfdf5;
    --warning-soft: #fffbeb;
    --danger-soft: #fef2f2;
    --info-soft: #eff6ff;
    --sidebar: #0b1220;
    --sidebar-soft: #111a2e;
    --shadow-soft: 0 18px 48px rgba(15, 23, 42, .08);
    --shadow-card: 0 12px 32px rgba(15, 23, 42, .07);
    --radius-lg: 22px;
    --radius-md: 16px;
}

* { box-sizing: border-box; }
body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, .14), transparent 36%),
        radial-gradient(circle at 82% 18%, rgba(14, 165, 233, .14), transparent 28%),
        var(--bg-body);
    color: var(--text-main);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { text-decoration: none; }

.app-shell { min-height: 100vh; }

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 288px;
    min-height: 100vh;
    padding: 22px 18px;
    background:
        linear-gradient(180deg, rgba(15,23,42,.97), rgba(2,6,23,.98)),
        radial-gradient(circle at top, rgba(37,99,235,.32), transparent 40%);
    color: #fff;
    z-index: 1030;
    box-shadow: 14px 0 42px rgba(15, 23, 42, .18);
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 6px 24px;
    margin-bottom: 10px;
}

.brand-mark {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: linear-gradient(135deg, #2563eb, #06b6d4);
    box-shadow: 0 14px 30px rgba(37, 99, 235, .35);
    font-size: 1.35rem;
}

.brand-title { font-size: 1.18rem; font-weight: 800; letter-spacing: .2px; line-height: 1.05; }
.brand-subtitle { font-size: .78rem; color: #94a3b8; margin-top: 3px; }
.sidebar-section-label {
    margin: 18px 8px 8px;
    color: #64748b;
    font-size: .72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .11em;
}

.sidebar-nav { display: grid; gap: 6px; }
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 10px 12px;
    color: #cbd5e1;
    border-radius: 14px;
    font-weight: 650;
    transition: .18s ease;
}
.sidebar-link i { width: 22px; font-size: 1.05rem; color: #94a3b8; }
.sidebar-link:hover {
    color: #fff;
    background: rgba(255,255,255,.08);
    transform: translateX(2px);
}
.sidebar-link:hover i { color: #bfdbfe; }
.sidebar-link.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(37,99,235,.95), rgba(14,165,233,.72));
    box-shadow: 0 14px 28px rgba(37,99,235,.24);
}
.sidebar-link.active i { color: #fff; }
.sidebar-footer { margin-top: 24px; padding: 14px 8px 0; }
.mini-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid rgba(148,163,184,.18);
    border-radius: 18px;
    background: rgba(15, 23, 42, .56);
}
.avatar-sm, .avatar-md {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    box-shadow: 0 10px 22px rgba(37, 99, 235, .25);
}
.avatar-sm { width: 34px; height: 34px; border-radius: 12px; }
.avatar-md { width: 40px; height: 40px; border-radius: 14px; }
.profile-name { color: #fff; font-weight: 750; font-size: .9rem; }
.profile-role { color: #94a3b8; font-size: .78rem; text-transform: capitalize; }
.min-w-0 { min-width: 0; }

.app-content {
    min-height: 100vh;
    margin-left: 288px;
}
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    height: 76px;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(243,246,251,.82);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(15,23,42,.06);
}
.topbar-title { font-size: 1.02rem; font-weight: 800; letter-spacing: -.01em; }
.topbar-subtitle { color: var(--text-muted); font-size: .82rem; margin-top: 1px; }
.user-dropdown {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-main);
    padding: 8px 10px;
    border: 1px solid var(--border-soft);
    border-radius: 18px;
    background: rgba(255,255,255,.78);
    box-shadow: 0 10px 24px rgba(15,23,42,.04);
}
.user-name { display: block; font-size: .88rem; font-weight: 750; line-height: 1.1; }
.user-role { display: block; color: var(--text-muted); font-size: .75rem; text-transform: capitalize; margin-top: 2px; }
.modern-dropdown {
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
}
.dropdown-item { padding: 10px 14px; font-weight: 600; }
.app-main { padding: 28px; }

.page-heading,
.d-flex.justify-content-between.align-items-center.mb-3,
.d-flex.justify-content-between.align-items-center.mb-4 {
    padding: 2px 2px 8px;
}
h3, h4, h5 { letter-spacing: -.025em; font-weight: 800; }
.text-muted { color: var(--text-muted) !important; }

.card {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    box-shadow: var(--shadow-card) !important;
    overflow: hidden;
}
.card-body { padding: 1.25rem; }
.card-stat {
    min-height: 128px;
    position: relative;
    overflow: hidden;
}
.card-stat::after {
    content: "";
    position: absolute;
    width: 120px;
    height: 120px;
    right: -38px;
    top: -38px;
    border-radius: 999px;
    background: rgba(37, 99, 235, .08);
}
.display-6 { letter-spacing: -.055em; }

.btn {
    border-radius: 13px;
    font-weight: 750;
    padding: .62rem .9rem;
    border-width: 1px;
}
.btn-sm { border-radius: 11px; padding: .42rem .65rem; font-size: .78rem; }
.btn-primary {
    background: linear-gradient(135deg, var(--primary), #0ea5e9);
    border-color: transparent;
    box-shadow: 0 12px 24px rgba(37, 99, 235, .20);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-dark), #0284c7); border-color: transparent; }
.btn-light, .btn-outline-primary, .btn-outline-secondary {
    border-color: var(--border-soft);
    background: rgba(255,255,255,.7);
}
.btn-icon {
    width: 42px;
    height: 42px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--border-soft);
    background: #fff;
}

.form-control, .form-select {
    border-radius: 14px;
    border-color: rgba(148,163,184,.35);
    padding: .68rem .85rem;
    background-color: rgba(255,255,255,.92);
}
.form-control:focus, .form-select:focus {
    border-color: rgba(37,99,235,.55);
    box-shadow: 0 0 0 .22rem rgba(37,99,235,.10);
}
.form-label { font-weight: 750; color: #334155; font-size: .86rem; }
.required::after { content: " *"; color: #ef4444; }
.form-text { color: var(--text-muted); }

.table { margin-bottom: 0; }
.table td, .table th { vertical-align: middle; }
.table thead th {
    background: #f8fafc;
    color: #475569;
    border-bottom: 1px solid var(--border-soft);
    font-size: .78rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
}
.table tbody td { color: #1e293b; }
.table-bordered > :not(caption) > * { border-color: rgba(226,232,240,.95); }
.table-striped > tbody > tr:nth-of-type(odd) > * { --bs-table-accent-bg: rgba(248,250,252,.75); }
.table-hover tbody tr:hover > * { background-color: #f8fafc; }
.table-responsive { border-radius: 16px; }
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    border-radius: 12px;
    border: 1px solid rgba(148,163,184,.35);
    padding: .45rem .65rem;
}
.page-link { border-radius: 10px; margin: 0 2px; border-color: var(--border-soft); color: var(--primary); }
.active > .page-link { background: var(--primary); border-color: var(--primary); }

.badge {
    border-radius: 999px;
    padding: .48em .72em;
    font-weight: 800;
    letter-spacing: .01em;
}
.bg-warning { color: #854d0e !important; background-color: #fef3c7 !important; }
.bg-info { color: #075985 !important; background-color: #e0f2fe !important; }
.bg-success { color: #166534 !important; background-color: #dcfce7 !important; }
.bg-danger { color: #991b1b !important; background-color: #fee2e2 !important; }
.bg-secondary { color: #334155 !important; background-color: #e2e8f0 !important; }
.bg-dark { color: #f8fafc !important; background-color: #0f172a !important; }

.modal-content {
    border: 0;
    border-radius: 24px;
    box-shadow: 0 28px 70px rgba(15,23,42,.22);
    overflow: hidden;
}
.modal-header {
    background: linear-gradient(135deg, #0f172a, #2563eb);
    color: #fff;
    border: 0;
    padding: 1.1rem 1.25rem;
}
.modal-footer { border-color: var(--border-soft); background: #f8fafc; }
.btn-close-white { filter: invert(1) grayscale(100%) brightness(200%); }

.alert { border-radius: 16px; border: 0; }
.toastr, #toast-container > div { border-radius: 16px !important; box-shadow: var(--shadow-card) !important; }
.swal2-popup { border-radius: 24px !important; }

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 15% 15%, rgba(14,165,233,.40), transparent 28%),
        radial-gradient(circle at 85% 20%, rgba(37,99,235,.45), transparent 32%),
        linear-gradient(135deg, #020617, #0f172a 42%, #1d4ed8);
}
.login-shell {
    width: min(980px, 100%);
    display: grid;
    grid-template-columns: 1.12fr .88fr;
    gap: 22px;
    align-items: stretch;
}
.login-hero, .login-card-modern {
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 30px;
    box-shadow: 0 28px 80px rgba(0,0,0,.28);
    backdrop-filter: blur(18px);
}
.login-hero {
    padding: 38px;
    color: #fff;
    background: linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,.06));
}
.login-card-modern {
    padding: 34px;
    background: rgba(255,255,255,.94);
}
.login-brand-mark {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 20px;
    background: linear-gradient(135deg, #2563eb, #06b6d4);
    box-shadow: 0 18px 38px rgba(37,99,235,.34);
    font-size: 1.6rem;
}
.login-feature {
    display: flex;
    gap: 12px;
    align-items: start;
    padding: 12px 0;
    color: #dbeafe;
}
.login-feature i { color: #7dd3fc; font-size: 1.25rem; }

@media (max-width: 991.98px) {
    .app-sidebar {
        position: relative;
        width: 100%;
        min-height: auto;
        border-radius: 0 0 28px 28px;
    }
    .app-content { margin-left: 0; }
    .app-topbar { height: auto; padding: 14px 18px; }
    .app-main { padding: 20px 16px; }
    .sidebar-nav-scroll { max-height: none; }
    .login-shell { grid-template-columns: 1fr; }
    .login-hero { display: none; }
}

@media (max-width: 575.98px) {
    .card-body { padding: 1rem; }
    .d-flex.justify-content-between.align-items-center.mb-3,
    .d-flex.justify-content-between.align-items-center.mb-4 {
        align-items: flex-start !important;
        gap: 12px;
        flex-direction: column;
    }
    .btn { width: 100%; }
    .btn-sm { width: auto; }
}
