/**
 * Styly pro export protokolu do PDF (HTML → html2pdf)
 * A4, okraje, zlomy stránek, typografie
 *
 * Očekávaná struktura (buildProtocolHTML):
 *   .protocol-pdf
 *     .page-header.page-header--running  … horní lišta (číslo zakázky – název, logo)
 *     .page-body                          … tělo: titulka, obsah, kapitoly
 */

.protocol-pdf {
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 10pt;
  line-height: 1.4;
  color: #1a1a1a;
  max-width: 210mm;
  margin: 0 auto;
  padding: 0;
  box-sizing: border-box;
  --pdf-obstacle-hatch-bg: #eef1f4;
  --pdf-obstacle-hatch-svg: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='8'%20height='8'%20viewBox='0%200%208%208'%3E%3Cpath%20d='M-2,6%20L2,10%20M0,0%20L8,8%20M6,-2%20L10,2'%20stroke='%23232830'%20stroke-width='1.15'%20stroke-linecap='square'%20fill='none'/%3E%3C/svg%3E");
}

.protocol-pdf * {
  box-sizing: border-box;
}

/* Titulní strana – blok s hlavním nadpisem (ne dokumentová lišta) */
.protocol-pdf .title-page__lead {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  width: 100%;
  min-height: 0;
  text-align: center;
}
.protocol-pdf .title-page__lead h1 {
  margin: 0;
}

/* Tělo protokolu (pod dokumentovou lištou) */
.protocol-pdf .page-body {
  padding: 0 8mm 0 8mm;
  min-height: 0;
}
@media print {
  /* Prostor pod fixní horní lištou (číslo/název + logo) na každé stránce */
  .protocol-pdf.protocol-pdf--running-header .page-body {
    padding-top: 12mm;
  }
}

/* Titulní stránka */
.protocol-pdf .title-page {
  min-height: 240mm;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  text-align: center;
  padding: 0 10mm;
  page-break-after: always;
  break-inside: avoid;
  page-break-inside: avoid;
}

/* Logo / razítko jsou v HTML před tabulkou – bez z-index by je překryla. */
.protocol-pdf .title-page__asset {
  z-index: 2;
}

.protocol-pdf .title-page .subtitle {
  font-size: 12pt;
  margin: 0 0 10px 0;
}

.protocol-pdf .title-page .date {
  font-size: 11pt;
  margin: 0;
}

.protocol-pdf .title-page__info {
  width: 100%;
  max-width: 165mm;
  margin: auto auto 2mm auto;
  text-align: left;
}

.protocol-pdf .cover-info-table {
  width: 100%;
  border-collapse: collapse;
  border: 1.2pt solid #444;
  font-size: 8pt;
  background: #fff;
}

.protocol-pdf .cover-info-table th,
.protocol-pdf .cover-info-table td {
  border: 1px solid #b7b7b7;
  padding: 2.5mm 3mm;
  vertical-align: top;
}

.protocol-pdf .cover-info-table th {
  width: 34%;
  font-weight: 700;
  background: #f4f4f4;
}

