<x-filament-widgets::widget>
    <x-filament::section>
        <x-slot name="heading">
            Attention-needed workspaces
        </x-slot>

        <x-slot name="description">
            Worst derived workspace health first. Operational stability, review-pack readiness, and engagement freshness honor {{ $windowLabel }}.
        </x-slot>

        @if ($rows->isEmpty())
            <div class="rounded-lg border border-dashed border-gray-300 px-4 py-6 text-sm text-gray-500 dark:border-white/15 dark:text-gray-400">
                No workspaces need attention in the selected view.
            </div>
        @else
            <div class="space-y-3">
                @foreach ($rows as $row)
                    <article class="rounded-xl border border-gray-200 bg-white/70 p-4 dark:border-white/10 dark:bg-white/5">
                        <div class="flex flex-col gap-3 md:flex-row md:items-start md:justify-between">
                            <div class="space-y-2">
                                <div class="flex flex-wrap items-center gap-2">
                                    <h3 class="text-sm font-semibold text-gray-950 dark:text-white">{{ $row['workspace_label'] }}</h3>

                                    <x-filament::badge :color="$row['overall']['color']" :icon="$row['overall']['icon']">
                                        {{ $row['overall']['label'] }}
                                    </x-filament::badge>
                                </div>

                                <p class="text-sm text-gray-600 dark:text-gray-300">
                                    Top drivers: {{ $row['dominant_copy'] }}
                                </p>

                                <div class="flex flex-wrap gap-2">
                                    @foreach ($row['dominant_dimensions'] as $dimension)
                                        <x-filament::badge :color="$dimension['color']" :icon="$dimension['icon']">
                                            {{ $dimension['label'] }}
                                        </x-filament::badge>
                                    @endforeach
                                </div>
                            </div>

                            <div>
                                <x-filament::link :href="$row['next_link']['url']" icon="heroicon-m-arrow-top-right-on-square">
                                    {{ $row['next_link']['label'] }}
                                </x-filament::link>
                            </div>
                        </div>
                    </article>
                @endforeach
            </div>
        @endif
    </x-filament::section>
</x-filament-widgets::widget>