<!doctype html>
<html>
<head>
<meta charset="utf-8">
<style>
    body { font-family: sans-serif; font-size: 12px; color: #333; }
    h1 { font-size: 18px; }
    table { width: 100%; border-collapse: collapse; margin-top: 10px; }
    th, td { border: 1px solid #ddd; padding: 6px; text-align: left; }
    .totals td { border: none; }
    .right { text-align: right; }
</style>
</head>
<body>
    <h1>{{ __('vrc::lang.estimate') }} — {{ $estimate->number }}</h1>
    <p>
        <strong>{{ __('vrc::lang.customer') }}:</strong> {{ optional($customer)->name ?? '—' }}<br>
        <strong>{{ __('vrc::lang.valid_until') }}:</strong> {{ optional($estimate->valid_until)->format('Y-m-d') ?? '—' }}
    </p>

    <table>
        <thead><tr><th>{{ __('vrc::lang.description') }}</th><th>HSN/SAC</th><th>{{ __('vrc::lang.qty') }}</th><th>{{ __('vrc::lang.price') }}</th><th>{{ __('vrc::lang.line_total') }}</th></tr></thead>
        <tbody>
        @foreach ($estimate->items as $it)
            <tr><td>{{ $it->description }}</td><td>{{ $it->hsn_sac ?: '—' }}</td><td>{{ $it->qty }}</td><td>{{ $it->unit_price }}</td><td>{{ $it->line_total }}</td></tr>
        @endforeach
        </tbody>
    </table>

    <table class="totals" style="width:40%; margin-left:60%;">
        <tr><td>{{ __('vrc::lang.subtotal') }}</td><td class="right">{{ $estimate->subtotal }}</td></tr>
        <tr><td>{{ __('vrc::lang.discount') }}</td><td class="right">{{ $estimate->discount_total }}</td></tr>
        <tr><td>{{ __('vrc::lang.tax') }}</td><td class="right">{{ $estimate->tax_total }}</td></tr>
        <tr><td><strong>{{ __('vrc::lang.grand_total') }}</strong></td><td class="right"><strong>{{ $estimate->grand_total }}</strong></td></tr>
    </table>

    @if($estimate->terms)<p><strong>{{ __('vrc::lang.terms') }}:</strong> {{ $estimate->terms }}</p>@endif
</body>
</html>
