window.tmSidebar = {
    toggle() {
        const shell = document.querySelector('.tm-shell');
        if (!shell) return;
        shell.classList.toggle('tm-sidebar-collapsed');
        try { localStorage.setItem('tm_sidebar_collapsed', shell.classList.contains('tm-sidebar-collapsed') ? '1' : '0'); } catch { }
    },
    restore() {
        try {
            if (localStorage.getItem('tm_sidebar_collapsed') === '1') {
                document.querySelector('.tm-shell')?.classList.add('tm-sidebar-collapsed');
            }
        } catch { }
    }
};
