/* Аркуш паспорта A4: /p/<id>/print (apps/studio/passport-print.js).
   На екрані — аркуш на підкладці з панеллю «Друк»; у друці — лише аркуш.
   Розміри креслення малює /ui/dims.js (стилі — /ui/dims.css). */
.a4-body { background: #e9e4d6; margin: 0; color: #1d2b25; }
.a4-bar { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px;
  padding: 10px 16px; background: var(--cream, #F9F4E8); border-bottom: 1px solid rgba(27, 77, 62, .15); }
.a4-bar a { color: var(--green); }
.a4-bar-note { font-size: .82rem; color: var(--hint); }

.a4-sheet { box-sizing: border-box; width: 210mm; max-width: calc(100% - 32px); min-height: 297mm; margin: 24px auto;
  padding: 14mm 14mm 10mm; background: #fff; box-shadow: 0 12px 40px rgba(0, 0, 0, .18);
  display: flex; flex-direction: column; gap: 6mm; }

.a4-head { display: grid; grid-template-columns: auto 1fr auto; gap: 6mm; align-items: start;
  padding-bottom: 4mm; border-bottom: 2px solid var(--green); }
.a4-brand { display: flex; flex-direction: column; line-height: 1.1; color: var(--green); }
.a4-brand b { font-size: 16pt; letter-spacing: -.01em; }
.a4-brand span { font-size: 7.5pt; color: var(--hint); }
.a4-eyebrow { margin: 0; font-size: 8pt; letter-spacing: .12em; text-transform: uppercase; color: var(--hint); }
.a4-head h1 { margin: 1mm 0; font-size: 18pt; line-height: 1.15; color: var(--green); }
.a4-date { margin: 0; font-size: 8.5pt; color: var(--hint); }
.a4-qr { margin: 0; width: 24mm; text-align: center; }
.a4-qr svg { display: block; width: 24mm; height: 24mm; }
.a4-qr figcaption { font-size: 7pt; color: var(--hint); margin-top: 1mm; }

/* Розкладка за формою сцени (I-0317, sheetShape): місця креслення — DRAW_MM у passport-print.js,
   числа нижче з ними збігаються (max-height креслення).
   a4-tall — специфікація ліворуч, креслення праворуч на всю висоту: апарат високий і вузький.
   a4-wide — креслення зверху на всю ширину тіла, специфікація під ним.
   a4-land — на першому аркуші специфікація, креслення — окремим альбомним аркушем (a4-land-sheet). */
.a4-cols { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 8mm; align-items: start; }
.a4-draws { display: flex; flex-direction: column; gap: 4mm; min-width: 0; }
.a4-wide .a4-drawing svg { max-height: 120mm; }
.a4-wide .a4-side .a4-drawing svg { max-height: 60mm; }
@page land { size: A4 landscape; margin: 0; }
.a4-land-sheet { page: land; width: 297mm; min-height: 210mm; }
.a4-land-sheet .a4-draws { flex: 1; }
.a4-land-sheet .a4-drawing svg { max-height: 160mm; }
.a4-land-sheet .a4-side .a4-drawing svg { max-height: 70mm; }
.a4-head-min { grid-template-columns: auto 1fr; }
.a4-sheet h2 { margin: 0 0 2mm; font-size: 11pt; color: var(--green); }
.a4-spec dl { display: grid; grid-template-columns: 30mm 1fr; margin: 0; font-size: 8.5pt; }
.a4-spec dt, .a4-spec dd { margin: 0; padding: 1.4mm 0; }
.a4-spec dt, .a4-spec dd, .a4-ins th, .a4-ins td { border-bottom: 1px solid #e6e1d3; }
.a4-spec dt { color: var(--hint); padding-right: 3mm; }
.a4-spec dd { font-weight: 600; overflow-wrap: anywhere; }
.a4-gaps { margin: 2mm 0 0; font-size: 8pt; color: var(--hint); }
/* Переліки (склад і збірки, секції, врізки) — розділи ядра @theinua/passport (/ui/passport.css);
   на папері без картки й тіні, кеглем аркуша. Контейнер прибрано: на папері таблиця лишається
   таблицею навіть у вузькій колонці (на екрані вона стала б стовпчиком). */
.a4-spec .pp-sect { margin-top: 4mm; padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; container-type: normal; }
.a4-spec .pp-sect h2 { margin: 0 0 1.5mm; font-size: 10pt; letter-spacing: 0; text-transform: none; color: var(--green); }
.a4-spec .pp-table { font-size: 8.5pt; line-height: 1.3; }
.a4-spec .pp-table th { padding: 0 2mm 1mm 0; font-size: 7.5pt; border-bottom-color: var(--border-gold); }
.a4-spec .pp-table td { padding: 1.1mm 2mm 1.1mm 0; border-bottom-color: var(--border-gold); }
.a4-spec .pp-table tr:last-child td { border-bottom: 1px solid var(--border-gold); }
.a4-spec .pp-table tr { break-inside: avoid; }
/* Утеплення зонами: зона · тип · товщина · площа · втрати — під характеристиками. */
.a4-spec .a4-ins { width: 100%; border-collapse: collapse; font-size: 8pt; }
.a4-spec dl + h2 { margin-top: 4mm; }
.a4-ins th, .a4-ins td { padding: 1.2mm 2mm 1.2mm 0; text-align: left; vertical-align: top; }
.a4-ins th { color: var(--hint); font-weight: 600; }
.a4-ins small { display: block; color: var(--hint); }

.a4-drawing-block { display: flex; flex-direction: column; break-inside: avoid; }
.a4-drawing { --dims-ink: #000; }
.a4-drawing svg { display: block; width: 100%; height: auto; max-height: 215mm; }
/* Перемикач «до осі / до краю» з passport-dims.js — на екрані, у друк ні. */
.a4-drawing-block .dims-ref { display: flex; gap: 12px; margin: 0 0 2mm; font-size: 8.5pt; color: var(--hint); }

/* Ємність на аркуші позиції (I-0373): спереду, зліва, згори в ряд в одному масштабі (--w — ширина кадру в мм при
   кеглі 2,6 мм), характеристики під ними на всю ширину. */
.a4-tv-row { display: flex; gap: 4mm; align-items: flex-start; }
.a4-tv-row figure { margin: 0; flex: 0 1 var(--w); min-width: 0; }
.a4-tv-row figcaption, .a4-tv-note { margin: 1mm 0 0; font-size: 7.5pt; color: var(--hint); }
.a4-cols.a4-one { grid-template-columns: 1fr; }

.a4-foot { display: flex; justify-content: space-between; gap: 6mm; padding-top: 3mm; border-top: 1px solid #e6e1d3;
  font-size: 7.5pt; color: var(--hint); }

@media (max-width: 640px) {
  .a4-sheet { margin: 12px auto; padding: 16px; min-height: 0; }
  .a4-head { grid-template-columns: 1fr auto; }
  .a4-brand { grid-column: 1 / -1; }
  .a4-cols { grid-template-columns: 1fr; }
  .a4-spec dl { grid-template-columns: 1fr; }
  .a4-spec dt { border-bottom: 0; padding-bottom: 0; }
  /* Аркуш на телефоні — екран, не папір: широка таблиця ядра стає картками (passport.css, pp-table-wide), інакше
     шість колонок «Труби й лінії» ламають слова по літері. Друк (A4, ширший за 640) лишає таблицю таблицею. */
  .a4-spec .pp-sect { container-type: inline-size; }
  .a4-foot { flex-direction: column; gap: 2px; }
}

@media print {
  @page { size: A4; margin: 0; }
  .a4-body { background: #fff; }
  .no-print { display: none !important; }
  .a4-sheet { width: 210mm; max-width: none; min-height: 296mm; margin: 0; box-shadow: none; }
  .a4-land-sheet { width: 297mm; min-height: 209mm; }
}

/* Позиції (власник 16.11.2026): кружки з номером над елементами, легенда на першому аркуші й аркуш на
   кожну позицію. Підлога й поверхні — той самий шар, що в конструкторі (floor.js). */
.a4-pin circle { fill: var(--surface); stroke: var(--green); stroke-width: 2; vector-effect: non-scaling-stroke; }
.a4-pin text { fill: var(--green); font-weight: 700; font-family: inherit; }
.a4-drawing .sc-floor-line { stroke: var(--text); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.a4-drawing .sc-floor-hatch { fill: none; stroke: var(--hint); stroke-width: .6; vector-effect: non-scaling-stroke; }
.a4-drawing .sc-ceil { stroke: var(--hint); stroke-width: .8; stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; }
.a4-drawing .sc-surf rect, .a4-drawing .sc-surf path { fill: none; stroke: var(--text); stroke-width: 1; vector-effect: non-scaling-stroke; }
.a4-drawing .sc-surf .sc-surf-top { fill: var(--border-gold); }
.a4-legend { break-inside: avoid; }
.a4-legend table { width: 100%; border-collapse: collapse; font-size: 8.5pt; }
.a4-legend th, .a4-legend td { padding: 1.2mm 2mm 1.2mm 0; border-bottom: 1px solid var(--border-gold); text-align: left; vertical-align: top; }
.a4-legend th { color: var(--hint); font-weight: 600; }
.a4-legend td:first-child { width: 8mm; font-weight: 700; color: var(--green); }
.a4-legend small { color: var(--hint); }
.a4-el-n { display: grid; place-items: center; width: 16mm; height: 16mm; border: 2px solid var(--green); border-radius: 50%;
  font-size: 20pt; color: var(--green); }
/* Кожен аркуш — з нової сторінки. «~», а не «+»: між аркушами бувають <script> (дані креслення),
   і сусідський «+» тоді мовчки губив розрив перед першим аркушем позиції (0.0.423). */
@media print { .a4-sheet ~ .a4-sheet { break-before: page; } }

/* Вибір сторінок (вікно «Що друкувати», passport-pages.js): не позначене не друкується й не видно —
   на екрані те саме, що піде на папір. Мініатюра плитки — зменшене креслення аркуша. */
.a4-off { display: none !important; }
.a4-thumb { display: grid; place-items: center; overflow: hidden; background: var(--surface); border: 1px solid var(--border-gold); }
.a4-thumb > svg { width: 100%; height: 100%; }
.a4-thumb .a4-pins, .a4-thumb .dims-layer { display: none; }
/* Аркуш групи: креслення зверху на всю ширину й до 165 мм заввишки — крупніше, ніж на загальному
   (DRAW_MM.wide 120 мм), бо тут розміри; склад збірки під ним. */
.a4-grp .a4-drawing-block { margin-bottom: 4mm; }
.a4-grp .a4-drawing svg { max-height: 165mm; }
