/* =====================================================
   PDF templaty pre html2canvas → jsPDF.
   Všetko pod #pdfRoot je renderované off-screen a
   následne vklopené do PDF.
   ===================================================== */

#pdfRoot {
  position: fixed;
  left: -10000px;
  top: 0;
  pointer-events: none;
}

.a4 {
  width: 794px;
  height: 1123px;
  background: #fff;
  color: #000;
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
  font-size: 10.5px;
  line-height: 1.35;
  padding: 28px 32px 22px;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.a4 + .a4 { margin-top: 20px; }

/* ===== spoločné ===== */
.pdf-header {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid #000;
  padding-bottom: 6px; margin-bottom: 8px;
  min-height: 56px;
}
.pdf-h1 { font-size: 18px; font-weight: 700; letter-spacing: 1px; color: #0c2340; }
.pdf-logo-img { height: 52px; width: auto; display: block; }

.pdf-box {
  border: 1px solid #000;
  padding: 6px 8px;
  margin-bottom: 6px;
}
.pdf-line {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 2px 0;
  border-bottom: 1px dotted #999;
  min-height: 18px;
}
.pdf-line:last-child { border-bottom: none; }
.pdf-line-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pdf-line-grid > div {
  display: flex; align-items: center; gap: 6px;
  border-bottom: 1px dotted #999; padding: 2px 0;
}
.pdf-key { font-weight: 700; white-space: nowrap; }
.pdf-fill {
  flex: 0 1 auto; min-width: 80px; padding: 0 4px;
  font-family: "Courier New", Courier, monospace;
}
.pdf-fill.grow { flex: 1; }
.pdf-cb {
  display: inline-block;
  font-family: "Arial Unicode MS", Arial, sans-serif;
  font-size: 12px; line-height: 1; width: 12px; text-align: center;
}
.pdf-note { font-size: 9px; color: #333; margin: 2px 0 4px; font-style: italic; }
.pdf-druh {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px 12px;
  margin-left: 4px; flex: 1;
}
.pdf-druh > span { display: flex; align-items: center; gap: 4px; }

.pdf-rozpis {
  padding-bottom: 4px;
  flex: 1 1 auto;
  display: flex; flex-direction: column;
  min-height: 130px;
}
.pdf-rozpis-area {
  flex: 1; min-height: 100px;
  border-top: 1px dotted #999;
  margin-top: 4px; padding: 4px 2px;
  white-space: pre-wrap;
  font-family: "Courier New", Courier, monospace;
}

.pdf-two-col {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 6px;
  margin-bottom: 6px;
}
.pdf-two-col > * { margin-bottom: 0; }

.pdf-h2 {
  font-weight: 700; font-size: 11px; text-transform: uppercase;
  margin-bottom: 4px; letter-spacing: 0.3px;
}

.pdf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
}
.pdf-table td, .pdf-table th {
  border: 1px solid #000;
  padding: 3px 5px;
  vertical-align: middle;
}
.pdf-table th { background: #f1f5f9; font-weight: 700; text-align: left; }
.pdf-cz { margin-top: 6px; }
.pdf-cz td { font-size: 9.5px; }

.pdf-qa { padding: 6px 8px; }
.pdf-qa-row {
  display: flex; align-items: center; gap: 10px;
  padding: 3px 0;
  border-bottom: 1px dotted #999;
}
.pdf-qa-row:last-child { border-bottom: none; }
.pdf-qa-row > span:first-child { flex: 1; }
.pdf-dovod {
  border-top: 1px dotted #999;
  margin-top: 4px; padding-top: 4px;
  min-height: 28px;
  font-family: "Courier New", Courier, monospace;
}

.pdf-sign { margin-top: auto; padding-top: 16px; }
.pdf-sign-note { font-size: 9.5px; font-style: italic; margin-bottom: 10px; }
.pdf-sign-row { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.pdf-sign-box { position: relative; }
.pdf-sign-line {
  margin: 54px 0 6px;
  border-bottom: 1px solid #000; height: 0;
}
.pdf-sign-label { font-size: 9px; color: #333; text-align: center; }
/* Pečiatka + podpis firmy — nad čiarou v poli zástupcu / dodávateľa */
.pdf-company-stamp {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  height: 88px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  pointer-events: none;
  z-index: 2;
}
.pdf-customer-sign {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  height: 64px;
  width: auto;
  max-width: 92%;
  object-fit: contain;
  pointer-events: none;
  z-index: 2;
}

.pdf-footer {
  margin-top: 10px;
  text-align: center;
  font-size: 8px;
  color: #444;
  border-top: 1px solid #000;
  padding-top: 4px;
}

/* ===== Strana 2 mont. denníka ===== */
.pdf-decl { margin-bottom: 4px; }
.pdf-decl p {
  margin: 0 0 4px;
  font-size: 9.2px;
  text-align: justify;
  line-height: 1.35;
}
.pdf-zar-head {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  margin: 10px 0 4px;
}
.pdf-h1-small {
  font-size: 14px; font-weight: 700; letter-spacing: 0.5px;
  border-bottom: 1px solid #000; padding-bottom: 3px;
}
.pdf-sp { table-layout: fixed; }
.pdf-sp td {
  height: 70px; vertical-align: top; padding: 4px 6px; position: relative;
}
.sp-label { font-size: 9px; }
.sp-space { height: 32px; position: relative; }
.sp-date { font-size: 9px; border-top: 1px dotted #555; padding-top: 2px; }
.pdf-sp-stamp {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  height: 46px;
  width: auto;
  max-width: 96%;
  object-fit: contain;
  pointer-events: none;
}
.pdf-zaruka-text { margin: 8px 0; font-size: 9.5px; text-align: justify; }
.pdf-podm { margin: 0 0 8px 18px; padding: 0; font-size: 9.2px; }
.pdf-podm li { margin-bottom: 2px; text-align: justify; }
.pdf-zrus { margin: 0 0 10px 18px; padding: 0; font-size: 9.2px; }
.pdf-zrus li { margin-bottom: 2px; }

/* ===== Cenová ponuka PDF ===== */
.pdf-quote-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  border-bottom: 2px solid #0c2340;
  padding-bottom: 10px; margin-bottom: 14px;
}
.pdf-quote-title { font-size: 22px; font-weight: 800; color: #0c2340; letter-spacing: 0.5px; }
.pdf-quote-num { font-size: 12px; color: #64748b; margin-top: 2px; }
.pdf-cust-block {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
  margin-bottom: 16px; font-size: 11px;
}
.pdf-cust-block .col h4 {
  margin: 0 0 6px; font-size: 10px; color: #64748b;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.pdf-cust-block .col p { margin: 0; line-height: 1.5; }

.pdf-quote-items { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.pdf-quote-items th, .pdf-quote-items td {
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 6px;
  vertical-align: top;
  font-size: 11px;
}
.pdf-quote-items th {
  background: #0c2340; color: #fff;
  text-align: left; font-weight: 700; font-size: 10px;
  text-transform: uppercase;
}
.pdf-quote-items td.right { text-align: right; white-space: nowrap; }
.pdf-quote-items td.center { text-align: center; }
.pdf-quote-items img.qi { max-width: 70px; max-height: 60px; border-radius: 4px; }
.pdf-quote-items .item-name { font-weight: 700; }
.pdf-quote-items .item-desc { color: #64748b; font-size: 10px; margin-top: 3px; }

.pdf-quote-total {
  margin-left: auto; width: 300px;
  border-top: 2px solid #0c2340;
  padding: 8px 0;
}
.pdf-quote-total .line {
  display: flex; justify-content: space-between;
  padding: 3px 0; font-size: 12px;
}
.pdf-quote-total .line.grand {
  border-top: 1px solid #cbd5e1;
  margin-top: 6px; padding-top: 8px;
  font-size: 16px; font-weight: 800; color: #0c2340;
}

/* ===== Cestovný príkaz PDF ===== */
.pdf-travel-head {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 2px solid #0c2340; padding-bottom: 10px; margin-bottom: 14px;
}
.pdf-travel-title { font-size: 20px; font-weight: 800; color: #0c2340; }
.pdf-travel-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  font-size: 11px;
  margin-bottom: 14px;
}
.pdf-travel-grid .cell {
  border: 1px solid #cbd5e1; border-radius: 8px; padding: 8px 10px;
}
.pdf-travel-grid .cell .label { color: #64748b; font-size: 10px; text-transform: uppercase; letter-spacing: 0.3px; }
.pdf-travel-grid .cell .value { font-weight: 700; font-size: 12px; color: #0c2340; }

.pdf-travel-calc {
  margin-top: 14px; border-top: 2px solid #0c2340; padding-top: 8px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; font-size: 11px;
}
.pdf-travel-calc .box { border: 1px solid #cbd5e1; border-radius: 6px; padding: 6px 8px; }
.pdf-travel-calc .box .label { color: #64748b; font-size: 9px; text-transform: uppercase; }
.pdf-travel-calc .box .value { font-weight: 700; font-size: 13px; color: #0c2340; margin-top: 2px; }
.pdf-travel-calc .box.grand { background: #0c2340; color: #fff; }
.pdf-travel-calc .box.grand .label { color: rgba(255,255,255,0.7); }
.pdf-travel-calc .box.grand .value { color: #fff; }
