{{-- 회원사 과금 상세 모달 내용 --}}
<div class="space-y-6">
    <!-- 회원사 정보 -->
    <div class="bg-gray-50 rounded-lg p-4">
        <h4 class="text-sm font-semibold text-gray-700 mb-3">회원사 정보</h4>
        <div class="grid grid-cols-2 gap-4 text-sm">
            <div>
                <span class="text-gray-500">상호명</span>
                <p class="font-medium text-gray-900">{{ $member->corp_name }}</p>
            </div>
            <div>
                <span class="text-gray-500">사업자번호</span>
                <p class="font-mono text-gray-900">{{ $member->formatted_biz_no }}</p>
            </div>
            <div>
                <span class="text-gray-500">테넌트</span>
                <p class="font-medium text-gray-900">{{ $member->tenant->company_name ?? '-' }}</p>
            </div>
            <div>
                <span class="text-gray-500">과금 기준월</span>
                <p class="font-medium text-gray-900">{{ $billingMonth }}</p>
            </div>
        </div>
    </div>

    <!-- 과금 내역 -->
    @if($records->isNotEmpty())
    <div class="space-y-3">
        <h4 class="text-sm font-semibold text-gray-700">과금 내역</h4>

        @foreach($records as $record)
            @php
                $colors = [
                    'bank_account' => ['bg' => 'bg-green-50', 'border' => 'border-green-100', 'text' => 'text-green-700', 'icon' => 'text-green-600'],
                    'card' => ['bg' => 'bg-blue-50', 'border' => 'border-blue-100', 'text' => 'text-blue-700', 'icon' => 'text-blue-600'],
                    'hometax' => ['bg' => 'bg-orange-50', 'border' => 'border-orange-100', 'text' => 'text-orange-700', 'icon' => 'text-orange-600'],
                    'tax_invoice' => ['bg' => 'bg-purple-50', 'border' => 'border-purple-100', 'text' => 'text-purple-700', 'icon' => 'text-purple-600'],
                ];
                $color = $colors[$record->service_type] ?? ['bg' => 'bg-gray-50', 'border' => 'border-gray-100', 'text' => 'text-gray-700', 'icon' => 'text-gray-600'];
            @endphp
            <div class="flex items-center justify-between p-4 {{ $color['bg'] }} rounded-lg border {{ $color['border'] }}">
                <div class="flex items-center gap-3">
                    <div class="p-2 bg-white/50 rounded-lg">
                        @if($record->service_type === 'tax_invoice')
                        <svg class="w-5 h-5 {{ $color['icon'] }}" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
                        </svg>
                        @else
                        <svg class="w-5 h-5 {{ $color['icon'] }}" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z" />
                        </svg>
                        @endif
                    </div>
                    <div>
                        <p class="font-medium {{ $color['text'] }}">{{ $record->service_type_label }}</p>
                        <p class="text-xs {{ $color['icon'] }}">
                            {{ $record->billing_type_label }}
                            @if($record->billing_type === 'usage')
                            ({{ number_format($record->quantity) }}건 x {{ number_format($record->unit_price) }}원)
                            @endif
                        </p>
                    </div>
                </div>
                <div class="text-right">
                    <p class="text-xl font-bold {{ $color['text'] }}">{{ number_format($record->total_amount) }}원</p>
                    <p class="text-xs text-gray-500">{{ $record->billed_at?->format('Y-m-d') }}</p>
                </div>
            </div>
        @endforeach
    </div>
    @else
    <div class="text-center py-8 text-gray-500">
        <p>이 기간에 과금 내역이 없습니다.</p>
    </div>
    @endif

    <!-- 집계 -->
    @if($summary)
    <div class="bg-yellow-50 rounded-lg p-4 border-2 border-yellow-200">
        <div class="grid grid-cols-2 gap-4 mb-4">
            <div class="text-center">
                <p class="text-xs text-gray-500">월정액 합계</p>
                <p class="text-lg font-bold text-gray-700">{{ number_format($summary->subscription_total) }}원</p>
            </div>
            <div class="text-center">
                <p class="text-xs text-gray-500">건별 합계</p>
                <p class="text-lg font-bold text-gray-700">{{ number_format($summary->usage_total) }}원</p>
            </div>
        </div>
        <div class="flex items-center justify-between pt-4 border-t border-yellow-200">
            <div class="flex items-center gap-3">
                <div class="p-2 bg-yellow-100 rounded-lg">
                    <svg class="w-6 h-6 text-yellow-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
                    </svg>
                </div>
                <span class="text-lg font-semibold text-yellow-800">총 과금액</span>
            </div>
            <span class="text-2xl font-bold text-yellow-700">{{ number_format($summary->grand_total) }}원</span>
        </div>
    </div>
    @endif
</div>
