@php($dir = app()->getLocale() === 'ar' ? 'rtl' : 'ltr')
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}" dir="{{ $dir }}">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{ __('accounts.monthly_settlement.employee_print_title') }}</title>
    <style>
        body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif; }
        .wrap { max-width: 720px; margin: 0 auto; padding: 24px; }
        .title { font-weight: 700; font-size: 20px; margin-bottom: 8px; }
        .meta { color: #6c757d; font-size: 12px; margin-bottom: 12px; }
        table { width: 100%; border-collapse: collapse; }
        th, td { border: 1px solid #dee2e6; padding: 10px; font-size: 14px; }
        th { background: #f8f9fa; text-align: start; width: 40%; }
        .fw-bold { font-weight: 700; }
        .text-end { text-align: end; }
    </style>
    <meta name="color-scheme" content="light dark">
</head>
<body>
    <div class="wrap">
        <div class="title">{{ __('accounts.monthly_settlement.employee_report') }}</div>
        <div class="meta">{{ $settlement->date_from->toDateString() }} → {{ $settlement->date_to->toDateString() }}</div>

        <table>
            <tr>
                <th>{{ __('accounts.monthly_settlement.employee') }}</th>
                <td>{{ $row->employee?->full_name ?? '—' }}</td>
            </tr>
            <tr>
                <th>{{ __('accounts.monthly_settlement.base_salary') }}</th>
                <td>{{ number_format((int) $row->base_salary) }}</td>
            </tr>
            <tr>
                <th>{{ __('accounts.monthly_settlement.commissions_total') }}</th>
                <td>{{ number_format((int) $row->commissions_total) }}</td>
            </tr>
            <tr>
                <th>{{ __('accounts.monthly_settlement.bonuses_total') }}</th>
                <td>{{ number_format((int) $row->bonuses_total) }}</td>
            </tr>
            <tr>
                <th>{{ __('accounts.monthly_settlement.penalties_total') }}</th>
                <td>{{ number_format((int) $row->penalties_total) }}</td>
            </tr>
            <tr>
                <th>{{ __('accounts.monthly_settlement.absences_total') }}</th>
                <td>{{ number_format((int) $row->absences_total) }}</td>
            </tr>
            <tr>
                <th>{{ __('accounts.monthly_settlement.withdrawals_total') }}</th>
                <td>{{ number_format((int) $row->withdrawals_total) }}</td>
            </tr>
            <tr>
                <th>{{ __('accounts.monthly_settlement.final_salary') }}</th>
                <td class="fw-bold">{{ number_format((int) $row->final_salary) }}</td>
            </tr>
            <tr>
                <th>{{ __('accounts.monthly_settlement.issued_at') }}</th>
                <td>{{ optional($settlement->settled_at)->translatedFormat('Y-m-d h:i A') }}</td>
            </tr>
        </table>
    </div>
    <script>window.print()</script>
</body>
</html>
