:root{
    --sidebar-width: 270px;
    --sidebar-bg: linear-gradient(180deg, #111827 0%, #1f2937 100%);
    --sidebar-text: rgba(255,255,255,.82);
    --sidebar-muted: rgba(255,255,255,.55);
    --sidebar-active: rgba(255,255,255,.12);

    --page-bg: #eef2f7;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --title-color: #111827;
    --text-color: #4b5563;

    --primary: #2563eb;
    --primary-soft: rgba(37,99,235,.08);
    --success-soft: rgba(16,185,129,.10);
    --warning-soft: rgba(245,158,11,.12);
    --danger-soft: rgba(239,68,68,.10);

    --shadow-soft: 0 10px 30px rgba(15,23,42,.08);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
}

*{
    box-sizing:border-box;
}

html,body{
    margin:0;
    padding:0;
    background:var(--page-bg);
    color:var(--text-color);
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}

a{
    text-decoration:none;
}

.panel-body{
    background: var(--page-bg);
}

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

.sidebar{
    position:fixed;
    top:0;
    left:0;
    width:var(--sidebar-width);
    height:100vh;
    background:var(--sidebar-bg);
    color:#fff;
    padding:24px 18px 20px 18px;
    overflow-y:auto;
    z-index:1040;
    box-shadow: 8px 0 28px rgba(0,0,0,.12);
}

.sidebar-brand{
    display:flex;
    align-items:center;
    gap:12px;
    padding:10px 12px 20px 12px;
    border-bottom:1px solid rgba(255,255,255,.09);
    margin-bottom:20px;
}

.brand-logo{
    width:42px;
    height:42px;
    border-radius:14px;
    background:linear-gradient(135deg,#3b82f6,#1d4ed8);
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:20px;
    color:#fff;
    flex-shrink:0;
}

.brand-text{
    min-width:0;
}

.brand-title{
    font-size:22px;
    font-weight:800;
    color:#fff;
    line-height:1.1;
    letter-spacing:.3px;
}

.brand-subtitle{
    font-size:12px;
    color:var(--sidebar-muted);
    margin-top:4px;
}

.menu-group{
    margin-bottom:20px;
}

.menu-title{
    font-size:11px;
    text-transform:uppercase;
    letter-spacing:.12em;
    color:var(--sidebar-muted);
    padding:0 12px 8px 12px;
    font-weight:700;
}

.menu-link{
    display:flex;
    align-items:center;
    gap:12px;
    padding:12px 14px;
    border-radius:14px;
    color:var(--sidebar-text);
    font-weight:600;
    transition:.2s ease;
    margin-bottom:6px;
}

.menu-link:hover{
    background:rgba(255,255,255,.08);
    color:#fff;
    transform:translateX(2px);
}

.menu-link.active{
    background:var(--sidebar-active);
    color:#fff;
}

.menu-link i{
    font-size:18px;
    width:22px;
    text-align:center;
}

.sidebar-footer{
    margin-top:24px;
    padding-top:18px;
    border-top:1px solid rgba(255,255,255,.09);
}

.sidebar-logout{
    display:flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    border:1px solid rgba(255,255,255,.16);
    color:#fff;
    padding:12px 14px;
    border-radius:14px;
    font-weight:700;
    transition:.2s ease;
}

.sidebar-logout:hover{
    background:rgba(255,255,255,.08);
    color:#fff;
}

.main-area{
    margin-left:var(--sidebar-width);
    min-height:100vh;
    padding:28px 28px 36px 28px;
}

.topbar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:16px;
    margin-bottom:26px;
}

.topbar-left{
    display:flex;
    align-items:center;
    gap:12px;
}

.sidebar-toggle{
    display:none;
    width:44px;
    height:44px;
    border:none;
    background:#fff;
    border-radius:14px;
    box-shadow:var(--shadow-soft);
    color:#111827;
    font-size:20px;
}

.page-heading h1{
    margin:0;
    font-size:28px;
    line-height:1.2;
    color:var(--title-color);
    font-weight:800;
}

.page-heading p{
    margin:6px 0 0;
    color:#6b7280;
    font-size:14px;
}

.topbar-user{
    background:#fff;
    border-radius:18px;
    padding:12px 16px;
    box-shadow:var(--shadow-soft);
    display:flex;
    align-items:center;
    gap:12px;
}

.user-avatar{
    width:42px;
    height:42px;
    border-radius:50%;
    background:linear-gradient(135deg,#3b82f6,#1e40af);
    color:#fff;
    display:flex;
    align-items:center;
    justify-content:center;
    font-weight:800;
    font-size:16px;
}

.user-meta{
    line-height:1.2;
}

.user-name{
    font-weight:700;
    color:#111827;
    font-size:14px;
}

.user-role{
    color:#6b7280;
    font-size:12px;
}

.flash-wrap .alert{
    border:none;
    border-radius:16px;
    box-shadow:var(--shadow-soft);
}

.dashboard-section{
    margin-bottom:26px;
}

.section-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    margin-bottom:16px;
}

.section-header h2{
    margin:0;
    font-size:22px;
    font-weight:800;
    color:#111827;
}

.section-header p{
    margin:6px 0 0;
    color:#6b7280;
    font-size:14px;
}

.main-card{
    background:var(--card-bg);
    border:none;
    border-radius:var(--radius-xl);
    box-shadow:var(--shadow-soft);
    overflow:hidden;
}

.widget-grid{
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:18px;
}

.widget-card{
    background:#fff;
    border-radius:22px;
    box-shadow:var(--shadow-soft);
    padding:22px 18px;
    min-height:130px;
    display:flex;
    flex-direction:column;
    justify-content:space-between;
    transition:.2s ease;
}

.widget-card:hover{
    transform:translateY(-2px);
}

.widget-top{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:10px;
}

.widget-title{
    color:#6b7280;
    font-size:14px;
    font-weight:600;
}

.widget-value{
    margin-top:10px;
    font-size:18px;
    font-weight:800;
    color:#111827;
    line-height:1.2;
}

.widget-value.number{
    font-size:42px;
}

.widget-icon{
    width:48px;
    height:48px;
    border-radius:16px;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:22px;
    background:var(--primary-soft);
    color:var(--primary);
}

.quick-grid{
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:18px;
}

.quick-card{
    background:#fff;
    border-radius:24px;
    box-shadow:var(--shadow-soft);
    padding:22px 20px;
    min-height:190px;
    color:inherit;
    transition:.2s ease;
    border:1px solid transparent;
}

.quick-card:hover{
    transform:translateY(-3px);
    border-color:#dbeafe;
}

.quick-icon{
    width:56px;
    height:56px;
    border-radius:18px;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:26px;
    margin-bottom:16px;
    background:var(--primary-soft);
    color:var(--primary);
}

.quick-title{
    font-size:18px;
    font-weight:800;
    color:#111827;
    margin-bottom:8px;
}

.quick-desc{
    color:#6b7280;
    font-size:15px;
    line-height:1.55;
}

.stats-grid{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:18px;
}

.stat-mini{
    background:#fff;
    border-radius:20px;
    box-shadow:var(--shadow-soft);
    padding:20px;
}

.stat-mini-label{
    color:#6b7280;
    font-size:14px;
    margin-bottom:6px;
}

.stat-mini-value{
    font-size:42px;
    font-weight:800;
    color:#111827;
    line-height:1;
}

.table-card .table{
    margin-bottom:0;
}

.table-card .table thead th{
    color:#374151;
    font-weight:700;
    border-bottom:1px solid var(--border-color);
    background:transparent;
}

.table-card .table td{
    vertical-align:middle;
    border-color:var(--border-color);
}

.soft-badge{
    display:inline-flex;
    align-items:center;
    padding:6px 10px;
    border-radius:999px;
    font-size:12px;
    font-weight:700;
}

.soft-badge.gray{
    background:#f3f4f6;
    color:#374151;
}

.soft-badge.blue{
    background:#dbeafe;
    color:#1d4ed8;
}

.public-wrap{
    min-height:100vh;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:30px 18px;
}

.public-card{
    width:min(100%, 1040px);
    background:#fff;
    border-radius:26px;
    box-shadow:var(--shadow-soft);
    padding:32px;
}

.btn{
    border-radius:14px !important;
    font-weight:600 !important;
}

@media (max-width: 1399.98px){
    .widget-grid,
    .quick-grid{
        grid-template-columns:repeat(3,minmax(0,1fr));
    }
}

@media (max-width: 991.98px){
    .sidebar{
        transform:translateX(-100%);
        transition:.25s ease;
    }

    body.sidebar-open .sidebar{
        transform:translateX(0);
    }

    .main-area{
        margin-left:0;
        padding:20px 16px 28px 16px;
    }

    .sidebar-toggle{
        display:inline-flex;
        align-items:center;
        justify-content:center;
    }

    .widget-grid,
    .quick-grid,
    .stats-grid{
        grid-template-columns:repeat(2,minmax(0,1fr));
    }

    .topbar{
        flex-direction:column;
        align-items:stretch;
    }
}

@media (max-width: 575.98px){
    .widget-grid,
    .quick-grid,
    .stats-grid{
        grid-template-columns:1fr;
    }

    .page-heading h1{
        font-size:24px;
    }

    .widget-value.number{
        font-size:34px;
    }

    .stat-mini-value{
        font-size:34px;
    }
}
