.print-preview { display: block; }
.print-preview > .sidebar, .print-preview > .workspace, .print-preview .smetych-root { display: none !important; }
.print-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; max-width: 210mm; margin: 16px auto; }
.print-message { max-width: 210mm; margin: 0 auto 14px; padding: 12px 16px; background: white; border: 1px solid #e4eaf3; border-radius: 10px; }
.print-message h2 { font-size: 16px; color: #182747; margin: 0 0 4px; }
.print-send-steps { font-size: 13px; color: #52627b; margin: 0; }
.print-message textarea { width: 100%; margin-top: 10px; padding: 8px 10px; border: 1px solid #ccd8e6; border-radius: 6px; font: inherit; resize: vertical; background: #fbfcff; }
.print-send-actions { margin-top: 10px; }
#copy-estimate-status { font-size: 13px; color: #345071; }
.estimate-sheet { --pdf-accent: #005ac1; --pdf-header: #f1f5f9; color: #182747; background: white; font-size: 10pt; line-height: 1.35; overflow-wrap: anywhere; }
@media screen {
  .estimate-sheet { max-width: 210mm; min-height: 297mm; margin: 0 auto 26px; padding: 13mm; border: 1px solid #e4eaf3; }
}
.estimate-sheet h1 { color: var(--pdf-accent); font-size: 22pt; }
.estimate-sheet h2 { color: #345071; font-size: 10pt; margin-bottom: 4px; }
.print-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 2px solid var(--pdf-accent); padding-bottom: 9px; }
.print-header > div { flex: 1; min-width: 0; }
.print-header time { display: block; margin-top: 3px; }
.print-logo { width: 36mm; height: 19mm; object-fit: contain; object-position: right center; }
.print-contacts, .print-signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.print-contacts { margin: 14px 0; }
.print-contacts section, .print-object { border: 1px solid #ccd8e6; border-radius: 5px; padding: 8px 10px; }
.print-object { margin-bottom: 14px; }
.print-table { table-layout: fixed; font-size: 9pt; }
.print-table th, .print-table td { padding: 5px; border: 1px solid #b9c7d8; }
.print-table th { color: var(--pdf-accent); background: var(--pdf-header); font-size: 9pt; white-space: normal; }
.print-table .number { white-space: normal; text-align: right; }
.print-table .print-section-total th, .print-table .print-section-total td { color: var(--pdf-accent); background: var(--pdf-header); font-weight: 700; }
.print-table .print-section-total th { text-align: right; }
.print-table.purchase-table th:first-child { width: 37%; }
.print-table.purchase-table th:nth-child(4) { width: 12%; }
.print-table small { display: block; }
.print-index { width: 7%; }
.print-unit { width: 10%; }
.print-qty { width: 12%; }
.print-price { width: 15%; }
.print-amount { width: 17%; }
.print-total { margin: 16px 0 16px auto; max-width: 355px; font-size: 10pt; }
.print-total div { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; }
.print-total dd { margin: 0; text-align: right; }
.print-total div:last-child { border-top: 2px solid var(--pdf-accent); font-weight: 750; color: var(--pdf-accent); }
.print-notes p { white-space: pre-wrap; }
.print-tax { margin: 0 0 10px; color: #345071; }
.print-acceptance { padding: 8px 10px; margin: 10px 0; border-left: 3px solid var(--pdf-accent); background: var(--pdf-header); break-inside: avoid; }
.print-payment { margin: 12px 0; }
.print-payment h2 { margin-bottom: 6px; }
.print-payment-group { padding: 8px 10px; border: 1px solid #ccd8e6; border-radius: 5px; margin-bottom: 6px; }
.print-payment-group h3 { margin: 0 0 5px; color: var(--pdf-accent); font-size: 10pt; }
.print-payment-group dl { display: grid; grid-template-columns: minmax(35%, max-content) 1fr; gap: 4px 12px; margin: 0; }
.print-payment-group dt { color: #345071; }
.print-payment-group dd { margin: 0; min-width: 0; }
.print-watermark { position: fixed; top: 48%; left: 50%; transform: translate(-50%, -50%) rotate(-29deg); color: #314b6a1c; font-size: 34pt; font-weight: 750; text-align: center; width: min(90%, 170mm); pointer-events: none; }
.print-signatures { margin-top: 22px; }
.print-signatures p { margin-top: 22px; border-top: 1px solid #788ba1; }
.print-stamp { display: block; width: 26mm; height: 26mm; object-fit: contain; object-position: left center; }
.print-stamp + p { margin-top: 4px; }
.print-marks { display: flex; align-items: center; gap: 5mm; min-height: 26mm; }
.print-signature { display: block; width: 48mm; max-width: 60%; height: 18mm; object-fit: contain; object-position: left center; }
.print-marks + p { margin-top: 4px; }
.contract-preamble { margin: 12px 0; }
.contract-print-clause { margin: 10px 0; }
.contract-print-clause h2 { break-after: avoid; color: var(--pdf-accent); }
.contract-print-clause h3 { font-size: 10pt; }
.contract-print-clause > p { white-space: pre-wrap; orphans: 2; widows: 2; }
.contract-sheet .print-signatures { margin-top: 8px; }
.contract-appendix-label { margin-bottom: 8px; color: #345071; }
.print-act-photos { margin-top: 18px; }
.print-act-photos h2 { color: var(--pdf-accent); font-size: 16pt; }
.print-act-photos figure { margin: 10px 0 14px; }
.print-hidden-photo { display: block; width: 100%; max-height: 98mm; object-fit: contain; background: var(--pdf-header); }
.print-act-photos figcaption { padding: 4px 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.print-act-photos figcaption small { display: block; color: #52627b; }

@page {
  size: A4;
  margin: 13mm;
  @top-left { content: ""; }
  @top-center { content: ""; }
  @top-right { content: ""; }
  @bottom-left { content: ""; }
  @bottom-center { content: ""; }
  @bottom-right { content: ""; }
}
@media print {
  :root { background: white; }
  body.print-preview { background: white; min-height: 0; display: block; }
  .print-controls, .print-message, .smetych-root { display: none !important; }
  .estimate-sheet { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .print-table thead { display: table-header-group; }
  .print-table tr, .print-header, .print-contacts, .print-object, .print-total, .print-signatures { break-inside: avoid; }
  .print-group { break-after: avoid; }
  .print-section-total { break-before: avoid; }
  .print-payment > h2 { break-after: avoid; }
  .print-payment-group, .contract-sheet .contract-print-clause:has(.print-signatures) { break-inside: avoid; }
  .contract-appendix { break-before: page; }
  .print-act-photos { break-before: page; margin-top: 0; }
  .print-act-photos h2, .print-act-photos h2 + p { break-after: avoid; }
  .print-act-photos figure { break-inside: avoid; }
}
