/* Paper geometry is independent of screen size, cards, dialogs and UI breakpoints. */
#alp-print-root { display: none; }
/* The independent print window previews the same unscaled A4 landscape sheet. */
body.paper-window { margin: 0; padding: 20px; background: #f4f7fb; color: #172b4d; font: 14px/1.4 Arial, sans-serif; }
.paper-window .paper-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; max-width: 297mm; margin: 0 auto 20px; }
.paper-window .paper-toolbar span { margin-right: auto; color: #526989; }
.paper-window .paper-toolbar button { min-height: 44px; padding: 8px 16px; border: 1px solid #d4deeb; border-radius: 8px; background: white; color: #172b4d; font: inherit; cursor: pointer; }
.paper-window #paper-print { background: #087df4; border-color: #087df4; color: white; }
.paper-window #paper-print:disabled { opacity: .55; cursor: wait; }
.paper-window #alp-print-root { display: block; box-sizing: border-box; width: 297mm; min-height: 210mm; margin: 0 auto; padding: 12mm; background: white; color: #172b4d; font: 9pt/1.4 Arial, sans-serif; }
#alp-print-root, #alp-print-root * { box-sizing: border-box; border-radius: 0 !important; box-shadow: none !important; text-shadow: none !important; }
@page {
  size: A4 landscape;
  margin: 12mm;
  @bottom-right { content: "Страница " counter(page) " из " counter(pages); font: 8pt Arial, sans-serif; color: #526989; }
}
@media print {
  /* System printing on other prototype routes also uses plain paper surfaces. */
  html:has(body.alp-preview), body.alp-preview { background: #fff !important; }
  body.alp-preview:not([data-print-document]) { display: block; height: auto; padding: 0; overflow: visible; }
  body.alp-preview #sidebar, body.alp-preview #top, body.alp-preview #toast,
  body.alp-preview .app-footer, body.alp-preview .alp-popover,
  body.alp-preview .filters, body.alp-preview .periodbar, body.alp-preview .tabs,
  body.alp-preview .modal-actions, body.alp-preview .modal-foot button { display: none !important; }
  body.alp-preview .workspace, body.alp-preview #content, body.alp-preview .scroll-content,
  body.alp-preview .table-scroll, body.alp-preview #modal, body.alp-preview .modal-body,
  body.alp-preview dialog[open] { display: block; position: static; width: 100%; max-width: none; min-width: 0; height: auto; max-height: none; padding: 0; margin: 0; overflow: visible !important; }
  body.alp-preview:has(dialog[open]):not([data-print-document]) .workspace { display: none; }
  body.alp-preview dialog, body.alp-preview .card, body.alp-preview .metric { background: #fff; border-radius: 0; box-shadow: none; }
  body.alp-preview dialog::backdrop { background: transparent; backdrop-filter: none; }
  body.alp-preview table { min-width: 0 !important; width: 100%; font-size: 8pt; }
  body.alp-preview th, body.alp-preview td { position: static; height: auto; font-size: 8pt; padding: 2mm; }
  body.alp-preview tr { break-inside: avoid; }
  body.alp-preview thead { display: table-header-group; }
  html:has(body[data-print-document]), body[data-print-document] {
    display: block !important; width: auto !important; min-width: 0 !important;
    height: auto !important; min-height: 0 !important; overflow: visible !important;
    margin: 0 !important; padding: 0 !important; background: #fff !important;
  }
  body[data-print-document] > :not(#alp-print-root) { display: none !important; }
  body[data-print-document] dialog, body[data-print-document] dialog::backdrop {
    display: none !important; visibility: hidden !important; background: transparent !important;
    border: 0 !important; border-radius: 0 !important; box-shadow: none !important;
  }
  #alp-print-root, #alp-print-root * {
    box-sizing: border-box; border-radius: 0 !important; box-shadow: none !important;
    text-shadow: none !important; min-width: 0; max-height: none;
  }
  body[data-print-document] #alp-print-root {
    display: block !important; position: static !important; width: 100% !important;
    height: auto !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; overflow: visible !important;
    background: #fff !important; color: #172b4d; font: 9pt/1.4 Arial, sans-serif;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
}
#alp-print-root .paper-heading { display: flex; position: relative; justify-content: space-between; align-items: flex-start; border-bottom: .25mm solid #d4deeb; padding: 0 0 5mm; margin: 0 0 5mm; break-inside: avoid; }
#alp-print-root .paper-heading::after { content: ""; position: absolute; left: 0; bottom: -.25mm; width: 18mm; border-bottom: .5mm solid #ff7900; }
#alp-print-root .paper-heading > div:first-child { display: flex; gap: 3mm; align-items: center; font-size: 20pt; }
#alp-print-root .paper-heading img { display: block; width: 9mm; height: 9mm; object-fit: contain; }
#alp-print-root .paper-brand { font-weight: bold; font-size: 10pt; }
#alp-print-root .paper-brand small { display: block; margin-top: 2mm; color: #526989; font-size: 8pt; font-weight: normal; }
#alp-print-root .paper-metadata { display: flex; flex-wrap: wrap; gap: 4mm; margin: 0 0 5mm; break-inside: avoid; }
#alp-print-root .paper-metadata > div { flex: 1 1 28%; }
#alp-print-root .paper-metadata > div:nth-child(2) { flex-grow: 2; }
#alp-print-root .paper-account > div:first-child { flex: 0 0 26%; }
#alp-print-root .paper-account > div:nth-child(2) { flex: 1 1 auto; }
#alp-print-root .paper-account > div:last-child { flex: 0 0 9%; }
#alp-print-root .paper-metadata dt { color: #526989; font-size: 8pt; margin-bottom: 1.5mm; }
#alp-print-root .paper-metadata dd { margin: 0; font-size: 11pt; overflow-wrap: anywhere; }
#alp-print-root .paper-metadata > div:first-child dd { font-weight: bold; }
#alp-print-root .paper-account > div:last-child dd { font-weight: bold; }
#alp-print-root .paper-title { display: flex; justify-content: space-between; align-items: baseline; gap: 5mm; margin: 0 0 5mm; break-after: avoid; }
#alp-print-root .paper-title h1 { margin: 0; color: #172b4d; font-size: 20pt; line-height: 1.2; font-weight: bold; letter-spacing: 0; }
#alp-print-root .paper-title p { margin: 0; white-space: nowrap; font-size: 10pt; }
#alp-print-root .paper-table { width: 100%; min-width: 0 !important; margin: 0; table-layout: fixed; border-spacing: 0; border-collapse: collapse; font-size: 8.5pt; }
#alp-print-root thead { display: table-header-group; }
#alp-print-root tbody { display: table-row-group; }
#alp-print-root tr { break-inside: avoid; page-break-inside: avoid; }
#alp-print-root th, #alp-print-root td { position: static !important; height: auto !important; padding: 2.5mm 2.5mm; vertical-align: top; text-align: left; line-height: 1.4; font-size: 8.5pt; overflow-wrap: break-word; word-break: normal; border: 0; border-bottom: .2mm solid #d4deeb; }
#alp-print-root th { background: #eff4fa; color: #526989; font-weight: bold; padding-top: 3mm; padding-bottom: 3mm; }
#alp-print-root td { color: #172b4d; background: white; }
#alp-print-root tbody tr:nth-child(even) td { background: #fafcfe; }
#alp-print-root .paper-number { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
#alp-print-root .paper-number strong { font-size: 9.5pt; }
#alp-print-root .paper-date { white-space: nowrap; font-variant-numeric: tabular-nums; }
#alp-print-root .paper-line { display: block; }
#alp-print-root small.paper-line { font-size: 8pt; color: #526989; }
#alp-print-root .paper-iban { overflow-wrap: anywhere; font-size: 8pt; }
#alp-print-root .paper-credit { color: #188344; }
#alp-print-root .paper-debit { color: #b9242d; }
#alp-print-root .paper-totals { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 3mm 6mm; padding: 4mm 0; break-after: avoid; break-inside: avoid; page-break-inside: avoid; font-size: 9pt; }
#alp-print-root .paper-totals span { white-space: nowrap; }
#alp-print-root .paper-footer { display: block; position: static; font-size: 7.5pt; color: #526989; border-top: .2mm solid #d4deeb; padding-top: 2mm; margin-top: 2mm; break-before: avoid; break-inside: avoid; }
#alp-print-root .paper-section-title { font-size: 12pt; margin: 5mm 0 3mm; break-after: avoid; }
#alp-print-root .paper-note { font-size: 8pt; margin: 0 0 3mm; }
@page alp-letter { size:A4 portrait; margin:14mm; }
#alp-print-root .paper-portrait { page:alp-letter; width:100%; }
#alp-print-root .paper-body,#alp-print-root .biz-paper-text { white-space:pre-wrap; font-size:10pt; line-height:1.65; }
#alp-print-root .scan-paper img { display:block;max-width:100%;max-height:260mm;object-fit:contain;margin:auto; }

@media screen {.paper-window #alp-print-root:has(.paper-portrait){width:210mm;min-height:297mm;padding:14mm}}
