@if (($hasActiveRuns ?? false) === true)
@endif @php $reference = is_array($reference ?? null) ? $reference : []; $tenantSummaries = is_array($tenantSummaries ?? null) ? $tenantSummaries : []; $rows = is_array($rows ?? null) ? $rows : []; $policyTypeOptions = is_array($policyTypeOptions ?? null) ? $policyTypeOptions : []; $stateOptions = is_array($stateOptions ?? null) ? $stateOptions : []; $severityOptions = is_array($severityOptions ?? null) ? $severityOptions : []; $tenantSortOptions = is_array($tenantSortOptions ?? null) ? $tenantSortOptions : []; $subjectSortOptions = is_array($subjectSortOptions ?? null) ? $subjectSortOptions : []; $stateLegend = is_array($stateLegend ?? null) ? $stateLegend : []; $freshnessLegend = is_array($freshnessLegend ?? null) ? $freshnessLegend : []; $trustLegend = is_array($trustLegend ?? null) ? $trustLegend : []; $emptyState = is_array($emptyState ?? null) ? $emptyState : null; $currentFilters = is_array($currentFilters ?? null) ? $currentFilters : []; $referenceReady = ($reference['referenceState'] ?? null) === 'ready'; $matrixSourceNavigation = is_array($navigationContext ?? null) ? $navigationContext : null; $activeFilterCount = $this->activeFilterCount(); $activeFilterSummary = $this->activeFilterSummary(); $hiddenAssignedTenantCount = max(0, (int) ($reference['assignedTenantCount'] ?? 0) - (int) ($reference['visibleTenantCount'] ?? 0)); $stateBadge = static fn (mixed $value) => \App\Support\Badges\BadgeCatalog::spec(\App\Support\Badges\BadgeDomain::BaselineCompareMatrixState, $value); $freshnessBadge = static fn (mixed $value) => \App\Support\Badges\BadgeCatalog::spec(\App\Support\Badges\BadgeDomain::BaselineCompareMatrixFreshness, $value); $trustBadge = static fn (mixed $value) => \App\Support\Badges\BadgeCatalog::spec(\App\Support\Badges\BadgeDomain::BaselineCompareMatrixTrust, $value); $severityBadge = static fn (mixed $value) => \App\Support\Badges\BadgeCatalog::spec(\App\Support\Badges\BadgeDomain::FindingSeverity, $value); $profileStatusBadge = static fn (mixed $value) => \App\Support\Badges\BadgeCatalog::spec(\App\Support\Badges\BadgeDomain::BaselineProfileStatus, $value); $profileStatusSpec = $profileStatusBadge($reference['baselineStatus'] ?? null); @endphp Compare assigned tenants is simulation only. It reuses the existing tenant-owned baseline compare path for the visible assigned set and does not create a workspace umbrella run.
{{ $profileStatusSpec->label }} @if ($referenceReady) Reference snapshot ready @else Reference snapshot blocked @endif @if (filled($reference['referenceSnapshotId'] ?? null)) Snapshot #{{ (int) $reference['referenceSnapshotId'] }} @endif @if ($hiddenAssignedTenantCount > 0) {{ $hiddenAssignedTenantCount }} hidden by access scope @endif

{{ $reference['baselineProfileName'] ?? ($profile->name ?? 'Baseline compare matrix') }}

Assigned tenants: {{ (int) ($reference['assignedTenantCount'] ?? 0) }}. Visible tenants: {{ (int) ($reference['visibleTenantCount'] ?? 0) }}. @if (filled($reference['referenceSnapshotCapturedAt'] ?? null)) Reference captured {{ \Illuminate\Support\Carbon::parse($reference['referenceSnapshotCapturedAt'])->diffForHumans() }}. @endif

@if (filled($reference['referenceReasonCode'] ?? null))

Reference reason: {{ \Illuminate\Support\Str::headline(str_replace('.', ' ', (string) $reference['referenceReasonCode'])) }}

@endif @if ($hiddenAssignedTenantCount > 0)

Showing only the visible assigned set for your current access scope. Hidden tenants are excluded from summaries, rows, and drilldowns.

@endif
Visible tenants
{{ (int) ($reference['visibleTenantCount'] ?? 0) }}
Rendered subjects
{{ count($rows) }}
Tenant sort
{{ $tenantSortOptions[$currentFilters['tenant_sort'] ?? 'tenant_name'] ?? 'Tenant name' }}
Subject sort
{{ $subjectSortOptions[$currentFilters['subject_sort'] ?? 'deviation_breadth'] ?? 'Deviation breadth' }}
Narrow the matrix by policy type, technical state, severity, or one focused subject. Only the visible tenant set contributes to the rendered counts, rows, and drilldowns.
Current matrix scope

