);
                if (filter === 'completed') return todos.filter(t => t.completed);
                return todos;
            };

            const stats = () => {
                const todos = getTodos();
                const completed = todos.filter(t => t.completed).length;
                const active = todos.length - completed;
                return { total: todos.length, completed, active };
            };

            return {
                render: () => ({
                    div: {
          