/* Document modals — load after Tailwind */

.doc-form-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  background-size: 1.1rem;
}

/* ---- Desktop (default): full width, no horizontal scroll ---- */
.document-line-items-strip {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: hidden;
}

.document-line-items-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
}

.document-line-items-table col.li-col-desc {
  width: 36%;
}

.document-line-items-table col.li-col-qty {
  width: 10%;
}

.document-line-items-table col.li-col-price {
  width: 18%;
}

.document-line-items-table col.li-col-total {
  width: 16%;
}

.document-line-items-table col.li-col-action {
  width: 12%;
}

.document-line-items-table th,
.document-line-items-table td {
  vertical-align: middle;
  box-sizing: border-box;
}

.document-line-items-table th {
  white-space: nowrap;
}

.document-line-items-table td.col-desc {
  white-space: normal;
}

.document-line-items-table td input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.document-line-items-table td.col-total {
  text-align: right;
  white-space: nowrap;
}

.document-line-items-table th.col-action,
.document-line-items-table td.col-action {
  text-align: center;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.document-line-items-action-wrap {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 2.25rem;
}

.document-line-items-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  margin: 0 auto;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 0.375rem;
  color: hsl(var(--destructive));
}

.document-line-items-delete:hover:not(:disabled) {
  background: hsl(var(--destructive) / 0.12);
}

.document-line-items-delete:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ---- Narrow portrait: wide table inside strip only; Actions off-screen until swipe ----
   Landscape phones (≥640px wide) keep a fluid table so rotate can use horizontal space. */
@media (max-width: 639px) {
  .document-line-items-strip,
  .document-line-items-strip.ww-line-items-mobile {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-x: contain !important;
    touch-action: pan-x pan-y !important;
    scrollbar-width: thin;
  }

  .document-line-items-table,
  .document-line-items-strip.ww-line-items-mobile .document-line-items-table {
    display: table !important;
    width: 680px !important;
    min-width: 680px !important;
    max-width: none !important;
    table-layout: fixed !important;
  }

  .document-line-items-table col.li-col-desc {
    width: 220px !important;
  }

  .document-line-items-table col.li-col-qty {
    width: 80px !important;
  }

  .document-line-items-table col.li-col-price {
    width: 120px !important;
  }

  .document-line-items-table col.li-col-total {
    width: 100px !important;
  }

  .document-line-items-table col.li-col-action {
    width: 80px !important;
  }
}

@media (min-width: 768px) {
  .document-line-items-strip::-webkit-scrollbar {
    display: none;
  }
}

/* Standard document sheet — layout + weight roles (faces come from document-typography.css) */
.vpx-sheet-scroll {
  overflow-x: auto;
  background: #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  max-width: 100%;
}

.vpx-sheet {
  --vpx-primary: #1c3d6e;
  --vpx-secondary: #4b5563;
  --vpx-accent: #9ca3af;
  --vpx-primary-rgb: 28, 61, 110;
  --vpx-secondary-rgb: 75, 85, 99;
  --vpx-accent-rgb: 156, 163, 175;
  /* 10% secondary on white — keep in sync with DocumentBrandColors.MixOntoWhite */
  --vpx-row-alt: #e8eaed;
  width: 100%;
  max-width: 794px;
  min-width: min(100%, 640px);
  min-height: 1123px;
  margin: 0 auto;
  background: #ffffff;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.vpx-sheet.vpx-sheet--landscape {
  max-width: 1123px;
  min-width: min(100%, 794px);
  min-height: 794px;
}

.vpx-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 36px 40px 24px;
  box-sizing: border-box;
  min-width: 0;
}

.vpx-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.vpx-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  max-width: 52%;
}

.vpx-brand--has-logo {
  align-items: flex-start;
}

.vpx-brand--has-logo .vpx-brand-name,
.vpx-brand--has-logo .vpx-mark {
  display: none !important;
}

.vpx-brand-logo {
  display: block;
  max-height: 80px;
  max-width: 240px;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: left center;
  flex: none;
}

.vpx-brand-name {
  font-size: 20px;
  font-weight: var(--vpx-fw-bold, 700); /* Bold — brand mark */
  color: var(--vpx-primary);
  letter-spacing: 0;
  line-height: 1.3;
  overflow: visible;
}

.vpx-mark {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--vpx-primary);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: var(--vpx-fw-bold, 700);
  letter-spacing: 0.02em;
  line-height: 1;
  flex: none;
  overflow: visible;
}

.vpx-doc-meta {
  text-align: right;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 0;
  max-width: 48%;
}

.vpx-title {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
  font-weight: var(--vpx-fw-bold, 700); /* Bold — document title */
  color: var(--vpx-primary);
  overflow: visible;
}