.protocol-pdf .cover-info-table td {
  width: 66%;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Horní lišta: jeden řádek „název dokumentu – zakázka – projekt“ + logo; náhled sticky, tisk fixed */
.protocol-pdf .page-header.page-header--running {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8mm;
  padding: 0 10mm 0 10mm;
  margin: 0;
  border: none;
  background: #fff;
  min-height: 10mm;
  position: sticky;
  top: 0;
  z-index: 4;
}
.protocol-pdf .page-header__meta {
  flex: 1;
  min-width: 0;
  font-size: 8pt;
  font-weight: 400;
  color: #555;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}
.protocol-pdf .page-header--running .page-header__logo {
  flex-shrink: 0;
}
@media print {
  .protocol-pdf .page-header.page-header--running {
    position: fixed;
    top: -6mm;
    left: 0;
    right: 0;
    z-index: 1;
    pointer-events: none;
  }
}

.protocol-pdf .page-header .page-header__logo {
  max-height: 10mm;
  max-width: 45mm;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

/* Pruh zakrývající hlavičku na přílohách: v tisku fixed kreslí na VŠECH stránkách, takže by zakrýval i logo. Nepoužíváme. */
.protocol-pdf .appendix-header-cover {
  display: none;
}

.protocol-pdf .page-header .title {
  font-weight: bold;
}

.protocol-pdf .page-header .subtitle {
  font-weight: normal;
  color: #444;
}

/* Patička */
.protocol-pdf .page-footer {
  padding: 0 10mm;
  margin-top: 8px;
  font-size: 9pt;
  color: #555;
  text-align: center;
}

/* Obsah */
.protocol-pdf .toc {
  page-break-after: always;
}

.protocol-pdf .toc h2 {
  font-size: 12pt;
  font-weight: bold;
  margin: 0 0 8px 0;
}

.protocol-pdf .toc ul {
  list-style: none;
  padding-left: 4px;
  margin: 0 0 12px 0;
}

.protocol-pdf .toc-list--rooms {
  margin: 2px 0 6px 0;
  padding-left: 7em;
  font-size: 9pt;
}

.protocol-pdf .toc-item--room {
  margin: 1px 0;
}

.protocol-pdf .toc li {
  margin: 3px 0;
  font-size: 10pt;
}

.protocol-pdf .toc a {
  text-decoration: none;
  color: #1a1a1a;
  display: flex;
  align-items: baseline;
}

.protocol-pdf .toc a .toc-title {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Tečky mezi názvem a číslem stránky v obsahu */
.protocol-pdf .toc a .toc-dots {
  flex: 1;
  border-bottom: 1px dotted #999;
  margin: 0 8px;
  min-width: 20px;
  height: 0.9em;
}

.protocol-pdf .toc a .page-number {
  flex-shrink: 0;
}

/* Sekce – čára pod sekcí (ne nad), aby na nové stránce nebyla zbytečná čára nahoře */
.protocol-pdf .section {
  margin-bottom: 14px;
  page-break-inside: avoid;
  border-bottom: 1px solid #bbb;
}

.protocol-pdf .section:last-of-type,
.protocol-pdf .section.appendix {
  border-bottom: none;
}

.protocol-pdf .section + .section {
  margin-top: 1.8em;
  padding-top: 1.2em;
}

.protocol-pdf .section-title {
  font-size: 11pt;
  font-weight: bold;
  margin: 0 0 6px 0;
}
/* Nadpis 6 a 10 nesmí zůstat sami na stránce – držet s obsahem pod nimi. */
.protocol-pdf .section-10-maintenance-note {
  font-size: 9pt;
  color: #444;
  margin: 0 0 12px 0;
  line-height: 1.35;
}
.protocol-pdf #sec-6 .section-title,
.protocol-pdf #sec-10 .section-title {
  page-break-after: avoid;
}

.protocol-pdf .subsection {
  margin-bottom: 10px;
  page-break-inside: avoid;
}

.protocol-pdf .subsection-title {
  font-size: 9pt;
  font-weight: bold;
  margin: 0 0 4px 0;
  padding-left: 4px;
}

.protocol-pdf .subsection-content {
  padding-left: 8px;
  font-size: 9pt;
  margin: 0 0 2px 0;
}

.protocol-pdf .subsection-content p {
  margin: 0 0 4px 0;
}

/* 4.3 Značky a jednotky */
.protocol-pdf .subsection-content.symbol-defs .symbol-def {
  margin: 0 0 4px 0;
  display: grid;
  grid-template-columns: 9em auto minmax(0, 1fr);
  align-items: flex-start;
  gap: 0.35em;
}
.protocol-pdf .symbol-def__sym {
  min-width: 0;
}
.protocol-pdf .symbol-def__sep {
  min-width: 0;
}
.protocol-pdf .symbol-def__desc {
  display: block;
  min-width: 0;
}

/* ========== Report table style (technical / laboratory report) ==========
   Stronger outer border, clear header separation, lighter inner grid, neutral.
   Applied to: summary-table, requirements-table, room-params-table, task-zone-table.
   NOT applied to: grid-table (measurement grid diagram). */

/* Tabulka souhrnu (9.1) – vycentrovaná */
.protocol-pdf .summary-table-wrap {
  text-align: center;
  margin: 8px 0;
}
.protocol-pdf .summary-table {
  border-collapse: collapse;
  margin: 0 auto;
  font-size: 8pt;
  page-break-inside: avoid;
  width: 100%;
  border: 1.2pt solid #444;
}
.protocol-pdf .summary-table th,
.protocol-pdf .summary-table td {
  border: 0.5pt solid #777;
  padding: 5px 7px;
  text-align: center;
  vertical-align: middle;
}
.protocol-pdf .summary-table thead th {
  background: #f2f2f2;
  font-weight: 700;
}
.protocol-pdf .summary-table thead tr:first-child th {
  border-top: 1.2pt solid #444;
}
.protocol-pdf .summary-table thead tr:last-child th {
  border-bottom: 1.2pt solid #444;
}
.protocol-pdf .summary-table tbody tr:last-child td {
  border-bottom: 1.2pt solid #444;
}
.protocol-pdf .summary-table__group-row th.summary-table__group-namerene,
.protocol-pdf .summary-table__group-row th.summary-table__group-pozadovane {
  background: #e8e8e8;
  font-weight: 700;
  border-bottom: 1.2pt solid #444;
}
.protocol-pdf .summary-table__vyhodnoceni--vyhovuje {
  color: #0a6b0a;
  font-weight: bold;
}
.protocol-pdf .summary-table__vyhodnoceni--nevyhovuje {
  color: #c00;
  font-weight: bold;
}
.protocol-pdf .summary-table__value--fail {
  color: #c00;
  font-weight: bold;
}

/* Tabulka požadavků normy (9.1) */
.protocol-pdf .requirements-table {
  border-collapse: collapse;
  font-size: 8pt;
  page-break-inside: avoid;
  margin: 8px auto;
  width: 100%;
  border: 1.2pt solid #444;
}
.protocol-pdf .requirements-table th,
.protocol-pdf .requirements-table td {
  border: 0.5pt solid #777;
  padding: 5px 7px;
  text-align: left;
  vertical-align: middle;
}
.protocol-pdf .requirements-table thead th {
  background: #f2f2f2;
  font-weight: 700;
}
.protocol-pdf .requirements-table thead tr:first-child th {
  border-top: 1.2pt solid #444;
}
.protocol-pdf .requirements-table thead tr:last-child th {
  border-bottom: 1.2pt solid #444;
}
.protocol-pdf .requirements-task-zones-note {
  margin-top: 0.75em;
  font-size: 0.95em;
}

.protocol-pdf .requirements-table tbody tr:last-child td {
  border-bottom: 1.2pt solid #444;
}

/* Podpis – místo na podpis a razítko nad jménem */
.protocol-pdf .signature {
  margin-top: 12px;
  padding-left: 8px;
  font-size: 9pt;
}

.protocol-pdf .signature .date { margin: 0 0 4px 0; }
.protocol-pdf .signature .sign-stamp-wrap {
  width: 66mm;
  height: 44mm;
  margin: 0.8mm 0 1.2mm 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: transparent;
}
.protocol-pdf .signature .sign-stamp-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.protocol-pdf .signature .name {
  margin: 0;
  margin-top: 0;
  font-weight: bold;
}

/* Podpisová doložka musí zůstat pohromadě na jedné straně.
   Když se nevejde, přesune se celá sekce 13 na další stránku. */
.protocol-pdf #sec-13,
.protocol-pdf #sec-13 .subsection,
.protocol-pdf #sec-13 .subsection-content,
.protocol-pdf #sec-13 .signature {
  break-inside: avoid-page;
  page-break-inside: avoid;
}

/* Přílohy – nová stránka před každou */
.protocol-pdf .appendix {
  page-break-before: always;
}

.protocol-pdf .appendix-title {
  font-size: 12pt;
  font-weight: bold;
  margin: 0 0 10px 0;
}

/* Místnost v příloze 1 – každá na novou stránku */
.protocol-pdf .room-block {
  margin-bottom: 16px;
  page-break-before: always;
  page-break-inside: auto;
}
.protocol-pdf .room-block:first-of-type {
  page-break-before: auto;
}
.protocol-pdf .room-block .room-tables {
  margin-top: 12px;
  margin-bottom: 4px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
}
/* Vyhodnocovací tabulky zón a plošné vyhodnocení – jedna šířka přes sloupec (stejně široké jako sebe navazující tabulky). */
.protocol-pdf .room-block .room-tables > .task-mode-results,
.protocol-pdf .room-block .room-tables > .evaluation-block {
  width: 100%;
  max-width: 100%;
  align-self: stretch;
  box-sizing: border-box;
  page-break-inside: avoid;
}
.protocol-pdf .task-mode-results .evaluation-block {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  page-break-inside: avoid;
}
/* Fotografie místnosti v protokolu – větší, 2 vedle sebe */
.protocol-pdf .room-block .room-photos-protocol {
  margin-top: 10px;
  margin-bottom: 4px;
  page-break-inside: avoid;
}
.protocol-pdf .room-block .room-photos-protocol .room-photos-protocol-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  justify-content: center;
}
.protocol-pdf .room-block .room-photo-protocol-figure {
  flex: 1 1 calc(50% - 6px);
  min-width: 0;
  max-width: calc(50% - 6px);
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  page-break-inside: avoid;
  break-inside: avoid;
}
.protocol-pdf .room-block .room-photo-protocol-img {
  max-height: 300px;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid #ddd;
  display: block;
}
.protocol-pdf .room-block .room-photo-protocol-caption {
  font-size: 9pt;
  text-align: center;
  margin-top: 6px;
  width: 100%;
  color: #222;
}
.protocol-pdf .room-block .room-floor-plans {
  width: 100%;
  margin-top: 10px;
  margin-bottom: 0;
  padding-bottom: 12px;
  border-bottom: 1px solid #ddd;
}
.protocol-pdf .room-block .room-previews {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: none;
}
.protocol-pdf .room-block .room-previews .room-floor-plan:not(.room-floor-plan--crop) {
  flex: 1 1 100%;
}
/* Výřez: centrovaní i když engine špatně spočte flex řádek (html2pdf); margin:auto funguje u flex položky. */
.protocol-pdf .room-block .room-previews .room-floor-plan--crop {
  flex: 0 1 auto;
  align-self: center;
  margin-left: auto;
  margin-right: auto;
}
.protocol-pdf .room-block .room-floor-plan {
  margin-top: 10px;
  page-break-inside: avoid;
}
.protocol-pdf .room-block .room-floor-plan.room-floor-plan--crop {
  margin: 0;
  page-break-inside: avoid;
  break-inside: avoid;
}
/* Půdorysy a výřezy tak, jak jsou na plátně – bez ořezu výšky */
.protocol-pdf .room-block .room-floor-plan .floor-plan-img {
  max-width: 100%;
  height: auto;
  max-height: 200mm;
  display: block;
  margin-left: auto;
  margin-right: auto;
}
/* Výřez tasku: --img-width, --img-height v pt (odpovídá layoutu v JS). Neomezovat na 230 mm – při vyšším boxu
   by object-fit:contain obrázek zbytečně zmenšil oproti zamýšlené velikosti v protokolu. */
.protocol-pdf .room-block .room-floor-plan--crop .floor-plan-img--crop-sized {
  width: 100%;
  height: auto;
  max-width: 100%;
  display: block;
  margin: 0;
  box-sizing: border-box;
  vertical-align: top;
}
.protocol-pdf .room-block .room-floor-plan--crop .floor-plan-img:not(.floor-plan-img--crop-sized) {
  max-width: 100%;
  height: auto;
  display: block;
}
/* Výřez: bez uřícených okrajů figure; crop-wrap jen kolem obrázku. */
.protocol-pdf .room-block .room-floor-plan--crop {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
  page-break-inside: avoid;
  break-inside: avoid;
}
/* Obal jen určuje max. šířku; výšku řídí samotný obrázek (height:auto) – bez aspect-ratio/max-height,
   které ve WeasyPrint/html2pdf občas rozbijí výšku boxu a legenda „leze“ do výřezu. Měřítko drží JS. */
.protocol-pdf .room-block .room-floor-plan--crop .room-floor-plan__crop-wrap {
  display: block;
  width: min(100%, calc(var(--img-width) * 1pt));
  max-width: 100%;
  flex-shrink: 0;
  line-height: 0;
}
.protocol-pdf .room-block .room-floor-plan--crop .floor-plan-legend {
  break-inside: avoid;
  page-break-inside: avoid;
}
.protocol-pdf .room-block .room-floor-plan--crop .floor-plan-caption {
  break-inside: avoid;
  page-break-inside: avoid;
}
.protocol-pdf .room-block .protocol-preview-rotate-label {
  display: block;
  margin-top: 4px;
  font-size: 0.9em;
}
@media print {
  .protocol-pdf .protocol-preview-rotate-label {
    display: none;
  }
}
.protocol-pdf .room-block .room-previews .floor-plan-caption--preview {
  text-align: center;
  font-style: italic;
}

/* Legenda zóny zrakového úkolu (barvy jako na plátně) */
.protocol-pdf .room-block .floor-plan-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  box-sizing: border-box;
  gap: 14px 20px;
  margin: 6px 0 4px 0;
  padding: 6px 10px 4px;
  font-size: 8.5pt;
  line-height: 1.35;
  color: #333;
}
.protocol-pdf .room-block .room-floor-plan--crop .floor-plan-legend {
  max-width: 100%;
  justify-content: flex-start;
  align-self: stretch;
  margin: 2px 0 0 0;
  padding: 2px 6px 2px;
  gap: 8px 12px;
}
.protocol-pdf .room-block .floor-plan-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
}
.protocol-pdf .room-block .floor-plan-legend__swatch {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  box-sizing: border-box;
}
.protocol-pdf .room-block .floor-plan-legend__swatch--surrounding {
  background: rgba(34, 197, 94, 0.22);
  border: 1.5px solid rgba(22, 163, 74, 0.9);
}
.protocol-pdf .room-block .floor-plan-legend__swatch--task {
  background: rgba(245, 158, 11, 0.22);
  border: 1.5px solid rgba(180, 83, 9, 0.9);
}
.protocol-pdf .room-block .floor-plan-legend__swatch--offset-belt {
  background: rgba(140, 145, 155, 0.4);
  border: 1.5px solid rgba(100, 105, 115, 0.85);
}
.protocol-pdf .room-block .floor-plan-legend__swatch--obstacle {
  background-color: var(--pdf-obstacle-hatch-bg);
  background-image: var(--pdf-obstacle-hatch-svg);
  background-repeat: repeat;
  background-size: 8px 8px;
  border: 1.5px solid #374151;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.protocol-pdf .room-block .floor-plan-legend__swatch--opening {
  background: rgba(55, 65, 81, 0.12);
  border: 1.5px dashed #374151;
}
.protocol-pdf .room-block .floor-plan-legend__text {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
}

