:root {
    --sidebar-width: 260px;
    --brand: #4f46e5;
    --brand-dark: #4338ca;
}

body {
    background-color: #f4f6fb;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

[data-bs-theme="dark"] body {
    background-color: #0f172a;
}

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ---------------- Sidebar ---------------- */
.app-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: linear-gradient(180deg, #312e81 0%, #1e1b4b 100%);
    color: #e2e8f0;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform .25s ease;
    overflow-y: auto;
}

.app-sidebar .sidebar-brand {
    padding: 1.15rem 1.25rem;
    font-weight: 700;
    font-size: 1.05rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: .6rem;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.app-sidebar .nav-section {
    padding: 1rem 1.25rem .35rem;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(226, 232, 240, .45);
}

.app-sidebar .nav-link {
    color: #cbd5e1;
    padding: .6rem 1.25rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    border-radius: 0;
    font-size: .93rem;
}

.app-sidebar .nav-link i {
    font-size: 1.1rem;
    width: 1.25rem;
    text-align: center;
}

.app-sidebar .nav-link:hover {
    background: rgba(255, 255, 255, .06);
    color: #fff;
}

.app-sidebar .nav-link.active {
    background: rgba(129, 140, 248, .22);
    color: #fff;
    border-left: 3px solid #a5b4fc;
    font-weight: 600;
}

/* ---------------- Main area ---------------- */
.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-navbar {
    background: var(--bs-body-bg);
    border-bottom: 1px solid var(--bs-border-color);
    padding: .65rem 1rem;
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.app-content {
    flex: 1;
}

.app-footer {
    border-top: 1px solid var(--bs-border-color);
}

/* ---------------- Components ---------------- */
.card {
    border: none;
    border-radius: .85rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
}

.stat-card {
    --accent: #4f46e5;
    position: relative;
    border-radius: .85rem;
    overflow: hidden;
    /* Tint pastel natural yang menyelimuti seluruh kartu — terlihat jelas tapi lembut di mata. */
    background:
        linear-gradient(135deg,
            color-mix(in srgb, var(--accent) 20%, var(--bs-card-bg, #fff)) 0%,
            color-mix(in srgb, var(--accent) 9%, var(--bs-card-bg, #fff)) 100%);
    border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
    transition: transform .18s ease, box-shadow .18s ease;
}

/* Garis aksen tipis di sisi kiri untuk sentuhan profesional. */
.stat-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--accent);
    opacity: .7;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 20%, rgba(15, 23, 42, .06));
}

.stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: .75rem;
    display: grid;
    place-items: center;
    font-size: 1.5rem;
}

/* Fallback bila browser tidak mendukung color-mix: tetap putih bersih. */
@supports not (background: color-mix(in srgb, red, blue)) {
    .stat-card {
        background: var(--bs-card-bg, #fff);
        border-color: var(--bs-border-color);
    }
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.1;
}

.table > :not(caption) > * > * {
    padding: .7rem .75rem;
}

.page-title {
    font-weight: 700;
    margin-bottom: .15rem;
}

.avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 600;
}

/* ---------------- Responsive ---------------- */
.sidebar-backdrop {
    display: none;
}

@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    .app-sidebar.show {
        transform: translateX(0);
    }
    .app-main {
        margin-left: 0;
    }
    .sidebar-backdrop.show {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .5);
        z-index: 1035;
    }
}
