<!doctype html>
<html lang="id">

<head>
    <meta charset="utf-8">
    <title>Rekap Absensi {{ $monthLabel }}</title>
    <style>
        body {
            font-family: DejaVu Sans, sans-serif;
            font-size: 11px;
            color: #111827;
        }

        .title {
            font-size: 16px;
            font-weight: 700;
            margin: 0;
        }

        .sub {
            margin: 4px 0 14px;
            color: #374151;
        }

        table {
            width: 100%;
            border-collapse: collapse;
        }

        th,
        td {
            border: 1px solid #e5e7eb;
            padding: 8px;
        }

        th {
            background: #f3f4f6;
            text-align: left;
        }

        td.center,
        th.center {
            text-align: center;
        }

        .tot {
            font-weight: 700;
            background: #fafafa;
        }
    </style>
</head>

<body>
    <p class="title">Rekap Absensi Desa</p>
    <p class="sub">Periode: <b>{{ $monthLabel }}</b> ({{ $start }} s/d {{ $end }})</p>

    <table>
        <thead>
            <tr>
                <th style="width:40px" class="center">No</th>
                <th>Nama</th>
                <th style="width:160px">Jabatan</th>
                <th style="width:90px" class="center">Hadir</th>
                <th style="width:90px" class="center">Izin</th>
                <th style="width:90px" class="center">Sakit</th>
                <th style="width:90px" class="center">Alpha</th>
            </tr>
        </thead>
        <tbody>
            @foreach ($rows as $i => $r)
                <tr>
                    <td class="center">{{ $i + 1 }}</td>
                    <td>{{ $r->name }}</td>
                    <td>{{ $r->jabatan ?? '-' }}</td>
                    <td class="center">{{ (int) $r->hadir }}</td>
                    <td class="center">{{ (int) $r->izin }}</td>
                    <td class="center">{{ (int) $r->sakit }}</td>
                    <td class="center">{{ (int) $r->alpha }}</td>
                </tr>
            @endforeach

            <tr class="tot">
                <td colspan="3">TOTAL</td>
                <td class="center">{{ $totals['hadir'] }}</td>
                <td class="center">{{ $totals['izin'] }}</td>
                <td class="center">{{ $totals['sakit'] }}</td>
                <td class="center">{{ $totals['alpha'] }}</td>
            </tr>
        </tbody>
    </table>
</body>

</html>