@if ($activeFilterCount === 0) No narrowing filters are active. Showing every visible subject and tenant in the current baseline scope. @else {{ $activeFilterCount }} active {{ \Illuminate\Support\Str::plural('filter', $activeFilterCount) }} are narrowing the matrix before you scan drift and follow-up links. @endif

@if ($activeFilterCount === 0) All visible results @else {{ $activeFilterCount }} active {{ \Illuminate\Support\Str::plural('filter', $activeFilterCount) }} @endif @if ($hiddenAssignedTenantCount > 0) Visible-set only @endif
@if ($activeFilterSummary !== [])
@foreach ($activeFilterSummary as $label => $value) {{ $label }}: {{ $value }} @endforeach
@endif
{{ $this->form }}
Focused subject @if (filled($currentFilters['subject_key'] ?? null)) {{ $currentFilters['subject_key'] }} Clear subject focus @else None set yet. Use Focus subject from a row when you want a subject-first drilldown. @endif
@if ($activeFilterCount > 0) Clear all filters @else No filter reset needed @endif
@if (($hasActiveRuns ?? false) === true)
Auto-refresh every 5 seconds while compare runs are queued or running.
@endif
State legend
@foreach ($stateLegend as $item) {{ $item['label'] }} @endforeach
Freshness legend
@foreach ($freshnessLegend as $item) {{ $item['label'] }} @endforeach
Trust legend
@foreach ($trustLegend as $item) {{ $item['label'] }} @endforeach
@if ($emptyState !== null)

{{ $emptyState['title'] ?? 'Nothing to show' }}

{{ $emptyState['body'] ?? 'Adjust the current inputs and try again.' }}

@else Tenant-level freshness, trust, and breadth stay visible before you scan the subject-by-tenant body.
@foreach ($tenantSummaries as $tenantSummary) @php $freshnessSpec = $freshnessBadge($tenantSummary['freshnessState'] ?? null); $trustSpec = $trustBadge($tenantSummary['trustLevel'] ?? null); $tenantSeveritySpec = filled($tenantSummary['maxSeverity'] ?? null) ? $severityBadge($tenantSummary['maxSeverity']) : null; $tenantCompareUrl = $this->tenantCompareUrl((int) $tenantSummary['tenantId']); $tenantRunUrl = filled($tenantSummary['compareRunId'] ?? null) ? $this->runUrl((int) $tenantSummary['compareRunId'], (int) $tenantSummary['tenantId']) : null; @endphp

{{ $tenantSummary['tenantName'] }}

