@php
    $nodes = $nodes ?? [];
    $coverage = $coverage ?? [];
@endphp
<ul class="space-y-2">
    @foreach($nodes as $node)
        <li>
            <div class="flex items-center gap-2 rounded-lg border border-slate-200 bg-slate-50 px-3 py-2 text-sm text-slate-700">
                <span class="ui-badge-muted">{{ $node['level'] ?? '' }}</span>
                <span class="font-medium">{{ $node['title'] ?? '未命名章节' }}</span>
                @if(isset($coverage[$node['id'] ?? '']))
                    <span class="ml-auto ui-tag">关联卷子 {{ $coverage[$node['id']] }}</span>
                @endif
            </div>
            @if(!empty($node['children']))
                <div class="ml-4 mt-2 border-l border-slate-200 pl-4">
                    @include('filament.partials.catalog-tree', ['nodes' => $node['children'], 'coverage' => $coverage])
                </div>
            @endif
        </li>
    @endforeach
</ul>
