/* ==========================================================================
   Commercial Proposal (КП) Stylesheet & Print Media
   ========================================================================== */

/* 1. Bottom Commercial Proposal Floating Dock */
.proposal-dock {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
  color: #fff;
  padding: 12px 24px;
  border-radius: 999px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  gap: 20px;
  z-index: 99;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.proposal-dock.active {
  transform: translateX(-50%) translateY(0);
}

.dock-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dock-badge {
  background: var(--primary, #2563eb);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 4px 10px;
  border-radius: 999px;
}

.dock-total {
  font-size: 0.95rem;
  font-weight: 600;
}

.dock-total span {
  font-weight: 800;
  color: #60a5fa;
}

.dock-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 2. Proposal Preview Modal Layout */
.modal-card.proposal-modal-card {
  max-width: 1120px;
  width: 97vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}

.proposal-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.proposal-header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.proposal-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: #f1f5f9;
}

/* 3. A4 Document Sheet (Clean Visual Paper Simulation) */
.kp-document-sheet {
  max-width: 880px;
  margin: 0 auto;
  background: #ffffff;
  padding: 16px 20px;
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.04);
  border-radius: 4px;
  border: none;
  color: #1e293b;
  font-size: 0.76rem;
  line-height: 1.35;
  box-sizing: border-box;
  position: relative;
}

/* Paged Media Frame (Table Wrapper) - Screen & Edit Mode (Neutralized) */
.kp-print-frame {
  display: block;
  width: 100%;
  border-collapse: collapse;
  border: none;
  margin: 0;
  padding: 0;
}

.kp-print-frame-header,
.kp-print-frame-footer {
  display: none !important;
}

.kp-print-frame-body {
  display: block;
  width: 100%;
}

.kp-print-frame-body>tr {
  display: block;
  width: 100%;
}

.kp-print-frame-content {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  box-sizing: border-box;
}

/* Obsolete sheet divider and badges - hidden permanently */
.kp-sheet-header-badge,
.kp-sheet-divider,
.kp-sheet-footer {
  display: none !important;
}

/* Header PNG banner */
.kp-header-wrap {
  margin-bottom: 4px;
}

.kp-header-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 2px;
  object-fit: cover;
}

/* Editable text indicator */
.kp-editable {
  outline: none;
  transition: background 0.15s;
  padding: 1px 3px;
  border-radius: 2px;
}

.kp-editable:hover {
  background: rgba(241, 245, 249, 0.7);
}

.kp-editable:focus {
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
  border-radius: 2px;
}

/* Document Title & Number */
.kp-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 2px solid #0f172a;
  padding-bottom: 3px;
  margin-bottom: 4px;
  gap: 12px;
}

.kp-title-text {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1.2;
}

.kp-meta-text {
  font-size: 0.72rem;
  color: #475569;
  text-align: right;
  line-height: 1.25;
  flex-shrink: 0;
  white-space: nowrap;
}

.kp-meta-item {
  margin-bottom: 1px;
}

.kp-meta-validity {
  font-size: 0.68rem;
  color: #64748b;
  white-space: nowrap;
}

/* Two-column Parties Block (Client / Supplier) */
.kp-parties-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: #f8fafc;
  padding: 5px 8px;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
  margin-bottom: 4px;
}

.kp-party-title {
  font-size: 0.66rem;
  text-transform: uppercase;
  font-weight: 700;
  color: #227dbd;
  margin-bottom: 2px;
}

.kp-party-name {
  font-weight: 700;
  font-size: 0.8rem;
  color: #0f172a;
  margin-bottom: 1px;
}

.kp-party-row {
  font-size: 0.71rem;
  color: #475569;
  line-height: 1.25;
}

/* Introductory Text */
.kp-intro-box {
  background: #f8fafc;
  border-left: 3px solid #227dbd;
  padding: 4px 8px;
  font-size: 0.71rem;
  color: #334155;
  margin-bottom: 4px;
  border-radius: 0 3px 3px 0;
  line-height: 1.3;
}

