{{-- 역할별 수당 상세 --}}
<div class="bg-white rounded-xl shadow-sm p-6">
    <div class="flex items-center gap-3 mb-4">
        <svg class="w-5 h-5 text-gray-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z" />
        </svg>
        <h2 class="text-lg font-bold text-gray-800">역할별 수당 상세</h2>
    </div>

    <div class="grid grid-cols-1 {{ count($commissionByRole) === 1 ? 'md:grid-cols-1 max-w-md' : 'md:grid-cols-3' }} gap-4 mb-4">
        @foreach($commissionByRole as $role)
        <div class="rounded-xl p-4 border
            @if($role['color'] === 'green') bg-green-50 border-green-200
            @elseif($role['color'] === 'blue') bg-blue-50 border-blue-200
            @elseif($role['color'] === 'purple') bg-purple-50 border-purple-200
            @elseif($role['color'] === 'red') bg-red-50 border-red-200
            @else bg-gray-50 border-gray-200
            @endif">
            <div class="flex items-center justify-between mb-2">
                <div class="flex items-center gap-2">
                    <svg class="w-5 h-5
                        @if($role['color'] === 'green') text-green-600
                        @elseif($role['color'] === 'blue') text-blue-600
                        @elseif($role['color'] === 'purple') text-purple-600
                        @elseif($role['color'] === 'red') text-red-600
                        @else text-gray-600
                        @endif" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" />
                    </svg>
                    <span class="text-sm font-medium
                        @if($role['color'] === 'green') text-green-800
                        @elseif($role['color'] === 'blue') text-blue-800
                        @elseif($role['color'] === 'purple') text-purple-800
                        @elseif($role['color'] === 'red') text-red-800
                        @else text-gray-800
                        @endif">{{ $role['name'] }}</span>
                </div>
                @if($role['rate'] !== null)
                <span class="text-sm font-semibold
                    @if($role['color'] === 'green') text-green-600
                    @elseif($role['color'] === 'blue') text-blue-600
                    @elseif($role['color'] === 'purple') text-purple-600
                    @else text-gray-600
                    @endif">{{ $role['rate'] }}%</span>
                @elseif(!empty($role['rate_label']))
                <span class="px-2 py-0.5 text-xs font-medium bg-blue-100 text-blue-700 rounded">{{ $role['rate_label'] }}</span>
                @else
                <span class="px-2 py-0.5 text-xs font-medium bg-red-100 text-red-700 rounded">별도</span>
                @endif
            </div>
            @if($role['amount'] !== null)
            <p class="text-2xl font-bold
                @if($role['color'] === 'green') text-green-700
                @elseif($role['color'] === 'blue') text-blue-700
                @elseif($role['color'] === 'purple') text-purple-700
                @else text-gray-700
                @endif">₩{{ number_format($role['amount']) }}</p>
            @else
            <p class="text-xl font-bold text-red-600">운영팀 산정</p>
            @endif
        </div>
        @endforeach
    </div>

    <!-- 수당합계 -->
    <div class="bg-gray-50 rounded-xl p-4 border border-gray-200">
        <div class="flex items-center justify-end gap-4">
            <div class="text-right">
                <p class="text-2xl font-bold text-gray-900">₩{{ number_format($totalCommissionRatio) }}</p>
                <p class="text-sm text-gray-500">수당합계</p>
            </div>
        </div>
    </div>
</div>
