/* Commercial invoice paper. These selectors beat the dark workspace table rules. */
html body :is(#app,#sb-form-layer) .sb-inv-paper,
html[data-theme="dark"] body :is(#app,#sb-form-layer) .sb-inv-paper{
  display:block !important;
  box-sizing:border-box !important;
  min-height:0 !important;
  background:#fff !important;
  color:#111827 !important;
  color-scheme:light !important;
}
@media screen{
  html body :is(#app,#sb-form-layer) .sb-inv-paper[data-paper="LETTER"],
  html body :is(#app,#sb-form-layer) .sb-inv-paper[data-orientation="landscape"]{min-height:0 !important}
}
@media screen{
html body :is(#app,#sb-form-layer) .sb-inv-paper .sb-letter-head,
html body :is(#app,#sb-form-layer) .sb-inv-paper .sb-letter-foot{display:block !important;min-height:0 !important;flex:none !important}
}
html body :is(#app,#sb-form-layer) .sb-inv-paper .print-company{display:block !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper .print-title{display:flex !important;align-items:center !important;justify-content:flex-end !important;gap:12px !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper .print-title .qr-corner{position:static !important;flex:0 0 auto !important;margin:0 !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper .print-title .qr-corner img{width:48px !important;height:48px !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper .sb-doc-head{display:flex !important;align-items:flex-start !important;justify-content:space-between !important;gap:16px !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper .sb-doc-head .print-company{flex:1 1 auto !important;min-width:0 !important;margin:0 !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper .sb-doc-head .qr-corner{position:static !important;right:auto !important;top:auto !important;flex:0 0 auto !important;margin:0 0 0 auto !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper .sb-doc-head .qr-corner img{width:72px !important;height:72px !important;display:block !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper .print-title{display:flex !important;align-items:center !important;justify-content:flex-end !important;border:0 !important;margin:0 0 10px !important;padding:0 !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper .sb-doc-name{display:block !important;margin:0 !important;text-align:inherit !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper .sb-inv-head,
html body :is(#app,#sb-form-layer) .sb-inv-paper .sb-inv-head.sb-has-vendor{display:flex !important;flex-direction:row !important;align-items:flex-start !important;justify-content:space-between !important;gap:28px !important;margin:0 0 14px !important;grid-template-columns:none !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper .sb-inv-parties{display:flex !important;align-items:flex-start !important;gap:16px !important;flex:1 1 auto !important;min-width:0 !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper .sb-inv-parties .sb-company-side{flex:1 1 200px !important;max-width:280px !important;min-width:0 !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper .sb-company-side .print-company h1{font-size:16px !important;margin:0 0 2px !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper .print-parties{display:grid !important;grid-template-columns:minmax(0,1fr) minmax(0,1fr) !important;gap:12px !important;align-items:start !important;margin:0 !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper .print-parties.sb-parties-1,
html body :is(#app,#sb-form-layer) .sb-inv-paper .sb-inv-head .print-parties.sb-parties-1{grid-template-columns:minmax(0,1fr) !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper .sb-inv-facts{display:grid !important;grid-template-columns:repeat(auto-fit,minmax(90px,1fr)) !important;gap:0 !important;width:100% !important;max-width:none !important;margin:0 0 14px !important;border:1px solid #c5d0da !important;border-radius:6px !important;background:transparent !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper .sb-fact{display:block !important;padding:8px 10px !important;min-width:0 !important;border-right:1px solid #d5dee8}
html body :is(#app,#sb-form-layer) .sb-inv-paper .sb-fact span{display:block !important;font-size:9pt !important;font-weight:700 !important;letter-spacing:.03em !important;text-transform:uppercase !important;text-align:left !important;color:#3d4d5c !important;background:transparent !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper .sb-fact b{display:block !important;margin:0 !important;font-size:13px !important;font-weight:800 !important;text-align:left !important;color:#111827 !important;white-space:normal !important;overflow-wrap:anywhere !important;background:transparent !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper .sb-party-box{min-height:0 !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper .sb-meta-rows{display:grid !important;grid-template-columns:max-content minmax(0,1fr) max-content minmax(0,1fr) !important;column-gap:16px !important;row-gap:6px !important;align-items:baseline !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper .sb-meta-row{display:contents !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper .sb-meta-label{font-size:11px !important;font-weight:700 !important;letter-spacing:.03em !important;text-transform:uppercase !important;color:#3d4d5c !important;background:transparent !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper .sb-meta-value{font-size:13px !important;font-weight:700 !important;color:#111827 !important;background:transparent !important;white-space:nowrap !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper table.sb-inv-grid{
  width:100% !important;
  table-layout:fixed !important;
  border-collapse:collapse !important;
  background:#fff !important;
  color:#111827 !important;
}
html[data-theme="dark"] body :is(#app,#sb-form-layer) .sb-inv-paper table,
html[data-theme="dark"] body :is(#app,#sb-form-layer) .sb-inv-paper table tbody,
html[data-theme="dark"] body :is(#app,#sb-form-layer) .sb-inv-paper table tbody tr,
html[data-theme="dark"] body :is(#app,#sb-form-layer) .sb-inv-paper table tbody td,
html[data-theme="dark"] body :is(#app,#sb-form-layer) .sb-inv-paper table thead,
html[data-theme="dark"] body :is(#app,#sb-form-layer) .sb-inv-paper table thead tr,
html[data-theme="dark"] body :is(#app,#sb-form-layer) .sb-inv-paper table thead th{
  background:#fff !important;
  color:#111827 !important;
  -webkit-text-fill-color:#111827 !important;
  border-color:#c5d0da !important;
  position:static !important;
  height:auto !important;
  font-size:11px !important;
  white-space:normal !important;
  word-break:normal !important;
  overflow-wrap:break-word !important;
}
html[data-theme="dark"] body :is(#app,#sb-form-layer) .sb-inv-paper table thead th{
  font-weight:800 !important;
  text-align:center !important;
  border-bottom:1.5px solid #1b2836 !important;
  background:#fff !important;
  color:#1b2836 !important;
  -webkit-text-fill-color:#1b2836 !important;
}
html body :is(#app,#sb-form-layer) .sb-inv-paper table.sb-inv-grid th,
html body :is(#app,#sb-form-layer) .sb-inv-paper table.sb-inv-grid td{
  white-space:normal !important;
  overflow:hidden !important;
  text-overflow:clip !important;
  word-break:normal !important;
  overflow-wrap:break-word !important;
  font-size:9pt !important;
  line-height:1.2 !important;
  padding:4px 3px !important;
  min-width:0 !important;
  box-sizing:border-box !important;
}
html body :is(#app,#sb-form-layer) .sb-inv-paper table.sb-inv-grid td.sb-col-num,
html body :is(#app,#sb-form-layer) .sb-inv-paper .total-row b,
html body :is(#app,#sb-form-layer) .sb-inv-paper .sb-totals-table td:last-child{
  white-space:nowrap !important;
  word-break:keep-all !important;
  overflow-wrap:normal !important;
  overflow:visible !important;
  text-align:right !important;
}
html body :is(#app,#sb-form-layer) .sb-inv-paper table.sb-inv-grid .sb-col-desc{
  white-space:normal !important;
  word-break:normal !important;
  overflow-wrap:break-word !important;
  overflow:hidden !important;
  text-align:left !important;
  min-width:0 !important;
}
html body :is(#app,#sb-form-layer) .sb-inv-paper .totals,
html body :is(#app,#sb-form-layer) .sb-inv-paper .sb-totals-boxed{
  margin-left:auto !important;
  width:min(280px,100%) !important;
  background:transparent !important;
  border:0 !important;
  box-shadow:none !important;
  padding:0 !important;
}
html body :is(#app,#sb-form-layer) .sb-inv-paper .total-row{display:flex !important;justify-content:space-between !important;gap:16px !important;background:transparent !important;color:#111827 !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper .total-row.grand{border-top:1.5px solid #1b2836 !important;margin-top:4px !important;padding-top:6px !important;font-weight:800 !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper[data-title-align="left"] .print-title{justify-content:flex-start !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper[data-title-align="center"] .print-title{justify-content:center !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper[data-title-align="right"] .print-title{justify-content:flex-end !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper[data-totals-align="left"] .totals,
html body :is(#app,#sb-form-layer) .sb-inv-paper[data-totals-align="left"] .sb-totals-boxed{margin-left:0 !important;margin-right:auto !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper[data-totals-align="full"] .totals,
html body :is(#app,#sb-form-layer) .sb-inv-paper[data-totals-align="full"] .sb-totals-boxed{width:100% !important;margin-left:0 !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper[data-borders="0"] table.sb-inv-grid th,
html body :is(#app,#sb-form-layer) .sb-inv-paper[data-borders="0"] table.sb-inv-grid td{border-color:transparent !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper table.sb-inv-grid :is(th,td).sb-align-left{text-align:left !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper table.sb-inv-grid :is(th,td).sb-align-center{text-align:center !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper table.sb-inv-grid :is(th,td).sb-align-right{text-align:right !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper .sb-qr-sample{display:inline-flex;align-items:center;justify-content:center;width:48px;height:48px;border:1px solid #1b2836;font-size:11px;font-weight:700;flex:0 0 auto}
html body :is(#app,#sb-form-layer) .sb-inv-paper .sb-behalf{white-space:pre-wrap;margin:0 0 8px}
html body :is(#app,#sb-form-layer) .sb-inv-paper[data-header-align="center"] .sb-fact,
html body :is(#app,#sb-form-layer) .sb-inv-paper[data-header-align="center"] .sb-fact span,
html body :is(#app,#sb-form-layer) .sb-inv-paper[data-header-align="center"] .sb-fact b{text-align:center !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper[data-header-align="right"] .sb-fact,
html body :is(#app,#sb-form-layer) .sb-inv-paper[data-header-align="right"] .sb-fact span,
html body :is(#app,#sb-form-layer) .sb-inv-paper[data-header-align="right"] .sb-fact b{text-align:right !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper[data-header-case="typed"] .sb-fact span{text-transform:none !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper[data-heading-case="upper"] .sb-inv-grid th{text-transform:uppercase}
html body :is(#app,#sb-form-layer) .sb-inv-paper[data-heading-weight="normal"] .sb-inv-grid th{font-weight:500 !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper.sb-free{position:relative !important;min-height:0 !important}
html body :is(#app) .sb-inv-paper.sb-free{width:100% !important;height:auto !important;aspect-ratio:var(--place-ar,210 / 297)}
html body :is(#app,#sb-form-layer) .sb-inv-paper.sb-free .sb-section,
html body :is(#app,#sb-form-layer) .sb-inv-paper.sb-free .print-title,
html body :is(#app,#sb-form-layer) .sb-inv-paper.sb-free .sb-inv-head,
html body :is(#app,#sb-form-layer) .sb-inv-paper.sb-free .sb-inv-parties,
html body :is(#app,#sb-form-layer) .sb-inv-paper.sb-free .print-parties,
html body :is(#app,#sb-form-layer) .sb-inv-paper.sb-free .sb-inv-facts,
html body :is(#app,#sb-form-layer) .sb-inv-paper.sb-free .sb-doc-foot,
html body :is(#app,#sb-form-layer) .sb-inv-paper.sb-free .sb-doc-notes,
html body :is(#app,#sb-form-layer) .sb-inv-paper.sb-free .totals:not([data-place]),
html body :is(#app,#sb-form-layer) .sb-inv-paper.sb-free .print-signatures{display:contents !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper.sb-free [data-place]{position:absolute !important;margin:0 !important;box-sizing:border-box !important;max-width:none !important;z-index:1}
html body :is(#app,#sb-form-layer) .sb-inv-paper.sb-free .esb-software-stamp{position:absolute !important;right:8px;bottom:4px;margin:0 !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper[data-footer-align="center"] .sb-doc-notes{text-align:center !important}
html body :is(#app,#sb-form-layer) .sb-inv-paper[data-footer-align="right"] .sb-doc-notes{text-align:right !important}

/* Keep note margins inside the measured field before and after free placement. */
html body :is(#app,#sb-form-layer) .sb-inv-paper table.sb-inv-grid thead th{
  height:auto!important;white-space:normal!important;overflow:visible!important;
  overflow-wrap:anywhere!important;word-break:normal!important;text-overflow:initial!important;
}
html body :is(#app,#sb-form-layer) .sb-inv-paper :is(.sb-note,.sb-company-top){display:flow-root !important}

/* Document codes occupy their own space, never the title's inline row. */
html body :is(#app,#sb-form-layer,.sb-fmt-preview) .sb-inv-paper .sb-party-band > .qr-corner{position:static!important;align-self:center!important;flex:0 0 64px!important;width:64px!important;margin:0!important;padding:4px!important;box-sizing:content-box!important;background:#fff!important;align-items:center!important;break-inside:avoid}
html body :is(#app,#sb-form-layer,.sb-fmt-preview) .sb-inv-paper .sb-party-band > .qr-corner img{display:block!important;width:64px!important;height:64px!important;max-width:none!important}
html body :is(#app,#sb-form-layer,.sb-fmt-preview) .sb-inv-paper .print-title.sb-title-with-barcode{flex-direction:column!important;align-items:flex-end!important;gap:6px!important}
html body :is(#app,#sb-form-layer,.sb-fmt-preview) .sb-inv-paper .sb-document-barcode{position:static!important;max-width:100%;background:#fff}
