*{
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body{
    font-family: 'Poppins', sans-serif;
    background: #f4f8f4;
    color: #1b5e20;
    overflow-x: hidden;
}

/* ================= LAYOUT ================= */
.layout{
    display: flex;
    min-height: 100vh;
}

/* ================= SIDEBAR ================= */
.sidebar{
    width: 240px;
    background: linear-gradient(180deg, #2e7d32, #1b5e20);
    color: white;
    padding: 20px;
    position: fixed;
    left: 0;
    top: 0;
    height: 100%;
    transition: left 0.3s ease;
    z-index: 300;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Sidebar tersembunyi — dipakai di tablet/mobile */
.sidebar.hide{
    left: -240px;
}

.sidebar-header{
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    flex-shrink: 0;
}

/* MENU ITEM */
.menu-item{
    display: block;
    color: white;
    text-decoration: none;
    padding: 11px 14px;
    border-radius: 10px;
    margin-bottom: 6px;
    transition: background 0.2s, transform 0.2s;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.menu-item:hover{
    background: rgba(255,255,255,0.2);
    transform: translateX(4px);
}

.menu-item.active{
    background: white;
    color: #1b5e20;
    font-weight: 600;
}

/* ================= OVERLAY (mobile) ================= */
.sidebar-overlay{
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 299;
}

.sidebar-overlay.active{
    display: block;
}

/* ================= MAIN ================= */
.main{
    margin-left: 240px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* penting agar flex child tidak overflow */
    transition: margin-left 0.3s ease;
}

/* Saat sidebar disembunyikan di desktop */
.main.full{
    margin-left: 0;
}

/* ================= NAVBAR ================= */
.navbar{
    background: white;
    padding: 0 20px;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 3px 10px rgba(0,0,0,0.06);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

/* LEFT */
.nav-left{
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

/* HAMBURGER */
.hamburger{
    font-size: 20px;
    background: #2e7d32;
    color: white;
    padding: 6px 11px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
    user-select: none;
    line-height: 1;
}

.hamburger:hover{
    background: #1b5e20;
}

/* LOGO */
.logo{
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 15px;
    color: #1b5e20;
    white-space: nowrap;
}

.logo img{
    height: 30px;
    width: auto;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

/* RIGHT NAV */
.nav-right{
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

/* ================= USER MENU ================= */
.user-menu{
    position: relative;
}

.user-info{
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    background: #f1f8f4;
    padding: 6px 10px;
    border-radius: 12px;
    transition: background 0.2s;
}

.user-info:hover{
    background: #e8f5e9;
}

/* AVATAR */
.avatar{
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

/* TEXT */
.user-text{
    display: flex;
    flex-direction: column;
    font-size: 13px;
    line-height: 1.3;
    max-width: 120px;
    overflow: hidden;
}

.user-text span{
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ROLE */
.role{
    font-size: 10px;
    color: white;
    background: #2e7d32;
    padding: 2px 6px;
    border-radius: 5px;
    margin-top: 2px;
    width: fit-content;
    text-transform: capitalize;
}

/* ================= DROPDOWN ================= */
.dropdown{
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    display: none;
    min-width: 150px;
    overflow: hidden;
    z-index: 200;
}

.dropdown a,
.dropdown button{
    display: block;
    width: 100%;
    padding: 10px 14px;
    text-align: left;
    border: none;
    background: none;
    cursor: pointer;
    text-decoration: none;
    color: #333;
    font-size: 13px;
    font-family: 'Poppins', sans-serif;
    transition: background 0.15s;
}

.dropdown a:hover,
.dropdown button:hover{
    background: #f5f5f5;
}

/* ================= CONTENT ================= */
.content{
    flex: 1;
    padding: 30px;
    min-width: 0;
}

/* ================= FOOTER ================= */
.footer{
    text-align: center;
    padding: 14px 20px;
    background: #e8f5e9;
    font-size: 12px;
    color: #4a7c59;
    flex-shrink: 0;
}

/* ================= BUTTON ================= */
.btn{
    display: inline-block;
    padding: 9px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    font-family: 'Poppins', sans-serif;
    color: white;
    background: #2e7d32;
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.btn:hover{
    background: #1b5e20;
    transform: translateY(-1px);
}

/* ================= TABLE ================= */
.table-wrapper{
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.table{
    width: 100%;
    border-collapse: collapse;
    background: white;
    min-width: 500px; /* paksa scroll horizontal jika perlu */
}

.table th{
    background: #2e7d32;
    color: white;
    padding: 13px 14px;
    text-align: left;
    font-size: 13px;
    white-space: nowrap;
}

.table td{
    padding: 11px 14px;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}

.table tbody tr{
    transition: background 0.2s;
}

.table tbody tr:hover{
    background: #f1f8f4;
}

.table tbody tr:last-child td{
    border-bottom: none;
}

/* ================= CARDS ================= */
.cards{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card{
    background: white;
    padding: 24px 20px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 6px 20px rgba(0,0,0,0.06);
    transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover{
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.1);
}

/* ================================================================
   RESPONSIVE BREAKPOINTS
================================================================ */

/* ===== TABLET (≤ 1024px) ===== */
@media screen and (max-width: 1024px){

    .sidebar{
        left: -240px; /* sembunyikan default di tablet */
    }

    .sidebar.show{
        left: 0;
    }

    .main{
        margin-left: 0; /* konten full width */
    }

    .content{
        padding: 20px;
    }

    .cards{
        grid-template-columns: repeat(2, 1fr);
    }

}

/* ===== MOBILE (≤ 768px) ===== */
@media screen and (max-width: 768px){

    /* SIDEBAR */
    .sidebar{
        width: 240px;
        left: -240px;
        padding: 16px;
    }

    .sidebar.show{
        left: 0;
    }

    /* MAIN */
    .main{
        margin-left: 0 !important;
        width: 100%;
    }

    /* NAVBAR */
    .navbar{
        padding: 0 14px;
        height: 56px;
    }

    .nav-left{
        gap: 10px;
    }

    .hamburger{
        font-size: 18px;
        padding: 5px 10px;
    }

    /* USER - hide text to save space */
    .user-text{
        display: none;
    }

    .user-info{
        padding: 5px 7px;
    }

    .avatar{
        width: 30px;
        height: 30px;
    }

    /* CONTENT */
    .content{
        padding: 15px;
    }

    /* CARDS */
    .cards{
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    /* BUTTON */
    .btn{
        width: 100%;
        display: block;
        text-align: center;
    }

    /* FOOTER */
    .footer{
        font-size: 11px;
        padding: 10px 15px;
    }

    /* DROPDOWN */
    .dropdown{
        right: 0;
        top: calc(100% + 6px);
        min-width: 135px;
    }

    /* HEADING */
    h1{ font-size: clamp(20px, 5vw, 28px) !important; }
    h2{ font-size: clamp(18px, 4vw, 22px) !important; }
    h3{ font-size: clamp(15px, 3.5vw, 18px) !important; }

}

/* ===== SMALL MOBILE (≤ 480px) ===== */
@media screen and (max-width: 480px){

    .navbar{
        padding: 0 10px;
    }

    /* sembunyikan teks logo di layar sangat kecil */
    .logo span{
        display: none;
    }

    .logo img{
        height: 26px;
    }

    .content{
        padding: 12px;
    }

    .cards{
        grid-template-columns: 1fr;
    }

    .sidebar-header{
        font-size: 17px;
    }

    .menu-item{
        padding: 10px 12px;
        font-size: 13px;
    }

    .hamburger{
        font-size: 16px;
        padding: 5px 9px;
    }

}