  </main>

  <!-- Bootstrap & SweetAlert (CDN) -->
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>

  <script>
    document.addEventListener('DOMContentLoaded', () => {
      const sidebar = document.getElementById('sidebar');
      const toggleBtn = document.getElementById('toggleSidebar');
      const overlay = document.getElementById('overlay');
      const logoutBtn = document.getElementById('logoutBtn');

      // ===== TOGGLE SIDEBAR =====
      toggleBtn.addEventListener('click', () => {
        if (window.innerWidth < 992) {
          // Mode mobile
          sidebar.classList.toggle('active');
          overlay.classList.toggle('active');
        } else {
          // Mode desktop
          sidebar.classList.toggle('collapsed');
        }
      });

      // ===== OVERLAY CLICK (mobile close) =====
      overlay.addEventListener('click', () => {
        sidebar.classList.remove('active');
        overlay.classList.remove('active');
      });

      // ===== SWEETALERT LOGOUT =====
      if (logoutBtn) {
        logoutBtn.addEventListener('click', (e) => {
          e.preventDefault();
          Swal.fire({
            title: 'Keluar dari sistem?',
            text: 'Anda yakin ingin logout dari akun ini?',
            icon: 'warning',
            showCancelButton: true,
            confirmButtonColor: '#d33',
            cancelButtonColor: '#3085d6',
            confirmButtonText: 'Ya, keluar',
            cancelButtonText: 'Batal'
          }).then((result) => {
            if (result.isConfirmed) {
              window.location.href = '../logout.php';
            }
          });
        });
      }
    });
  </script>
  <script>
// Toggle submenu (biar bisa expand-collapse PPEPP)
document.querySelectorAll('.submenu-toggle').forEach(btn => {
  btn.addEventListener('click', e => {
    e.preventDefault();
    btn.parentElement.classList.toggle('open');
  });
});
</script>
</body>
</html>
