<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>{{ $title }} — {{ $collateral->code }}</title>
<style>
body{font-family:Arial,sans-serif;color:#111;margin:0;background:#f5f5f5}.sheet{max-width:820px;margin:24px auto;background:#fff;border:1px solid #d4d4d4;padding:28px}.top{display:flex;justify-content:space-between;gap:24px;border-bottom:1px solid #ddd;padding-bottom:18px;margin-bottom:18px}.brand{display:flex;gap:12px}.logo{max-width:82px;max-height:65px;object-fit:contain}.title{font-size:24px;font-weight:700}.muted{color:#666;font-size:12px}.grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px 24px}.field{border-bottom:1px solid #eee;padding-bottom:8px}.label{font-size:11px;color:#666;text-transform:uppercase;letter-spacing:.04em}.value{font-size:14px;margin-top:4px}.barcode{max-width:420px;margin:22px auto}.signatures{display:grid;grid-template-columns:1fr 1fr;gap:48px;margin-top:52px}.signature{border-top:1px solid #222;padding-top:8px;font-size:12px}.stamp{max-width:110px;max-height:80px;object-fit:contain}.actions{max-width:820px;margin:12px auto;display:flex;justify-content:flex-end;gap:8px}.btn{border:1px solid #bbb;background:#fff;color:#111;padding:8px 12px;cursor:pointer;text-decoration:none;font-size:13px}@media print{body{background:#fff}.sheet{border:0;margin:0;max-width:none}.actions{display:none}}@media(max-width:640px){.grid,.signatures{grid-template-columns:1fr}.sheet{margin:0;border:0;padding:18px}.top{flex-direction:column}}
</style>
</head>
<body>
@php($business=$collateral->branch->business)
<div class="actions"><button class="btn" onclick="window.print()">Print</button>@if($acknowledgement)<a class="btn" href="{{ route('documents.collateral-release.pdf',$collateral) }}">Download PDF</a>@else<a class="btn" href="{{ route('documents.collateral-receipt.pdf',$collateral) }}">Download PDF</a>@endif</div>
<main class="sheet">
<div class="top"><div class="brand">@if($business->logo_path)<img class="logo" src="{{ route('document-branding.asset',[$business,'logo']) }}" alt="Company logo">@endif<div><div class="title">{{ $title }}</div><div class="value"><strong>{{ $business->name }}</strong></div><div class="muted">{{ collect([$business->address,$business->phone,$business->email])->filter()->join(' · ') }}</div><div class="muted">Reg {{ $business->registration_number ?: 'N/A' }} · TIN {{ $business->tin ?: 'N/A' }}</div></div></div><div><div class="label">Collateral code</div><div class="value"><strong>{{ $collateral->code }}</strong></div><div class="muted">Generated {{ now()->format('d M Y H:i') }}</div></div></div>
<div class="grid">
<div class="field"><div class="label">Customer</div><div class="value">{{ $collateral->customer->full_name }}</div><div class="muted">{{ $collateral->customer->customer_number }} · {{ $collateral->customer->phone }}</div></div>
<div class="field"><div class="label">Branch</div><div class="value">{{ $collateral->branch->name }}</div></div>
<div class="field"><div class="label">Category / item</div><div class="value">{{ $collateral->category->name }} — {{ $collateral->item }}</div></div>
<div class="field"><div class="label">Brand / model / serial</div><div class="value">{{ collect([$collateral->brand,$collateral->model,$collateral->serial_number])->filter()->join(' / ') ?: '—' }}</div></div>
<div class="field"><div class="label">Condition</div><div class="value">{{ $collateral->condition ?: '—' }}</div></div>
<div class="field"><div class="label">Accepted value</div><div class="value">{{ $business->currency_symbol ?: $business->currency }} {{ number_format((float)($collateral->accepted_value ?? 0),2) }}</div></div>
<div class="field"><div class="label">Date received</div><div class="value">{{ optional($collateral->received_at)->format('d M Y') }}</div></div>
<div class="field"><div class="label">Received by</div><div class="value">{{ $collateral->receiver?->name ?: '—' }}</div></div>
<div class="field"><div class="label">Current status</div><div class="value">{{ str($collateral->status)->replace('_',' ')->title() }}</div></div>
<div class="field"><div class="label">Storage location</div><div class="value">{{ $collateral->storage_location ?: '—' }}</div></div>
@if($acknowledgement)
<div class="field"><div class="label">Release / return date</div><div class="value">{{ optional($acknowledgement->moved_at)->format('d M Y H:i') }}</div></div>
<div class="field"><div class="label">Released / returned by</div><div class="value">{{ $acknowledgement->mover?->name ?: '—' }}</div></div>
@endif
</div>
<div class="barcode">{!! $barcodeSvg !!}</div>
@if($acknowledgement && $acknowledgement->notes)<div class="field"><div class="label">Release note</div><div class="value">{{ $acknowledgement->notes }}</div></div>@endif
<div class="signatures"><div class="signature">Customer / recipient signature</div><div class="signature">Authorized staff signature</div></div>
@if($business->stamp_path)<div style="text-align:right;margin-top:18px"><img class="stamp" src="{{ route('document-branding.asset',[$business,'stamp']) }}" alt="Company stamp"></div>@endif
</main>
</body>
</html>
