/*
  Вёрстка альбома. Один и тот же код работает на экране (предпросмотр) и на
  бумаге: браузер сам верстает страницы и разрывает таблицы по строкам —
  свой генератор PDF был бы лишней сущностью.
*/

.album { display: none; }

.app[data-mode="print"] .album { display: block; }
.app[data-mode="print"] .left,
.app[data-mode="print"] .right,
.app[data-mode="print"] .canvas-wrap,
.app[data-mode="print"] .sheet { display: none; }

.app[data-mode="print"] {
  grid-template-areas:
    "bar bar bar"
    "album album album"
    "status status status";
}
.album { grid-area: album; overflow-y: auto; background: var(--sunk); padding: 20px; }

.print-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  max-width: 210mm;
  margin: 0 auto 16px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.print-toolbar .sheet-toggle {
  font: inherit;
  font-size: 12.5px;
  padding: 4px 10px;
  border: 1px solid var(--line-2);
  background: var(--panel);
  color: var(--ink-2);
  cursor: pointer;
}
.print-toolbar .sheet-toggle[aria-pressed="true"] {
  border-color: var(--pe-green);
  color: var(--pe-green);
  font-weight: 600;
}

/* ── Лист ───────────────────────────────────────────────────────────── */

.page {
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto 16px;
  padding: 16mm 14mm 22mm;
  background: #fff;
  color: #111;
  position: relative;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.18);
  font: 11pt/1.4 system-ui, "Segoe UI", sans-serif;
  break-after: page;
}

.sheet-title {
  font-family: var(--display);
  font-size: 20pt;
  font-weight: 700;
  margin: 0 0 10mm;
  padding-bottom: 3mm;
  border-bottom: 1.5pt solid #111;
}

.block-title { font-size: 12pt; font-weight: 700; margin: 7mm 0 3mm; }

.plan-holder { width: 100%; }
.plan-svg { width: 100%; height: auto; max-height: 195mm; }

