/*
 * Print stylesheet: engine documents, field forms and blank paper forms.
 * Plain CSS (not built by Tailwind), linked with media="print" so it costs nothing on screen.
 * No fixed paper size: the same layout fits A4 and US Letter, whichever the printer uses.
 */
@page { margin: 12mm 12mm 14mm; }

* { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
html, body { background: #fff !important; }
body { padding: 0 !important; font-size: 12pt; color: #0f172a; }

/* ---------- Screen-only UI ---------- */
.no-print, header.sticky, nav, aside.engine-side, .submit-bar, dialog, .toast,
button, [data-sign-phone], [data-draft-banner], .signature-bar, .phone-dialog { display: none !important; }
main { max-width: none !important; margin: 0 !important; padding: 0 !important; }
a { color: inherit !important; text-decoration: none !important; }
.card { box-shadow: none !important; --tw-ring-shadow: 0 0 #0000 !important; border-radius: 0 !important; }

/* ---------- Engine submission document ---------- */
.doc { padding: 0 !important; grid-column: 1 / -1 !important; }   /* full width: the side panel is hidden */
.doc-meta, .doc-notice { background: #f8fafc !important; }
.doc-section h2 { break-after: avoid; page-break-after: avoid; }
.doc-grid > div, tr, .signature-img { break-inside: avoid; page-break-inside: avoid; }
.doc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
.doc-grid .sm\:col-span-2 { grid-column: span 2 / span 2 !important; }
.doc-meta { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
.dd { font-size: 12pt; }
.dt { font-size: 9pt; }
.doc-notice { font-size: 10pt; }
.badge { background: none !important; color: #0f172a !important; border: 1px solid #94a3b8; padding: 0 6px; }
.table th { background: #f1f5f9 !important; }
/* Signatures sit on a signature line */
.doc .signature-img { display: block; border-bottom: 1px solid #334155; padding-bottom: 2px; min-width: 60mm; object-position: left bottom; }
.doc-signing { border: 1px dashed #94a3b8 !important; background: none !important; font-size: 9.5pt; }

/* ---------- Field form (Print form button): every section open, inputs as filled-in boxes ---------- */
#field-form .section { border: 1px solid #cbd5e1 !important; margin-bottom: 4mm; break-inside: auto; }
#field-form .section-head { min-height: 0 !important; padding: 2mm 3mm !important; background: #f1f5f9 !important; }
#field-form .section-num, #field-form .section-chevron, [data-next-section], [data-items-add], [data-item-remove], [data-check-all] { display: none !important; }
#field-form .grid { gap: 2.5mm 5mm !important; padding: 3mm !important; }
#field-form [data-field] { break-inside: avoid; page-break-inside: avoid; }
#field-form .input { min-height: 0 !important; padding: 1mm 2mm !important; border: 0 !important; border-bottom: 1px solid #475569 !important; border-radius: 0 !important; box-shadow: none !important; background: none !important; font-size: 10pt !important; }
#field-form select.input { background-image: none !important; }
#field-form .choice > span { min-height: 0 !important; padding: .5mm 3mm !important; font-size: 9.5pt; }
#field-form .check-row { min-height: 0 !important; padding: 1.5mm 2mm !important; }
#field-form .signature { border: 1px solid #94a3b8 !important; }
#field-form .signature canvas { height: 28mm !important; }
#field-form .notice { padding: 2mm 3mm !important; font-size: 8.5pt; }

/* ---------- Blank paper form ---------- */
.paper { padding: 0 !important; font-size: 11.5pt !important; }
.paper-section { break-inside: auto; }
.paper-section h2 { break-after: avoid; page-break-after: avoid; }
.paper-grid > div, .paper-table tr, .paper-sig, .paper-office { break-inside: avoid; page-break-inside: avoid; }
.paper-grid > div:has(.paper-table) { break-inside: auto; page-break-inside: auto; }   /* long tables split between rows */
.paper-table thead { display: table-header-group; }                                       /* header repeats on the next page */
.paper-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
.paper-grid .col-span-2 { grid-column: span 2 / span 2 !important; }
.paper-table th { background: #f1f5f9 !important; }

/* ---------- Letterhead (engine document + blank paper form) ----------
 * Full page, like the PDF: the letterhead pages have no printer margin, so the glow and the
 * orange/navy bar reach the paper edges. The margins are rebuilt inside .lh-frame instead:
 * its <thead> spacer repeats at the top of every page, its <tfoot> spacer keeps content clear
 * of the fixed footer, and the cells carry the side margins. */
@page letterhead { margin: 0; }
.lh-doc { page: letterhead; overflow: visible !important; --lh-pad: 13mm !important; }
.lh-frame > thead > tr > td, .lh-frame > tbody > tr > td, .lh-frame > tfoot > tr > td { padding: 0 var(--lh-pad) !important; }
.lh-head-space { display: block !important; height: 12mm; }
.lh-foot-space { display: block !important; height: 33mm; }
.lh-head { margin: 0 calc(-1 * var(--lh-pad)) !important; padding-top: 0 !important; }
.lh-glow { top: -12mm !important; height: 50mm !important; }
.lh-logo { height: 17mm !important; }
.lh-watermark { position: fixed !important; top: 50% !important; left: 50% !important; width: 110mm !important; max-width: none !important; transform: translate(-50%, -50%) !important; z-index: -1 !important; }
.lh-foot { position: fixed; left: 0; right: 0; bottom: 0; margin: 0 !important; font-size: 9.5pt; background: #fff; }
.lh-bar { margin-top: 3mm !important; height: 7mm !important; }
.lh-bar td { height: 7mm !important; }
.doc-footer { margin-top: 4mm !important; }