/* Název místnosti v sekci 10 – sémantika h3, vizuál jako dříve .room-name */
.protocol-pdf .room-block .room-name.room-block__room-heading {
  font-size: 11pt;
  font-weight: bold;
  margin: 0 0 8px 0;
  padding: 0;
  line-height: 1.25;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 0.1em;
}

/* Jednotné podnadpisy bloku místnosti: fotky, půdorysy, mřížky, vyhodnocení (task / plošné) */
.protocol-pdf .room-block .room-block__block-title {
  font-size: 10pt;
  font-weight: bold;
  text-align: left;
  margin: 10px 0 6px 0;
  padding-left: 4px;
  color: #1a1a1a;
  break-after: avoid-page;
  page-break-after: avoid;
}
.protocol-pdf .room-block .room-floor-plans > .room-block__block-title:first-child,
.protocol-pdf .room-block .room-measurement-grids > .room-block__block-title:first-child,
.protocol-pdf .room-block .room-photos-protocol > .room-block__block-title:first-child {
  margin-top: 0;
}
.protocol-pdf .room-block .task-mode-results > .evaluation-block:first-child > .room-block__block-title:first-child {
  margin-top: 4px;
}
.protocol-pdf .room-block .room-tables > .evaluation-block:first-child > .room-block__block-title:first-child {
  margin-top: 0;
}