/* Items Table (Classic clean invoice / счет style with full borders) */
.kp-table-wrapper {
  margin-bottom: 4px;
  width: 100%;
  box-sizing: border-box;
}

.kp-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.74rem;
  background: #ffffff;
  border: 1px solid #475569;
  margin-bottom: 4px;
  box-sizing: border-box;
}

.kp-table thead th {
  background: #f1f5f9;
  color: #0f172a;
  border: 1px solid #475569;
  padding: 4px 6px;
  font-weight: 700;
  font-size: 0.72rem;
  text-align: center;
  letter-spacing: 0.2px;
  vertical-align: middle;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
  box-sizing: border-box;
}

.kp-table thead th.kp-col-name {
  text-align: left;
}

.kp-col-num {
  width: 28px;
  text-align: center;
  font-weight: 700;
  color: #475569;
}

.kp-col-name {
  text-align: left;
}

.kp-col-qty {
  width: 40px;
  text-align: center;
}

.kp-col-price {
  width: 86px;
  text-align: right;
  white-space: nowrap;
}

.kp-col-sum {
  width: 102px;
  text-align: right;
  white-space: nowrap;
  padding-right: 8px !important;
}

.kp-col-sum-cell {
  text-align: right !important;
  padding-right: 8px !important;
  white-space: nowrap !important;
}

.kp-del-col {
  width: 26px;
  text-align: center;
  border: 1px dashed #cbd5e1 !important;
}

.kp-table tbody td {
  padding: 3px 6px;
  border: 1px solid #64748b;
  vertical-align: top;
  color: #0f172a;
  line-height: 1.3;
  box-sizing: border-box;
  overflow-wrap: break-word;
}

.kp-table tbody tr:hover td {
  background: #f8fafc;
}

.kp-item-title {
  font-weight: 700;
  color: #0f172a;
  font-size: 0.77rem;
  line-height: 1.25;
  word-break: break-word;
  overflow-wrap: break-word;
}

.kp-item-options {
  font-size: 0.68rem;
  color: #227dbd;
  font-weight: 600;
  margin-top: 1px;
  line-height: 1.25;
}

.kp-item-sku {
  font-size: 0.66rem;
  color: #64748b;
  margin-top: 1px;
}

/* Clear, robust quantity controls */
.kp-qty-ctrl {
  display: inline-flex;
  align-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  background: #ffffff;
  overflow: hidden;
  height: 24px;
}

.kp-qty-btn {
  width: 20px;
  height: 24px;
  background: #f1f5f9;
  border: none;
  color: #1e293b;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  user-select: none;
}

.kp-qty-btn:hover {
  background: #e2e8f0;
  color: #000;
}

.kp-qty-input {
  width: 32px;
  height: 24px;
  border: none;
  border-left: 1px solid #e2e8f0;
  border-right: 1px solid #e2e8f0;
  text-align: center;
  font-weight: 700;
  font-size: 0.76rem;
  color: #0f172a;
  outline: none;
  background: #fff;
  -moz-appearance: textfield;
}

.kp-qty-input::-webkit-outer-spin-button,
.kp-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Qty plain text cell */
.kp-qty-text {
  font-weight: 700;
  font-size: 0.76rem;
  text-align: center;
  cursor: text;
  padding: 1px 4px;
  border-radius: 2px;
  border-bottom: 1px dashed transparent;
  min-width: 24px;
  display: inline-block;
  transition: border-color 0.15s;
}

.kp-qty-text:hover {
  border-bottom-color: #94a3b8;
}

.kp-qty-text:focus {
  outline: none;
  border-bottom: 1px solid #3b82f6;
  background: #eff6ff;
}

/* Add Custom Row Button */
.kp-add-row-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  margin-bottom: 3px;
  padding: 3px 8px;
  background: #f0f9ff;
  border: 1px dashed #7dd3fc;
  border-radius: 3px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #0284c7;
  cursor: pointer;
  transition: all 0.15s;
  width: fit-content;
}

