:root {
    --primary: #0d6efd;
    --primary-dark: #0a4ea2;
    --navy: #0e2340;
    --navy-2: #163a5d;
    --sidebar: #0f243f;
    --sidebar-hover: #183d63;
    --sidebar-text: #dfeaf9;
    --bg: #f4f7fb;
    --card-bg: #ffffff;
    --white: #ffffff;
    --text: #1f2d3d;
    --muted: #6b7a90;
    --border: #dfe7f0;
    --success: #2bb673;
    --warning: #f4b740;
    --danger: #e05a5a;
    --shadow: 0 10px 25px rgba(15, 36, 63, 0.08);
    --radius: 14px;
}


* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body {
    min-height: 100vh;
}

img {
    max-width: 100%;
}

button, input, select {
    font: inherit;
}

.app-body {
    background: var(--bg);
}

.app-shell {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 330px;
    background: linear-gradient(180deg, var(--sidebar) 0%, var(--navy) 100%);
    color: var(--sidebar-text);
    z-index: 1020;
    transition: all 0.3s ease;
    border-right: 1px solid rgba(255,255,255,0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Prevent the whole sidebar from scrolling */
}

.sidebar .sidebar-header {
    flex-shrink: 0; 
    padding: 20px 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.brand-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.12);
    border-radius: 10px;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
}

.sidebar-nav {
     flex: 1;                 /* Take remaining height */
    overflow-y: auto;        /* Only menu scrolls */
    padding-top: 14px;
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    margin: 4px 10px;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 14px;
    border-radius: 10px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: 0.2s ease;
    /* font-weight: 500; */
}

.nav-item a:hover,
.nav-item.active a {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.nav-item .nav-icon {
    width: 18px;
    text-align: center;
    opacity: 0.9;
}

.nav-section {
    padding: 18px 18px 8px;
    color: rgba(255,255,255,0.5);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
}

.nav-logout {
    margin-top: 24px;
}

.main-content {
    margin-left: 330px;
    min-height: 100vh;
    transition: all 0.3s ease;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 1010;
    background: rgba(255,255,255,0.96);
    border-bottom: 1px solid var(--border);
    padding: 14px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    backdrop-filter: blur(8px);
}

.brand-block {
    gap: 12px;
}

.brand-logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 10px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    box-shadow: var(--shadow);
}

.brand-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--navy);
}

.top-search {
    width: 260px;
}

.top-search .form-control {
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #f8fafc;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f4f7fb;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 7px 12px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--primary-dark);
    color: #fff;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}

.user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.user-meta strong {
    font-size: 0.85rem;
    color: var(--text);
}

.user-meta small {
    color: var(--muted);
}

.page-shell {
    padding: 24px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.page-title {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--navy);
}

.subtitle {
    color: var(--muted);
    margin: 6px 0 0;
}

.card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    background: var(--card-bg);
}

.stat-card {
    padding: 18px 20px;
    height: 100%;
    min-height: 120px;
}

.stat-card .stat-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
}

.icon-blue { background: linear-gradient(135deg, #3c8dff, #1a5ed8); }
.icon-green { background: linear-gradient(135deg, #2ec5a3, #1ba17a); }
.icon-gold { background: linear-gradient(135deg, #f5bf5b, #e29d22); }
.icon-purple { background: linear-gradient(135deg, #7b6ef6, #5649d9); }

.stat-label {
    font-size: 0.8rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin: 6px 0 4px;
    color: var(--navy);
}

.stat-meta {
    font-size: 0.85rem;
    color: var(--success);
}

.panel {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}

.chart-box {
    height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--border);
    border-radius: 12px;
    background: linear-gradient(180deg, #f9fbff 0%, #eef4ff 100%);
    color: var(--muted);
    font-weight: 600;
}

.table-panel {
    margin-top: 24px;
}

.table-custom {
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
}

.table-custom thead th {
    background: #f3f7fd;
    color: var(--navy);
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 14px 12px;
}

.table-custom tbody td {
    padding: 12px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(43,182,115,0.12);
    color: var(--success);
}

.badge-warning {
    background: rgba(244,183,64,0.14);
    color: #b77910;
}

.badge-secondary {
    background: rgba(108,117,125,0.12);
    color: #495057;
}

.btn {
    border-radius: 10px;
    padding: 0.6rem 1rem;
    font-weight: 600;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}

.btn-outline-primary {
    color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff;
}

.btn-light {
    border: 1px solid var(--border);
    background: #fff;
}

.action-btns .btn {
    padding: 0.38rem 0.7rem;
    font-size: 0.8rem;
}

.page-toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.toolbar-search {
    max-width: 260px;
    min-width: 180px;
}

.toolbar-search .form-control {
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #f9fbff;
}

.form-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.form-label {
    font-size: 0.83rem;
    color: var(--navy);
    font-weight: 600;
    margin-bottom: 8px;
}

.form-control,
.form-select {
    border-radius: 10px;
    border: 1px solid var(--border);
    padding: 0.7rem 0.85rem;
    background: #fff;
    color: var(--text);
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(13,110,253,0.5);
    box-shadow: 0 0 0 0.25rem rgba(13,110,253,0.12);
}

.modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: 0 18px 50px rgba(15, 36, 63, 0.16);
}

.modal-header {
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.2rem;
}

.modal-body {
    padding: 1.2rem;
}

.modal-footer {
    border-top: 1px solid var(--border);
    padding: 1rem 1.2rem;
}

.loader-overlay {
    position: fixed;
    inset: 0;
    background: rgba(7, 16, 31, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loader-box {
    background: rgba(255,255,255,0.98);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 24px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.loader-text {
    font-weight: 600;
    color: var(--navy);
}

.toast {
    border-radius: 12px;
    border: none;
    box-shadow: var(--shadow);
}

.sidebar-collapsed .sidebar {
    width: 80px;
}

.sidebar-collapsed .sidebar-brand .brand-text,
.sidebar-collapsed .nav-item a span:last-child,
.sidebar-collapsed .nav-section {
    display: none;
}

.sidebar-collapsed .main-content {
    margin-left: 80px;
}

.sidebar-collapsed .nav-item a {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .top-search {
        width: 180px;
    }
}

@media (max-width: 767.98px) {
    .page-shell {
        padding: 18px 14px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .topbar {
        padding: 12px 14px;
    }

    .user-meta {
        display: none;
    }

    .top-search {
        display: none;
    }
}



