// Отдельный файл (а не код в index.html): так политика безопасности CSP может запретить инлайн-скрипты.
(function () {
try {
var t = JSON.parse(localStorage.getItem('kb-theme') || '"dark"');
if (t === 'light' || t === 'sun' || t === 'dark') document.documentElement.setAttribute('data-theme', t);
} catch {
/* тема по умолчанию */
}
})();