@props(['title' => null])
@php
    // Default the title in a block (never an inline directive on this line, and never
    // the literal directive tokens in a comment — Blade's raw-block matcher eats them;
    // see rules.md R17).
    $title ??= __('shell.title_default');
@endphp
<header class="sticky top-0 z-20 flex h-14 items-center gap-3 border-b border-line bg-base/90 px-4 backdrop-blur sm:px-6 lg:px-8">
    <button type="button" @click="nav = true"
            class="grid min-h-11 min-w-11 shrink-0 place-items-center rounded-md text-ink-2 hover:bg-raised hover:text-ink lg:hidden"
            aria-label="{{ __('shell.menu_open') }}">
        <x-icon name="menu" class="h-5 w-5" />
    </button>

    <h1 class="min-w-0 truncate font-display text-sm font-semibold text-ink sm:text-base">{{ $title }}</h1>

    <div class="ml-auto flex min-w-0 items-center gap-2">
        <x-lang-switch />
        <button type="button" @click="$dispatch('cmdk-open')"
                class="hidden items-center gap-2 rounded-md border border-line bg-inset px-2.5 py-1.5 text-ink-3 transition-colors hover:border-line-strong hover:text-ink sm:flex"
                aria-label="{{ __('shell.commands_open_aria') }}" title="{{ __('shell.commands_title') }}">
            <x-icon name="command" class="h-3.5 w-3.5" />
            <span class="font-mono text-[10px] uppercase tracking-wider">{{ __('shell.shortcut_ctrl_k') }}</span>
        </button>
        @php
            $fleetTotal = \App\Models\Server::count();
            $fleetOnline = \App\Models\Server::where('status', 'online')->count();
        @endphp
        <x-status-pill :status="$fleetOnline > 0 ? 'online' : 'offline'">{{ __('shell.fleet_online', ['online' => $fleetOnline, 'total' => $fleetTotal]) }}</x-status-pill>
    </div>
</header>