.protocol-pdf .room-block .char-list {
  font-size: 9pt;
  margin: 0 0 6px 0;
  padding-left: 4px;
}

.protocol-pdf .room-block .char-list p {
  margin: 0 0 2px 0;
}

/* Tabulka parametrů místnosti (všechny položky z levého menu) */
.protocol-pdf .room-params-wrap {
  margin: 8px 0 12px 0;
  overflow-x: auto;
  page-break-inside: avoid;
  text-align: center;
}
.protocol-pdf .room-params-table {
  width: auto;
  min-width: min(100%, 720px);
  max-width: 100%;
  table-layout: auto;
  border-collapse: collapse;
  font-size: 9pt;
  margin-left: auto;
  margin-right: auto;
  border: 1.2pt solid #444;
}
.protocol-pdf .room-params-table th,
.protocol-pdf .room-params-table td {
  border: 0.5pt solid #777;
  padding: 5px 8px;
  text-align: left;
  vertical-align: top;
}
.protocol-pdf .room-params-table thead th {
  background: #f2f2f2;
  font-weight: 700;
}
.protocol-pdf .room-params-table thead tr:first-child th {
  border-top: 1.2pt solid #444;
}
.protocol-pdf .room-params-table thead tr:last-child th {
  border-bottom: 1.2pt solid #444;
}
.protocol-pdf .room-params-table tbody tr:last-child td {
  border-bottom: 1.2pt solid #444;
}
.protocol-pdf .room-params-table__label {
  color: #444;
  white-space: nowrap;
  padding-right: 10px;
}
.protocol-pdf .room-params-table thead th {
  white-space: nowrap;
}
.protocol-pdf .room-params-table__value {
  font-weight: 500;
  white-space: normal;
  word-break: break-word;
}
.protocol-pdf .sqrt-overbar {
  display: inline-block;
  text-decoration: overline;
  text-decoration-thickness: 1px;
  padding-left: 1px;
}