.kp-add-row-btn:hover {
  background: #e0f2fe;
  border-color: #38bdf8;
}

/* Delete button for custom rows */
.kp-custom-row-del {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 0.9rem;
  cursor: pointer;
  line-height: 1;
  padding: 1px 3px;
  border-radius: 2px;
  transition: color 0.15s;
}

.kp-custom-row-del:hover {
  color: #ef4444;
}

/* Discount row on the sheet (checkbox style) */
.kp-discount-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
  margin-bottom: 4px;
  font-size: 0.74rem;
  color: #475569;
}

.kp-discount-row label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-weight: 600;
  user-select: none;
}

.kp-discount-row input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: #2563eb;
}

.kp-discount-row .kp-discount-pct {
  width: 42px;
  height: 22px;
  border: none;
  border-bottom: 1px solid #94a3b8;
  text-align: center;
  font-weight: 700;
  font-size: 0.76rem;
  color: #0f172a;
  outline: none;
  background: transparent;
  margin: 0 2px;
}

/* Totals Box */
.kp-totals-container {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 6px;
  box-sizing: border-box;
  padding-right: 2px;
  break-inside: avoid;
  page-break-inside: avoid;
}

.kp-totals-table {
  width: 310px;
  border-collapse: collapse;
  font-size: 0.74rem;
  box-sizing: border-box;
}

.kp-totals-table td {
  padding: 2px 6px;
  border: none;
  box-sizing: border-box;
}

.kp-total-lbl {
  color: #475569;
  font-weight: 500;
  text-align: right;
  padding-right: 8px !important;
}

.kp-total-val {
  text-align: right;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  padding-right: 4px;
}

.kp-totals-table .kp-final-row td {
  font-size: 0.94rem;
  font-weight: 800;
  color: #0f172a;
  border-top: 1.5px solid #0f172a;
  padding-top: 3px;
  padding-bottom: 2px;
}

.kp-totals-table .kp-final-row td:last-child {
  padding-right: 4px;
}

.kp-vat-interactive {
  display: inline-flex;
  align-items: center;
}

.kp-vat-select {
  border: none;
  border-bottom: 1px solid #94a3b8;
  padding: 1px 3px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #0f172a;
  background: transparent;
  outline: none;
  cursor: pointer;
  margin-left: 4px;
}

.kp-vat-readonly {
  display: none;
  font-weight: 500;
  color: #475569;
}

/* Section Header */
.kp-section-head {
  font-size: 0.78rem;
  font-weight: 700;
  color: #0f172a;
  border-bottom: 1.5px solid #0f172a;
  padding-bottom: 2px;
  margin-top: 6px;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  break-inside: auto;
  page-break-inside: auto;
  break-after: auto;
  page-break-after: auto;
}

/* Compact Product Detail Cards (Under Table) */
.kp-detail-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 6px 8px;
  margin-bottom: 5px;
  break-inside: auto;
  page-break-inside: auto;
}

.kp-detail-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  padding-bottom: 3px;
  border-bottom: 1px solid #f1f5f9;
  gap: 8px;
}

.kp-detail-card-title {
  font-weight: 700;
  font-size: 0.8rem;
  color: #0f172a;
}

.kp-detail-card-sku {
  font-size: 0.68rem;
  color: #64748b;
  white-space: nowrap;
  flex-shrink: 0;
}

.kp-detail-card-sku .kp-opt-tag {
  color: #227dbd;
  font-weight: 600;
}

.kp-detail-card-body {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
  align-items: flex-start;
}

.kp-detail-photo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 3px;
  padding: 2px;
  flex-shrink: 0;
}

.kp-detail-desc {
  font-size: 0.70rem;
  color: #334155;
  line-height: 1.28;
  flex: 1;
}

/* Robust 2-Column Specs Grid with compact sizing */
.kp-detail-specs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 14px;
  row-gap: 2px;
  background: #f8fafc;
  padding: 4px 6px;
  border-radius: 3px;
  border: 1px solid #e2e8f0;
  margin-top: 3px;
}

