<!DOCTYPE html>
<html lang="pt-br">
<head><meta charset="UTF-8">
<style>
body{font-family:DejaVu Sans,Arial,sans-serif;font-size:12px;color:#222}
.page{margin:15px;border:2px solid #333;padding:22px}
.via-label{text-align:right;font-size:10px;color:#888;margin-bottom:4px}
.header{text-align:center;border-bottom:2px solid #333;padding-bottom:10px;margin-bottom:10px}
.header h2{margin:0 0 3px;font-size:17px}
.header p{margin:2px 0;font-size:10px;color:#555}
.recibo-title{text-align:center;font-size:20px;font-weight:bold;letter-spacing:3px;border:2px solid #333;padding:6px;margin-bottom:12px}
.numero{text-align:right;font-size:12px;margin-bottom:10px}
.valor-box{border:3px double #333;padding:8px 15px;font-size:18px;font-weight:bold;text-align:center;margin-bottom:10px;background:#f5f5f5}
.valor-extenso{font-size:11px;text-align:center;font-style:italic;margin-bottom:12px}
table.campos{width:100%;border-collapse:collapse}
table.campos td{padding:5px 3px;border-bottom:1px solid #ddd;font-size:11px}
table.campos td.lbl{font-weight:bold;color:#555;width:34%}
.assinatura{text-align:center;margin-top:35px}
.assinatura .linha{border-top:1px solid #333;width:260px;margin:0 auto 4px}
.rodape{font-size:9px;text-align:center;color:#aaa;margin-top:12px;border-top:1px solid #eee;padding-top:6px}
.separador{border-top:2px dashed #bbb;margin:18px 0}
</style>
</head>
<body>
<?php foreach([['1ª Via','Cliente'],['2ª Via','Escritório']] as $i=>[$n,$dest]): ?>
<?php if($i>0): ?><div class="separador"></div><?php endif; ?>
<div class="page">
    <div class="via-label"><?php echo $n?> — <?php echo $dest?></div>
    <?php if(!empty($setting->name)): ?>
    <div class="header">
        <h2><?php echo htmlspecialchars($setting->name)?></h2>
        <?php if(!empty($setting->address)): ?><p><?php echo htmlspecialchars($setting->address)?></p><?php endif; ?>
    </div>
    <?php endif; ?>
    <div class="recibo-title">R E C I B O</div>
    <div class="numero">Nº <strong><?php echo htmlspecialchars($recibo->numero)?></strong></div>
    <div class="valor-box">R$ <?php echo number_format($recibo->valor,2,',','.')?></div>
    <div class="valor-extenso">(<?php echo htmlspecialchars($recibo->valor_extenso)?>)</div>
    <table class="campos">
        <tr><td class="lbl">Recebi(emos) de:</td><td><strong><?php echo htmlspecialchars($recibo->pagador_nome)?></strong><?php if($recibo->pagador_cpf_cnpj): ?> — CPF/CNPJ: <?php echo htmlspecialchars($recibo->pagador_cpf_cnpj)?><?php endif; ?></td></tr>
        <?php if($recibo->pagador_endereco): ?><tr><td class="lbl">Endereço:</td><td><?php echo htmlspecialchars($recibo->pagador_endereco)?></td></tr><?php endif; ?>
        <tr><td class="lbl">A importância de:</td><td><?php echo htmlspecialchars($recibo->referente)?></td></tr>
        <?php if(!empty($recibo->case_no)): ?><tr><td class="lbl">Processo nº:</td><td><?php echo htmlspecialchars($recibo->case_no)?></td></tr><?php endif; ?>
        <tr><td class="lbl">Data de emissão:</td><td><?php echo (!empty($recibo->local_emissao)?htmlspecialchars($recibo->local_emissao).', ':'')?><?php echo date('d \d\e F \d\e Y',strtotime($recibo->data_emissao))?></td></tr>
    </table>
    <div class="assinatura">
        <div class="linha"></div>
        <div><strong><?php echo htmlspecialchars($recibo->recebedor_nome)?></strong></div>
        <?php if(!empty($recibo->recebedor_oab)): ?><div style="font-size:10px;color:#555">OAB nº <?php echo htmlspecialchars($recibo->recebedor_oab)?></div><?php endif; ?>
    </div>
    <div class="rodape">Emitido em <?php echo date('d/m/Y H:i')?> — Sistema Breno Paiva Advocacia</div>
</div>
<?php endforeach; ?>
</body>
</html>
