:root{
    --primary: #0d6efd;
    --primary-dark: #0b5ed7;
    --bg: #f5f7fb;
    --white: #ffffff;
    --dark: #0f172a;
    --dark-2: #111827;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --success: #198754;
    --warning: #f59e0b;
    --danger: #dc3545;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    --radius: 18px;
    --sidebar-width: 270px;
    --topbar-height: 80px;
}

*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body{
    min-height: 100%;
}

body{
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
}

a{
    text-decoration: none;
}

.app-wrapper{
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar{
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #0b1320 0%, #111827 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 24px 18px;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 1000;
}

.sidebar-brand{
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
    padding: 8px 10px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-logo{
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), #4f8cff);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 8px 20px rgba(13,110,253,.35);
}

.sidebar-brand h5{
    font-weight: 800;
    font-size: 18px;
}

.sidebar-brand small{
    color: rgba(255,255,255,0.65);
}

.sidebar-menu{
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.menu-link{
    display: flex;
    align-items: center;
    gap: 12px;
    color: #d1d5db;
    padding: 12px 14px;
    border-radius: 14px;
    transition: all .2s ease;
    font-weight: 500;
}

.menu-link i{
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.menu-link:hover{
    background: rgba(255,255,255,0.06);
    color: #fff;
}

.menu-link.active{
    background: linear-gradient(90deg, var(--primary), #3b82f6);
    color: #fff;
    box-shadow: 0 10px 20px rgba(13,110,253,.25);
}

.sidebar-footer{
    margin-top: auto;
    padding-top: 22px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.user-box{
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar{
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255,255,255,0.14);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.user-info strong{
    display: block;
    font-size: 14px;
    color: #fff;
}

.user-info small{
    color: rgba(255,255,255,0.65);
    text-transform: capitalize;
}

/* MAIN */
.main-area{
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
}

.topbar{
    height: var(--topbar-height);
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    padding: 16px 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 999;
}

.topbar-left h4{
    font-weight: 800;
    color: var(--dark);
}

.topbar-right{
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-user{
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: 14px;
    box-shadow: 0 4px 15px rgba(0,0,0,.04);
    font-weight: 600;
}

.page-content{
    padding: 28px;
}

/* CARDS */
.card{
    border: 0;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.kpi-card{
    padding: 24px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.kpi-card::after{
    content: '';
    position: absolute;
    width: 90px;
    height: 90px;
    right: -18px;
    top: -18px;
    background: rgba(13,110,253,.08);
    border-radius: 50%;
}

.kpi-title{
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.kpi-value{
    font-size: 30px;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 6px;
}

.kpi-icon{
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    margin-bottom: 14px;
}

.bg-kpi-primary{ background: linear-gradient(135deg, #0d6efd, #4f8cff); }
.bg-kpi-success{ background: linear-gradient(135deg, #198754, #3cb371); }
.bg-kpi-warning{ background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.bg-kpi-danger{ background: linear-gradient(135deg, #dc3545, #ef4444); }

/* BOXES */
.content-box{
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}

.section-title{
    font-size: 18px;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 18px;
}

/* TABLE */
.table-responsive{
    border-radius: 16px;
}

.table{
    margin-bottom: 0;
}

.table thead th{
    background: #f8fafc;
    color: #374151;
    font-size: 13px;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
    padding: 14px;
}

.table tbody td{
    padding: 14px;
    vertical-align: middle;
    border-color: #f1f5f9;
}

/* BUTTONS */
.btn{
    border-radius: 12px;
    font-weight: 600;
}

.btn-primary{
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover{
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* BADGES */
.badge-soft-success{
    background: rgba(25,135,84,.12);
    color: var(--success);
    padding: 8px 12px;
    border-radius: 999px;
    font-weight: 700;
}

.badge-soft-warning{
    background: rgba(245,158,11,.12);
    color: #b45309;
    padding: 8px 12px;
    border-radius: 999px;
    font-weight: 700;
}

.badge-soft-danger{
    background: rgba(220,53,69,.12);
    color: var(--danger);
    padding: 8px 12px;
    border-radius: 999px;
    font-weight: 700;
}

/* LOGIN */
.login-page{
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f7fb 0%, #eaf1ff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card{
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 15px 40px rgba(0,0,0,.08);
    padding: 34px;
}

.login-logo{
    width: 70px;
    height: 70px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary), #4f8cff);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto 18px;
}

.login-title{
    font-weight: 800;
    text-align: center;
    margin-bottom: 4px;
}

.login-subtitle{
    text-align: center;
    color: var(--muted);
    margin-bottom: 24px;
}

/* RESPONSIVE */
@media (max-width: 991px){
    .sidebar{
        position: relative;
        width: 100%;
        min-height: auto;
    }

    .main-area{
        margin-left: 0;
        width: 100%;
    }

    .app-wrapper{
        flex-direction: column;
    }
}

@media (max-width: 576px){
    .page-content{
        padding: 18px;
    }

    .topbar{
        padding: 14px 18px;
        height: auto;
        align-items: flex-start;
        gap: 12px;
        flex-direction: column;
    }

    .kpi-value{
        font-size: 24px;
    }
}