ssList.add("bg-blue-600");
                } else {
                    this.classList.remove("bg-blue-600");
                    this.classList.add("bg-gray-800");
                }

                // Reapply filtering
                filterApps();
            });

            function filterApps() {
                const tableRows = Array.from(document.querySelectorAll("#appTable tr")); // Get latest rows
                let visibleAppsCount = 0;
                let visiblePermissions = new Set();

     