.kp-detail-spec-row {
  display: grid;
  grid-template-columns: minmax(90px, 1.2fr) minmax(70px, 1fr);
  gap: 4px;
  align-items: baseline;
  border-bottom: 1px dotted #cbd5e1;
  padding-bottom: 1px;
  min-width: 0;
  break-inside: auto;
  page-break-inside: auto;
}

.kp-spec-key {
  color: #64748b;
  font-size: 0.66rem;
  line-height: 1.2;
  overflow-wrap: break-word;
  word-break: normal;
  min-width: 0;
}

.kp-spec-val {
  font-weight: 600;
  color: #0f172a;
  text-align: right;
  font-size: 0.66rem;
  line-height: 1.2;
  overflow-wrap: break-word;
  word-break: normal;
  min-width: 0;
}

@media (max-width: 650px) {
  .kp-detail-specs-grid {
    grid-template-columns: 1fr;
  }
}

/* Custom Text / Notes Block */
.kp-custom-notes {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 0.71rem;
  color: #334155;
  line-height: 1.32;
  margin-bottom: 6px;
  break-inside: auto;
  page-break-inside: auto;
}

/* Signatures & Stamp Footer */
.kp-signatures-row {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  margin-top: 6px;
  padding-top: 20px;
  border-top: 1px solid #cbd5e1;
  break-inside: avoid !important;
  page-break-inside: avoid !important;
  position: relative;
  min-height: 100px;
  padding-bottom: 12px;
  width: 100% !important;
  box-sizing: border-box !important;
}

.kp-sig-col {
  width: 48%;
  position: relative;
  min-height: 95px;
  break-inside: avoid !important;
  page-break-inside: avoid !important;
}

.kp-sig-company {
  font-weight: 700;
  font-size: 0.8rem;
  color: #0f172a;
}

.kp-sig-role {
  font-size: 0.72rem;
  color: #475569;
  margin-top: 1px;
  margin-bottom: 22px;
}

.kp-sig-line {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  position: relative;
}

.kp-sig-line-bar {
  border-bottom: 1px solid #0f172a;
  min-width: 140px;
  text-align: center;
  font-size: 0.74rem;
  font-weight: 600;
  padding-bottom: 2px;
  color: #0f172a;
}

.kp-mp-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
}

/* Stamp & Signature overlays */
.kp-stamp-overlay {
  position: absolute;
  top: -8px;
  left: 95px;
  width: 150px;
  height: 150px;
  pointer-events: none;
  opacity: 0.95;
  transform: rotate(-6deg);
  z-index: 2;
  display: block !important;
}

.kp-signature-overlay {
  position: absolute;
  top: 12px;
  left: 35px;
  width: 110px;
  height: auto;
  pointer-events: none;
  z-index: 3;
  display: block !important;
}

