
/* Показываем макет для печати */
.print-layout {
  display: flex !important;
  flex-direction: column;
  width: 210mm;
  height: 297mm;
  margin: 5mm auto;
  padding: 5mm;
  box-sizing: border-box;
  font-family: "Inter", Arial, sans-serif;
  color: #000;
  background: #fff;
  border: none;
}

/* Скрываем обычный интерфейс при печати */
.layout,
.main-container,
.sidebar,
.grid,
.buttons,
.canvas-buttons,
#summary,
#specification,
#schemeModal {
  display: none !important;
  visibility: hidden !important;
}

/* Оформление печатных блоков */
.print-header h1 {
  font-size: 20pt;
  font-weight: 600;
  margin: 3mm 0 0 0;
  text-align: center;
}

/* --- Блок 2 и 3: Общие данные + схема связей --- */
.print-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

/* Левая часть — данные */
.print-summary {
  flex: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  font-size: 12pt;
  background: #fff;
  padding: 4mm ;
margin-left: 10mm;
  line-height: 1.1;
}
.print-summary p {
  margin: 1mm 0;
}


.print-scheme {
  align-self: flex-end;
  display: flex;
  flex-direction: column;
  align-items: center;
margin-right: 10mm;
margin-bottom: 5mm;
}

.scheme-title {
  font-size: 12pt;
  font-weight: 600;
}

.scheme-preview {
  width: 60mm;
  display: flex;
  justify-content: center;
  align-items: center;
}

.scheme-preview svg { width: 100%; height: 25mm; display: block; }


  .print-canvas-title {
    display: block;
    font-size: 12pt;
    text-align: center;
  margin-top: 0;
  margin-bottom: 0; 
  }

.print-canvas {
  margin: 0;
  padding: 0;
  border: none;
  line-height: 1;
}


/* Основная схема на печати — займём всю ширину */
.print-canvas svg {
  display: block;
  height: 150mm !important;
  margin-top: 0;
  margin-bottom: 0; 
}


.print-spec {
  margin-top: 0;
  margin-bottom: 0; 
  page-break-inside: avoid;
  align-items: center;

}

.print-spec table {
  height: 50mm !important;

  border-collapse: collapse;
  font-size: 10pt;
  margin-top: 3mm;
  margin-bottom: 0;
  table-layout: fixed !important;  /* чтобы браузер не растягивал ячейки */

}


.print-spec th,
.print-spec td {
  border: 1px solid #000;
  padding: 3px 5px;
  text-align: center;
}

.print-spec th {
  font-weight: bold;
}


  /* Таблица спецификации → фиксированная раскладка + общая ширина листа */
  .print-spec table {
    width: 190mm !important;           /* ширина контентной области */
    table-layout: fixed !important;     /* ширины берутся из первой строки */
    border-collapse: collapse;
    font-size: 11pt;
  margin-left: auto;   /* 👈 добавлено */
  margin-right: auto;  /* 👈 добавлено */
  }

  /* Жёсткие ширины колонок задаём только на TH в шапке — этого хватает */
  .print-spec thead th:nth-child(1) { width: 10mm !important; min-width:10mm !important; max-width:10mm !important; }
  .print-spec thead th:nth-child(2) { width: 70mm !important; min-width:70mm !important; max-width:60mm !important; }
  .print-spec thead th:nth-child(3) { width: 20mm !important; min-width:20mm !important; max-width:15mm !important; }
  .print-spec thead th:nth-child(4) { width: 20mm !important; min-width:20mm !important; max-width:20mm !important; }
  .print-spec thead th:nth-child(5) { width: 25mm !important; min-width:20mm !important; max-width:20mm !important; }
  .print-spec thead th:nth-child(6) { width: 20mm !important; min-width:20mm !important; max-width:25mm !important; }
  .print-spec thead th:nth-child(7) { width: 30mm !important; min-width:30mm !important; max-width:40mm !important; }

  /* Выровнять поведение содержимого */
  .print-spec th,
  .print-spec td {
    border: 1px solid #000;
    padding: 3px 5px;
    text-align: center;
    vertical-align: middle;
    box-sizing: border-box;
    overflow-wrap: anywhere;  /* перенос длинных слов/чисел */
    word-break: break-word;
    white-space: normal;
  }


.print-canvas,
.print-spec,
.print-canvas-title {
  outline: none;/* 1px solid red !important;*/

}

input {
    border: none !important;
    background: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    font: inherit !important;
    width: 100% !important;
    text-align: center !important;
  }

  input[type="number"],
  input[type="text"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: textfield;
}



.print-approval {
  margin: 20mm 10mm 5mm 10mm;
  font-size: 11pt;
  text-align: right;
  page-break-inside: avoid;
}

.print-approval p {
  margin: 2mm 0;
}

.approval-line {
  display: inline-block;
  width: auto;
}

.approval-date {
  text-align: right;
  margin-top: 5mm;
}


html, body {
  width: 210mm;
  height: 297mm;
  margin: 0;
  padding: 0;
  background: #fff;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

body, table, p, input, td, th {
  font-family: "Inter", Arial, sans-serif !important;
  font-size: 11pt !important;
  line-height: 1.2 !important;
  color: #000 !important;
}


.print-canvas,
.print-spec,
.print-summary,
.print-approval {
  page-break-inside: avoid;
  break-inside: avoid;
}



  /* Центрирование SVG схемы в Chrome и Edge */
  #printCanvasWrap {
    position: relative;
    text-align: center;
    height: 110mm;
  }

  #printCanvasWrap svg {
    display: inline-block;
    margin: 0 auto !important;
    max-height: 110mm;
    width: auto !important;

    /* 👇 Ключевые свойства для Chrome */
    preserveAspectRatio: xMidYMin meet !important; /* центр по горизонтали */
    transform: translateX(0); /* сброс старых смещений */
  }

  /* Иногда Chrome добавляет белый отступ слева у viewBox — компенсируем */
  #printCanvasWrap > svg[viewBox] {
    margin-left: auto !important;
    margin-right: auto !important;
  }

  body::before {
    content: "";
    position: fixed;
    top: 5mm;      /* отступ от края листа */
    left: 5mm;
    right: 5mm;
    bottom: 5mm;
    border: 0.2mm solid #000; /* цвет и толщина рамки */
    pointer-events: none;   /* чтобы не мешала кликам */
    box-sizing: border-box;
    z-index: 9999;
  }
}

/* Скрыть основной интерфейс */
.main-container,
.sidebar,
.buttons,
#schemeModal,
#summary,
#specification {
  display: none !important;
  visibility: hidden !important;
}

@page {
  size: A4 portrait;
margin: 0;
}


