:root {
    --sidebar-width: 260px;
    --sidebar-bg: #0f172a;
    --sidebar-hover: rgba(255,255,255,0.07);
    --sidebar-active: rgba(99,102,241,0.2);
    --sidebar-active-border: #6366f1;
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #a5b4fc;
    --body-bg: #f1f5f9;
    --card-radius: 12px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--body-bg);
    color: #1e293b;
    -webkit-font-smoothing: antialiased;
}

/* ─── SIDEBAR ─── */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1050;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--sidebar-bg);
    border-right: 1px solid rgba(255,255,255,0.06);
    transition: var(--transition);
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 10px; }

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-brand .brand-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-brand .brand-text {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #fff;
}

.sidebar-brand .brand-sub {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sidebar .nav-section {
    padding: 1rem 1.5rem 0.4rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.3);
}

.sidebar .nav-link {
    padding: 0.6rem 1.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: rgba(255,255,255,0.6);
    transition: var(--transition);
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.sidebar .nav-link i { width: 18px; text-align: center; font-size: 0.9rem; }

.sidebar .nav-link:hover {
    color: #fff;
    background: var(--sidebar-hover);
    border-left-color: rgba(255,255,255,0.2);
}

.sidebar .nav-link.active {
    color: #fff;
    background: var(--sidebar-active);
    border-left-color: var(--sidebar-active-border);
    font-weight: 600;
}

/* ─── MAIN CONTENT ─── */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    width: calc(100% - var(--sidebar-width));
    max-width: calc(100% - var(--sidebar-width));
    transition: var(--transition);
}

/* ─── TOP NAV ─── */
.top-navbar {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0 1.5rem;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1040;
}

.top-navbar .page-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #334155;
}

.top-navbar .user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.top-navbar .user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.75rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.top-navbar .user-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
}

.top-navbar .user-name { font-size: 0.82rem; font-weight: 600; color: #334155; }
.top-navbar .user-role { font-size: 0.7rem; color: #94a3b8; }

/* ─── CARDS ─── */
.card {
    border-radius: var(--card-radius);
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: var(--transition);
}

.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

.card-header {
    background: #fff;
    border-bottom: 1px solid #f1f5f9;
    border-radius: var(--card-radius) var(--card-radius) 0 0 !important;
    padding: 0.85rem 1.25rem;
    font-weight: 600;
    font-size: 0.88rem;
}

/* ─── STAT CARDS ─── */
.stat-card {
    border: none;
    border-radius: var(--card-radius);
    overflow: hidden;
    position: relative;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.stat-card .stat-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 0.25rem;
}

/* ─── TABLES ─── */
.table { font-size: 0.85rem; }

.table th {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    border-bottom: 2px solid #e2e8f0;
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.table td {
    padding: 0.65rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

.table-hover tbody tr:hover { background: #f8fafc; }

/* ─── BADGES ─── */
.badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.35em 0.65em;
    border-radius: 6px;
    letter-spacing: 0.02em;
}

/* ─── BUTTONS ─── */
.btn { font-size: 0.85rem; font-weight: 500; border-radius: 8px; transition: var(--transition); }
.btn-sm { font-size: 0.78rem; padding: 0.3rem 0.6rem; border-radius: 6px; }

.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,0.3); }

.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); }

/* ─── FORM CONTROLS ─── */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    font-size: 0.85rem;
    padding: 0.5rem 0.85rem;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.form-label { font-size: 0.82rem; font-weight: 600; color: #475569; margin-bottom: 0.35rem; }

/* ─── MODALS ─── */
.modal-content { border-radius: 14px; border: none; box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
.modal-header { border-bottom: 1px solid #f1f5f9; padding: 1rem 1.5rem; }
.modal-header .modal-title { font-weight: 700; font-size: 1rem; }
.modal-body { padding: 1.5rem; }

/* ─── LOGIN PAGE ─── */
.login-page {
    min-height: 100vh;
    display: flex;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(99,102,241,0.15) 0%, transparent 70%);
    top: -100px;
    right: -100px;
    border-radius: 50%;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(139,92,246,0.1) 0%, transparent 70%);
    bottom: -50px;
    left: -50px;
    border-radius: 50%;
}

.login-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 4rem;
    color: #fff;
    position: relative;
    z-index: 1;
}

.login-left h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 1rem;
}

.login-left h1 span {
    background: linear-gradient(135deg, #6366f1, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-left p { color: rgba(255,255,255,0.5); font-size: 1rem; line-height: 1.6; max-width: 400px; }

.login-features {
    margin-top: 2rem;
    list-style: none;
    padding: 0;
}

.login-features li {
    padding: 0.5rem 0;
    color: rgba(255,255,255,0.6);
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.login-features li i {
    width: 28px;
    height: 28px;
    background: rgba(99,102,241,0.2);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: var(--primary-light);
}

.login-right {
    width: 480px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    padding: 2rem;
}

.login-card {
    width: 100%;
    background: #fff;
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 25px 80px rgba(0,0,0,0.3);
}

.login-card .logo-icon {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #fff;
    margin-bottom: 1.5rem;
}

.login-card h2 { font-size: 1.4rem; font-weight: 800; color: #0f172a; margin-bottom: 0.25rem; }
.login-card .login-subtitle { font-size: 0.85rem; color: #94a3b8; margin-bottom: 1.75rem; }

.login-card .form-label { font-size: 0.8rem; font-weight: 600; color: #475569; }

.login-card .form-control {
    padding: 0.65rem 1rem;
    font-size: 0.88rem;
    border-radius: 10px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
}

.login-card .form-control:focus { background: #fff; border-color: var(--primary); }

.login-card .input-group-text {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px 0 0 10px;
    color: #94a3b8;
}

.login-card .btn-login {
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    border: none;
    padding: 0.7rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 10px;
    transition: var(--transition);
}

.login-card .btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99,102,241,0.4);
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.75rem;
    color: #94a3b8;
}

/* ─── PAGE CONTENT ─── */
.page-content { padding: 1.5rem; }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.page-header h4 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-header h4 i { color: var(--primary); font-size: 1rem; }

/* ─── FILTER BAR ─── */
.filter-bar {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--card-radius);
    padding: 0.65rem 1.25rem;
    margin-bottom: 1rem;
}

/* ─── LIST GROUP ─── */
.list-group-item {
    border-color: #f1f5f9;
    transition: var(--transition);
    padding: 0.85rem 1.25rem;
}

.list-group-item:hover { background: #f8fafc; }
.list-group-item.active { background: var(--sidebar-active); border-color: var(--sidebar-active-border); color: var(--primary); }

/* ─── PAGINATION ─── */
.page-link {
    border-radius: 8px !important;
    margin: 0 2px;
    font-size: 0.82rem;
    font-weight: 500;
    color: #475569;
    border-color: #e2e8f0;
}

.page-item.active .page-link { background: var(--primary); border-color: var(--primary); }

/* ─── RESPONSIVE ─── */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
    }
    .login-left { display: none; }
    .login-right { width: 100%; }
    .login-page { justify-content: center; }
}

@media (max-width: 768px) {
    .page-content { padding: 1rem; }
    .stat-card .stat-value { font-size: 1.3rem; }
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ─── ANIMATIONS ─── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-in { animation: fadeInUp 0.4s ease-out; }

/* ─── SIDEBAR BACKDROP (mobile) ─── */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1045;
}

.sidebar-backdrop.show { display: block; }
