@php
    // ✅ CS 헤더
    $nav = config('web.cs_nav', []);
    $navTitle = $nav['title'] ?? '고객센터';
    $navSubtitle = $nav['subtitle'] ?? null;

    // ✅ CS items
    $rawTabs = config('web.cs_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 = $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>
