@font-face{font-family:HarborSC;unicode-range:U+2E80-2FDF,U+3000-303F,U+3100-312F,U+31A0-31BF,U+3400-4DBF,U+4E00-9FFF,U+F900-FAFF,U+FE30-FE4F,U+FF00-FFEF,U+20000-2FA1F;src:url('./fonts/NotoSansSC-Regular.ttf?v=1.3.1') format('truetype');font-style:normal;font-weight:400;font-display:swap}
@font-face{font-family:HarborTC;unicode-range:U+2E80-2FDF,U+3000-303F,U+3100-312F,U+31A0-31BF,U+3400-4DBF,U+4E00-9FFF,U+F900-FAFF,U+FE30-FE4F,U+FF00-FFEF,U+20000-2FA1F;src:url('./fonts/NotoSansTC-Regular.ttf?v=1.3.1') format('truetype');font-style:normal;font-weight:400;font-display:swap}
body,input,button,textarea,select{font-family:Arial,'Segoe UI','Microsoft YaHei','Microsoft JhengHei','PingFang SC','PingFang TC','Hiragino Sans GB','Noto Sans CJK SC','Noto Sans CJK TC',sans-serif!important}:lang(zh) body,:lang(zh) input,:lang(zh) button,:lang(zh) textarea,:lang(zh) select{font-family:Arial,'Segoe UI',HarborSC,'Microsoft YaHei','Microsoft JhengHei',sans-serif!important}
.fb-pair strong,.fb-memo,.document-field div{white-space:pre-wrap;overflow-wrap:anywhere}
.business-document{font-family:HarborSC,sans-serif!important;background:#fff;color:#183631;border:1px solid #cddad5;margin:20px auto;padding:24px;max-width:650px;line-height:1.7;overflow-wrap:anywhere}
.business-document:lang(zh-Hant){font-family:HarborTC,sans-serif!important}
.business-document header{display:flex;justify-content:space-between;gap:16px;border-bottom:3px solid #20564b;padding-bottom:12px;color:#20564b}
.business-document h2{font-size:19px;margin:20px 0}.business-document h3{font-size:14px;border-top:1px solid #ccd9d5;padding-top:12px;margin:20px 0 8px}
.document-field{margin:8px 0;font-size:13px}.document-field b{display:block;font-size:11px;color:#51655e}.document-field div{margin-top:2px}
.business-document footer{display:block!important;position:static;border-top:1px solid #ccd9d5;margin-top:24px;padding-top:12px;font-size:10px;color:#51655e}
.document-label{max-width:384px}.document-controls{display:flex;flex-wrap:wrap;gap:8px;align-items:end}.document-controls .field{width:100%}.document-controls p{width:100%;font-size:12px}
#modal:has(.business-document){width:min(1000px,calc(100vw - 28px))}
#modal:has(.business-document) .document-controls .field{width:auto;min-width:280px;flex:1;margin-bottom:0}
.business-document,.business-document strong,.business-document b,.business-document h2,.business-document h3{font-weight:400;font-synthesis:none}
.business-document header strong{letter-spacing:1px}
.business-document.invoice-document{display:block;max-width:900px;color:#161616;line-height:1.45;padding:28px;background:white;border-color:#d3d6da;font-size:12px}
.invoice-document .invoice-heading{display:grid;grid-template-columns:minmax(0,1fr) 115px auto;border:0;color:#111;gap:22px;align-items:start;min-height:115px;padding:0}
.invoice-document .invoice-company{white-space:pre-line}.invoice-document .invoice-company strong{display:block;font-size:21px;letter-spacing:0;font-family:Arial,HarborSC,sans-serif;font-weight:700}
.invoice-document .invoice-title{text-align:right}.invoice-document .invoice-title h2{margin:0;font-size:30px;color:#111;font-family:Arial,HarborSC,sans-serif;font-weight:700}.invoice-document .invoice-barcode svg{width:115px;height:75px}
.invoice-document .invoice-table{width:100%;min-width:0;border-collapse:collapse;table-layout:fixed;margin:0;color:#161616;font-size:11px}
.invoice-document .invoice-table th,.invoice-document .invoice-table td{padding:7px 6px;vertical-align:top;line-height:1.5;white-space:pre-line;overflow-wrap:anywhere;border:1px solid #d6d9dd;color:#161616;background:white}
.invoice-document .invoice-table th{font-family:Arial,HarborSC,sans-serif;font-weight:700;text-align:left;font-size:11px}
.invoice-document .invoice-meta{width:75%;margin:0 0 18px auto}.invoice-document .invoice-meta th,.invoice-document .invoice-meta td{text-align:center}
.invoice-document .invoice-addresses{display:grid;grid-template-columns:1fr 1fr;gap:24px}.invoice-document .invoice-addresses section{border:1px solid #d6d9dd}.invoice-document .invoice-addresses h3{font-size:13px;margin:0;padding:6px 8px;border:0;border-bottom:1px solid #d6d9dd;font-family:Arial,HarborSC,sans-serif;font-weight:700}.invoice-document .invoice-addresses section>div{white-space:pre-line;min-height:46px;padding:8px}.invoice-document .invoice-addresses p{padding:8px;margin:0;border-top:1px solid #d6d9dd;white-space:pre-line}
.invoice-document .invoice-notes{margin:20px 0 16px;white-space:pre-line}.invoice-document .invoice-logistics{margin-bottom:24px}
.invoice-document .invoice-items th,.invoice-document .invoice-items td{border-left:0;border-right:0}.invoice-document .invoice-items tbody tr:nth-child(odd) td,.invoice-document .invoice-total tr:nth-child(odd) td{background:#f0f0f0}
.invoice-document .invoice-items th:nth-child(1){width:3%}.invoice-document .invoice-items th:nth-child(2){width:8%}.invoice-document .invoice-items th:nth-child(3){width:13%}.invoice-document .invoice-items th:nth-child(4){width:27%}.invoice-document .invoice-items th:nth-child(5){width:12%}.invoice-document .invoice-items th:nth-child(6){width:10%}.invoice-document .invoice-items th:nth-child(7){width:12%}.invoice-document .invoice-items th:nth-child(8){width:15%}
.invoice-document .invoice-items td:nth-child(n+5),.invoice-document .invoice-items th:nth-child(n+5){text-align:right}.invoice-document .invoice-payment{margin:25px 0}.invoice-document .invoice-total{width:45%;margin-left:auto;text-align:right}.invoice-document .invoice-total td{border-left:0;border-right:0}.invoice-document .invoice-total td:last-child{text-align:right}.invoice-document .invoice-total tr:last-child td{font-weight:700;border-top:2px solid #9ca3ac}.invoice-document footer{color:#555}
@media(max-width:700px){.business-document.invoice-document{padding:14px}.invoice-document .invoice-heading{grid-template-columns:1fr auto;gap:10px;min-height:110px}.invoice-document .invoice-title h2{font-size:23px}.invoice-document .invoice-company strong{font-size:17px}.invoice-document .invoice-barcode{display:none}.invoice-document .invoice-meta{width:100%}.invoice-document .invoice-addresses{gap:10px}.invoice-document .invoice-lines,.invoice-document .invoice-logistics{overflow-x:auto}.invoice-document .invoice-items{min-width:720px}.invoice-document .invoice-total{width:85%}}
@media print{.business-document.invoice-document{padding:0;max-width:none;border:0;font-size:9pt}.invoice-document .invoice-heading{grid-template-columns:minmax(0,1fr) 115px auto;min-height:100px}.invoice-document .invoice-barcode{display:block}.invoice-document .invoice-items{min-width:0}.invoice-document .invoice-table{font-size:8pt}.invoice-document .invoice-table tr,.invoice-addresses{break-inside:avoid}.invoice-document .invoice-table thead{display:table-header-group}.invoice-document .invoice-lines{overflow:visible}.invoice-document .invoice-total{width:45%;break-inside:avoid}}
@media screen and (min-width:850px){.business-document{max-width:none;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 28px}.business-document header,.business-document h2,.business-document h3,.business-document footer{grid-column:1/-1}.document-field{margin:4px 0}.document-label{max-width:450px;display:block}}
@media print{
 @page harbor-document{size:A4;margin:14mm}
 @page harbor-label{size:4in 6in;margin:6mm}
 body:has(.business-document)>:not(#modal){display:none!important}
 body:has(.business-document) #modal{display:block!important;position:static;margin:0;padding:0;width:100%;max-width:none;max-height:none;border:0;overflow:visible;box-shadow:none}
 body:has(.business-document) #modal::backdrop{display:none}
 body:has(.business-document) .modal-head,body:has(.business-document) .modal-actions,.document-controls,#form-error{display:none!important}
 body:has(.business-document) .modal-body{padding:0;overflow:visible}
 .business-document{page:harbor-document;max-width:none;padding:0;border:0;margin:0;break-after:page;font-size:11pt;display:block}
 .document-label{page:harbor-label}.document-field{break-inside:avoid}.business-document h3{break-after:avoid}
 .business-document:last-child{break-after:auto}
}

/* Document codes have their own full-width row and remain visible on phones. */
.invoice-document .invoice-heading{grid-template-columns:minmax(0,1fr) auto;min-height:85px}
.document-scan-codes{display:grid;grid-template-columns:minmax(0,1fr) 116px;gap:20px;align-items:center;grid-column:1/-1;background:white;margin:10px 0 22px;padding:10px 0;break-inside:avoid}
.document-linear{min-width:0}.document-linear svg{display:block;width:min(100%,420px);height:130px;max-width:100%;margin:auto}
.document-linear small{display:block;text-align:center;font:14px/1.4 Arial,sans-serif;color:#111}
.document-qr{text-align:center}.document-qr svg{width:106px;height:106px;max-width:100%;display:block;margin:auto}.document-qr small{display:block;font-size:10px;line-height:1.4;color:#172b3b}
@media(max-width:700px){.document-scan-codes{grid-template-columns:minmax(0,1fr) 90px;gap:8px}.document-linear svg{height:112px}.document-qr svg{width:84px;height:84px}}
@media print{.invoice-document .invoice-heading{grid-template-columns:minmax(0,1fr) auto;min-height:80px}.document-scan-codes{grid-template-columns:1fr 30mm;padding:0}.document-linear svg{width:100mm;height:32mm}.document-qr svg{width:28mm;height:28mm}}
