/* Друк, А4 книжкова: аркуш 1 — загальний план, аркуші 2–9 — ділянки,
   далі відомість і схеми розварки. Підложка схематична — під чорно-білий принтер. */
@page{ size:A4 portrait; margin:12mm 10mm 14mm; }

@media print{
  html,body{height:auto;background:#fff;color:#000;font-size:10pt;
    font-family:'Montserrat',Arial,sans-serif;-webkit-print-color-adjust:exact;print-color-adjust:exact}
  .topbar,#views,.sheetbox,.modal,.toast,.net-bar,.fab,.lightbox,
  .leaflet-control-container .leaflet-top,.leaflet-control-attribution{display:none !important}
  .leaflet-control-container .leaflet-bottom{display:block !important}

  #print-area{display:block !important;position:static}

  .p-head{
    display:flex;justify-content:space-between;align-items:flex-start;gap:6mm;
    border-bottom:1.2pt solid #0E2D43;padding-bottom:2.5mm;margin-bottom:4mm
  }
  .p-logo{width:14mm;height:14mm;object-fit:contain;flex:none}
  .p-title{flex:1}
  .p-title b{font-size:12pt;color:#0E2D43}
  .p-sub{font-size:8.5pt;margin-top:1mm;max-width:130mm}
  .p-date{font-size:8.5pt;text-align:right;white-space:nowrap}
  .p-h2{font-size:11pt;margin:0 0 3mm;color:#0E2D43}
  .p-note{font-size:8pt;color:#444;margin:2mm 0 0}

  /* ─── карта: схематична підложка ─── */
  .p-map{
    width:190mm;height:205mm;max-width:100%;border:0.8pt solid #444;
    overflow:hidden;position:relative;background:#fff
  }
  .p-map .leaflet-container{width:100%;height:100%;background:#fff}
  /* приглушуємо тайли: сірий, світлий, малоконтрастний */
  .p-map .print-tiles{
    filter:grayscale(100%) brightness(1.28) contrast(.42) opacity(.72);
  }
  .p-map .leaflet-control-scale{margin:0 0 2mm 2mm}
  .p-map .leaflet-control-scale-line{
    border:1pt solid #000;border-top:none;background:rgba(255,255,255,.8);
    font-size:7.5pt;color:#000;padding:0 3px
  }

  /* маркери у друці — контрастні, без тіней */
  .p-map .wm{box-shadow:none;border-color:#000;color:#000;background:#fff;
    width:22px;height:22px;font-size:9px;border-width:1.6px}
  .p-map .wm.done{background:#fff;border-color:#000}
  .p-map .wm.done span::after{content:'✓';margin-left:1px}
  .p-map .wm.vvod{background:#000;color:#fff;width:22px;height:20px}
  .p-map .wm.flag{border-style:dashed}
  .p-map .wm.dim{opacity:.34;width:13px;height:13px;font-size:0;border-width:1px}
  .p-map .mf{box-shadow:none;border-color:#000;border-width:2.4px;width:34px;height:34px}
  .p-map .mf b{font-size:12px;color:#000}
  .p-map .mf i{font-size:7px;color:#333}
  .p-map .mf.dim{opacity:.4}
  .p-map .len-lbl i{
    background:#fff;border:0.4pt solid #666;color:#000;font-size:8px;padding:0 2px;font-weight:600
  }
  .sheet-tag i{
    font-style:normal;font-size:7.5pt;font-weight:600;background:#fff;border:0.5pt solid #000;
    padding:0 1.5mm;white-space:nowrap
  }

  .p-legend{
    display:flex;flex-wrap:wrap;gap:2.5mm 7mm;margin-top:3mm;font-size:8.5pt;
    border:0.6pt solid #999;padding:2.5mm 3mm;border-radius:1mm
  }
  .p-legend .lg{display:flex;align-items:center;gap:2mm}
  .p-legend .sw{width:9mm;height:1.4mm;border-radius:.7mm}
  .p-legend .dot{width:3.4mm;height:3.4mm;border-radius:50%;border:0.8pt solid #000}
  .p-legend .dot.muff{border-width:1.4pt}
  .p-legend .dot.done{background:#000}
  .p-legend .dot.vvod{
    border:0;background:#000;border-radius:0;width:3.6mm;height:3.2mm;
    clip-path:polygon(50% 0%, 100% 100%, 0% 100%)
  }

  /* ─── аркуші ділянок ─── */
  .p-sheet-map{break-before:page;break-inside:avoid}
  .p-sheet-map .p-map{height:150mm}
  .p-sheet-h{
    display:flex;align-items:baseline;gap:4mm;flex-wrap:wrap;margin-bottom:2.5mm;
    border-left:1.6mm solid #DC662D;padding-left:2.5mm
  }
  .p-sheet-h b{font-size:11pt;color:#0E2D43}
  .p-sheet-h span{font-size:8.5pt;color:#333}
  .p-sheet-sum{margin-left:auto;white-space:nowrap}
  .p-sheet-nodes{font-size:8pt;margin-top:2.5mm;line-height:1.5;color:#222}

  /* ─── відомість ─── */
  #p-sheet{break-before:page}
  .p-chain{margin-bottom:5mm;break-inside:avoid-page}
  .p-chain h3{
    font-size:9.5pt;margin:0 0 1.5mm;padding:1mm 2mm;background:#EDF1F4;
    border-left:1.5mm solid #0E2D43;font-weight:600
  }
  table.pt{width:100%;border-collapse:collapse;font-size:8.5pt}
  table.pt th,table.pt td{border:0.6pt solid #666;padding:1mm 1.5mm;text-align:left;vertical-align:top}
  table.pt thead{display:table-header-group}
  table.pt th{background:#F0F0F0;font-weight:600;text-align:center;font-size:8pt}
  table.pt td.c{text-align:center}
  table.pt td.r{text-align:right}
  table.pt tfoot td{font-weight:600;background:#F7F7F7}
  .geo{display:block;font-size:7pt;color:#777;font-weight:400;white-space:nowrap}
  .p-sign{
    display:flex;justify-content:space-between;gap:12mm;margin-top:9mm;font-size:9pt;break-inside:avoid
  }

  /* ─── схеми розварки ─── */
  .p-muff{break-before:page}
  .p-scheme{margin:0 0 5mm;break-inside:avoid}
  .p-scheme img{max-width:100%;max-height:200mm;object-fit:contain;border:0.6pt solid #666}
  .p-scheme figcaption{font-size:8pt;margin-top:1.5mm;color:#333}

  /* ─── режими ─── */
  body.print-map     #p-sheet, body.print-map     #p-schemes{display:none}
  body.print-sheet   #p-map,   body.print-sheet   #p-sheets,
  body.print-sheet   #p-schemes{display:none}
  body.print-sheet   #p-sheet{break-before:auto}
  body.print-schemes #p-map,   body.print-schemes #p-sheets,
  body.print-schemes #p-sheet{display:none}
  body.print-schemes .p-muff:first-child{break-before:auto}
}
