        </main>
        <footer class="text-center text-xs text-slate-400 py-4 border-t border-slate-100 bg-white">
            © <?= date('Y') ?> <?= APP_NAME ?> v<?= APP_VERSION ?> — Built for business efficiency
        </footer>
    </div>
</div>

<script>
// Auto-hide flash messages
setTimeout(() => {
    const flashEl = document.querySelector('[class^="flash-"]');
    if (flashEl) { flashEl.style.transition = 'opacity 0.5s'; flashEl.style.opacity = '0'; setTimeout(() => flashEl.remove(), 500); }
}, 4000);

// Confirm delete
function confirmDelete(msg, form) {
    if (confirm(msg || 'Are you sure you want to delete this item?')) {
        form.submit();
    }
}

// Mobile sidebar toggle (offcanvas)
(function () {
    const btn = document.getElementById('menuBtn');
    const sidebar = document.getElementById('sidebar');
    const overlay = document.getElementById('menuOverlay');
    if (!btn || !sidebar || !overlay) return;

    function openMenu() {
        sidebar.classList.add('translate-x-0');
        sidebar.classList.remove('-translate-x-full');
        overlay.classList.remove('opacity-0', 'pointer-events-none');
        overlay.classList.add('opacity-100', 'pointer-events-auto');
    }

    function closeMenu() {
        sidebar.classList.add('-translate-x-full');
        sidebar.classList.remove('translate-x-0');
        overlay.classList.add('opacity-0', 'pointer-events-none');
        overlay.classList.remove('opacity-100', 'pointer-events-auto');
    }

    btn.addEventListener('click', () => {
        const isClosed = sidebar.classList.contains('-translate-x-full');
        if (isClosed) openMenu();
        else closeMenu();
    });

    overlay.addEventListener('click', closeMenu);
    document.addEventListener('keydown', (e) => { if (e.key === 'Escape') closeMenu(); });
})();
</script>
</body>
</html>
