sModal').addEventListener('click', function(e) {
            if (e.target === this) {
                closeDeviceAnalytics();
            }
        });

        // Close modal with ESC key
        document.addEventListener('keydown', function(e) {
            if (e.key === 'Escape' && document.getElementById('deviceAnalyticsModal').style.display === 'flex') {
                closeDeviceAnalytics();
            }
        });
    </script>

    <style>
        /* Device Analytics Modal Styles */
        .devi