@php
    // ✅ Policy 헤더
    $nav = config('web.policy_nav', []);
    $navTitle = $nav['title'] ?? 'PIN FOR YOU';
    $navSubtitle = $nav['subtitle'] ?? '약관 및 정책';

    // ✅ policy tabs items
    $rawTabs = config('web.policy_tabs', []);

    $items = collect($rawTabs)->map(function ($t) {
        $url = '#';
        if (!empty($t['route']) && \Illuminate\Support\Facades\Route::has($t['route'])) {
            $url = route($t['route']);
        }
        return [
            'label' => $t['label'] ?? '',
            'url'   => $url,
            'key'   => $t['key'] ?? null,
        ];
    })->values()->all();

    // activeKey는 페이지에서 넘기거나, 없으면 현재 route로 자동 판별
    $activeKey = $activeKey ?? null;

    if (!$activeKey) {
        foreach ($rawTabs as $t) {
            if (!empty($t['route']) && request()->routeIs($t['route'])) {
                $activeKey = $t['key'] ?? null;
                break;
            }
        }
    }
@endphp

{{-- Mobile Tabs --}}
<div class="subpage-tabs">
    @include('web.partials.subpage-sidenav', [
        'items'  => $items,
        'active' => $activeKey,
        'mode'   => 'tabs'
    ])
</div>

{{-- Desktop Side --}}
<aside class="subpage-side" aria-label="약관 및 정책 메뉴">
    @include('web.partials.subpage-sidenav', [
        'items'    => $items,
        'active'   => $activeKey,
        'mode'     => 'side',
        'title'    => $navTitle,
        'subtitle' => $navSubtitle,
    ])
</aside>
