        </main> <!-- End of content-body -->
    </div> <!-- End of main-content -->

    <!-- Scripts -->
    <script src="https://code.jquery.com/jquery-3.4.1.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
    <script src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>

    <script>
        $(document).ready(function() {
            const sidebar = $('#sidebar');
            const mainContent = $('#main-content');
            const overlay = $('#sidebar-overlay');
            const toggleBtn = $('#toggle-sidebar');

            // Função para alternar sidebar
            function toggleSidebar() {
                if ($(window).width() <= 992) {
                    sidebar.toggleClass('mobile-open');
                    overlay.toggleClass('active');
                } else {
                    sidebar.toggleClass('collapsed');
                    mainContent.toggleClass('expanded');
                    
                    // Salvar estado no localStorage
                    const isCollapsed = sidebar.hasClass('collapsed');
                    localStorage.setItem('sidebar_collapsed', isCollapsed);
                }
            }

            toggleBtn.on('click', toggleSidebar);
            overlay.on('click', toggleSidebar);

            // Restaurar estado do sidebar no desktop
            if ($(window).width() > 992) {
                if (localStorage.getItem('sidebar_collapsed') === 'true') {
                    sidebar.addClass('collapsed');
                    mainContent.addClass('expanded');
                }
            }

            // Fechar sidebar mobile ao clicar em link (exceto dropdowns se houvesse)
            $('.menu-link').on('click', function() {
                if ($(window).width() <= 992) {
                    sidebar.removeClass('mobile-open');
                    overlay.removeClass('active');
                }
            });

            // Inicializar DataTables se existir #Dtable
            if ($('#Dtable').length) {
                $('#Dtable').DataTable({
                    "language": {
                        "url": "//cdn.datatables.net/plug-ins/1.10.24/i18n/Portuguese-Brasil.json"
                    },
                    "responsive": true
                });
            }
        });
    </script>
</body>
</html>
