/* Printed / PDF output = customer view only.
   .ic-only is force-hidden here regardless of the on-screen toggle state. */

.print-only, .print-only-inline, .print-only-row { display: none; }

@media print {
  @page { size: A4; margin: 14mm 12mm; }

  .no-print, .topbar, .btn, button, .row-actions, .add-term-row {
    display: none !important;
  }

  .ic-only { display: none !important; }

  html, body {
    background: #fff !important;
    color: #14181f !important;
    font-size: 12.5px;
  }

  .wrap {
    max-width: none;
    padding: 0;
    margin: 0;
    min-height: 269mm;
    display: flex;
    flex-direction: column;
  }

  .terms-panel { margin-top: auto !important; }

  .print-only-inline { display: inline !important; }

  /* ---------- Letterhead: logo left, boxed meta table right ---------- */

  .print-only.print-letterhead {
    display: flex !important;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
  }

  .print-brand { display: block; }
  .print-brand img.logo { height: 80px; width: auto; }

  /* ---------- Hero title: centered "Teklif" + green rule ---------- */

  .print-only.print-hero {
    display: block !important;
    text-align: center;
    margin: 34px 0 28px;
  }
  .print-hero-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 28px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #14181f;
  }
  .print-hero-rule {
    height: 3px;
    background: #14181f;
    border-radius: 2px;
    margin-top: 18px;
  }

  table.print-meta-table {
    border-collapse: collapse;
    font-size: 12px;
  }
  table.print-meta-table th,
  table.print-meta-table td {
    border: none;
    border-bottom: 1px solid #e5e8ee;
    padding: 5px 0;
  }
  table.print-meta-table th {
    text-align: left;
    padding-right: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 10.5px;
    color: #6b7688;
    white-space: nowrap;
  }
  table.print-meta-table td {
    text-align: left;
    min-width: 160px;
    font-weight: 600;
    color: #14181f;
  }

  .panel {
    background: #fff !important;
    border: none !important;
    padding: 0 !important;
    margin-bottom: 16px !important;
    break-inside: avoid;
  }

  .panel-title {
    color: #14181f !important;
    font-family: var(--font-display) !important;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.06em !important;
    text-transform: uppercase !important;
    text-decoration: none;
    border-bottom: 1px solid #dde1e8 !important;
    padding-bottom: 6px;
  }

  .items-panel-title { display: none !important; }

  input, textarea {
    background: transparent !important;
    border: none !important;
    color: #14181f !important;
    padding: 2px 0 !important;
    font-family: inherit !important;
  }

  input[type="number"] { -moz-appearance: textfield; }
  input[type="number"]::-webkit-inner-spin-button,
  input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }

  label { color: #6b7688 !important; }

  /* ---------- Full bordered grid, matching the printed quote form ----------
     table-layout:fixed + explicit % widths on the visible header cells keeps
     the table within the A4 content width. Without this, auto-layout sizes
     columns off each cell's content/input intrinsic width and long product
     codes push the table wider than the page — it gets silently clipped on
     the right edge instead of wrapping. */

  .items-table-wrap {
    border: 1px solid #e5e8ee;
    border-radius: 10px;
    overflow: hidden;
  }

  table.items {
    min-width: 0;
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
  }
  table.items th, table.items td {
    border: none !important;
    border-bottom: 1px solid #e5e8ee !important;
    padding: 9px 8px;
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: normal !important;
  }
  table.items tbody tr:last-child td { border-bottom: none !important; }
  table.items th {
    color: #6b7688 !important;
    background: #fff;
    font-family: var(--font-body) !important;
    font-weight: 600;
    font-size: 9.5px;
    text-transform: uppercase !important;
    letter-spacing: 0.02em !important;
    white-space: nowrap !important;
    border-bottom: 2px solid #e5e8ee !important;
  }
  table.items td.col-sira { text-align: center; color: #14181f; font-weight: 700; }
  table.items td.row-total { color: #14181f; font-weight: 700; }
  table.items td.col-fiyat, table.items td.col-toplam { white-space: nowrap !important; }

  table.items th.col-sira { width: 7%; }
  table.items th.col-urun { width: 29%; }
  table.items th.col-miktar { width: 8%; }
  table.items th.col-fiyat { width: 17%; }
  table.items th.col-toplam { width: 17%; }
  table.items th.col-teslim { width: 22%; }

  td.col-urun { min-width: 0 !important; }
  table.items input { width: 100%; box-sizing: border-box; }

  .print-only.print-total-plain {
    display: block !important;
    margin: 18px 0 30px auto;
    width: 260px;
  }
  .print-total-plain .ptp-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 3px 0;
  }
  .print-total-plain .ptp-label {
    color: #8b93a3;
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
  .print-total-plain .ptp-value {
    color: #14181f;
    font-family: var(--font-mono);
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
  }
  .print-total-plain .ptp-row.ptp-final {
    border-top: 1px solid #dde1e8;
    margin-top: 4px;
    padding-top: 8px;
  }
  .print-total-plain .ptp-final .ptp-label { color: #14181f; font-size: 11px; }
  .print-total-plain .ptp-final-value {
    font-size: 15px;
    font-weight: 700;
  }

  .scope-panel.is-empty { display: none !important; }
  .print-only.scope-print {
    display: block !important;
    white-space: pre-wrap;
    font-size: 11.5px;
    line-height: 1.6;
    color: #14181f !important;
  }

  .terms-list .term-row { gap: 4px; }
  .terms-panel .terms-list input { font-size: 10px; }

  .terms-with-approval {
    display: flex;
    align-items: flex-start;
    gap: 24px;
  }
  .terms-with-approval .terms-list { flex: 1 1 auto; min-width: 0; }

  .print-only.approval-box {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
    width: 190px;
    flex: none;
    padding: 14px;
    border: 1px solid #dde1e8;
    border-radius: 10px;
  }
  .approval-label {
    color: #8b93a3;
    font-family: var(--font-body);
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
  .approval-stamp {
    height: 84px;
    border: 1px dashed #c9ced8;
    border-radius: 6px;
    display: flex;
    align-items: flex-end;
    padding: 6px;
  }

  .footer-note {
    color: #4a5568 !important;
    border-top: 1px solid #d7dce4;
    padding-top: 8px;
    margin-top: 24px;
  }

  a { color: inherit; text-decoration: none; }
}


/* ---------- On-screen PDF preview (Kayitli Teklifler > Goruntule) ----------
   Mirrors the @media print rules above but applies on screen when body has
   .pdf-preview-mode, so index.html can render inside an iframe without
   triggering window.print(). Keep in sync with @media print by hand if that
   block changes. */

body.pdf-preview-mode .no-print,
body.pdf-preview-mode .topbar,
body.pdf-preview-mode .btn,
body.pdf-preview-mode button,
body.pdf-preview-mode .row-actions,
body.pdf-preview-mode .add-term-row {
  display: none !important;
}

body.pdf-preview-mode .ic-only {
  display: none !important;
}

body.pdf-preview-mode {
  background: #fff !important;
  color: #14181f !important;
  font-size: 12.5px;
}

body.pdf-preview-mode .wrap {
  max-width: none;
  padding: 14mm 12mm;
  margin: 0;
  min-height: 269mm;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

body.pdf-preview-mode .terms-panel {
  margin-top: auto !important;
}

body.pdf-preview-mode .print-only-inline {
  display: inline !important;
}

body.pdf-preview-mode .print-only.print-letterhead {
  display: flex !important;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

body.pdf-preview-mode .print-brand {
  display: block;
}

body.pdf-preview-mode .print-brand img.logo {
  height: 80px;
  width: auto;
}

body.pdf-preview-mode .print-only.print-hero {
  display: block !important;
  text-align: center;
  margin: 34px 0 28px;
}

body.pdf-preview-mode .print-hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #14181f;
}

body.pdf-preview-mode .print-hero-rule {
  height: 3px;
  background: #14181f;
  border-radius: 2px;
  margin-top: 18px;
}

body.pdf-preview-mode table.print-meta-table {
  border-collapse: collapse;
  font-size: 12px;
}

body.pdf-preview-mode table.print-meta-table th,
body.pdf-preview-mode table.print-meta-table td {
  border: none;
  border-bottom: 1px solid #e5e8ee;
  padding: 5px 0;
}

body.pdf-preview-mode table.print-meta-table th {
  text-align: left;
  padding-right: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 10.5px;
  color: #6b7688;
  white-space: nowrap;
}

body.pdf-preview-mode table.print-meta-table td {
  text-align: left;
  min-width: 160px;
  font-weight: 600;
  color: #14181f;
}

body.pdf-preview-mode .panel {
  background: #fff !important;
  border: none !important;
  padding: 0 !important;
  margin-bottom: 16px !important;
  break-inside: avoid;
}

body.pdf-preview-mode .panel-title {
  color: #14181f !important;
  font-family: var(--font-display) !important;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
  text-decoration: none;
  border-bottom: 1px solid #dde1e8 !important;
  padding-bottom: 6px;
}

body.pdf-preview-mode .items-panel-title {
  display: none !important;
}

body.pdf-preview-mode input,
body.pdf-preview-mode textarea {
  background: transparent !important;
  border: none !important;
  color: #14181f !important;
  padding: 2px 0 !important;
  font-family: inherit !important;
}

body.pdf-preview-mode input[type="number"] {
  -moz-appearance: textfield;
}

body.pdf-preview-mode input[type="number"]::-webkit-inner-spin-button,
body.pdf-preview-mode input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

body.pdf-preview-mode label {
  color: #6b7688 !important;
}

body.pdf-preview-mode .items-table-wrap {
  border: 1px solid #e5e8ee;
  border-radius: 10px;
  overflow: hidden;
}

body.pdf-preview-mode table.items {
  min-width: 0;
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

body.pdf-preview-mode table.items th,
body.pdf-preview-mode table.items td {
  border: none !important;
  border-bottom: 1px solid #e5e8ee !important;
  padding: 9px 8px;
  overflow-wrap: break-word;
  word-break: break-word;
  white-space: normal !important;
}

body.pdf-preview-mode table.items tbody tr:last-child td {
  border-bottom: none !important;
}

body.pdf-preview-mode table.items th {
  color: #6b7688 !important;
  background: #fff;
  font-family: var(--font-body) !important;
  font-weight: 600;
  font-size: 9.5px;
  text-transform: uppercase !important;
  letter-spacing: 0.02em !important;
  white-space: nowrap !important;
  border-bottom: 2px solid #e5e8ee !important;
}

body.pdf-preview-mode table.items td.col-sira {
  text-align: center;
  color: #14181f;
  font-weight: 700;
}

body.pdf-preview-mode table.items td.row-total {
  color: #14181f;
  font-weight: 700;
}

body.pdf-preview-mode table.items td.col-fiyat,
body.pdf-preview-mode table.items td.col-toplam {
  white-space: nowrap !important;
}

body.pdf-preview-mode table.items th.col-sira {
  width: 7%;
}

body.pdf-preview-mode table.items th.col-urun {
  width: 29%;
}

body.pdf-preview-mode table.items th.col-miktar {
  width: 8%;
}

body.pdf-preview-mode table.items th.col-fiyat {
  width: 17%;
}

body.pdf-preview-mode table.items th.col-toplam {
  width: 17%;
}

body.pdf-preview-mode table.items th.col-teslim {
  width: 22%;
}

body.pdf-preview-mode td.col-urun {
  min-width: 0 !important;
}

body.pdf-preview-mode table.items input {
  width: 100%;
  box-sizing: border-box;
}

body.pdf-preview-mode .print-only.print-total-plain {
  display: block !important;
  margin: 18px 0 30px auto;
  width: 260px;
}

body.pdf-preview-mode .print-total-plain .ptp-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 3px 0;
}

body.pdf-preview-mode .print-total-plain .ptp-label {
  color: #8b93a3;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

body.pdf-preview-mode .print-total-plain .ptp-value {
  color: #14181f;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

body.pdf-preview-mode .print-total-plain .ptp-row.ptp-final {
  border-top: 1px solid #dde1e8;
  margin-top: 4px;
  padding-top: 8px;
}

body.pdf-preview-mode .print-total-plain .ptp-final .ptp-label {
  color: #14181f;
  font-size: 11px;
}

body.pdf-preview-mode .print-total-plain .ptp-final-value {
  font-size: 15px;
  font-weight: 700;
}

body.pdf-preview-mode .scope-panel.is-empty {
  display: none !important;
}

body.pdf-preview-mode .print-only.scope-print {
  display: block !important;
  white-space: pre-wrap;
  font-size: 11.5px;
  line-height: 1.6;
  color: #14181f !important;
}

body.pdf-preview-mode .terms-list .term-row {
  gap: 4px;
}

body.pdf-preview-mode .terms-panel .terms-list input {
  font-size: 10px;
}

body.pdf-preview-mode .terms-with-approval {
  display: flex;
  align-items: flex-start;
  gap: 24px;
}

body.pdf-preview-mode .terms-with-approval .terms-list {
  flex: 1 1 auto;
  min-width: 0;
}

body.pdf-preview-mode .print-only.approval-box {
  display: flex !important;
  flex-direction: column;
  gap: 12px;
  width: 190px;
  flex: none;
  padding: 14px;
  border: 1px solid #dde1e8;
  border-radius: 10px;
}

body.pdf-preview-mode .approval-label {
  color: #8b93a3;
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

body.pdf-preview-mode .approval-stamp {
  height: 84px;
  border: 1px dashed #c9ced8;
  border-radius: 6px;
  display: flex;
  align-items: flex-end;
  padding: 6px;
}

body.pdf-preview-mode .footer-note {
  color: #4a5568 !important;
  border-top: 1px solid #d7dce4;
  padding-top: 8px;
  margin-top: 24px;
}

body.pdf-preview-mode a {
  color: inherit;
  text-decoration: none;
}