/* MathML (√ přes radikand) v rozpočtu nejistoty luxmetru */
.protocol-pdf math.protocol-math {
  font-family: "STIX Two Math", "Cambria Math", "Latin Modern Math", serif;
  font-size: 0.98em;
}
.protocol-pdf .protocol-math--sqrt {
  vertical-align: middle;
}
.protocol-pdf .luxmeter-uncertainty-budget__formulas {
  text-align: left;
  margin-top: 10px;
}
.protocol-pdf .luxmeter-uncertainty-budget__step {
  margin: 0 0 12px 0;
}
.protocol-pdf .luxmeter-uncertainty-budget__step-label {
  font-weight: 700;
  margin: 0 0 4px 0;
  font-size: 9.5pt;
}
.protocol-pdf .luxmeter-uncertainty-budget__step-body {
  margin: 0;
  font-size: 9.5pt;
}
.protocol-pdf .luxmeter-uncertainty-budget__uc-formula {
  margin: 0;
  text-align: left;
}
.protocol-pdf .luxmeter-uncertainty-budget__uc-formula math.protocol-math--uc {
  display: block;
  margin: 4px 0 0 0;
  text-align: left;
  width: fit-content;
  max-width: 100%;
}
.protocol-pdf .protocol-math--uc {
  font-size: 1em;
}

