:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --sidebar: #0f172a;
    --sidebar-hover: #1e293b;
    --light-bg: #f4f6fb;
    --text-dark: #1f2937;
    --danger-soft: rgba(239, 68, 68, 0.15);
}

/* =========================
   GLOBAL
========================= */
* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: var(--light-bg);
    color: var(--text-dark);
    margin: 0;
}

a {
    text-decoration: none;
}

/* =========================
   LOGIN PAGE
========================= */
.login-body {
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.35), transparent 35%),
        linear-gradient(135deg, #0f172a, #2563eb);
}

.login-card {
    border-radius: 24px;
    overflow: hidden;
    background: #ffffff;
}

.login-left {
    min-height: 440px;
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(37, 99, 235, 0.88)),
        url('https://images.unsplash.com/photo-1523240795612-9a054b0db644?auto=format&fit=crop&w=900&q=80');
    background-size: cover;
    background-position: center;
    color: #ffffff;
    align-items: center;
    padding: 48px;
}

.brand-circle {
    width: 72px;
    height: 72px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
}

.login-footer {
    line-height: 1.6;
}

.login-footer strong {
    color: #ffffff;
    font-weight: 700;
}

/* =========================
   APP LAYOUT
========================= */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* =========================
   SIDEBAR
========================= */
.sidebar {
    width: 270px;
    background: var(--sidebar);
    color: #ffffff;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    transition: 0.3s;
    z-index: 1000;

    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}

.sidebar-brand {
    padding: 22px;
    font-weight: 700;
    font-size: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
    height: 78px;
    display: flex;
    align-items: center;
}

/* menu bisa scroll */
.sidebar-menu {
    padding: 16px;
    flex: 1;
    max-height: calc(100vh - 78px - 73px);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #334155 #0f172a;
}

/* scrollbar chrome/edge */
.sidebar-menu::-webkit-scrollbar {
    width: 6px;
}

.sidebar-menu::-webkit-scrollbar-track {
    background: #0f172a;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 999px;
}

.sidebar-menu::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #cbd5e1;
    text-decoration: none;
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 6px;
    transition: 0.2s;
    font-size: 15px;
    white-space: nowrap;
}

.sidebar-menu a i {
    width: 20px;
    min-width: 20px;
    text-align: center;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: var(--sidebar-hover);
    color: #ffffff;
}

.sidebar-menu a.active {
    background: #2563eb;
    color: #ffffff;
}

/* logout tetap di bawah */
.sidebar-logout {
    flex-shrink: 0;
    height: 73px;
    padding: 14px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: #0f172a;
}

.sidebar-logout a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fecaca;
    text-decoration: none;
    padding: 12px 14px;
    border-radius: 12px;
    transition: 0.2s;
    font-size: 15px;
}

.sidebar-logout a i {
    width: 20px;
    min-width: 20px;
    text-align: center;
}

.sidebar-logout a:hover {
    background: var(--danger-soft);
    color: #ffffff;
}

/* =========================
   MAIN CONTENT
========================= */
.main-content {
    margin-left: 270px;
    width: calc(100% - 270px);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 70px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 900;
}

.content {
    padding: 28px;
    flex: 1;
}

/* =========================
   CARDS
========================= */
.stat-card {
    border: none;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: rgba(37, 99, 235, 0.12);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.card-modern {
    border: none;
    border-radius: 18px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
}

/* =========================
   BUTTONS
========================= */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.logout-topbar {
    border-radius: 10px;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

/* =========================
   TABLE
========================= */
.table-modern thead th {
    background: #f8fafc;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.table-modern tbody td {
    font-size: 14px;
    color: #334155;
    vertical-align: middle;
}

.table-modern tbody tr:hover {
    background: #f8fafc;
}

/* =========================
   FORM
========================= */
.form-control,
.form-select {
    border-radius: 10px;
    border-color: #dbe3ef;
    font-size: 14px;
}

.form-control:focus,
.form-select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 0.15rem rgba(37, 99, 235, 0.15);
}

/* =========================
   FOOTER
========================= */
.app-footer {
    margin: 28px 28px 0 28px;
    padding: 12px 20px;
    background: #ffffff;
    border-top: 1px solid #dbe3ef;
    border-radius: 14px 14px 0 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.04);
}

.app-footer .footer-title {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 2px;
}

.app-footer .footer-credit {
    font-size: 12.5px;
    color: #64748b;
}

.app-footer strong {
    color: #0f172a;
    font-weight: 700;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 991px) {
    .sidebar {
        left: -270px;
    }

    .sidebar.show {
        left: 0;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .topbar {
        padding: 0 16px;
    }

    .content {
        padding: 20px 16px;
    }

    .app-footer {
        margin: 20px 16px 0 16px;
        padding: 12px 16px;
        text-align: center;
    }

    .app-footer .footer-title {
        margin-bottom: 4px;
    }

    .logout-topbar {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* =========================
   FORCE FIX SIDEBAR SCROLL
========================= */
.sidebar {
    height: 100vh !important;
    overflow: hidden !important;
}

.sidebar-brand {
    flex-shrink: 0 !important;
}

.sidebar-menu {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    min-height: 0 !important;
}

.sidebar-logout {
    flex-shrink: 0 !important;
}