/* Edit Mode Toggle Notice */
.kp-edit-hint {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 0.8rem;
  color: #1e40af;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ==========================================================================
   4. Native Browser Print Styles (@media print)
   ========================================================================== */
@page {
  size: A4 portrait;
  margin: 0 !important;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 0 !important;
  }

  html,
  body {
    width: 100% !important;
    height: auto !important;
    min-height: 100% !important;
    overflow: visible !important;
    background: #ffffff !important;
    color: #000000 !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* Hide everything except proposalModal */
  body>*:not(#proposalModal) {
    display: none !important;
  }

  #proposalModal,
  #proposalModal.modal-overlay,
  #proposalModal.open {
    position: static !important;
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
  }

  .modal-card.proposal-modal-card {
    position: static !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    animation: none !important;
  }

  .proposal-modal-body {
    position: static !important;
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
  }

  .kp-document-sheet {
    position: static !important;
    display: block !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    overflow: visible !important;
    font-size: 0.74rem !important;
    box-sizing: border-box !important;
  }

  /* Paged Media Table Frame for repeating margins on EVERY printed page */
  table.kp-print-frame {
    display: table !important;
    width: 100% !important;
    border-collapse: collapse !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    table-layout: fixed !important;
    box-sizing: border-box !important;
  }

  thead.kp-print-frame-header {
    display: table-header-group !important;
    height: 8mm !important;
  }

  thead.kp-print-frame-header td,
  td.kp-print-frame-spacer-top {
    height: 8mm !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    line-height: 0 !important;
    font-size: 0 !important;
  }

  tfoot.kp-print-frame-footer {
    display: table-footer-group !important;
    height: 8mm !important;
  }

  tfoot.kp-print-frame-footer td,
  td.kp-print-frame-spacer-bottom {
    height: 8mm !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    line-height: 0 !important;
    font-size: 0 !important;
  }

  tbody.kp-print-frame-body {
    display: table-row-group !important;
  }

  tbody.kp-print-frame-body>tr {
    display: table-row !important;
  }

  td.kp-print-frame-content {
    display: table-cell !important;
    padding: 0 8mm !important;
    border: none !important;
    vertical-align: top !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Stretch all proposal sections across the entire printable sheet */

  .kp-header-wrap {
    margin-top: -15mm !important;
    /* <--- Чем больше минус (-4mm, -6mm, -8mm), тем выше шапка */
  }

  .kp-title-row,
  .kp-parties-grid,
  .kp-intro-box,
  .kp-table-wrapper,
  .kp-table,
  .kp-totals-container,
  .kp-section-head,
  .kp-detail-card,
  .kp-detail-specs-grid,
  .kp-custom-notes,
  .kp-signatures-row {
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .kp-title-row {
    padding-right: 4px !important;
  }

  .kp-meta-text {
    box-sizing: border-box !important;
    padding-right: 4px !important;
  }

  .kp-table-wrapper {
    overflow: visible !important;
    padding: 0 !important;
    margin-bottom: 6px !important;
  }

  .kp-table {
    width: 100% !important;
    table-layout: fixed !important;
    box-sizing: border-box !important;
    border-collapse: collapse !important;
    border: 1px solid #475569 !important;
  }

  .kp-table thead th {
    border: 1px solid #475569 !important;
    background: #f1f5f9 !important;
    padding: 4px 6px !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .kp-table tbody td {
    border: 1px solid #64748b !important;
    padding: 3px 6px !important;
  }

  .kp-col-sum,
  .kp-col-sum-cell {
    padding-right: 8px !important;
  }

  .kp-totals-container {
    box-sizing: border-box !important;
    padding-right: 6px !important;
  }

  /* Completely hide all UI buttons and editor controls */
  .proposal-modal-header,
  .modal-footer,
  .kp-edit-hint,
  .proposal-dock,
  .toast-container,
  .kp-editor-only,
  .kp-del-col,
  .kp-del-btn,
  .kp-custom-row-del,
  .kp-add-row-btn,
  .kp-discount-row,
  .kp-vat-interactive,
  .kp-sheet-header-badge,
  .kp-sheet-divider,
  .kp-sheet-footer,
  .header,
  .catalog-container,
  #toastContainer {
    display: none !important;
  }

  .kp-vat-readonly {
    display: inline !important;
  }

  .kp-editable {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    outline: none !important;
    box-shadow: none !important;
  }

  .kp-qty-text {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    outline: none !important;
  }

  .kp-table tbody tr:hover td {
    background: transparent !important;
  }

  /* Allow natural flow and breaking of container blocks across pages */
  .kp-detail-card,
  .kp-detail-specs-grid,
  .kp-table,
  .kp-parties-grid,
  .kp-title-row {
    break-inside: auto !important;
    page-break-inside: auto !important;
    break-after: auto !important;
    page-break-after: auto !important;
  }

  /* Protect atomic rows and headers from being sliced across page boundary */
  .kp-detail-spec-row,
  .kp-detail-card-head,
  .kp-table tr,
  .kp-totals-container,
  .kp-section-head,
  .kp-custom-notes,
  .kp-signatures-row,
  .kp-sig-col {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
}