/* Scoped print views for the patient forms. */
#forms-print-view { display: none; }
.forms-print-help { flex-basis: 100%; font-size: .9rem; color: var(--muted, #555); line-height: 1.45; }
.forms-print-actions .form-actions { flex-wrap: wrap; }
.forms-print-actions .form-actions .btn { white-space: normal; }
@media (max-width: 600px) {
  .forms-print-actions .form-actions { flex-direction: column; align-items: stretch; }
  .forms-print-actions .form-actions .btn { width: 100%; }
}
@page { size: A4 portrait; margin: 12mm 14mm; }
@media print {
  html:has(#forms-print-view), body.forms-printing { margin: 0 !important; padding: 0 !important; }
  body.forms-printing > :not(#forms-print-view) { display: none !important; }
  body.forms-printing { background: #fff !important; }
  body.forms-printing::before, body.forms-printing::after { display: none !important; }
  body.forms-printing #forms-print-view { display: block !important; }
  #forms-print-view, #forms-print-view * { box-sizing: border-box; }
  #forms-print-view {
    width: 100%; margin: 0; padding: 0; color: #15261e; background: #fff;
    font: 10.5pt/1.25 'Source Sans 3', Arial, sans-serif;
    text-align: left; overflow: visible; -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  #forms-print-view .fp-page { display: block; margin: 0; padding: 0; }
  #forms-print-view .fp-page + .fp-page { break-before: page; page-break-before: always; }
  #forms-print-view .fp-heading { display: flex; gap: 4mm; align-items: center; border-bottom: 1.2mm solid #ba9b51; padding: 0 0 3mm; margin-bottom: 3mm; break-inside: avoid; }
  #forms-print-view .fp-mark { flex: 0 0 9mm; height: 13mm; background: #164c36; border-radius: 2mm; padding: 1.4mm; }
  #forms-print-view .fp-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
  #forms-print-view .fp-brand { font-size: 9pt; font-weight: 700; color: #164c36; margin-bottom: 1mm; }
  #forms-print-view h1 { margin: 0; font: 700 17pt/1.1 'Roboto Slab', Georgia, serif; color: #164c36; text-transform: none; }
  #forms-print-view .fp-subtitle { margin: 1.2mm 0 0; font-size: 9pt; color: #49554c; }
  #forms-print-view .fp-demo { border: .4mm solid #8d6a25; color: #624815; background: #fbf6e9; padding: 2mm 3mm; margin: 0 0 3mm; font-size: 10pt; font-weight: 700; break-inside: avoid; }
  #forms-print-view h2 { font: 700 11.8pt/1.2 'Source Sans 3', Arial, sans-serif; color: #164c36; margin: 3.8mm 0 2.4mm; padding: 0 0 1.1mm; border-bottom: .25mm solid #97afa0; text-transform: none; break-after: avoid; }
  #forms-print-view .fp-section { margin: 0; padding: 0; break-inside: auto; }
  #forms-print-view .fp-field { margin: 0 0 2.7mm; padding: 0; min-width: 0; break-inside: auto; }
  #forms-print-view .fp-label { margin: 0; font-weight: 700; break-after: avoid; }
  #forms-print-view .fp-hint { font-size: 8.7pt; color: #505850; margin: .5mm 0 1mm; break-after: avoid; }
  #forms-print-view .fp-answer { margin: 1mm 0 0; padding: 0 0 1.5mm; border-bottom: .2mm solid #d0d7d1; white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; max-height: none; height: auto; overflow: visible; orphans: 3; widows: 3; }
  #forms-print-view .fp-unanswered { color: #68706b; font-style: italic; }
  #forms-print-view .fp-personal-grid { display: block; font-size: 0; }
  #forms-print-view .fp-personal-grid .fp-field:first-child { display: block; width: 100%; }
  #forms-print-view .fp-personal-grid .fp-field { display: inline-block; width: 49%; padding-right: 5mm; vertical-align: top; font-size: 10.5pt; break-inside: avoid; }
  #forms-print-view .fp-writing-line { height: 6mm; border-bottom: .2mm solid #b9c4bd; }
  #forms-print-view .fp-options { display: block; margin-top: 1.5mm; }
  #forms-print-view .fp-option { display: inline-block; margin: 0 5mm 1.5mm 0; white-space: nowrap; }
  #forms-print-view .fp-box { display: inline-block; width: 3.1mm; height: 3.1mm; border: .25mm solid #4c6254; line-height: 2.5mm; text-align: center; font-size: 9pt; font-weight: 700; vertical-align: -.5mm; margin-right: 1.7mm; }
  #forms-print-view .fp-note { font-size: 8.5pt; color: #576158; margin: 3mm 0 0; border-top: .25mm solid #ba9b51; padding-top: 2mm; break-inside: avoid; }
  #forms-print-view.fp-blank .fp-field { margin-bottom: 2.8mm; break-inside: avoid; }
  #forms-print-view.fp-blank .fp-field > .fp-answer { border: 0; padding: 0; }
  #forms-print-view.fp-blank .fp-section:first-of-type h2 { margin-top: 1mm; }
}

@media print {
 #forms-print-view .fp-page { break-inside: auto; }
 #forms-print-view h1 { font-size: 16pt; }
 #forms-print-view .fp-section { break-inside: auto; }
 #forms-print-view .fp-field { margin-bottom: 2.5mm; }
 #forms-print-view p { margin: 1.4mm 0 2mm; }
 #forms-print-view .fp-option { white-space: normal; max-width: 100%; }
 #forms-print-view .fp-table { border-collapse: collapse; width: 100%; table-layout: fixed; margin: 2mm 0; font-size: 9.5pt; }
 #forms-print-view .fp-table th,#forms-print-view .fp-table td { padding: 2mm; border: .2mm solid #9ead9f; text-align: left; overflow-wrap:anywhere; vertical-align: top; }
 #forms-print-view .fp-table th { background:#eaf0eb; color:#164c36; font-weight:700; }
 #forms-print-view .fp-table thead { display: table-header-group; }
 #forms-print-view .fp-table tr { break-inside: avoid; }
 #forms-print-view .fp-summary { border: .3mm solid #97afa0; padding: 2mm 3mm; margin: 2mm 0; break-inside:avoid; font-weight:600; }
 #forms-print-view a { color:inherit; text-decoration:none; overflow-wrap:anywhere; }
 #forms-print-view li { margin-bottom:1.5mm; }
 #forms-print-view ul { margin: 1.5mm 0 2mm; padding-left:5mm; }
 #forms-print-view .fp-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap:5mm; }
 #forms-print-view img { max-width:100%; }
}
.forms-print-actions {display:flex;flex-wrap:wrap;gap:10px;margin:16px 0;}
.forms-print-actions .btn {white-space:normal;}
@media(max-width:600px){.forms-print-actions {flex-direction:column;align-items:stretch;}.forms-print-actions .btn {width:100%;}}
@media print {
 #forms-print-view .fp-ipss-table {font-size:9pt;line-height:1.16;}
 #forms-print-view .fp-ipss-table th,#forms-print-view .fp-ipss-table td {padding:1.6mm 1mm;}
 #forms-print-view .fp-ipss-table thead th {font-size:8.3pt;text-align:center;hyphens:auto;}
 #forms-print-view .fp-ipss-table thead th:first-child {text-align:left;}
 #forms-print-view .fp-ipss-table tbody th {background:#fff;font-weight:500;color:#15261e;}
 #forms-print-view .fp-ipss-choice {text-align:center;vertical-align:middle;}
 #forms-print-view .fp-ipss-choice .fp-box {margin:0;}
 #forms-print-view .fp-diary-table tbody td {height:8.5mm;}
 #forms-print-view .fp-diary-summary .fp-field {display:inline-block;margin:0 4mm 0 0;}
 #forms-print-view .fp-diary-summary .fp-answer {margin-left:2mm;border:0;}
 #forms-print-view .fp-ipss-summary .fp-answer {display:block;}
 #forms-print-view .fp-before-surgery-page h2 {font-size:10.8pt;margin:3mm 0 1.5mm;}
 #forms-print-view .fp-before-surgery-page .fp-option {margin-bottom:1mm;}
 #forms-print-view .fp-preop-page .fp-field {margin-bottom:3mm;}
}
@page { @bottom-right {content: 'Стр. ' counter(page) ' / ' counter(pages);font:8pt/1 'Source Sans 3',Arial,sans-serif;color:#68746a;vertical-align:top;padding-top:1mm;} }
@page demo { @bottom-left {content:'Вымышленный пример · не медицинский документ';font:8pt/1 'Source Sans 3',Arial,sans-serif;color:#80622a;vertical-align:top;padding-top:1mm;} }
@media print { #forms-print-view.fp-filled:has(.fp-demo) {page:demo;} }
@media print {
 #forms-print-view .fp-document-checklist .fp-option {display:block;line-height:1.4;margin-bottom:5mm;}
 #forms-print-view .fp-document-checklist .fp-box {float:none;margin:0 2mm 0 0;}
 #forms-print-view .fp-pack-resources {display:flex;gap:6mm;}
 #forms-print-view .fp-pack-resources>* {width:49%;}
 #forms-print-view .pack-qr {width:22mm;height:22mm;display:block;float:none!important;margin:2mm 0;}
 #forms-print-view .pack-resource strong,#forms-print-view .pack-resource span {display:block;}
 #forms-print-view .pack-url {font-size:8.3pt;overflow-wrap:anywhere;}
 #forms-print-view .fp-behavior-section p {margin:1.5mm 0 2mm;}
 #forms-print-view .fp-behavior-section ul {margin:1.5mm 0;padding-left:5mm;}
}

@media print {#forms-print-view .pack-resource {display:block;float:none!important;break-inside:avoid;} #forms-print-view .fp-pack-resources {break-inside:avoid;} }

@media print {
 #forms-print-view .fp-paper-personal .fp-field {display:inline-block;width:48%;margin-right:1%;vertical-align:top;}
 #forms-print-view .fp-paper-diary-table th:nth-child(1){width:13%;}
 #forms-print-view .fp-paper-diary-table th:nth-child(2),#forms-print-view .fp-paper-diary-table th:nth-child(3){width:15%;}
 #forms-print-view .fp-paper-diary-table th:nth-child(4){width:19%;}
 #forms-print-view .fp-paper-diary-table th:nth-child(5){width:38%;}
 #forms-print-view .fp-paper-diary-table td {height:8mm;font-size:9pt;}
 #forms-print-view .fp-paper-totals .fp-field {display:inline-block;width:23%;margin-right:1%;vertical-align:top;font-size:9pt;}
 #forms-print-view .fp-paper-preop .fp-field {margin-bottom:2.3mm;}
 #forms-print-view .fp-paper-preop .fp-writing-line {height:5.2mm;}
}

/* Chrome A4 pagination: keep all questions and readable type; no fixed heights. */
@media print {
 #forms-print-view .fp-ipss-page .fp-heading { padding-bottom:2mm; margin-bottom:2mm; }
 #forms-print-view .fp-ipss-page .fp-note { margin:1.2mm 0; padding-top:1mm; line-height:1.2; }
 #forms-print-view .fp-ipss-page .fp-demo { padding:1mm 2mm; margin-bottom:1.5mm; font-size:9pt; }
 #forms-print-view .fp-ipss-page .fp-ipss-table th,
 #forms-print-view .fp-ipss-page .fp-ipss-table td { padding:1.1mm .8mm; }
 #forms-print-view .fp-ipss-page .fp-ipss-options-section h2 { font-size:10.6pt; margin:2mm 0 1mm; }
 #forms-print-view .fp-ipss-page .fp-option { margin:0 3mm .8mm 0; }
 #forms-print-view .fp-ipss-page .fp-summary { padding:1.5mm 2mm; margin:1.5mm 0; }
 #forms-print-view .fp-ipss-page .fp-summary .fp-field { margin-bottom:1mm; }
 #forms-print-view .fp-ipss-page .fp-summary .fp-answer { margin-top:.6mm; padding-bottom:.7mm; }
 #forms-print-view .fp-before-surgery-page .fp-heading { padding-bottom:2mm; margin-bottom:2mm; }
 #forms-print-view .fp-before-surgery-page .fp-demo { padding:1mm 2mm; margin-bottom:1.5mm; font-size:9pt; }
 #forms-print-view .fp-before-surgery-page h2 { margin:1.7mm 0 .9mm; }
 #forms-print-view .fp-before-surgery-page .fp-option { margin:0 3mm .6mm 0; line-height:1.2; }
 #forms-print-view .fp-before-surgery-page .fp-options { margin-top:1mm; }
 #forms-print-view .fp-before-surgery-page .fp-field { margin-bottom:1.5mm; }
 #forms-print-view .fp-before-surgery-page .fp-note { margin:1.2mm 0; padding-top:1mm; line-height:1.2; }
}

/* Form pages only: enough room for the unchanged desktop navigation. */
@media screen and (min-width:1200px) {
 body[data-page="forms"] .site-header .header-inner,
 body[data-print-form] .site-header .header-inner {
  max-width:1480px; padding-left:24px; padding-right:24px; gap:12px;
 }
}

/* Normalize inherited live-page spacing inside the static leaflet projection. */
@media print {
 #forms-print-view .fp-behavior-page .fp-heading { padding-bottom:2mm; margin-bottom:2mm; }
 #forms-print-view .fp-behavior-page .fp-note { margin:1.2mm 0; padding-top:1mm; line-height:1.2; }
 #forms-print-view .fp-behavior-page h2 { font-size:11.3pt; margin:2.5mm 0 1.4mm; }
 #forms-print-view .fp-behavior-page .fp-behavior-section p,
 #forms-print-view .fp-behavior-page .fp-behavior-section li { font-size:10.5pt; line-height:1.25; margin:1.2mm 0 1.5mm; }
 #forms-print-view .fp-behavior-page .fp-behavior-section ul { margin:1mm 0 1.5mm; }
 #forms-print-view .fp-behavior-page .btn { padding:1mm 2mm; font-size:9.5pt; min-height:0; }
}
