/* 1.3.244-r260: единый изолированный профиль печати для компьютеров и планшетов. */
@page report-violations {
  size: A3 landscape;
  margin: 14mm;
}

@media print {
  html.print-fixed-layout,
  html.print-fixed-layout body,
  body.print-fixed-layout #root,
  body.print-fixed-layout .app-shell,
  body.print-fixed-layout .workspace,
  body.print-fixed-layout .content-wrap {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: #fff !important;
  }

  body.print-fixed-layout,
  body.print-fixed-layout * {
    box-sizing: border-box !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body.print-fixed-layout .report-print-header,
  body.print-fixed-layout .report-print-footer,
  body.print-fixed-layout .report-stage-actions,
  body.print-fixed-layout .report-actions,
  body.print-fixed-layout .print-report-button {
    display: none !important;
  }

  /* Отчёт по проверке: первый лист А4, дальнейшие разделы А3. */
  body.print-profile-inspection .content-wrap > :not(.report-layout) {
    display: none !important;
  }

  body.print-profile-inspection .report-layout,
  body.print-profile-inspection .report-sheet {
    position: static !important;
    top: auto !important;
    display: block !important;
    width: 182mm !important;
    min-width: 182mm !important;
    max-width: 182mm !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    transform: none !important;
    page: auto !important;
    break-before: auto !important;
    page-break-before: auto !important;
  }

  body.print-profile-inspection .report-inspection-brand {
    display: grid !important;
    grid-template-columns: 25mm minmax(0, 1fr) 82mm !important;
    align-items: start !important;
    gap: 4mm !important;
    margin: 0 !important;
    padding: 0 0 3mm !important;
    break-inside: avoid-page !important;
    page-break-inside: avoid !important;
  }

  body.print-profile-inspection .report-inspection-brand .brand-logo {
    width: 25mm !important;
    height: auto !important;
  }

  body.print-profile-inspection .report-inspection-brand .report-stages {
    display: grid !important;
    grid-template-columns: 1fr !important;
    width: 82mm !important;
    min-width: 82mm !important;
    max-width: 82mm !important;
    gap: .6mm !important;
    margin: 0 0 0 auto !important;
    padding: 0 0 0 3mm !important;
    border-top: 0 !important;
    border-left: .7mm solid #dc661e !important;
  }

  body.print-profile-inspection .report-inspection-brand .report-stage-line {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    color: #4f6471 !important;
    background: transparent !important;
    font-size: 6.5pt !important;
    line-height: 1.2 !important;
    text-align: left !important;
    white-space: nowrap !important;
    break-inside: avoid-page !important;
    page-break-inside: avoid !important;
  }

  body.print-profile-inspection .report-object-card {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0 14px !important;
    margin: 0 !important;
    break-inside: avoid-page !important;
    page-break-inside: avoid !important;
  }

  body.print-profile-inspection .report-object-card > div {
    min-height: 10mm !important;
    padding: 1.5mm 0 !important;
  }

  body.print-profile-inspection .report-object-card dt {
    font-size: 8.5pt !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
  }

  body.print-profile-inspection .report-object-card dd {
    margin-top: .5mm !important;
    font-size: 9pt !important;
    line-height: 1.22 !important;
  }

  body.print-profile-inspection .report-score,
  body.print-profile-inspection .report-metrics {
    break-inside: avoid-page !important;
    page-break-inside: avoid !important;
  }

  body.print-profile-inspection .report-metrics {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 2mm !important;
  }

  body.print-profile-inspection .report-compliance-section,
  body.print-profile-inspection .report-a3-landscape {
    page: report-violations !important;
    display: block !important;
    width: 392mm !important;
    min-width: 392mm !important;
    max-width: 392mm !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    break-before: page !important;
    page-break-before: always !important;
  }

  /* Отчёт по нарушениям: состав на А4, карточки объектов на А3. */
  body.print-profile-violations .registry-report-builder,
  body.print-profile-violations .bulk-report-sheet {
    position: static !important;
    display: block !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    page: auto !important;
    break-before: auto !important;
    page-break-before: auto !important;
  }

  body.print-profile-violations .registry-report-builder > h2,
  body.print-profile-violations .registry-report-builder > .report-builder-controls {
    display: none !important;
  }

  body.print-profile-violations .bulk-report-cover {
    page: auto !important;
    display: block !important;
    width: 182mm !important;
    min-width: 182mm !important;
    max-width: 182mm !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    break-before: auto !important;
    page-break-before: auto !important;
    break-after: page !important;
    page-break-after: always !important;
    break-inside: avoid-page !important;
    page-break-inside: avoid !important;
  }

  body.print-profile-violations .bulk-report-summary {
    margin: 7mm 0 0 !important;
    break-inside: avoid-page !important;
    page-break-inside: avoid !important;
    break-after: auto !important;
    page-break-after: auto !important;
  }

  body.print-profile-violations .bulk-report-summary table {
    width: 100% !important;
    table-layout: auto !important;
    border-collapse: collapse !important;
  }

  body.print-profile-violations .bulk-report-summary th {
    background: #dce9e2 !important;
    text-align: center !important;
    vertical-align: middle !important;
  }

  body.print-profile-violations .bulk-report-object-section,
  body.print-profile-violations .bulk-report-object-section:first-of-type {
    page: report-violations !important;
    display: block !important;
    width: 392mm !important;
    min-width: 392mm !important;
    max-width: 392mm !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 0 7mm !important;
    padding: 0 !important;
    break-before: page !important;
    page-break-before: always !important;
    break-after: auto !important;
    page-break-after: auto !important;
  }

  body.print-profile-violations .bulk-report-requisites {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    break-inside: avoid-page !important;
    page-break-inside: avoid !important;
  }

  body.print-profile-violations .bulk-report-object-header,
  body.print-profile-violations .bulk-report-requisites {
    break-after: avoid-page !important;
    page-break-after: avoid !important;
  }

  /* Единые правила переноса карточек и фотографий. */
  body.print-fixed-layout .bulk-report-row,
  body.print-fixed-layout .report-violation-list > section,
  body.print-fixed-layout .report-compliant-list > section {
    break-inside: avoid-page !important;
    page-break-inside: avoid !important;
    orphans: 3 !important;
    widows: 3 !important;
  }

  body.print-fixed-layout .report-row-core {
    min-width: 0 !important;
    break-after: avoid-page !important;
    page-break-after: avoid !important;
  }

  body.print-fixed-layout .report-row-core > header,
  body.print-fixed-layout .bulk-report-finding,
  body.print-fixed-layout .report-finding,
  body.print-fixed-layout .report-corrective-details {
    break-after: avoid-page !important;
    page-break-after: avoid !important;
  }

  body.print-fixed-layout .report-corrective-details,
  body.print-fixed-layout .report-violation-list .report-row-core > small {
    display: block !important;
    line-height: 1.45 !important;
  }

  body.print-fixed-layout .report-photo-grid {
    display: flex !important;
    flex-flow: row wrap !important;
    justify-content: flex-start !important;
    align-items: flex-start !important;
    column-gap: 7mm !important;
    row-gap: 5mm !important;
    width: 100% !important;
    margin-top: 4mm !important;
    break-before: avoid-page !important;
    page-break-before: avoid !important;
    break-inside: avoid-page !important;
    page-break-inside: avoid !important;
  }

  body.print-fixed-layout .report-photo-grid figure {
    flex: 0 0 auto !important;
    width: max-content !important;
    min-width: 0 !important;
    max-width: 118mm !important;
    margin: 0 !important;
    break-inside: avoid-page !important;
    page-break-inside: avoid !important;
  }

  body.print-fixed-layout .report-photo-grid img {
    display: block !important;
    width: auto !important;
    height: auto !important;
    max-width: 118mm !important;
    max-height: 59mm !important;
    object-fit: contain !important;
    object-position: left top !important;
    background: #fff !important;
  }

  body.print-fixed-layout .report-photo-grid figcaption {
    margin-top: 1.5mm !important;
    font-size: 8.5pt !important;
    line-height: 1.2 !important;
  }

  body.print-fixed-layout .empty-report:empty,
  body.print-fixed-layout .report-photo-grid:empty,
  body.print-fixed-layout .report-a3-landscape:empty,
  body.print-fixed-layout .bulk-report-object-section:empty {
    display: none !important;
  }

  /* Требования, требующие уточнения: все листы А4 книжные. */
  body.print-profile-clarification .clarification-report {
    display: block !important;
    width: 182mm !important;
    min-width: 182mm !important;
    max-width: 182mm !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  body.print-profile-clarification .clarification-report .bulk-report-row {
    width: 100% !important;
  }

  /* Комплект ТО СПЗ: все листы А4 книжные. */
  body.print-profile-contractor .report-root {
    width: 182mm !important;
    min-width: 182mm !important;
    max-width: 182mm !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.print-profile-contractor .report-section {
    break-inside: avoid-page !important;
    page-break-inside: avoid !important;
  }

  /* План объезда: сводка, карта и каждый день на отдельных А4 альбомных. */
  body.print-profile-route .route-plan-result {
    position: static !important;
    left: auto !important;
    top: auto !important;
    display: block !important;
    width: 281mm !important;
    min-width: 281mm !important;
    max-width: 281mm !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  body.print-profile-route .route-print-summary,
  body.print-profile-route .route-print-map-page,
  body.print-profile-route .route-day {
    position: static !important;
    display: block !important;
    width: 281mm !important;
    min-width: 281mm !important;
    max-width: 281mm !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  body.print-profile-route .route-print-summary {
    break-before: auto !important;
    page-break-before: auto !important;
  }

  body.print-profile-route .route-print-map-page,
  body.print-profile-route .route-day,
  body.print-profile-route .route-day + .route-day {
    break-before: page !important;
    page-break-before: always !important;
  }

  body.print-profile-route .route-print-map-image {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    max-height: 155mm !important;
    object-fit: contain !important;
    object-position: left top !important;
  }

  body.print-profile-route .route-day-head,
  body.print-profile-route .route-plan-row,
  body.print-profile-route .route-day-totals,
  body.print-profile-route .route-plan-totals {
    break-inside: avoid-page !important;
    page-break-inside: avoid !important;
  }
}