{{ $freshnessSpec->label }} {{ $trustSpec->label }} @if ($tenantSeveritySpec) {{ $tenantSeveritySpec->label }} @endif
@if (filled($tenantSummary['lastComparedAt'] ?? null)) Compared {{ \Illuminate\Support\Carbon::parse($tenantSummary['lastComparedAt'])->diffForHumans() }} @else No completed compare yet @endif
Aligned
{{ (int) ($tenantSummary['matchedCount'] ?? 0) }}
Drift
{{ (int) ($tenantSummary['differingCount'] ?? 0) }}
Missing
{{ (int) ($tenantSummary['missingCount'] ?? 0) }}
Ambiguous / not compared
{{ (int) ($tenantSummary['ambiguousCount'] ?? 0) + (int) ($tenantSummary['notComparedCount'] ?? 0) }}
@if ($tenantCompareUrl) Open tenant compare @endif @if ($tenantRunUrl) Open latest run @endif
@endforeach
Row click is intentionally disabled. The subject column stays pinned while you scan across visible tenants.
@foreach ($tenantSummaries as $tenantSummary) @php $freshnessSpec = $freshnessBadge($tenantSummary['freshnessState'] ?? null); @endphp @endforeach @foreach ($rows as $row) @php $subject = is_array($row['subject'] ?? null) ? $row['subject'] : []; $cells = is_array($row['cells'] ?? null) ? $row['cells'] : []; $subjectSeveritySpec = filled($subject['maxSeverity'] ?? null) ? $severityBadge($subject['maxSeverity']) : null; $subjectTrustSpec = $trustBadge($subject['trustLevel'] ?? null); $rowKey = (string) ($subject['subjectKey'] ?? 'subject-'.$loop->index); $rowSurfaceClasses = $loop->even ? 'bg-gray-50/70 dark:bg-gray-950/20' : 'bg-white dark:bg-gray-900/60'; @endphp @foreach ($cells as $cell) @php $cellStateSpec = $stateBadge($cell['state'] ?? null); $cellTrustSpec = $trustBadge($cell['trustLevel'] ?? null); $cellSeveritySpec = filled($cell['severity'] ?? null) ? $severityBadge($cell['severity']) : null; $cellState = (string) ($cell['state'] ?? ''); $cellSeverity = is_string($cell['severity'] ?? null) ? (string) $cell['severity'] : null; $cellNeedsAttention = in_array($cellState, ['differ', 'missing', 'ambiguous'], true) || in_array($cellSeverity, ['critical', 'high'], true); $cellNeedsRefresh = in_array($cellState, ['stale_result', 'not_compared'], true); $cellLooksHealthy = $cellState === 'match' && $cellNeedsAttention === false && $cellNeedsRefresh === false; $cellSurfaceClasses = $cellNeedsAttention ? 'border-danger-300 bg-danger-50/80 ring-1 ring-danger-200/70 dark:border-danger-900/70 dark:bg-danger-950/15 dark:ring-danger-900/40' : ($cellNeedsRefresh ? 'border-warning-300 bg-warning-50/80 ring-1 ring-warning-200/70 dark:border-warning-900/70 dark:bg-warning-950/15 dark:ring-warning-900/40' : ($cellLooksHealthy ? 'border-success-200 bg-success-50/70 dark:border-success-900/60 dark:bg-success-950/10' : 'border-gray-200 bg-gray-50 dark:border-gray-800 dark:bg-gray-950/40')); $cellPriorityLabel = $cellNeedsAttention ? 'Needs attention' : ($cellNeedsRefresh ? 'Refresh recommended' : ($cellLooksHealthy ? 'Aligned' : 'Review')); $cellPriorityClasses = $cellNeedsAttention ? 'bg-danger-100 text-danger-700 dark:bg-danger-950/40 dark:text-danger-300' : ($cellNeedsRefresh ? 'bg-warning-100 text-warning-700 dark:bg-warning-950/40 dark:text-warning-300' : 'bg-success-100 text-success-700 dark:bg-success-950/40 dark:text-success-300'); $subjectKey = $subject['subjectKey'] ?? ($cell['subjectKey'] ?? null); $tenantId = (int) ($cell['tenantId'] ?? 0); $tenantCompareUrl = $tenantId > 0 ? $this->tenantCompareUrl($tenantId, $subjectKey) : null; $cellFindingUrl = ($tenantId > 0 && filled($cell['findingId'] ?? null)) ? $this->findingUrl($tenantId, (int) $cell['findingId'], $subjectKey) : null; $cellRunUrl = filled($cell['compareRunId'] ?? null) ? $this->runUrl((int) $cell['compareRunId'], $tenantId, $subjectKey) : null; @endphp @endforeach @endforeach
Baseline subject
{{ $tenantSummary['tenantName'] }}
{{ $freshnessSpec->label }}
{{ $subject['displayName'] ?? $subject['subjectKey'] ?? 'Subject' }}
{{ $subject['policyType'] ?? 'Unknown policy type' }}
@if (filled($subject['baselineExternalId'] ?? null))
Reference ID: {{ $subject['baselineExternalId'] }}
@endif
Drift breadth {{ (int) ($subject['deviationBreadth'] ?? 0) }} Missing {{ (int) ($subject['missingBreadth'] ?? 0) }} Ambiguous {{ (int) ($subject['ambiguousBreadth'] ?? 0) }} {{ $subjectTrustSpec->label }} @if ($subjectSeveritySpec) {{ $subjectSeveritySpec->label }} @endif
@if (filled($subject['subjectKey'] ?? null))
Focus subject
@endif
{{ $cellStateSpec->label }} @if ($cellSeveritySpec) {{ $cellSeveritySpec->label }} @endif
{{ $cellPriorityLabel }}
{{ $cellTrustSpec->label }}
@if (filled($cell['reasonCode'] ?? null))
Reason: {{ \Illuminate\Support\Str::headline(str_replace('_', ' ', (string) $cell['reasonCode'])) }}
@endif @if (filled($cell['lastComparedAt'] ?? null))
Compared {{ \Illuminate\Support\Carbon::parse($cell['lastComparedAt'])->diffForHumans() }}
@endif @if (($cell['policyTypeCovered'] ?? true) === false)
Policy type coverage was not proven in the latest compare run.
@endif
@if ($cellFindingUrl) Open finding @elseif ($tenantCompareUrl) Open tenant compare @endif @if ($cellRunUrl) Open run @endif
@endif