<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Patient label · {{ $patient->patient_number }}</title>
    <style>
        * { box-sizing: border-box; }
        body {
            margin: 0;
            font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
            color: #0f172a;
            background: #f1f5f9;
        }
        .toolbar {
            display: flex;
            gap: 0.75rem;
            padding: 1rem;
            background: #fff;
            border-bottom: 1px solid #e2e8f0;
        }
        .toolbar a, .toolbar button {
            font-family: system-ui, sans-serif;
            font-size: 0.875rem;
            padding: 0.5rem 0.9rem;
            border-radius: 0.5rem;
            border: 1px solid #cbd5e1;
            background: #fff;
            cursor: pointer;
            text-decoration: none;
            color: #334155;
        }
        .toolbar button.primary {
            background: #0ea5e9;
            border-color: #0284c7;
            color: #fff;
        }
        .sheet {
            display: flex;
            justify-content: center;
            padding: 2rem 1rem;
        }
        .label {
            width: 90mm;
            min-height: 40mm;
            background: #fff;
            border: 1px solid #94a3b8;
            padding: 4mm 5mm;
        }
        .org { font-size: 9pt; color: #64748b; margin: 0 0 2mm; }
        .id { font-size: 16pt; font-weight: 700; letter-spacing: 0.02em; margin: 0; }
        .name { font-size: 12pt; margin: 2mm 0 0; font-family: system-ui, sans-serif; }
        .meta { font-size: 9pt; color: #475569; margin: 1.5mm 0 0; font-family: system-ui, sans-serif; }
        @media print {
            body { background: #fff; }
            .toolbar { display: none !important; }
            .sheet { padding: 0; }
            .label { border: none; }
        }
    </style>
</head>
<body>
    <div class="toolbar">
        <button type="button" class="primary" onclick="window.print()">Print label</button>
        <a href="{{ route('care.patients.show', $patient) }}">Back to patient</a>
    </div>
    <div class="sheet">
        <div class="label">
            <p class="org">{{ $organization->name }}</p>
            <p class="id">{{ $patient->patient_number }}</p>
            <p class="name">{{ $patient->fullName() }}</p>
            <p class="meta">
                {{ $genders[$patient->gender] ?? '' }}
                @if ($patient->date_of_birth)
                    · {{ $patient->date_of_birth->format('d M Y') }}
                @endif
                @if ($patient->branch)
                    · {{ $patient->branch->name }}
                @endif
            </p>
        </div>
    </div>
</body>
</html>
