:root {
  --ink: #172126;
  --muted: #647178;
  --line: #d8e0d6;
  --line-dark: #b7c4b4;
  --paper: #ffffff;
  --canvas: #eef2ee;
  --brand: #739B6C;
  --brand-dark: #4F6F4A;
  --brand-deep: #3D5A38;
  --brand-pale: #e8f0e6;
  --teal: var(--brand);
  --teal-dark: var(--brand-dark);
  --teal-pale: var(--brand-pale);
  --navy: var(--brand-deep);
  --danger: #a33d3d;
  --font: "Inter", Arial, sans-serif;
  --display: "Manrope", "Inter", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--canvas); }
body { margin: 0; color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.45; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.app-header { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.97); border-bottom: 1px solid var(--line); }
.app-header__inner { min-height: 68px; max-width: 1500px; margin: 0 auto; padding: 10px 24px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; }
.brand-lockup { display: inline-flex; align-items: center; color: var(--ink); text-decoration: none; width: max-content; }
.brand-lockup__logo { display: block; height: 32px; width: auto; max-width: 220px; object-fit: contain; }
.mode-switch { display: inline-flex; border: 1px solid var(--line-dark); padding: 3px; background: #f7f9f9; }
.mode-switch__button { border: 0; background: transparent; padding: 8px 16px; font-weight: 600; color: var(--muted); }
.mode-switch__button.is-active { background: var(--brand-deep); color: #fff; }
.header-actions { justify-self: end; display: flex; flex-wrap: wrap; gap: 7px; }
.button { min-height: 36px; padding: 8px 13px; border: 1px solid var(--line-dark); background: #fff; font-weight: 600; transition: .15s ease; }
.button:hover { border-color: var(--teal-dark); }
.button--primary { background: var(--brand-deep); border-color: var(--brand-deep); color: #fff; }
.button--quiet { background: #fff; }
.button--block { display: flex; align-items: center; justify-content: center; width: 100%; text-align: center; }
.button--small { min-height: 32px; padding: 6px 11px; }
.file-button input { display: none; }
.workspace { max-width: 1500px; margin: 0 auto; padding: 28px 24px 56px; display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px; align-items: start; }
.control-panel { position: sticky; top: 96px; }
.control-group { padding: 0 0 21px; margin-bottom: 21px; border-bottom: 1px solid var(--line-dark); }
.control-group h2 { margin: 0 0 10px; font: 700 12px/1.2 var(--font); text-transform: uppercase; letter-spacing: .1em; color: var(--navy); }
.control-grid { display: grid; gap: 8px; }
.control-help { margin: 9px 0 0; color: var(--muted); font-size: 12px; }
.validation-summary { padding: 10px 11px; background: #fff; border-left: 3px solid var(--teal-dark); font-size: 12px; }
.validation-summary.has-errors { border-color: var(--danger); color: var(--danger); }
.quick-item-select { width: 100%; min-width: 0; background: #fff; }
.quick-item-select optgroup { font-weight: 700; }
.quick-item-select option { font-weight: 400; }
.document-stage { min-width: 0; overflow: auto; }
.document {
  --doc-pad-x: 10mm;
  width: 210mm;
  max-width: 100%;
  min-height: 297mm;
  margin: 0 auto;
  padding: 0 !important;
  background: var(--paper);
  box-shadow: 0 10px 35px rgba(29,49,55,.13);
  container-type: inline-size;
  container-name: document;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.document h2 { margin: 0 0 11px; font: 700 16px/1.25 var(--display); color: var(--brand-deep); }
.document-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  gap: 24px 42px;
  align-items: start;
  flex: 0 0 auto;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 14px var(--doc-pad-x) 16px;
  background: var(--brand-pale);
  border: 0;
  box-sizing: border-box;
}
.document-body {
  flex: 1 1 auto;
  width: 100%;
  margin: 0;
  padding: 0 var(--doc-pad-x);
  box-sizing: border-box;
  background: var(--paper);
}
@container document (max-width: 620px) {
  .document-header {
    grid-template-columns: 1fr;
  }
  .document-header-side { align-items: stretch; }
  .header-partners { justify-content: flex-start; }
  .document-identity { text-align: left; }
  .identity-grid {
    margin-left: 0;
    justify-content: start;
    text-align: left;
  }
  .field--number,
  .identity-grid .field,
  .identity-grid label > span:first-child { text-align: left; }
}
.document-brand {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.document-logo { display: inline-flex; align-items: center; max-width: 100%; }
.document-logo img { display: block; height: 52px; width: auto; max-width: min(300px, 100%); object-fit: contain; }
.company-details {
  display: grid;
  gap: 3px;
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.4;
  max-width: 360px;
}
.company-details strong {
  color: var(--ink);
  font: 700 11px/1.2 var(--display);
  letter-spacing: normal;
}
.company-details__address { max-width: 34em; }
.company-details__contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 0;
  color: var(--ink);
  font-weight: 500;
}
.company-details__contact a {
  color: inherit;
  text-decoration: none;
}
.company-details__sep {
  display: inline-block;
  width: 3px;
  height: 3px;
  margin: 0 7px;
  border-radius: 50%;
  background: var(--brand);
  flex: 0 0 auto;
}
.document-header-side {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  min-width: 0;
}
.header-partners {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 12px;
}
.header-partners__octopus {
  display: block;
  height: 62px;
  width: auto;
  max-width: 310px;
  max-height: 62px;
  object-fit: contain;
}
.header-partners__mcs {
  display: block;
  width: 62px;
  height: 62px;
  max-width: 62px;
  max-height: 62px;
  object-fit: contain;
}
.document-identity {
  text-align: right;
  min-width: 0;
  width: 100%;
  padding: 0;
  background: transparent;
  border-left: 0;
}
.eyebrow {
  margin: 0 0 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .16em;
  color: var(--brand-dark);
}
.field--number {
  width: 100%;
  text-align: right;
  border: 0 !important;
  padding: 0 !important;
  font: 700 24px/1.2 var(--display);
  color: var(--brand-deep);
  background: transparent !important;
}
.identity-grid {
  display: grid;
  grid-template-columns: auto auto;
  gap: 12px 28px;
  margin-top: 13px;
  margin-left: auto;
  width: max-content;
  max-width: 100%;
  text-align: right;
  justify-content: end;
}
/* Only the caption — not pdf-static-field value spans replaced into the same label. */
label > span:first-child { display: block; margin-bottom: 5px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.field { width: 100%; border: 1px solid var(--line-dark); background: #fff; padding: 8px 9px; min-height: 36px; border-radius: 0; }
.field:focus, .table-field:focus { outline: 2px solid rgba(115,155,108,.28); border-color: var(--brand-dark); }
textarea.field { resize: vertical; }
.identity-grid .field { text-align: right; font-size: 12px; background: #fff; min-height: 36px; padding: 8px 9px; }
.identity-grid label > span:first-child { letter-spacing: .04em; text-align: right; }
.party-section { padding: 24px 0 20px; }
.form-grid { display: grid; gap: 10px; min-width: 0; }
.form-grid--two { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.span-two { grid-column: 1 / -1; }
.project-section { padding: 18px 0 21px; border-top: 1px solid var(--line); }
.field--description { min-height: 78px; }
.items-section { border-top: 2px solid var(--brand-deep); padding: 16px 0 0; }
.section-heading-row { display: flex; justify-content: space-between; align-items: end; margin-bottom: 13px; }
.section-heading-row h2 { margin-bottom: 0; }
.items-table-wrap { overflow-x: auto; }
.items-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.items-table th { padding: 9px 8px; background: var(--brand-deep); color: #fff; font-size: 9px; text-align: left; text-transform: uppercase; letter-spacing: .06em; }
.items-table th.col-qty, .items-table th.col-rate, .items-table th.col-amount { text-align: right; }
.items-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.items-table tbody tr:last-child td { border-bottom: 1px solid var(--line); }
.col-order { width: 28px; }
.col-item { width: auto; }
.col-qty { width: 88px; }
.col-rate { width: 110px; }
.col-amount { width: 100px; }
.col-actions { width: 36px; }
.table-field { width: 100%; min-width: 0; border: 1px solid var(--line); background: #fff; padding: 7px 8px; font-size: 12px; border-radius: 4px; }
.table-field:hover, .table-field:focus { border-color: var(--teal-dark); }
textarea.table-field { resize: none; overflow: hidden; min-height: 34px; line-height: 1.35; }
.item-quantity, .item-price { text-align: right; }
.rate-cell { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; }
.rate-cell .table-field { padding-left: 4px; }
.line-total { text-align: right; font-weight: 700; font-size: 12px; white-space: nowrap; padding-right: 8px !important; }
.item-order { vertical-align: middle !important; }
.drag-handle { border: 0; background: transparent; color: var(--muted); padding: 3px; cursor: grab; }
.row-actions { text-align: center; }
.icon-button { border: 0; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; padding: 2px 4px; }
.delete-item:hover { color: var(--danger); }
.item-row.is-dragging { opacity: .45; }
.commercial-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  padding: 24px 0;
  align-items: start;
  min-width: 0;
}
.summary-notes { display: grid; gap: 12px; min-width: 0; }
.totals-panel {
  border-top: 2px solid var(--brand-deep);
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow: visible;
  container-type: inline-size;
  container-name: totals;
}
.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 10px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.total-row span { min-width: 0; }
.total-row strong { white-space: nowrap; flex: 0 0 auto; }
.total-row--grand {
  background: var(--teal-pale);
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  color: var(--navy);
  position: relative;
  z-index: 1;
  margin-top: 0;
}
.total-row--grand strong { font-size: 18px; }
.total-input {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 6px 12px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.totals-panel .total-input > span {
  display: inline;
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.2;
}
.totals-panel .total-input > .money-field,
.totals-panel .total-input > .field.money-field,
.totals-panel .total-input > .pdf-static-field.money-field {
  display: block;
  width: auto;
  flex: 0 1 96px;
  min-width: 72px;
  max-width: 110px;
  box-sizing: border-box;
}
.total-input--option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto) auto;
  align-items: center;
  gap: 8px;
}
.total-input--option > span { flex: unset; }
.total-input--option strong { text-align: right; white-space: nowrap; min-width: 56px; }
.total-option {
  display: grid;
  grid-template-columns: minmax(52px, 64px) minmax(36px, 40px);
  gap: 4px;
  flex: 0 1 auto;
  min-width: 0;
}
.total-option .field,
.total-input--option > .money-field,
.total-input--option > .pdf-static-field {
  width: 100%;
  min-height: 30px;
  padding: 4px 6px;
  max-width: none;
  flex: none;
  box-sizing: border-box;
}
.money-field { text-align: right; min-height: 30px; padding: 4px 6px; }
.total-row--balance { background: var(--brand-deep); color: #fff; border: 0; font-size: 14px; }
.total-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}
.total-toggle input { flex: 0 0 auto; width: 15px; height: 15px; margin: 0; accent-color: var(--brand-deep); cursor: pointer; }
.total-toggle span { min-width: 0; }
.is-hidden { display: none !important; }

@container totals (max-width: 300px) {
  .total-input--option {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "label amount"
      "controls amount";
  }
  .total-input--option > span { grid-area: label; }
  .total-input--option .total-option { grid-area: controls; justify-self: start; }
  .total-input--option > select.money-field,
  .total-input--option > select.field,
  .total-input--option > .pdf-static-field.money-field {
    grid-area: controls;
    justify-self: start;
    width: auto;
    min-width: 72px;
    max-width: 110px;
  }
  .total-input--option strong { grid-area: amount; align-self: center; }
}
.payment-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 28px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.payment-section > * { min-width: 0; }
.payment-section > :only-child { grid-column: 1 / -1; }
.bank-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 9px;
  min-width: 0;
}
.notes-terms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 28px;
  padding: 22px 0;
  min-width: 0;
}
.notes-terms-grid > :only-child { grid-column: 1 / -1; }
.acceptance-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 30px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
  min-width: 0;
}
.acceptance-section p { color: var(--muted); font-size: 11px; margin: 0; }
.signature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  min-width: 0;
}
.signature-field { font-style: italic; }
.document-closing {
  flex: 0 0 auto;
  width: 100%;
  max-width: none;
  margin: 0;
  border-top: 2px solid var(--brand);
  background: var(--brand-pale);
  overflow: hidden;
  box-sizing: border-box;
}
.accreditations {
  padding: 17px var(--doc-pad-x) 15px;
  border: 0;
}
.accreditations__label {
  margin: 0 0 8px;
  text-align: center;
}
.accreditation-list {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
}
.accreditation {
  width: 48px;
  height: 48px;
  min-width: 0;
  min-height: 0;
  padding: 0;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.accreditation img {
  display: block;
  width: 48px;
  height: 48px;
  max-width: 48px;
  max-height: 48px;
  margin: 0;
  object-fit: contain;
}
.document-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px 25px;
  padding: 12px var(--doc-pad-x);
  margin: 0;
  border-top: 1px solid #d5e3d1;
  font-size: 8.5px;
  color: var(--muted);
}
.document-footer strong {
  display: block;
  margin: 0 0 2px;
  color: var(--brand-deep);
  font: 700 10px/1.2 var(--display);
  letter-spacing: 0.02em;
}
.footer-contact {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.footer-contact__line {
  color: var(--ink);
  font-weight: 500;
  font-size: 9px;
}
.footer-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 1px;
}
.footer-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
  padding: 4px 6px 3px;
  background: #fff;
  border: 1px solid #d5e3d1;
}
.footer-qr__image {
  display: block;
  width: 56px;
  height: 56px;
  max-width: 56px;
  max-height: 56px;
  object-fit: contain;
  image-rendering: pixelated;
}
.footer-qr__caption {
  font-size: 6.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand-dark);
}
.footer-qr__label {
  font-size: 7.5px;
  letter-spacing: 0.02em;
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}
.document--quote #invoicePaymentSection, .document--quote #paymentStatusField, .document--quote #amountPaidField { display: none; }
#busSchemeField, #busSchemeTotalRow { display: none; }
.document--ashp #busSchemeField { display: grid; }
.document--ashp #busSchemeTotalRow { display: flex; }
.document--invoice #acceptanceSection { display: none; }
.ashp-section { padding: 18px 0 21px; border-top: 1px solid var(--line); display: none; }
.ashp-section p { margin: 0 0 8px; }
.ashp-section p:last-child { margin-bottom: 0; }
.ashp-section ol, .ashp-section ul { margin: 8px 0 0; padding-left: 20px; }
.ashp-section li { margin-bottom: 6px; }
.ashp-section li:last-child { margin-bottom: 0; }
.document--ashp .ashp-section { display: block; }
.document--ashp #invoicePaymentSection,
.document--ashp #paymentStatusField,
.document--ashp #amountPaidField,
.document--ashp #customerCompanyField,
.document--ashp #billingAddressField,
.document--ashp #summaryNotesPanel,
.document--ashp #discountField,
.document--ashp #depositField,
.document--ashp #balanceRow,
.document--ashp #notesTermsGrid,
.document--ashp #acceptancePositionField { display: none; }
.receipt-details { display: none; gap: 12px; min-width: 0; }
.document--receipt .receipt-details { display: grid; align-content: start; }
.document--receipt #dueDateField,
.document--receipt #summaryNotesPanel,
.document--receipt #depositField,
.document--receipt #invoicePaymentSection,
.document--receipt #termsColumn,
.document--receipt #acceptanceSection { display: none; }
.required-invalid { border-color: var(--danger) !important; background: #fff8f8 !important; }
body.preview-mode .document .field, body.preview-mode .document .table-field {
  border-color: transparent;
  background: transparent;
  pointer-events: none;
  appearance: none;
  padding-left: 0;
  padding-right: 0;
}
body.preview-mode .document textarea { resize: none; overflow: hidden; }
body.preview-mode #addItemButton, body.preview-mode .row-actions, body.preview-mode .item-order { display: none !important; }
body.preview-mode .col-order, body.preview-mode .col-actions { width: 0; padding: 0; }
body.preview-mode .rate-cell span { color: var(--ink); }
body.preview-mode .document input::placeholder,
body.preview-mode .document textarea::placeholder { color: transparent !important; opacity: 0 !important; }
body.preview-mode .document .output-empty,
body.preview-mode .document .pdf-static-field.output-empty {
  display: block;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: transparent !important;
  min-height: 28px !important;
  height: 28px !important;
  padding: 0 !important;
  -webkit-text-fill-color: transparent !important;
}
body.preview-mode .totals-panel .money-field {
  color: var(--ink) !important;
  -webkit-text-fill-color: var(--ink) !important;
  min-height: 30px !important;
  height: auto !important;
  text-align: right;
}
body.preview-mode .totals-panel .output-empty {
  color: var(--ink) !important;
  -webkit-text-fill-color: var(--ink) !important;
}
body.preview-mode .totals-panel .money-field.hide-raw-value {
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
}
body.preview-mode .document .signature-grid .output-empty,
body.preview-mode .document .signature-grid .pdf-static-field.output-empty {
  border-bottom: 1px solid var(--line-dark) !important;
}
body.preview-mode .document input[type="date"].output-empty::-webkit-datetime-edit,
body.preview-mode .document input[type="date"].output-empty::-webkit-calendar-picker-indicator {
  color: transparent !important;
  opacity: 0 !important;
  display: none !important;
}
body.preview-mode .document label.label-empty,
body.preview-mode .document .section-empty,
body.preview-mode .document #paymentInstructions.output-empty {
  display: none !important;
}
body.preview-mode .document .signature-grid label.label-empty {
  display: block !important;
}
body.preview-mode .document .signature-grid label.label-empty > span {
  display: block;
}
body.preview-mode .document .signature-grid label.label-empty .output-empty,
body.preview-mode .document .signature-grid label.label-empty .pdf-static-field.output-empty {
  display: block !important;
  border-bottom: 1px solid var(--line-dark) !important;
  min-height: 28px !important;
  height: 28px !important;
}
.pdf-static-field {
  display: block;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: normal;
  text-transform: none;
  border: 0;
  background: transparent;
}
#pdf-render-host .document {
  box-shadow: none;
  margin: 0;
  width: 210mm;
  max-width: 210mm;
  --doc-pad-x: 10mm;
  padding: 0 !important;
}
#pdf-render-host label.label-empty,
#pdf-render-host .section-empty,
#pdf-render-host #paymentInstructions.output-empty { display: none !important; }
#pdf-render-host .signature-grid label.label-empty { display: block !important; }
#pdf-render-host .signature-grid .output-empty {
  display: block !important;
  border-bottom: 1px solid var(--line-dark) !important;
  min-height: 28px;
}
@media (max-width: 1180px) {
  .app-header__inner { grid-template-columns: 1fr auto; }
  .mode-switch { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
  .workspace { grid-template-columns: 1fr; }
  .control-panel { position: static; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
  .document-stage { padding-bottom: 10px; }
}
@media (max-width: 760px) {
  .app-header__inner { padding: 10px 13px; }
  .header-actions { justify-self: end; }
  .workspace { padding: 14px 0 35px; }
  .control-panel { padding: 0 13px; grid-template-columns: 1fr; }
  .document-stage { overflow-x: auto; padding: 0 10px; }
  .document-stage .document {
    width: 100%;
    min-width: 0;
    --doc-pad-x: 14px;
    padding: 0 !important;
  }
  .identity-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .items-table { table-layout: auto; }
  .col-qty { width: 70px; }
  .col-rate { width: 90px; }
  .col-amount { width: 84px; }
}
@page { size: A4; margin: 0; }
@media print {
  html, body { background: #fff !important; }
  .no-print { display: none !important; }
  .workspace { display: block; padding: 0; max-width: none; }
  .document-stage { overflow: visible; }
  .document {
    width: 210mm;
    max-width: none;
    min-height: auto;
    margin: 0;
    --doc-pad-x: 10mm;
    padding: 0 !important;
    box-shadow: none;
    overflow: hidden;
  }
  .field, .table-field { border: 0 !important; background: transparent !important; padding-left: 0; padding-right: 0; appearance: none; }
  textarea { resize: none !important; overflow: hidden !important; }
  input::placeholder, textarea::placeholder { color: transparent !important; opacity: 0 !important; }
  .output-empty, .pdf-static-field.output-empty {
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: transparent !important;
    min-height: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    -webkit-text-fill-color: transparent !important;
  }
  .totals-panel .money-field {
    color: var(--ink) !important;
    -webkit-text-fill-color: var(--ink) !important;
    min-height: 30px !important;
    height: auto !important;
    width: auto !important;
    max-width: 110px !important;
  }
  .totals-panel .total-input > span {
    display: inline !important;
    margin: 0 !important;
    color: var(--muted) !important;
    -webkit-text-fill-color: var(--muted) !important;
  }
  label.label-empty,
  .section-empty,
  #paymentInstructions.output-empty {
    display: none !important;
  }
  .signature-grid label.label-empty {
    display: block !important;
  }
  .signature-grid .output-empty,
  .signature-grid .pdf-static-field.output-empty {
    display: block !important;
    border-bottom: 1px solid #bfc9cc !important;
    min-height: 28px !important;
    height: 28px !important;
  }
  input[type="date"].output-empty::-webkit-datetime-edit,
  input[type="date"].output-empty::-webkit-calendar-picker-indicator {
    color: transparent !important;
    opacity: 0 !important;
    display: none !important;
  }
  .items-table-wrap { overflow: visible; }
  .items-table { page-break-inside: auto; }
  .items-table thead { display: table-header-group; }
  .item-row { break-inside: avoid; page-break-inside: avoid; }
  .document-header,
  .commercial-summary,
  .payment-section,
  .notes-terms-grid,
  .acceptance-section,
  .ashp-section,
  .document-closing { break-inside: avoid; page-break-inside: avoid; }
  .document-footer { break-inside: avoid; }
}
/* PDF export: each .pdf-sheet is one full-bleed A4 page. */
#pdf-render-host {
  position: fixed;
  left: 0;
  top: 0;
  width: 794px;
  margin: 0;
  padding: 0;
  background: #fff;
  overflow: visible;
  pointer-events: none;
  opacity: 1;
  z-index: 2147483646;
}
#pdf-render-host .pdf-sheets {
  width: 794px;
  margin: 0;
  padding: 0;
  background: #fff;
}
#pdf-render-host .document,
#pdf-render-host .document--pdf,
#pdf-render-host .pdf-sheet {
  width: 794px;
  max-width: 794px;
  margin: 0;
  --doc-pad-x: 38px; /* text inset only; header/footer stay full-bleed */
  padding: 0 !important;
  box-shadow: none;
  box-sizing: border-box;
  overflow: hidden;
  container-type: normal;
}
#pdf-render-host .pdf-sheet {
  height: 1123px;
  min-height: 1123px;
  max-height: 1123px;
  display: flex;
  flex-direction: column;
  background: #fff;
}
#pdf-render-host .pdf-sheet__body {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  margin: 0;
  padding: 0 var(--doc-pad-x);
  box-sizing: border-box;
  overflow: hidden;
}
#pdf-render-host .pdf-sheet--continuation .pdf-sheet__body,
#pdf-render-host .pdf-sheet--last:not(.pdf-sheet--first) .pdf-sheet__body {
  padding-top: 18px;
  padding-bottom: 18px;
}
#pdf-render-host .document--pdf .document-header,
#pdf-render-host .document--pdf .document-closing,
#pdf-render-host .pdf-sheet .document-header,
#pdf-render-host .pdf-sheet .document-closing {
  width: 100%;
  max-width: none;
  margin: 0;
  flex: 0 0 auto;
  box-sizing: border-box;
}
#pdf-render-host .document--pdf .document-header,
#pdf-render-host .pdf-sheet .document-header {
  padding: 14px var(--doc-pad-x) 16px;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  gap: 24px 42px;
}
#pdf-render-host .document--pdf .document-body {
  padding: 0 var(--doc-pad-x);
  margin: 0;
  width: 100%;
  box-sizing: border-box;
}
.html2pdf__overlay,
.html2pdf__container {
  left: 0 !important;
  top: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  transform: none !important;
}
#pdf-render-host .document--pdf .pdf-static-field,
#pdf-render-host .document--pdf .pdf-static-field.field,
#pdf-render-host .document--pdf .pdf-static-field.table-field {
  min-height: 0 !important;
  height: auto !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  text-align: left !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  font-size: 12px !important;
  font-weight: 400 !important;
  line-height: 1.4 !important;
  color: var(--ink) !important;
  box-sizing: border-box !important;
  overflow-wrap: anywhere;
  word-break: break-word;
}
#pdf-render-host .document--pdf .identity-grid .pdf-static-field {
  text-align: right !important;
}
#pdf-render-host .document--pdf .pdf-static-field.field--number {
  font: 700 24px/1.2 var(--display) !important;
  color: var(--brand-deep) !important;
  text-align: right !important;
  padding: 0 !important;
}
#pdf-render-host .document--pdf .totals-panel .pdf-static-field.money-field,
#pdf-render-host .document--pdf .item-quantity.pdf-static-field,
#pdf-render-host .document--pdf .item-price.pdf-static-field {
  text-align: right !important;
}
#pdf-render-host .document--pdf .items-table-wrap {
  overflow: visible;
}
#pdf-render-host .document--pdf .item-row,
#pdf-render-host .document--pdf .document-header,
#pdf-render-host .document--pdf .document-closing,
#pdf-render-host .document--pdf .document-footer,
#pdf-render-host .document--pdf .commercial-summary,
#pdf-render-host .document--pdf .notes-terms-grid,
#pdf-render-host .document--pdf .acceptance-section,
#pdf-render-host .document--pdf .payment-section,
#pdf-render-host .document--pdf .ashp-section,
#pdf-render-host .document--pdf .total-input,
#pdf-render-host .document--pdf .total-row {
  break-inside: avoid;
  page-break-inside: avoid;
}
#pdf-render-host .document--pdf .document-header,
#pdf-render-host .document--pdf .document-closing {
  flex: 0 0 auto;
  width: 100%;
}
/* html2canvas ignores max-width on large intrinsic images — lock badge sizes. */
#pdf-render-host .document--pdf .header-partners__octopus {
  width: auto !important;
  height: 62px !important;
  max-width: 310px !important;
  max-height: 62px !important;
}
#pdf-render-host .document--pdf .header-partners__mcs {
  width: 62px !important;
  height: 62px !important;
  max-width: 62px !important;
  max-height: 62px !important;
  object-fit: contain !important;
}
#pdf-render-host .document--pdf .accreditation img {
  width: 48px !important;
  height: 48px !important;
  max-width: 48px !important;
  max-height: 48px !important;
  object-fit: contain !important;
}
#pdf-render-host .document--pdf .footer-qr__image {
  width: 56px !important;
  height: 56px !important;
  max-width: 56px !important;
  max-height: 56px !important;
  object-fit: contain !important;
}
#pdf-render-host .document--pdf .line-total,
#pdf-render-host .document--pdf .total-row strong,
#pdf-render-host .document--pdf .total-input strong {
  white-space: nowrap;
}
