<x-filament::section heading="Baseline Governance">
    @if ($landingUrl)
        <x-slot name="afterHeader">
            <x-filament::link :href="$landingUrl" size="sm" icon="heroicon-m-arrow-top-right-on-square" icon-position="after">
                Details
            </x-filament::link>
        </x-slot>
    @endif

    @if (! $hasAssignment)
        <div class="flex items-start gap-3 rounded-lg bg-gray-50 p-4 dark:bg-white/5">
            <x-heroicon-o-link-slash class="mt-0.5 h-5 w-5 shrink-0 text-gray-400 dark:text-gray-500" />
            <div>
                <div class="text-sm font-medium text-gray-950 dark:text-white">No Baseline Assigned</div>
                <div class="mt-0.5 text-sm text-gray-500 dark:text-gray-400">Assign a baseline profile to start monitoring drift.</div>
            </div>
        </div>
    @else
        <div class="flex flex-col gap-3">
            {{-- Profile + last compared --}}
            <div class="flex items-center justify-between text-sm">
                <div class="text-gray-600 dark:text-gray-300">
                    Baseline: <span class="font-medium text-gray-950 dark:text-white">{{ $profileName }}</span>
                </div>
                @if ($lastComparedAt)
                    <div class="text-gray-500 dark:text-gray-400">{{ $lastComparedAt }}</div>
                @endif
            </div>

            {{-- Findings summary --}}
            @if ($findingsCount > 0)
                {{-- Critical banner (inline) --}}
                @if ($highCount > 0)
                    <div class="flex items-center gap-2 rounded-lg border border-danger-300 bg-danger-50 px-3 py-2 dark:border-danger-700 dark:bg-danger-950/50">
                        <x-heroicon-s-exclamation-triangle class="h-4 w-4 shrink-0 text-danger-600 dark:text-danger-400" />
                        <span class="text-sm font-medium text-danger-800 dark:text-danger-200">
                            {{ $highCount }} high-severity {{ Str::plural('finding', $highCount) }}
                        </span>
                    </div>
                @endif

                <div class="flex items-center justify-between">
                    <div class="flex flex-wrap items-center gap-2">
                        <x-filament::badge color="danger" size="sm">
                            {{ $findingsCount }} {{ Str::plural('finding', $findingsCount) }}
                        </x-filament::badge>

                        @if ($mediumCount > 0)
                            <x-filament::badge color="warning" size="sm">
                                {{ $mediumCount }} medium
                            </x-filament::badge>
                        @endif

                        @if ($lowCount > 0)
                            <x-filament::badge color="gray" size="sm">
                                {{ $lowCount }} low
                            </x-filament::badge>
                        @endif
                    </div>
                </div>
            @else
                <div class="flex items-center gap-2 rounded-lg bg-success-50 px-3 py-2 dark:bg-success-950/50">
                    <x-heroicon-o-check-circle class="h-4 w-4 shrink-0 text-success-600 dark:text-success-400" />
                    <span class="text-sm font-medium text-success-700 dark:text-success-300">No open drift — baseline compliant</span>
                </div>
            @endif
        </div>
    @endif
</x-filament::section>
