:root {
    --navy: #052a6b;
    --blue: #1e4bd8;
    --highlight: #fff3b0;
    --sb-wide: 220px;
    --sb-narrow: 72px;
}

/* Reset */
* {
    box-sizing: border-box;
    text-decoration: none;
}

body {
    margin: 0;
    font-family: Inter, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f8f9fa;
    color: #1b1b1b;
}

/* Sidebar */
.sidebar {
    height: 100vh;
    background: linear-gradient(180deg, var(--navy), #031433);
    padding-top: 1rem;
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sb-wide);
    transition: width .28s ease;
    overflow: hidden;
    z-index: 1000;
}

.sidebar a {
    color: #fff;
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: 10px 16px;
    text-decoration: none;
    white-space: nowrap;
}

.sidebar a:hover {
    background: #495057;
}

.menu-text {
    transition: opacity .18s ease;
}

.sidebar.collapsed {
    width: var(--sb-narrow);
}

.sidebar.collapsed .menu-text {
    opacity: 0;
    visibility: hidden;
}

/* Pin button */
.pin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, .5);
    background: transparent;
    color: #fff;
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
}

/* Main content */
.main {
    margin-left: var(--sb-wide);
    padding: 20px;
    transition: margin-left .28s ease;
}

.sidebar.collapsed~.main {
    margin-left: var(--sb-narrow);
}

/* Highlight pencarian */
mark {
    background: var(--highlight);
    padding: 0 2px;
}

/* Table */
.table {
    font-size: 14px;
    width: 100%;
    border-collapse: collapse;
}

.table thead th {
    background: linear-gradient(90deg, var(--blue), var(--navy));
    color: #fff;
    font-weight: 700;
    vertical-align: middle;
}

.table tbody td {
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===================================================== */
/* ===============  NAVBAR ALIGNMENT FIX  =============== */
/* ===================================================== */

.navbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 56px;
    /* samakan tinggi dengan navbar Bootstrap */
}

/* Tombol toggle sidebar */
#toggleSidebar {
    font-size: 22px;
    background: transparent;
    border: none;
    color: var(--navy);
    cursor: pointer;
    text-align: left;
    z-index: 2500;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    /* samakan tinggi visual dengan logo */
    width: 40px;
    padding: 0;
    /* hapus padding bawaan tombol bootstrap */
    line-height: 1;
}

/* Logo */
.navbar-brand {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
    height: 40px;
    /* samakan tinggi logo */
}

.navbar-brand img {
    display: block;
    height: 40px;
    width: auto;
    object-fit: contain;
}

/* ===================================================== */
/* ===============  RESPONSIVE STYLING  ================= */
/* ===================================================== */

@media (max-width: 992px) {
    .navbar form {
        flex-wrap: wrap;
        gap: 6px;
    }
}

@media (max-width: 768px) {

    /* Sidebar overlay penuh di mobile */
    .sidebar {
        position: fixed;
        top: 0;
        left: -250px;
        width: 220px;
        height: 100%;
        background: linear-gradient(180deg, var(--navy), #031433);
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.25);
        transition: left 0.3s ease;
        z-index: 2000;
    }

    .sidebar.active {
        left: 0;
    }

    body.no-scroll::before {
        content: "";
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1500;
    }

    /* Navbar kiri */
    .navbar-left {
        display: flex;
        align-items: center;
        gap: 10px;
        height: 56px;
        position: relative;
        width: 100%;
    }

    /* Tombol toggle sidebar */
    #toggleSidebar {
        font-size: 22px;
        background: transparent;
        border: none;
        color: var(--navy);
        cursor: pointer;
        position: relative;
        text-align: left;
        z-index: 2500;
        margin-right: 10px;
        height: 38px;
        width: 38px;
        padding: 0;
    }

    /* Logo berada di tengah */
    .navbar-brand {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }

    .navbar-brand img {
        height: 36px;
        width: auto;
    }

    /* Form pencarian */
    .navbar form {
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }

    .navbar input,
    .navbar select,
    .navbar button {
        width: 100%;
    }

    .main {
        margin-left: 0 !important;
        padding: 15px;
        transition: none;
    }

    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table td,
    .table th {
        font-size: 13px;
        padding: 8px;
    }
}

/* ===================================================== */
/* ============  SIDEBAR & TOGGLE LAYER FIX  ============ */
/* ===================================================== */

/* Pastikan toggle berada di belakang sidebar saat sidebar aktif */
#toggleSidebar {
    position: relative;
    z-index: 1000;
    /* lebih rendah dari sidebar (2000) */
}

/* Sidebar harus menutupi toggle saat aktif */
.sidebar {
    z-index: 2000;
    /* pastikan lebih tinggi dari toggle */
}

/* Overlay ketika sidebar aktif */
body.no-scroll::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1500;
    /* di bawah sidebar */
}