/* A compact closing section shared by the live invoice, print and PDF. */
.invoice-sheet .inv-summary-container{margin-bottom:22px}
.amount-words-block{margin-bottom:18px;padding:12px 14px;background:#f3f6fc;border-left:3px solid #143f8f;border-radius:0 4px 4px 0;break-inside:avoid}
.invoice-sheet #invAmountWords{color:#143f8f;font-size:12px;line-height:1.6;font-weight:600;overflow-wrap:anywhere}
.invoice-sheet .invoice-ending{display:grid;grid-template-columns:minmax(0,1fr) minmax(170px,.9fr);gap:35px;align-items:end;margin-top:auto;padding:20px 0 16px;border-top:1px solid #dce4f0;break-inside:avoid}
.invoice-ending .invoice-payment,.invoice-ending .signature-area{min-width:0}
.invoice-ending .signature-area{margin:0;align-self:end}
.invoice-ending .signature-block{width:200px;max-width:100%}
.invoice-ending .signature-block img{max-width:100%;max-height:82px;margin:0 auto 10px}
.invoice-ending #signatureLabel{border-top:1px solid #afc2dc;padding-top:8px;color:#42536b;font-size:11px;line-height:1.5;overflow-wrap:anywhere}
.invoice-ending .signature-controls{margin-bottom:12px}
.invoice-ending [hidden],.invoice-sheet #amountWordsBlock[hidden]{display:none!important}
.payment-editor{font-size:12px;margin:0 0 14px;color:#143f8f;max-width:100%}
.payment-editor summary{cursor:pointer;min-height:36px;line-height:1.5;font-weight:600;display:list-item}
.payment-editor small{font-weight:400}
.payment-editor label{display:block;margin:8px 0 5px;font-weight:600}
.payment-editor textarea{display:block;width:100%;min-width:0;resize:vertical;border:1px solid #afc2e0;border-radius:5px;padding:9px;font:14px/1.5 'Segoe UI',Arial,sans-serif;color:#143f8f;background:#fff}
.payment-editor textarea:focus{outline:2px solid #638cca;outline-offset:2px}
.payment-upload-actions{display:flex;flex-wrap:wrap;gap:7px;margin-top:9px}
.payment-upload-actions button{border:1px solid #afc2e0;border-radius:5px;padding:8px 10px;min-height:38px;background:white;color:#143f8f;font:600 12px 'Segoe UI',Arial,sans-serif;cursor:pointer}
.payment-editor p,.payment-editor [role=status]{font-size:11px;line-height:1.5;color:#42536b;display:block;margin:8px 0}
.payment-block{break-inside:avoid;color:#42536b}
.payment-content{display:flex;flex-wrap:wrap;align-items:flex-start;gap:12px}
.payment-content figure{flex:0 0 126px;margin:0;text-align:center}
#paymentQrImage{display:block;width:126px;height:126px;padding:8px;border:1px solid #dce4f0;border-radius:5px;object-fit:contain;background:#fff;image-rendering:pixelated;box-sizing:border-box}
.payment-content figcaption{font-size:10px;margin-top:5px;color:#42536b}
#paymentDetailsText{flex:1 1 130px;min-width:0;white-space:pre-wrap;overflow-wrap:anywhere;font-size:12px;line-height:1.65}
.invoice-ending .inv-notes-title{color:#42536b}
.invoice-sheet .inv-footer{margin-top:0}
.invoice-settlement{display:flex;flex-direction:column;flex:1;min-width:0;break-inside:avoid}
.invoice-sheet .invoice-closing{margin-top:auto;break-inside:avoid}
.invoice-sheet .invoice-closing .invoice-ending{margin-top:0}
.invoice-sheet .invoice-notes{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;margin:14px 0 18px;padding-top:14px;border-top:1px solid #dce4f0;break-inside:avoid}
.invoice-notes .inv-notes-block,.invoice-notes .inv-terms-block{margin:0;min-width:0}
.invoice-notes #invNotes,.invoice-notes #invTerms{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.6}
.invoice-notes> :only-child,.invoice-notes:has(> [hidden])> :not([hidden]){grid-column:1/-1}
.signature-business-name{margin-bottom:12px;color:#143f8f;font-size:12px;font-weight:600;line-height:1.4;overflow-wrap:anywhere}
@media(max-width:600px){
  .invoice-sheet .invoice-ending{grid-template-columns:minmax(0,1fr);gap:22px}
  .invoice-ending .signature-area{justify-self:end;width:200px;max-width:100%}
  .payment-editor textarea{font-size:16px}
  .invoice-sheet .invoice-notes{grid-template-columns:minmax(0,1fr);gap:14px}
}
/* Stable A4 styling, independent of the device used to download. */
.invoice-sheet.pdf-export{padding:30px!important;min-height:820px!important;color:#263d5c}
.invoice-sheet.pdf-export .inv-sender-meta,.invoice-sheet.pdf-export .inv-client-details,.invoice-sheet.pdf-export .inv-details-table .label,.invoice-sheet.pdf-export .inv-details-table .value{color:#526179}
.invoice-sheet.pdf-export .inv-client-section{border-color:#dce4f0;padding:16px 0;margin-top:4px}
.invoice-sheet.pdf-export .inv-top-bar{padding-bottom:10px}
.invoice-sheet.pdf-export .inv-details-table{line-height:1.45;border-spacing:0 2px}
.invoice-sheet.pdf-export .inv-details-table td{padding-top:1px;padding-bottom:1px}
.invoice-sheet.pdf-export .region-invoice-meta{font-size:10px;line-height:1.5;margin-top:6px}
.invoice-sheet.pdf-export #invClientDetails:empty{display:none}
.invoice-sheet.pdf-export .inv-client-name{line-height:1.4}
.invoice-sheet.pdf-export .inv-section-title{color:#526179;font-weight:600}
.invoice-sheet.pdf-export .inv-items-table th{background:#eaf0fb;color:#143f8f;font-weight:700;padding:11px 6px}
.invoice-sheet.pdf-export .inv-items-table td{padding:13px 6px;border-color:#dce4f0}
.invoice-sheet.pdf-export .inv-items-table .col-num{width:5%;white-space:nowrap;overflow-wrap:normal;padding-left:4px;padding-right:4px}
.invoice-sheet.pdf-export .inv-summary-container{grid-template-columns:minmax(0,1fr) 250px;gap:28px;margin:20px 0}
.invoice-sheet.pdf-export .amount-words-block{margin-top:5px}
.invoice-sheet.pdf-export .totals-table td{padding:5px 0;line-height:1.45}
.invoice-sheet.pdf-export .totals-table .extra-tax-row .t-label{font-size:11px}
.invoice-sheet.pdf-export .inv-notes-terms,.invoice-sheet.pdf-export .t-label{color:#526179}
.invoice-sheet.pdf-export .inv-notes-title{color:#42536b;font-weight:600}
.invoice-sheet.pdf-export .grand-total-row{border-top:2px solid #143f8f;background:#edf2fb}
.invoice-sheet.pdf-export .grand-total-row td{padding:12px 9px;color:#143f8f;font-size:18px}
.invoice-sheet.pdf-export .grand-total-row .t-label{font-size:12px}
.invoice-sheet.pdf-export .invoice-ending{grid-template-columns:minmax(0,1fr) 220px;gap:28px;align-items:end;margin-top:auto;padding:18px 0 0}
.invoice-sheet.pdf-export .payment-content{gap:12px}
.invoice-sheet.pdf-export #paymentDetailsText{font-size:11px}
.invoice-sheet.pdf-export .invoice-ending:has(#paymentBlock[hidden]):has(#signatureBlock[hidden]){display:none}
.invoice-sheet.pdf-export .invoice-ending .signature-area{width:200px;justify-self:end;align-self:end}
.invoice-sheet.pdf-export .invoice-ending .signature-controls{display:none!important}
.invoice-sheet.pdf-export .invoice-notes{grid-template-columns:repeat(2,minmax(0,1fr));gap:22px;margin:14px 0 0;padding-top:12px;font-size:10px;line-height:1.55}
.invoice-sheet.pdf-export .signature-business-name{font-size:12px;margin-bottom:10px}
@media print{
  .invoice-sheet{padding:4mm 2mm!important;color:#263d5c!important}
  .invoice-sheet .inv-top-bar{padding-bottom:3mm}
  .invoice-sheet .inv-main-heading{font-size:22pt}
  .invoice-sheet .inv-details-table{line-height:1.45;border-spacing:0 2px}
  .invoice-sheet .inv-sender-meta,.invoice-sheet .inv-client-details,.invoice-sheet .inv-details-table .label,.invoice-sheet .inv-details-table .value{color:#526179}
  .invoice-sheet .inv-client-section{padding:4mm 0;margin-top:0;border-color:#dce4f0}
  .invoice-sheet .inv-client-name{font-size:11pt;line-height:1.4}
  .invoice-sheet #invClientDetails:empty{display:none}
  .invoice-sheet .inv-section-title{font-size:7.5pt;color:#526179;font-weight:600}
  .invoice-sheet .region-invoice-meta{font-size:8pt;line-height:1.45;margin-top:2mm}
  .invoice-sheet .inv-items-table{font-size:9pt}
  .invoice-sheet .inv-items-table th{background:#eaf0fb;color:#143f8f;font-size:8pt;padding:2.5mm 1.5mm}
  .invoice-sheet .inv-items-table td{padding:3mm 1.5mm;border-color:#dce4f0}
  .invoice-sheet .inv-items-table .col-num{width:5%;white-space:nowrap;overflow-wrap:normal;padding-left:1mm;padding-right:1mm}
  .invoice-sheet .inv-summary-container{grid-template-columns:minmax(0,1fr) 66mm;gap:7mm;margin:5mm 0}
  .invoice-sheet .totals-table td{padding:1.2mm 0;line-height:1.45}
  .invoice-sheet .totals-table,.invoice-sheet .totals-table .extra-tax-row .t-label,.invoice-sheet .inv-notes-terms{font-size:8.5pt;color:#526179}
  .invoice-sheet .t-label{color:#526179}
  .invoice-sheet .inv-notes-title{font-size:7pt;color:#42536b;font-weight:600}
  .invoice-sheet #invAmountWords{font-size:9pt;color:#143f8f}
  .invoice-sheet .invoice-ending{grid-template-columns:minmax(0,1fr) 55mm;gap:8mm;padding:5mm 0 0;margin-top:6mm;break-inside:avoid;page-break-inside:avoid}
  .invoice-ending:has(#paymentBlock[hidden]):has(#signatureBlock[hidden]){display:none!important}
  .invoice-ending .signature-area{width:52mm;justify-self:end}
  .invoice-ending #signatureLabel{font-size:9pt}
  .invoice-sheet .invoice-closing{margin-top:5mm;break-inside:avoid;page-break-inside:avoid}
  .invoice-sheet .invoice-notes{grid-template-columns:repeat(2,minmax(0,1fr));gap:6mm;margin:4mm 0 0;padding-top:3mm;font-size:8pt}
  .invoice-notes [data-empty="true"],.invoice-notes[data-empty="true"]{display:none!important}
  .invoice-notes:has(> [data-empty="true"])> :not([data-empty="true"]){grid-column:1/-1}
  .signature-business-name{font-size:9pt}
  #paymentDetailsText{font-size:9pt}
  .payment-content figure{flex-basis:32mm}
  #paymentQrImage{width:32mm;height:32mm}
  .invoice-sheet .grand-total-row{border-top:2px solid #143f8f;background:#edf2fb}
  .invoice-sheet .grand-total-row td{padding:3mm 2mm;color:#143f8f}
  .printing-shipping #amountWordsBlock,.printing-shipping .invoice-ending{display:none!important}
}
/* Long notes use the full width so paragraphs stay readable and compact. */
.invoice-sheet .invoice-notes[data-layout="stacked"]{grid-template-columns:minmax(0,1fr)}
