k);
        localStorage.setItem("theme", isDark ? "dark" : "light");

        if (themeToggle) {
          themeToggle.innerHTML = `<i data-lucide="${newIcon}"></i>`;
          lucide.createIcons();
        }
      }

      const savedTheme = localStorage.getItem("theme");
      const prefersDark =
        window.matchMedia &&
        window.matchMedia("(prefers-color-scheme: dark)").matches;
      setTheme(savedTheme === "dark" || (savedTheme === null && prefersDark));

      themeToggle?.addEventListener