.plan-svg .room { fill: #f2f2ee; }
.plan-svg .wall { stroke: #111; }
.plan-svg .sym { stroke: #111; stroke-width: 26; fill: none; }
.plan-svg .sym-fill { fill: #111; }
.plan-svg .board { fill: #fff; stroke: #111; stroke-width: 40; }
.plan-svg .board-line { stroke: #111; stroke-width: 26; }
.plan-svg .route { fill: none; stroke-width: 40; stroke-linejoin: round; stroke-linecap: round; }
.plan-svg .route.c0 { stroke: #2a5c9e; }
.plan-svg .route.c1 { stroke: #8a5230; }
.plan-svg .route.c2 { stroke: #3e8e41; }
.plan-svg .route.c3 { stroke: #b33a2b; }
.plan-svg .route.c4 { stroke: #6b4c9a; }
.plan-svg .route.c5 { stroke: #0f7d7d; }
.plan-svg .dim { stroke: #666; stroke-width: 12; }
.plan-svg .dim-text { font-size: 200px; fill: #444; text-anchor: middle; font-family: monospace; }
.plan-svg .room-name { font-size: 260px; fill: #333; text-anchor: middle; font-weight: 600; }
.plan-svg .room-area { font-size: 210px; fill: #666; text-anchor: middle; font-family: monospace; }
.plan-svg .dev-label { font-size: 150px; fill: #444; font-family: monospace; }

/* ── Таблицы ────────────────────────────────────────────────────────── */

table.grid { width: 100%; border-collapse: collapse; font-size: 9pt; }
table.grid th {
  text-align: left;
  border-bottom: 1pt solid #111;
  padding: 1.5mm 2mm 1.5mm 0;
  font-size: 8pt;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
table.grid td { padding: 1.2mm 2mm 1.2mm 0; border-bottom: 0.4pt solid #ccc; vertical-align: top; }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid tfoot td { border-top: 1pt solid #111; border-bottom: 0; font-weight: 700; }
table.grid tr { break-inside: avoid; }

table.data, table.totals-table { border-collapse: collapse; font-size: 10.5pt; margin: 6mm 0; }
table.data td, table.totals-table td { padding: 1.6mm 8mm 1.6mm 0; border-bottom: 0.4pt solid #ddd; }
table.data td:last-child, table.totals-table td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
table.totals-table { min-width: 90mm; }
table.totals-table tr.grand td {
  border-top: 1pt solid #111;
  border-bottom: 0;
  font-size: 13pt;
  font-weight: 700;
  padding-top: 3mm;
}

/* ── Титул и КП ─────────────────────────────────────────────────────── */

.title-page { display: flex; flex-direction: column; }
.title-top { font-size: 10pt; color: #666; }
.title-main { font-family: var(--display); font-size: 34pt; font-weight: 700; margin: 30mm 0 4mm; }
.title-object { font-size: 15pt; }
.title-address { font-size: 11pt; color: #555; margin-top: 1mm; }
.title-contacts { margin-top: auto; font-size: 10pt; color: #555; }
.title-date { font-size: 10pt; color: #555; margin-top: 2mm; }

.offer-lead { font-size: 12pt; margin: 0 0 5mm; }
.offer-terms ul { margin: 2mm 0 0; padding-left: 6mm; font-size: 10pt; }
.offer-terms li { margin-bottom: 1.5mm; }
.offer-signature { margin-top: 12mm; font-size: 10.5pt; }

.disclaimer {
  margin-top: 8mm;
  padding: 3mm 4mm;
  border-left: 2pt solid #999;
  font-size: 8.5pt;
  color: #444;
  max-width: 150mm;
}
.warn-block {
  margin-top: 6mm;
  padding: 3mm 4mm;
  border-left: 2pt solid #b33a2b;
  color: #b33a2b;
  font-size: 10pt;
}
.note-print { font-size: 8.5pt; color: #555; margin-top: 4mm; }
.note-print.warn { color: #b33a2b; }
.legend { font-size: 8.5pt; color: #444; margin-top: 4mm; }
.empty { color: #999; font-size: 10pt; }

/* ── Однолинейная схема ─────────────────────────────────────────────── */

.page.landscape { width: 297mm; min-height: 210mm; }
.scheme-holder { width: 100%; overflow: hidden; }
.single-line { width: 100%; height: auto; }
.single-line .sl-title { font-size: 15px; font-weight: 700; fill: #111; }
.single-line .sl-note { font-size: 10px; fill: #555; font-family: monospace; }
.single-line .sl-feed, .single-line .sl-bus { stroke: #111; stroke-width: 2.5; }
.single-line .sl-line { stroke-width: 1.6; }
.single-line .sl-line.c0 { stroke: #2a5c9e; }
.single-line .sl-line.c1 { stroke: #8a5230; }
.single-line .sl-line.c2 { stroke: #3e8e41; }
.single-line .sl-line.c3 { stroke: #b33a2b; }
.single-line .sl-line.c4 { stroke: #6b4c9a; }
.single-line .sl-line.c5 { stroke: #0f7d7d; }
.single-line .sl-sym { stroke: #111; stroke-width: 1.4; fill: none; }
.single-line .sl-sym-fill { fill: #111; }
.single-line .sl-grid { stroke: #bbb; stroke-width: 0.6; }
.single-line .sl-row-label { font-size: 9px; fill: #444; }
.single-line .sl-cell { font-size: 9px; fill: #111; text-anchor: middle; font-family: monospace; }

/* ── Штамп ──────────────────────────────────────────────────────────── */

.stamp {
  position: absolute;
  left: 14mm;
  right: 14mm;
  bottom: 10mm;
  display: flex;
  justify-content: space-between;
  gap: 6mm;
  border-top: 1pt solid #111;
  padding-top: 2mm;
  font-size: 8pt;
  color: #333;
}
.stamp-title { font-weight: 700; }

/* ── Печать ─────────────────────────────────────────────────────────── */

@page { size: A4 portrait; margin: 0; }
@page landscape { size: A4 landscape; margin: 0; }
.page.landscape { page: landscape; }

@media print {
  body { background: #fff; overflow: visible; }
  .app { display: block; height: auto; }
  .bar, .left, .right, .canvas-wrap, .sheet, .status, .print-toolbar { display: none !important; }
  .album { display: block !important; padding: 0; background: #fff; overflow: visible; }
  .page { box-shadow: none; margin: 0; break-after: page; }
  .page:last-child { break-after: auto; }
}