.vpx-doc-id {
  margin: 0;
  font-size: 14px;
  font-weight: var(--vpx-fw-semibold, 600); /* SemiBold — document number */
  color: var(--vpx-ink, #0a0a0a);
  letter-spacing: 0.01em;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}

.vpx-sheet .vpx-status,
.vpx-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  margin: 8px 0 0;
  padding: 6px 12px 7px;
  min-height: 26px;
  font-family: var(--vpx-font-family, "Inter", system-ui, sans-serif) !important;
  font-size: 12px;
  font-weight: var(--vpx-fw-bold, 700) !important;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.25;
  white-space: nowrap;
  overflow: visible;
  border: 1.5px solid var(--vpx-primary, #0f766e);
  color: var(--vpx-primary, #0f766e);
  border-radius: 2px;
  background: transparent;
  /* Beat .vpx-sheet * antialiased — small bold labels look faint with grayscale AA */
  -webkit-font-smoothing: auto !important;
  -moz-osx-font-smoothing: auto !important;
  text-rendering: geometricPrecision;
  font-synthesis: none !important;
  font-optical-sizing: none !important;
}

.vpx-status--unpaid {
  border-color: #1e3a8a;
  color: #1e3a8a;
  background: #eff6ff;
}

.vpx-status--partial {
  border-color: #78350f;
  color: #78350f;
  background: #fff7ed;
}

.vpx-status--paid {
  border-color: #064e3b;
  color: #064e3b;
  background: #ecfdf5;
}

.vpx-status--overdue {
  border-color: #7f1d1d;
  color: #7f1d1d;
  background: #fef2f2;
}

.vpx-status--draft {
  border-color: #374151;
  color: #1f2937;
  background: #f3f4f6;
}

.vpx-doc-date {
  margin: 0;
  font-size: 13px;
  font-weight: var(--vpx-fw-semibold, 600);
  color: var(--vpx-ink-secondary, #111827);
  line-height: 1.35;
}

.vpx-parties {
  margin-top: 32px;
  font-size: 13.5px;
  line-height: 1.5;
  font-weight: var(--vpx-fw-medium, 500);
}

.vpx-balance {
  margin-top: 22px;
}

.vpx-invoice-status-note {
  margin-top: 4px !important;
  font-size: 11px !important;
  font-weight: var(--vpx-fw-medium, 500) !important;
  color: var(--vpx-ink-muted, #1f2937) !important;
  letter-spacing: 0.01em;
  text-transform: none;
}

/* Quotation / receipt: name & signature above a line, label below (Word-style). */
.vpx-signoff {
  display: flex;
  flex-wrap: wrap;
  gap: 28px 48px;
  margin-top: 28px;
  align-items: flex-end;
}

.vpx-signoff-col {
  flex: 1 1 180px;
  max-width: 260px;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.vpx-signoff-content {
  min-height: 44px;
  display: flex;
  align-items: flex-end;
  padding-bottom: 4px;
}

.vpx-signoff-content--sig {
  justify-content: flex-start;
}

.vpx-signoff-name {
  font-size: 13.5px;
  font-weight: var(--vpx-fw-medium, 500);
  color: var(--vpx-ink, #0a0a0a);
  line-height: 1.3;
}

.vpx-signoff-img {
  height: 42px;
  max-width: 180px;
  object-fit: contain;
  display: block;
}

.vpx-signoff-line {
  height: 0;
  border-bottom: 1.25px solid var(--vpx-ink, #0a0a0a);
  width: 100%;
}

.vpx-signoff-caption {
  margin-top: 4px;
  font-size: 12.5px;
  font-weight: var(--vpx-fw-bold, 700);
  color: var(--vpx-ink, #0a0a0a);
}

.vpx-balance-table {
  width: 100%;
  max-width: 420px;
  margin-left: auto;
}

.vpx-balance-table td {
  padding: 6px 0;
  font-size: 13px;
  font-weight: var(--vpx-fw-semibold, 600);
  color: var(--vpx-ink, #0a0a0a);
}

.vpx-balance-table .vpx-col-amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding-left: 24px;
}

.vpx-balance-outstanding td {
  color: #b45309;
}

.vpx-balance-cleared td {
  color: #047857;
}

.vpx-from {
  margin: 0 0 18px;
}

.vpx-to {
  margin: 0;
}

.vpx-company-name {
  margin: 0 0 4px;
  font-size: 15px;
  line-height: 1.4;
  font-weight: var(--vpx-fw-semibold, 600); /* SemiBold — party heading */
  color: var(--vpx-primary);
}

.vpx-to-label {
  margin: 0 0 2px;
  font-weight: var(--vpx-fw-semibold, 600);
  color: var(--vpx-ink, #0a0a0a);
  line-height: 1.4;
}

.vpx-name {
  margin: 0;
  font-weight: var(--vpx-fw-medium, 500);
  color: var(--vpx-ink, #0a0a0a);
  line-height: 1.45;
}

.vpx-email {
  margin: 2px 0 0;
  font-weight: var(--vpx-fw-medium, 500);
  color: var(--vpx-ink-secondary, #1f2937);
  line-height: 1.45;
}

.vpx-address {
  margin: 2px 0 0;
  white-space: pre-line;
  font-weight: var(--vpx-fw-medium, 500);
  color: var(--vpx-ink, #0a0a0a);
  line-height: 1.45;
  overflow: visible;
}

.vpx-quiet {
  margin: 2px 0 0;
  font-size: 12px;
  line-height: 1.45;
  font-weight: var(--vpx-fw-medium, 500);
  color: var(--vpx-ink-muted, #374151);
}

.vpx-notes {
  margin: 16px 0 0;
  font-size: 13px;
  line-height: 1.5;
  font-weight: var(--vpx-fw-medium, 500);
  white-space: pre-line;
  color: var(--vpx-ink-secondary, #1f2937);
}

.vpx-table {
  width: 100%;
  margin-top: 28px;
  /* separate + spacing 0 avoids html2canvas / PDF white hairlines from collapsed borders */
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 13px;
  font-weight: var(--vpx-fw-medium, 500);
}

.vpx-table thead th {
  background: var(--vpx-secondary);
  color: #ffffff !important;
  font-weight: var(--vpx-fw-semibold, 600); /* SemiBold — table headings */
  text-align: left;
  padding: 10px 10px;
  border: none;
  line-height: 1.4;
  vertical-align: middle;
  overflow: visible;
}

.vpx-table tbody td,
.vpx-table tfoot td {
  padding: 10px 10px;
  border: none;
  vertical-align: top;
  color: var(--vpx-ink, #0a0a0a);
  font-weight: var(--vpx-fw-medium, 500);
  line-height: 1.45;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  overflow: visible;
  background-clip: padding-box;
}

/* Solid bottom edge (not inset shadow) — html2canvas tears inset shadows into white hairlines. */
.vpx-table:not(.vpx-payment-table) > tbody > tr > td {
  border-bottom: 1px solid rgba(var(--vpx-secondary-rgb, 75, 85, 99), 0.22);
  box-shadow: none;
}

.vpx-table:not(.vpx-payment-table) > tfoot > tr > td {
  border-bottom: none;
  box-shadow: none;
}

/* Opaque solid zebra fill — never rgba/gradient (those tear into white lines in PDF capture). */
.vpx-row-alt td {
  background: var(--vpx-row-alt, #e8eaed) !important;
  background-image: none !important;
  background-clip: border-box;
}

.vpx-col-num {
  width: 40px;
}

.vpx-col-qty {
  width: 56px;
  text-align: right !important;
  font-weight: var(--vpx-fw-semibold, 600);
  font-variant-numeric: tabular-nums lining-nums;
  white-space: nowrap;
  overflow: visible;
}

.vpx-col-price {
  width: 22%;
  text-align: right !important;
  font-weight: var(--vpx-fw-semibold, 600);
  font-variant-numeric: tabular-nums lining-nums;
  white-space: nowrap;
  overflow: visible;
}

.vpx-col-amount {
  width: 22%;
  text-align: right !important;
  font-weight: var(--vpx-fw-semibold, 600);
  font-variant-numeric: tabular-nums lining-nums;
  white-space: nowrap;
  overflow: visible;
}

.vpx-table thead th.vpx-col-qty,
.vpx-table thead th.vpx-col-price,
.vpx-table thead th.vpx-col-amount {
  text-align: right;
  font-weight: var(--vpx-fw-semibold, 600);
}

.vpx-item-title {
  display: block;
  font-weight: var(--vpx-fw-medium, 500);
  color: var(--vpx-ink, #0a0a0a);
  line-height: 1.45;
  overflow: visible;
}

.vpx-item-sub,
.vpx-item-extra {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.45;
  font-weight: var(--vpx-fw-medium, 500);
  color: var(--vpx-ink-muted, #374151);
}

.vpx-subtotal-row td {
  background: rgba(var(--vpx-secondary-rgb, 75, 85, 99), 0.06);
  font-size: 13px;
  font-weight: var(--vpx-fw-semibold, 600);
  color: var(--vpx-ink, #0a0a0a);
  line-height: 1.45;
}

.vpx-subtotal-row .vpx-col-amount {
  font-weight: var(--vpx-fw-semibold, 600);
}

.vpx-section-row td {
  color: var(--vpx-ink, #0a0a0a) !important;
  font-size: 13px;
  font-weight: var(--vpx-fw-semibold, 600);
  background: rgba(var(--vpx-secondary-rgb, 75, 85, 99), 0.1);
  padding-top: 14px !important;
  border-bottom: 1px solid rgba(var(--vpx-secondary-rgb, 75, 85, 99), 0.22);
}

.vpx-total-row td {
  /* Accent colour from Document Settings — same var as live brand preview. */
  background: rgba(var(--vpx-accent-rgb, 156, 163, 175), 0.42);
  color: var(--vpx-ink, #0a0a0a);
  font-size: 14px;
  font-weight: var(--vpx-fw-bold, 700);
  line-height: 1.45;
}

.vpx-total-row td strong {
  font-weight: var(--vpx-fw-bold, 700);
}

.vpx-payment {
  margin-top: 32px;
}

.vpx-section-title {
  margin: 0 0 12px;
  text-align: center;
  font-size: 15px;
  line-height: 1.35;
  font-weight: var(--vpx-fw-semibold, 600); /* SemiBold — section headings */
  color: var(--vpx-primary);
  overflow: visible;
}

.vpx-payment-table {
  margin-top: 0;
}

.vpx-payment-table tbody td {
  min-height: 36px;
  height: auto;
  background: #ffffff;
  border-bottom: 1px solid rgba(var(--vpx-secondary-rgb, 75, 85, 99), 0.22);
  font-weight: var(--vpx-fw-medium, 500);
  color: var(--vpx-ink, #0a0a0a);
  line-height: 1.45;
  padding-top: 10px;
  padding-bottom: 10px;
  overflow: visible;
}

/* Report KPI strip — label + amount stacked, both right-aligned in each column */
.vpx-summary-table {
  margin-top: 20px;
  margin-bottom: 4px;
  table-layout: fixed;
  width: 100%;
  border-collapse: collapse;
}

.vpx-summary-table tbody td.vpx-kpi {
  vertical-align: top;
  text-align: right;
  background: #ffffff;
  border: none;
  border-bottom: 1px solid rgba(var(--vpx-secondary-rgb, 75, 85, 99), 0.22);
  padding: 12px 12px 14px;
  color: var(--vpx-ink, #0a0a0a);
}

.vpx-summary-table tbody td.vpx-kpi + td.vpx-kpi {
  border-left: 1px solid rgba(var(--vpx-secondary-rgb, 75, 85, 99), 0.18);
}

.vpx-kpi-label {
  display: block;
  font-size: 12px;
  line-height: 1.35;
  font-weight: var(--vpx-fw-semibold, 600);
  color: var(--vpx-primary);
  letter-spacing: 0.01em;
  margin-bottom: 6px;
  text-align: right;
}

.vpx-kpi-value {
  display: block;
  font-size: 15px;
  line-height: 1.35;
  font-weight: var(--vpx-fw-bold, 700);
  color: var(--vpx-ink, #0a0a0a);
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
  text-align: right;
  white-space: nowrap;
}

/* Report line tables — label column flexes; amount/date columns fixed and right-aligned */
.vpx-report-table col.vpx-col-amount-slot {
  width: 22%;
}

.vpx-report-table col.vpx-col-date-slot {
  width: 16%;
}

.vpx-report-table thead th:not(.vpx-col-amount):not(.vpx-col-date) {
  text-align: left;
}

.vpx-col-date {
  text-align: right !important;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.vpx-extra {
  margin-top: 28px;
  font-size: 12px;
  line-height: 1.55;
  font-weight: var(--vpx-fw-medium, 500);
  color: var(--vpx-ink-secondary, #1f2937);
}

.vpx-extra-label {
  margin: 0 0 6px;
  font-size: 13px;
  line-height: 1.4;
  font-weight: var(--vpx-fw-semibold, 600); /* SemiBold — section heading */
  color: var(--vpx-primary);
}

.vpx-extra-body,
.vpx-thanks,
.vpx-sign {
  margin: 0 0 8px;
  white-space: pre-line;
  font-weight: var(--vpx-fw-medium, 500);
  font-style: normal;
  line-height: 1.55;
  color: var(--vpx-ink-secondary, #1f2937);
  overflow: visible;
}

.vpx-thanks--after-signoff {
  margin: 22px 0 0;
  text-align: center;
  font-weight: var(--vpx-fw-bold, 700);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--vpx-ink, #0a0a0a);
}

.vpx-sign {
  margin-top: 12px;
  font-weight: var(--vpx-fw-semibold, 600);
  color: var(--vpx-ink, #0a0a0a);
}

.vpx-footer {
  margin-top: auto;
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border-top: 1px solid rgba(var(--vpx-secondary-rgb, 75, 85, 99), 0.35);
}

.vpx-generated {
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
  font-weight: var(--vpx-fw-medium, 500);
  font-style: normal;
  color: var(--vpx-ink-muted, #374151);
}

.vpx-page {
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
  font-weight: var(--vpx-fw-medium, 500);
  color: var(--vpx-ink-muted, #374151);
  text-align: right;
}

/* ── Payment Voucher — branded layout (aligned with invoices / POs) ── */
/* Lock to one A4 page so preview/PDF stay single-page. */
.vpx-pv-sheet.vpx-sheet--single-page {
  height: 1123px;
  max-height: 1123px;
  overflow: hidden;
}

.vpx-pv-sheet .vpx-body {
  padding: 28px 36px 18px;
}

.vpx-pv-sheet .vpx-pv-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 24px;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(var(--vpx-primary-rgb, 28, 61, 110), 0.04);
  border: 1px solid rgba(var(--vpx-primary-rgb, 28, 61, 110), 0.12);
}

.vpx-pv-sheet .vpx-pv-parties .vpx-from,
.vpx-pv-sheet .vpx-pv-parties .vpx-to {
  margin: 0;
}

.vpx-pv-sheet .vpx-pv-party-label {
  margin: 0 0 6px;
  font-size: 10px;
  font-weight: var(--vpx-fw-bold, 700);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--vpx-ink-secondary, #111827);
  line-height: 1.2;
}

.vpx-pv-sheet .vpx-pv-payee-name {
  margin: 0 0 8px;
  font-size: 15px;
  line-height: 1.35;
  font-weight: var(--vpx-fw-bold, 700);
  color: var(--vpx-ink, #050505);
  letter-spacing: 0.01em;
}

.vpx-pv-sheet .vpx-pv-payee-meta {
  margin: 0;
  display: grid;
  gap: 4px;
}

.vpx-pv-sheet .vpx-pv-payee-row {
  display: grid;
  grid-template-columns: 7.25rem 1fr;
  gap: 8px;
  align-items: baseline;
  font-size: 11.5px;
  line-height: 1.4;
}

.vpx-pv-sheet .vpx-pv-payee-row dt {
  margin: 0;
  font-weight: var(--vpx-fw-bold, 700);
  color: var(--vpx-ink-secondary, #111827);
}

.vpx-pv-sheet .vpx-pv-payee-row dd {
  margin: 0;
  font-weight: var(--vpx-fw-semibold, 600);
  color: var(--vpx-ink, #050505);
  word-break: break-word;
}

.vpx-pv-sheet .vpx-from .vpx-company-name {
  margin-top: 0;
}

.vpx-pv-sheet .vpx-pv-chip-value--multiline {
  white-space: pre-line;
  font-size: 11.5px;
  line-height: 1.4;
  font-weight: var(--vpx-fw-medium, 500);
}

.vpx-pv-sheet .vpx-pv-chip-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.vpx-pv-sheet .vpx-pv-chip {
  border-radius: 10px;
  border: 1px solid rgba(var(--vpx-secondary-rgb, 75, 85, 99), 0.22);
  background: rgba(var(--vpx-secondary-rgb, 75, 85, 99), 0.06);
  padding: 8px 10px;
  min-width: 0;
}

.vpx-pv-sheet .vpx-pv-chip--amount {
  background: rgba(var(--vpx-primary-rgb, 28, 61, 110), 0.08);
  border-color: rgba(var(--vpx-primary-rgb, 28, 61, 110), 0.28);
}

.vpx-pv-sheet .vpx-pv-chip-label {
  display: block;
  font-size: 10px;
  font-weight: var(--vpx-fw-bold, 700);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--vpx-ink-secondary, #111827);
  margin-bottom: 3px;
}

.vpx-pv-sheet .vpx-pv-chip-value {
  display: block;
  font-size: 12.5px;
  font-weight: var(--vpx-fw-bold, 700);
  color: var(--vpx-ink, #050505);
  line-height: 1.3;
  word-break: break-word;
}

.vpx-pv-sheet .vpx-pv-chip--amount .vpx-pv-chip-value {
  font-size: 14px;
  font-weight: var(--vpx-fw-bold, 700);
  color: var(--vpx-primary);
  font-variant-numeric: tabular-nums;
}

.vpx-pv-sheet .vpx-pv-section-title {
  margin-top: 14px;
  margin-bottom: 6px;
}

.vpx-pv-sheet .vpx-pv-particulars {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.vpx-pv-sheet .vpx-pv-particulars thead th {
  background: var(--vpx-secondary);
  color: #ffffff !important;
  font-weight: var(--vpx-fw-semibold, 600);
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  border: none;
  padding: 8px 10px;
  text-align: left;
}

.vpx-pv-sheet .vpx-pv-particulars tbody td {
  border: 1px solid rgba(var(--vpx-secondary-rgb, 75, 85, 99), 0.35);
  border-top: none;
  padding: 7px 10px;
  vertical-align: top;
  color: var(--vpx-ink, #050505);
  font-weight: var(--vpx-fw-semibold, 600);
}

.vpx-pv-sheet .vpx-pv-particulars tbody td:first-child {
  width: 38%;
  background: rgba(var(--vpx-accent-rgb, 156, 163, 175), 0.14);
  font-weight: var(--vpx-fw-bold, 700);
  color: var(--vpx-ink-secondary, #111827);
}

.vpx-pv-sheet .vpx-pv-particulars tr.vpx-row-alt td:last-child {
  background: rgba(var(--vpx-primary-rgb, 28, 61, 110), 0.03);
}

.vpx-pv-sheet .vpx-pv-col-label { width: 38%; }
.vpx-pv-sheet .vpx-pv-col-value { width: 62%; }

.vpx-pv-sheet .vpx-pv-amount {
  font-weight: var(--vpx-fw-bold, 700);
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--vpx-primary);
  font-size: 13px;
}

/* PCR: amounts align left like other particulars. */
.vpx-pcr-sheet .vpx-pv-amount {
  text-align: left;
}

.vpx-pcr-sheet .vpx-pv-chip--amount .vpx-pv-chip-value {
  text-align: left;
}

/* Paper REQ Form tick boxes — large enough to mark by hand when printed */
.vpx-pcr-sheet--blank .vpx-tick-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.9rem;
}

.vpx-pcr-sheet--blank .vpx-tick-option {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.2;
  color: var(--vpx-ink, #050505);
}

.vpx-pcr-sheet--blank .vpx-tick {
  display: inline-block;
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  border: 1.75px solid #111;
  border-radius: 2px;
  background: #fff;
  box-sizing: border-box;
  flex-shrink: 0;
}

.vpx-pv-sheet .vpx-pv-words-row td {
  background: rgba(var(--vpx-primary-rgb, 28, 61, 110), 0.06) !important;
}

.vpx-pv-sheet .vpx-pv-words {
  font-weight: var(--vpx-fw-bold, 700);
  font-style: normal;
  color: var(--vpx-ink, #050505);
  line-height: 1.4;
}

.vpx-pv-sheet .vpx-pv-sigs {
  display: grid;
  /* Equal columns for however many stamp blocks are present (2 or 3) so header strips span full width */
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 0;
  margin-top: 4px;
  border: 1px solid rgba(var(--vpx-secondary-rgb, 75, 85, 99), 0.4);
  background: #ffffff;
  overflow: hidden;
  width: 100%;
}

.vpx-pv-sheet .vpx-pv-sig {
  border: none;
  border-right: 1px solid rgba(var(--vpx-secondary-rgb, 75, 85, 99), 0.4);
  border-radius: 0;
  padding: 0 0 10px;
  min-height: 132px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #ffffff;
}

.vpx-pv-sheet .vpx-pv-sig:last-child {
  border-right: none;
}

.vpx-pv-sheet .vpx-pv-sig--right {
  text-align: right;
  align-items: flex-end;
}

.vpx-pv-sheet .vpx-pv-sig--right .vpx-pv-sig-title {
  text-align: right;
}

.vpx-pv-sheet .vpx-pv-sig--right .vpx-pv-sig-name,
.vpx-pv-sheet .vpx-pv-sig--right .vpx-pv-sig-pos,
.vpx-pv-sheet .vpx-pv-sig--right .vpx-pv-sig-date,
.vpx-pv-sheet .vpx-pv-sig--right .vpx-pv-sig-line {
  text-align: right;
  width: 100%;
}

.vpx-pv-sheet .vpx-pv-sig--right .vpx-pv-sig-image {
  justify-content: flex-end;
  margin-left: auto;
  margin-right: 10px;
}

.vpx-pv-sheet .vpx-pv-sig--right .vpx-pv-sig-image img {
  margin-left: auto;
}

/* ── Petty Cash Voucher (PCV) professional sheet ── */
/* Two A4 pages: particulars on page 1, authorization on page 2. */
.vpx-pcv-doc {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  max-width: 794px;
  margin: 0 auto;
  background: transparent;
}

.vpx-pcv-doc .vpx-pcv-page {
  /* Usable A4 content height (~297mm − 14mm stamped footer ≈ 1063px at 794px width).
     Two pages must map to exactly two PDF slices — avoid a blank page 3. */
  min-height: 1063px;
  height: 1063px;
  max-height: 1063px;
  overflow: hidden;
  box-sizing: border-box;
}

.vpx-pcv-doc .vpx-pcv-page--auth {
  margin-top: 0;
}

@media screen {
  .vpx-pcv-doc .vpx-pcv-page {
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
  }
}

@media print {
  .vpx-pcv-doc .vpx-pcv-page--auth {
    break-before: page;
    page-break-before: always;
  }
}

.vpx-pcv-sheet .vpx-body {
  padding-bottom: 22px;
}

.vpx-pcv-sheet .vpx-pcv-continued-top {
  justify-content: flex-end;
  margin-bottom: 8px;
}

.vpx-pcv-sheet .vpx-pcv-continued-meta {
  text-align: right;
  margin-left: auto;
}

.vpx-pcv-sheet .vpx-pcv-header-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  max-width: 58%;
}

.vpx-pcv-sheet .vpx-pcv-header-left .vpx-brand {
  max-width: 100%;
}

.vpx-pcv-sheet .vpx-pcv-company-block {
  min-width: 0;
}

.vpx-pcv-sheet .vpx-pcv-company-block .vpx-company-name {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: var(--vpx-fw-semibold, 600);
  color: var(--vpx-ink, #0a0a0a);
}

.vpx-pcv-sheet .vpx-pcv-company-block .vpx-address {
  margin: 0;
  font-size: 10.5px;
  line-height: 1.4;
  font-weight: var(--vpx-fw-semibold, 600);
  color: var(--vpx-ink-secondary, #111827);
  white-space: pre-line;
}

.vpx-pcv-sheet .vpx-doc-meta {
  text-align: right;
}

.vpx-pcv-sheet .vpx-pcv-payee-full {
  width: 100%;
}

.vpx-pcv-sheet .vpx-pv-parties {
  grid-template-columns: 1fr;
}

.vpx-pcv-sheet .vpx-pcv-payee-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
}

.vpx-pcv-sheet .vpx-pcv-amount-left {
  text-align: left !important;
}

.vpx-pcv-sheet .vpx-pcv-notes {
  margin-top: 12px;
  padding: 8px 10px;
  border: 1px solid rgba(var(--vpx-secondary-rgb, 75, 85, 99), 0.28);
  background: rgba(var(--vpx-secondary-rgb, 75, 85, 99), 0.04);
}

.vpx-pcv-sheet .vpx-pcv-notes-label {
  margin: 0 0 4px;
  font-size: 10px;
  font-weight: var(--vpx-fw-semibold, 600);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--vpx-secondary, #4b5563);
}

.vpx-pcv-sheet .vpx-pcv-notes-body,
.vpx-pcv-sheet .vpx-pcv-notes-line {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--vpx-ink, #0a0a0a);
}

/* Advance voucher acknowledgment — normal weight (sheet default is SemiBold). */
.vpx-pv-sheet .vpx-pcv-notes {
  margin-top: 12px;
  padding: 8px 10px;
  border: 1px solid rgba(var(--vpx-secondary-rgb, 75, 85, 99), 0.28);
  background: rgba(var(--vpx-secondary-rgb, 75, 85, 99), 0.04);
}

.vpx-pv-sheet .vpx-pcv-notes-label {
  margin: 0 0 4px;
  font-size: 10px;
  font-weight: var(--vpx-fw-semibold, 600);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--vpx-secondary, #4b5563);
}

.vpx-pv-sheet .vpx-pcv-notes-body {
  margin: 0;
  font-size: 11.5px;
  font-weight: var(--vpx-fw-regular, 400) !important;
  line-height: 1.45;
  color: var(--vpx-ink, #0a0a0a);
}

.vpx-pcv-sheet .vpx-pcv-notes--blank .vpx-pcv-notes-line {
  color: var(--vpx-ink-muted, #6b7280);
  letter-spacing: 0.04em;
}

@media (max-width: 640px) {
  .vpx-pcv-sheet .vpx-pcv-payee-grid {
    grid-template-columns: 1fr;
  }
}

.vpx-pv-sheet .vpx-pv-sig-title {
  margin: 0 0 6px;
  padding: 8px 10px;
  border-bottom: none;
  background: var(--vpx-secondary);
  color: #ffffff !important;
  font-size: 10.5px;
  font-weight: var(--vpx-fw-semibold, 600);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  width: 100%;
  box-sizing: border-box;
  display: block;
}

.vpx-pv-sheet .vpx-pv-sig + .vpx-pv-sig .vpx-pv-sig-title {
  border-left: 1px solid rgba(255, 255, 255, 0.28);
}

.vpx-pv-sheet .vpx-pv-sig-name,
.vpx-pv-sheet .vpx-pv-sig-pos,
.vpx-pv-sheet .vpx-pv-sig-date {
  margin-left: 10px;
  margin-right: 10px;
}

.vpx-pv-sheet .vpx-pv-sig-name {
  margin-top: 0;
  margin-bottom: 0;
  font-size: 12px;
  font-weight: var(--vpx-fw-bold, 700);
  color: var(--vpx-ink, #050505);
}

.vpx-pv-sheet .vpx-pv-sig-pos,
.vpx-pv-sheet .vpx-pv-sig-date {
  margin-top: 0;
  margin-bottom: 0;
  font-size: 10.5px;
  font-weight: var(--vpx-fw-semibold, 600);
  color: var(--vpx-ink-secondary, #111827);
}

.vpx-pv-sheet .vpx-pv-sig-image {
  flex: 1;
  min-height: 40px;
  margin: 4px 10px 2px;
  display: flex;
  align-items: flex-end;
  border-bottom: 1px solid var(--vpx-accent);
  padding-bottom: 2px;
  background: transparent;
}

/* Received by: hand-sign line only — no second rule under Signature: _____ */
.vpx-pv-sheet .vpx-pv-sig-image--manual {
  border-bottom: none;
  padding-bottom: 0;
  min-height: 32px;
  align-items: center;
}

.vpx-pv-sheet .vpx-pv-sig-image img {
  max-height: 40px;
  max-width: 100%;
  object-fit: contain;
}

.vpx-pv-sheet .vpx-pv-sig-line {
  font-size: 10.5px;
  color: var(--vpx-ink, #111827);
  letter-spacing: 0.02em;
}

@media (max-width: 640px) {
  .vpx-pv-sheet .vpx-pv-parties,
  .vpx-pv-sheet .vpx-pv-chip-row,
  .vpx-pv-sheet .vpx-pv-sigs {
    grid-template-columns: 1fr;
  }

  .vpx-pv-sheet .vpx-pv-sig {
    border-right: none;
    border-bottom: 1px solid rgba(var(--vpx-secondary-rgb, 75, 85, 99), 0.4);
  }

  .vpx-pv-sheet .vpx-pv-sig:last-child {
    border-bottom: none;
  }

  .vpx-pv-sheet .vpx-pv-sig + .vpx-pv-sig .vpx-pv-sig-title {
    border-left: none;
  }
}

.vpx-sheet-fit {
  width: 100%;
  max-width: 794px;
  margin: 0 auto;
}

/* JS sets --vpx-scale / --vpx-natural-h so the A4 sheet fits narrow viewports. */
.vpx-sheet-fit[data-vpx-scale] {
  width: calc(794px * var(--vpx-scale, 1));
  max-width: 100%;
  height: calc(var(--vpx-natural-h, 1123px) * var(--vpx-scale, 1));
  overflow: hidden;
  margin: 0 auto;
}

.vpx-sheet-fit[data-vpx-scale] > .vpx-sheet,
.vpx-sheet-fit[data-vpx-scale] > .vpx-pcv-doc {
  width: 794px !important;
  min-width: 794px !important;
  max-width: 794px !important;
  transform: scale(var(--vpx-scale, 1));
  transform-origin: top left;
  /* No CSS filter here — contrast/blur filters soften Inter under transform:scale */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.vpx-sheet-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 1023px) {
  .vpx-sheet-scroll {
    padding: 8px;
    border-radius: 10px;
  }
}

@media print {
  .vpx-sheet-scroll {
    overflow: visible !important;
    background: transparent !important;
    padding: 0 !important;
    border-radius: 0 !important;
  }

  .vpx-sheet-fit,
  .vpx-sheet-fit[data-vpx-scale] {
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    overflow: visible !important;
    transform: none !important;
  }

  .vpx-sheet-fit > .vpx-sheet,
  .vpx-sheet-fit[data-vpx-scale] > .vpx-sheet,
  .vpx-sheet-fit > .vpx-pcv-doc,
  .vpx-sheet-fit[data-vpx-scale] > .vpx-pcv-doc {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    transform: none !important;
  }
}

/* Payslip — natural document flow (no fixed-height clipping / overflow hidden). */
.vpx-payslip-sheet.vpx-pv-sheet {
  height: auto;
  max-height: none;
  min-height: 0;
  overflow: visible;
}

.vpx-payslip-sheet.vpx-pv-sheet .vpx-body {
  padding: 28px 36px 18px;
  overflow: visible;
}

.vpx-payslip-sheet .vpx-top {
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 18px;
}

.vpx-payslip-sheet .vpx-brand {
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  max-width: 58%;
  min-width: 0;
}

.vpx-payslip-sheet .vpx-payslip-brand-details {
  min-width: 0;
  width: 100%;
}

.vpx-payslip-sheet .vpx-payslip-brand-details .vpx-company-name {
  margin: 0 0 4px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.vpx-payslip-sheet .vpx-payslip-brand-details .vpx-address {
  margin: 0;
  white-space: pre-line;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.vpx-payslip-sheet .vpx-doc-meta {
  flex: 0 0 auto;
  max-width: 40%;
  min-width: 0;
}

.vpx-payslip-sheet .vpx-doc-meta .vpx-doc-id,
.vpx-payslip-sheet .vpx-doc-meta .vpx-doc-date {
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.vpx-payslip-sheet .vpx-payslip-meta-table {
  table-layout: fixed;
  width: 100%;
  margin: 0 0 4px;
}

.vpx-payslip-sheet .vpx-payslip-meta-table td {
  vertical-align: top;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  line-height: 1.4;
}

.vpx-payslip-sheet .vpx-payslip-meta-label {
  width: 28%;
  font-weight: var(--vpx-fw-semibold, 600);
  color: var(--vpx-ink-muted, #1f2937);
  background: rgba(var(--vpx-secondary-rgb, 75, 85, 99), 0.06);
}

.vpx-payslip-sheet .vpx-payslip-meta-value {
  width: 72%;
  color: var(--vpx-ink, #0a0a0a);
  font-weight: var(--vpx-fw-medium, 500);
}

.vpx-payslip-sheet .vpx-payslip-employee-table .vpx-payslip-meta-label {
  width: 26%;
}

.vpx-payslip-sheet .vpx-payslip-employee-table .vpx-payslip-meta-value {
  width: 74%;
}

.vpx-payslip-sheet .vpx-payslip-account-no {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.vpx-payslip-sheet .vpx-payslip-table {
  table-layout: fixed;
  width: 100%;
  margin-bottom: 4px;
}

.vpx-payslip-sheet .vpx-payslip-col-desc {
  width: 54%;
  text-align: left;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  line-height: 1.4;
}

.vpx-payslip-sheet .vpx-payslip-line-note {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  line-height: 1.35;
  font-weight: var(--vpx-fw-regular, 400);
  color: var(--vpx-ink-muted, #374151);
}

.vpx-payslip-sheet .vpx-payslip-col-rate {
  width: 16%;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  vertical-align: top;
}

.vpx-payslip-sheet .vpx-payslip-col-amt {
  width: 30%;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  vertical-align: top;
}

.vpx-payslip-sheet .vpx-payslip-table thead th,
.vpx-payslip-sheet .vpx-payslip-table tbody td,
.vpx-payslip-sheet .vpx-payslip-table tfoot td {
  padding-top: 9px;
  padding-bottom: 9px;
  overflow: visible;
}

.vpx-payslip-sheet .vpx-payslip-table tfoot td {
  font-weight: var(--vpx-fw-semibold, 600);
  background: rgba(var(--vpx-secondary-rgb, 75, 85, 99), 0.08);
}

.vpx-payslip-sheet .vpx-payslip-net {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0 14px;
  padding: 14px 16px;
  border: 2px solid var(--vpx-primary, #111827);
  background: rgba(var(--vpx-accent-rgb, 156, 163, 175), 0.22);
  color: var(--vpx-ink, #0a0a0a);
  overflow: visible;
}

.vpx-payslip-sheet .vpx-payslip-net-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.vpx-payslip-sheet .vpx-payslip-net-label {
  margin: 0;
  font-size: 13px;
  font-weight: var(--vpx-fw-bold, 700);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.vpx-payslip-sheet .vpx-payslip-net-amount {
  margin: 0;
  font-size: 20px;
  font-weight: var(--vpx-fw-bold, 700);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.vpx-payslip-sheet .vpx-payslip-net-words-block {
  border-top: 1px solid rgba(var(--vpx-secondary-rgb, 75, 85, 99), 0.28);
  padding-top: 10px;
  min-width: 0;
}

.vpx-payslip-sheet .vpx-payslip-net-words-label {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: var(--vpx-fw-semibold, 600);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--vpx-ink-muted, #1f2937);
}

.vpx-payslip-sheet .vpx-payslip-net-words {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  font-weight: var(--vpx-fw-medium, 500);
  color: var(--vpx-ink-secondary, #111827);
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.vpx-payslip-sheet .vpx-payslip-note {
  margin: -4px 0 8px;
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--vpx-ink-muted, #1f2937);
}

.vpx-payslip-sheet .vpx-footer {
  margin-top: 20px;
}