.protocol-pdf .luxmeter-uncertainty-budget__numeric {
  margin: 0;
  font-size: 9.5pt;
  text-align: left;
}
.protocol-pdf .luxmeter-uncertainty-budget__u95-result {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.1em;
  text-decoration-thickness: 0.08em;
}
.protocol-pdf .luxmeter-uncertainty-budget__note {
  margin: 14px 0 0 0;
  padding-top: 8px;
  border-top: 1px solid #ccc;
  font-size: 9pt;
  font-style: italic;
  color: #333;
  text-align: left;
}
.protocol-pdf .luxmeter-uncertainty-budget__note p {
  margin: 0 0 8px 0;
}
.protocol-pdf .luxmeter-uncertainty-budget__note p:last-child {
  margin-bottom: 0;
}

/* Blok všech mřížek naměřených hodnot [lx] v jedné místnosti */
.protocol-pdf .room-measurement-grids {
  width: 100%;
  margin-bottom: 4px;
  break-inside: avoid;
  page-break-inside: avoid;
}
.protocol-pdf .room-block .room-floor-plans,
.protocol-pdf .room-block .room-photos-protocol {
  break-inside: avoid;
  page-break-inside: avoid;
}
.protocol-pdf .room-block .room-previews > :first-child,
.protocol-pdf .room-block .room-photos-protocol-list > :first-child,
.protocol-pdf .room-block .room-measurement-grids > :nth-child(2) {
  break-before: avoid-page;
  page-break-before: avoid;
}
/* Grid tabulka měření */
.protocol-pdf .grid-table-wrap {
  margin: 10px 0;
  overflow-x: auto;
  page-break-inside: avoid;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.protocol-pdf .grid-caption {
  font-size: 10pt;
  font-weight: normal;
  font-style: italic;
  margin: 8px 0 0 0;
  text-align: center;
  max-width: 100%;
}

.protocol-pdf .grid-cell-legend {
  font-size: 9pt;
  font-weight: normal;
  font-style: normal;
  text-align: left;
  margin: 8px auto 0 auto;
  padding: 0;
  width: fit-content;
  max-width: min(100%, 46em);
  align-self: center;
  list-style: none;
}

.protocol-pdf .grid-cell-legend__item {
  margin: 4px 0;
  display: flex;
  justify-content: flex-start;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 0.2em;
  text-align: left;
}

.protocol-pdf .grid-cell-legend__item--dash::before {
  content: "–";
  flex: 0 0 auto;
  margin-right: 0.35em;
  color: #333;
  font-weight: normal;
}

.protocol-pdf .grid-cell-legend__symbol-swatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  border: 1px solid #292929;
  box-sizing: border-box;
  font-size: 8pt;
  line-height: 1;
}

