@page { size: A4; margin: 16mm 15mm; }
* { box-sizing: border-box; }
body { margin: 0; background: #e9ebef; color: #1b1f27; font: 10.5pt/1.45 Georgia, "Times New Roman", serif; }
body.embed { background: #fff; }
.toolbar { position: sticky; top: 0; background: #1c2a44; padding: 8px; text-align: center; z-index: 2; }
.toolbar button { font: 600 14px system-ui, sans-serif; padding: 8px 18px; border: 0; border-radius: 6px; cursor: pointer; }
.pagina { background: #fff; max-width: 210mm; margin: 16px auto; padding: 16mm 15mm; box-shadow: 0 2px 12px rgba(0,0,0,.12); }
body.embed .pagina { box-shadow: none; margin: 0 auto; }
.intest { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding-bottom: 12px; border-bottom: 2px solid #1c2a44; }
.intest-sx { display: flex; align-items: center; gap: 16px; }
.intest .logo { height: 78px; width: 78px; object-fit: contain; flex: 0 0 auto; }
.intest-nome { border-left: 1px solid #b48a4f; padding-left: 16px; }
.nome-studio { font: 700 15pt/1.15 Georgia, "Times New Roman", serif; color: #1c2a44; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
.titolare { font: 600 10.5pt/1.3 Georgia, serif; color: #1c2a44; margin-top: 6px; }
.qualifica { font: italic 9pt/1.3 Georgia, serif; color: #b48a4f; }
.intest-dx { text-align: right; font: 8.5pt/1.55 system-ui, "Segoe UI", sans-serif; color: #3d4556; white-space: nowrap; }
.intest-dx .sito { color: #b48a4f; font-weight: 600; }
.intest-legale { border-top: 1px solid #b48a4f; margin: 3px 0 20px; padding-top: 5px; text-align: center; font: 7.5pt/1.5 system-ui, "Segoe UI", sans-serif; color: #6b7385; letter-spacing: .02em; }
h1 { font-size: 15pt; margin: 0 0 4px; color: #1c2a44; } h1 small { font-size: 10pt; color: #666; font-weight: 400; }
h3 { font-size: 11pt; margin: 14px 0 4px; color: #1c2a44; }
.sub { margin-top: 0; color: #555; font-style: italic; }
.riga-top { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 14px; }
.destinatario { order: 2; min-width: 45%; border-left: 3px solid #1c2a44; padding-left: 10px; } .lbl { color: #666; font-size: 9pt; }
.rif { order: 1; }
table.voci, table.totali, table.consensi, table.compilabile { width: 100%; border-collapse: collapse; margin: 8px 0; }
table.voci th, table.voci td { border-bottom: 1px solid #ddd; padding: 5px 6px; text-align: left; vertical-align: top; }
table.voci thead th { background: #1c2a44; color: #fff; font: 600 9pt system-ui, sans-serif; }
tr.sez td { background: #f3efe7; font-weight: 700; color: #1c2a44; }
.r { text-align: right !important; white-space: nowrap; }
table.totali { width: 60%; margin-left: 40%; } table.totali td { padding: 4px 6px; border-bottom: 1px solid #eee; }
table.totali tr.tot td { font-weight: 700; border-top: 2px solid #1c2a44; }
table.consensi td { border: 1px solid #ccc; padding: 8px; vertical-align: top; } table.consensi td:last-child { width: 30%; white-space: nowrap; }
table.compilabile th, table.compilabile td { border: 1px solid #bbb; padding: 4px; height: 26px; font-size: 8.5pt; }
.condizioni { padding-left: 18px; font-size: 9.5pt; } .clausole li { margin-bottom: 4px; }
.compila { display: inline-block; min-width: 140px; border-bottom: 1px dotted #555; padding: 0 4px; } .compila.lungo { min-width: 300px; }
.firme { display: flex; justify-content: space-between; gap: 40px; margin-top: 34px; font-size: 9.5pt; }
.firme > div { flex: 1; } .firme .riga { border-bottom: 1px solid #333; height: 36px; }
.muted { color: #666; font-size: 9pt; }
table.voci.opz td { font-size: 9pt; padding: 3px 6px; } table.voci.opz small { color: #666; font-size: 8pt; }
.nota-opz { font-size: 9.5pt; font-style: italic; }
@media print {
  body { background: #fff; } .no-print { display: none !important; }
  .pagina { box-shadow: none; margin: 0; padding: 0; max-width: none; }
  .nuova-pagina { page-break-before: always; break-before: page; }
  tr { page-break-inside: avoid; }
}
