ddSelectedButton();
    }
    
    function updateModalSelectionCounter() {
        const counter = document.getElementById('selectionCounter');
        if (counter) {
            const count = window.selectedDevicesForCase ? window.selectedDevicesForCase.length : 0;
            counter.textContent = `${count} devices selected`;
        }
    }
    
    function updateAddSelectedButton() {
        const button = document.getElementById('addSelectedDevicesBtn');
        const buttonText = document.getElement