.protocol-pdf .grid-cell-legend__symbol-swatch--excluded,
.protocol-pdf .grid-cell-legend__symbol-swatch--novalue {
  font-weight: bold;
}

.protocol-pdf .grid-cell-legend__symbol-swatch--nopoint {
  font-weight: normal;
  color: #555;
}

.protocol-pdf .grid-cell-legend__obstacle-swatch {
  display: inline-block;
  vertical-align: middle;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  border: 1px solid #292929;
  box-sizing: border-box;
  background-color: var(--pdf-obstacle-hatch-bg);
  background-image: var(--pdf-obstacle-hatch-svg);
  background-repeat: repeat;
  background-size: 8px 8px;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.protocol-pdf .grid-table td.grid-table__cell--excluded,
.protocol-pdf .grid-table td.grid-table__cell--novalue {
  font-weight: bold;
}

.protocol-pdf .grid-table td.grid-table__cell--nopoint {
  color: #555;
}

/* Prázdná buňka v ploše zrakového úkolu / okolí (měření jinde v protokolu) */
.protocol-pdf .grid-table td.grid-table__cell--taskskip {
  background: #e4e4e8;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.protocol-pdf .grid-cell-legend__taskzone-swatch {
  display: inline-block;
  vertical-align: middle;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  border: 1px solid #292929;
  box-sizing: border-box;
  background: #e4e4e8;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* Buňka v polygonu překážky — jen šrafa, bez symbolu */
.protocol-pdf .grid-table td.grid-table__cell--obstacle {
  background-color: var(--pdf-obstacle-hatch-bg);
  background-image: var(--pdf-obstacle-hatch-svg);
  background-repeat: repeat;
  background-size: 8px 8px;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.protocol-pdf .grid-table {
  border-collapse: collapse;
  font-size: 10pt;
  --grid-cell: 40px;
  min-width: 140px;
}

.protocol-pdf .grid-table th,
.protocol-pdf .grid-table td {
  border: 1px solid #333;
  text-align: center;
  box-sizing: border-box;
}

.protocol-pdf .grid-table th {
  font-weight: bold;
  background: #f5f5f5;
}

/* Čtvercové buňky: hlavičky souřadnic X a naměřené hodnoty */
.protocol-pdf .grid-table thead tr:nth-child(2) th,
.protocol-pdf .grid-table tbody td {
  width: var(--grid-cell);
  min-width: var(--grid-cell);
  max-width: var(--grid-cell);
  height: var(--grid-cell);
  min-height: var(--grid-cell);
  padding: 3px;
  vertical-align: middle;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

/* Řádková souřadnice Y */
.protocol-pdf .grid-table tbody tr > th:not(.grid-table__axis-label) {
  width: auto;
  min-width: 2.7em;
  max-width: 4.5em;
  height: var(--grid-cell);
  min-height: var(--grid-cell);
  padding: 2px 7px;
  vertical-align: middle;
}

/* Sloučené buňky – roh, X (m), Y (m) – bez ohraničení, bílé pozadí */
.protocol-pdf .grid-table__corner,
.protocol-pdf .grid-table__axis-label {
  border: none !important;
  background: #fff !important;
  font-size: 8pt;
  font-weight: bold;
  vertical-align: middle;
  text-align: center;
  width: auto;
  min-width: 0;
  max-width: none;
  height: auto;
  min-height: 0;
}

/* Buňky s hodnotami vzdálenosti (X, Y) – bez ohraničení, bílé pozadí */
.protocol-pdf .grid-table thead tr:nth-child(2) th,
.protocol-pdf .grid-table tbody tr th {
  border: none !important;
  background: #fff !important;
}

/* Znovu vynutit čtverec u číselných hlaviček X a dat (po pravidle výše pro th) */
.protocol-pdf .grid-table thead tr:nth-child(2) th:not(.grid-table__axis-label),
.protocol-pdf .grid-table tbody td {
  width: var(--grid-cell);
  min-width: var(--grid-cell);
  max-width: var(--grid-cell);
  height: var(--grid-cell);
  min-height: var(--grid-cell);
}

.protocol-pdf .grid-table .axis-label {
  font-size: 8pt;
  color: #555;
  padding-top: 4px;
}

/* Půdorys – obrázek v příloze 2 */
.protocol-pdf .floor-plan-img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0;
  page-break-inside: avoid;
}

.protocol-pdf .floor-plan-caption {
  font-size: 9pt;
  margin: 2px 0 12px 0;
}

/* Měření zrakového úkolu – tabulka zón (task / surrounding / background) */
.protocol-pdf .task-mode-results {
  margin: 10px 0;
  page-break-inside: avoid;
  text-align: center;
}
/* Nadpis vyhodnocení + tabulka vždy pohromadě; při přetečení celý blok na další stránku */
.protocol-pdf .evaluation-block {
  break-inside: avoid;
  page-break-inside: avoid;
}
.protocol-pdf .task-mode-intro {
  font-size: 9pt;
  color: #444;
  margin: 8px 0 8px 0;
}
.protocol-pdf .task-zone-table {
  border-collapse: collapse;
  font-size: 9pt;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-left: auto;
  margin-right: auto;
  border: 1.2pt solid #444;
  box-sizing: border-box;
  table-layout: auto;
}
.protocol-pdf .task-zone-table th,
.protocol-pdf .task-zone-table td {
  border: 0.5pt solid #777;
  padding: 5px 7px;
  text-align: center;
  vertical-align: middle;
}
.protocol-pdf .task-zone-table thead th {
  background: #f2f2f2;
  font-weight: 700;
  white-space: nowrap;
}
.protocol-pdf .task-zone-table thead tr:first-child th {
  border-top: 1.2pt solid #444;
}
.protocol-pdf .task-zone-table thead tr:last-child th {
  border-bottom: 1.2pt solid #444;
}
.protocol-pdf .task-zone-table tbody tr:last-child td {
  border-bottom: 1.2pt solid #444;
}
.protocol-pdf .task-zone-table tbody td:nth-child(5) {
  font-weight: 700;
}
.protocol-pdf .task-zone-table .evaluation-table__em-lo,
.protocol-pdf .summary-table .summary-table__em-lo {
  font-weight: bold;
}

/* Náhled: skrýt tabulky měření podle checkboxu */
.protocol-pdf.hide-tables .grid-table-wrap {
  display: none !important;
}

/* Přílohy – ověřovací list, certifikát (embed PDF) */
.protocol-pdf .appendix-watermark-note {
  font-size: 9pt;
  color: #555;
  margin-bottom: 8px;
}
.protocol-pdf .appendix-pdf-pages {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.protocol-pdf .appendix-pdf-page-img {
  width: 100%;
  height: auto;
  max-width: 100%;
  display: block;
  border: 1px solid #ddd;
  border-radius: 4px;
  page-break-inside: avoid;
}
.protocol-pdf .appendix-pdf-no-pages {
  color: #666;
  font-size: 9pt;
  margin: 8px 0 0 0;
}

/* Disclaimer na konci protokolu (nad patičkou) – 8pt, nerušivý, celý blok bez zlomu */
.protocol-pdf .protocol-pdf-disclaimer {
  page-break-inside: avoid;
}
