{{-- 하단 2컬럼 --}}
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
    {{-- 좌: 최근 알림 --}}
    <div class="bg-white rounded-lg shadow p-5">
        <div class="flex items-center justify-between mb-4">
            <h3 class="text-base font-semibold text-gray-900">최근 알림</h3>
            <a href="{{ route('system.alerts.index') }}" class="text-sm text-blue-600 hover:underline">전체보기</a>
        </div>
        @if($recentAlerts->isEmpty())
            <div class="text-center py-8 text-gray-400">
                <svg class="w-10 h-10 mx-auto mb-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"/>
                </svg>
                <p class="text-sm">미해결 알림이 없습니다</p>
            </div>
        @else
            <div class="space-y-3">
                @foreach($recentAlerts as $alert)
                    <div class="flex items-start gap-3 p-3 rounded-lg bg-gray-50 border border-gray-100">
                        <span class="inline-flex items-center justify-center w-8 h-8 rounded-full text-xs font-medium shrink-0 {{ $alert->severity_color }}">
                            {{ mb_substr($alert->severity_label, 0, 1) }}
                        </span>
                        <div class="flex-1 min-w-0">
                            <div class="flex items-center gap-2 mb-1">
                                <span class="text-xs font-medium px-2 py-0.5 rounded bg-gray-200 text-gray-600">{{ $alert->domain_label }}</span>
                                <span class="text-xs text-gray-400">{{ $alert->created_at?->diffForHumans() }}</span>
                            </div>
                            <p class="text-sm text-gray-800 truncate">{{ $alert->title }}</p>
                        </div>
                    </div>
                @endforeach
            </div>
        @endif
    </div>

    {{-- 우: 이번 달 요약 --}}
    <div class="bg-white rounded-lg shadow p-5">
        <h3 class="text-base font-semibold text-gray-900 mb-4">이번 달 요약 ({{ $monthlySummary['month'] }})</h3>
        <table class="w-full text-sm">
            <thead>
                <tr class="border-b border-gray-200">
                    <th class="text-left py-2 font-medium text-gray-500">구분</th>
                    <th class="text-right py-2 font-medium text-gray-500">항목</th>
                    <th class="text-right py-2 font-medium text-gray-500">금액/수량</th>
                </tr>
            </thead>
            <tbody class="divide-y divide-gray-100">
                {{-- 매출 --}}
                <tr>
                    <td class="py-2.5 text-gray-600" rowspan="3">
                        <span class="inline-flex items-center gap-1">
                            <span class="w-2 h-2 rounded-full bg-green-500"></span>
                            매출
                        </span>
                    </td>
                    <td class="py-2.5 text-right text-gray-600">주문건수</td>
                    <td class="py-2.5 text-right font-medium text-gray-900">{{ number_format($monthlySummary['sales']['order_count']) }}건</td>
                </tr>
                <tr>
                    <td class="py-2.5 text-right text-gray-600">주문금액</td>
                    <td class="py-2.5 text-right font-medium text-gray-900">{{ number_format($monthlySummary['sales']['order_amount']) }}원</td>
                </tr>
                <tr>
                    <td class="py-2.5 text-right text-gray-600">매출액</td>
                    <td class="py-2.5 text-right font-medium text-gray-900">{{ number_format($monthlySummary['sales']['sales_amount']) }}원</td>
                </tr>

                {{-- 재무 --}}
                <tr>
                    <td class="py-2.5 text-gray-600" rowspan="3">
                        <span class="inline-flex items-center gap-1">
                            <span class="w-2 h-2 rounded-full bg-blue-500"></span>
                            재무
                        </span>
                    </td>
                    <td class="py-2.5 text-right text-gray-600">입금</td>
                    <td class="py-2.5 text-right font-medium text-green-600">{{ number_format($monthlySummary['finance']['deposit_total']) }}원</td>
                </tr>
                <tr>
                    <td class="py-2.5 text-right text-gray-600">출금</td>
                    <td class="py-2.5 text-right font-medium text-red-600">{{ number_format($monthlySummary['finance']['withdrawal_total']) }}원</td>
                </tr>
                <tr>
                    <td class="py-2.5 text-right text-gray-600">순자금흐름</td>
                    <td class="py-2.5 text-right font-bold {{ $monthlySummary['finance']['net_cashflow'] >= 0 ? 'text-green-600' : 'text-red-600' }}">
                        {{ $monthlySummary['finance']['net_cashflow'] >= 0 ? '+' : '' }}{{ number_format($monthlySummary['finance']['net_cashflow']) }}원
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</div>
