<aside class="hidden w-56 border-r border-slate-200 bg-white px-3 py-6 text-sm dark:border-slate-800 dark:bg-slate-950 md:block">
    <nav class="flex flex-col gap-1">
        {% set links = [
            { href: '/app/dashboard',     label: 'Dashboard',     section: 'dashboard' },
            { href: '/app/ips',           label: 'IPs',           section: 'ips' },
            { href: '/app/subnets',       label: 'Subnets',       section: 'subnets' },
            { href: '/app/manual-blocks', label: 'Manual blocks', section: 'manual-blocks' },
            { href: '/app/allowlist',     label: 'Allowlist',     section: 'allowlist' },
            { href: '/app/policies',      label: 'Policies',      section: 'policies' },
            { href: '/app/reporters',     label: 'Reporters',     section: 'reporters' },
            { href: '/app/consumers',     label: 'Consumers',     section: 'consumers' },
            { href: '/app/tokens',        label: 'Tokens',        section: 'tokens' },
            { href: '/app/categories',    label: 'Categories',    section: 'categories' },
            { href: '/app/users',         label: 'Users',         section: 'users',         admin_only: true },
            { href: '/app/audit',         label: 'Audit',         section: 'audit' },
            { href: '/app/settings',      label: 'Settings',      section: 'settings' },
            { href: '/app/me',            label: 'My identity',   section: 'me' },
        ] %}
        {% for link in links %}
            {% if link.admin_only is defined and link.admin_only and (current_user is null or current_user.role != 'admin') %}
                {# hide admin-only links from non-admins #}
            {% elseif link.upcoming is defined %}
                <span class="flex items-center justify-between rounded-md px-3 py-1.5 text-slate-400 dark:text-slate-600">
                    <span>{{ link.label }}</span>
                    <span class="font-mono text-[0.6rem] uppercase tracking-wider">{{ link.upcoming }}</span>
                </span>
            {% else %}
                {% set is_active = (active_section is defined and active_section == link.section) %}
                <a href="{{ link.href }}"
                   class="rounded-md px-3 py-1.5 {% if is_active %}bg-indigo-50 text-indigo-700 dark:bg-indigo-950 dark:text-indigo-300{% else %}text-slate-700 hover:bg-slate-100 dark:text-slate-200 dark:hover:bg-slate-800{% endif %}"
                   {% if is_active %}aria-current="page"{% endif %}>
                    {{ link.label }}
                </a>
            {% endif %}
        {% endfor %}
    </nav>
</aside>
