.pvj-card {
  margin-top: 18px;
  padding: 22px;
  border-radius: 22px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e5e7eb;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.1);
}

.pvj-header h2 {
  margin: 0;
  font-size: clamp(22px, 2vw, 30px);
  letter-spacing: -0.02em;
  color: #0f172a;
}

.pvj-model-name {
  margin: 8px 0 4px;
  font-size: 15px;
  color: #1f2937;
}

.pvj-model-desc {
  margin: 0;
  color: #64748b;
  font-size: 14px;
}

/* ─── Layout principal ─── */

.pvj-layout {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pvj-panel {
  border-radius: 16px;
  border: 1px solid #e5e7eb;
  background: #f8fafc;
  padding: 14px;
}

.pvj-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pvj-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.pvj-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pvj-label {
  flex: 1;
  font-size: 12px;
  font-weight: 650;
  color: #64748b;
  display: flex;
  align-items: flex-end;
}

.pvj-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pvj-input {
  width: 100%;
  min-width: 0;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
  color: #111827;
  padding: 9px 10px;
  font-size: 14px;
}

.pvj-input:focus {
  outline: 2px solid rgba(196, 30, 58, 0.2);
  border-color: #c41e3a;
}

.pvj-unit {
  font-size: 12px;
  color: #6b7280;
  min-width: 30px;
}

.pvj-submit {
  margin-top: 4px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(180deg, #d12044 0%, #b31634 100%);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 11px 12px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(196, 30, 58, 0.3);
}

.pvj-submit:hover {
  background: linear-gradient(180deg, #dc2b4e 0%, #bc1838 100%);
}

.pvj-feedback {
  min-height: 18px;
  font-size: 12px;
  margin: 2px 0 0;
}

.pvj-feedback.is-loading {
  color: #64748b;
}

.pvj-feedback.is-ok {
  color: #16a34a;
}

.pvj-feedback.is-error {
  color: #ef4444;
}

/* ─── Cards de peças individuais (1 SVG por vidro) ─── */

.pvj-pieces {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pvj-piece-card {
  border-radius: 16px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  overflow: hidden;
}

.pvj-piece-header {
  padding: 10px 16px;
  font-weight: 700;
  font-size: 14px;
  color: #0f172a;
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
}

.pvj-piece-svg {
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(0deg, rgba(226, 232, 240, 0.25) 1px, transparent 1px),
    linear-gradient(90deg, rgba(226, 232, 240, 0.25) 1px, transparent 1px),
    #ffffff;
  background-size: 24px 24px, 24px 24px, auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.pvj-piece-svg svg {
  width: 100%;
  height: auto;
  display: block;
}

/* ─── Estilos SVG – Compartilhados ─── */

.pv-cota-text { font: 700 12px "Inter","Segoe UI",Arial,sans-serif; letter-spacing: .02em; fill: #838383 }
.pv-hole { fill: #fff; stroke: #838383; stroke-width: 2 }
.pv-hole-tag { font: 700 10px "Inter","Segoe UI",Arial,sans-serif; fill: #1f2937 }

/* ─── Estilos SVG – Overview (svgBase) ─── */

.pv-overview .pv-vidro { fill: none; stroke: #078dbd; stroke-width: 2.2 }
.pv-overview .pv-bandeira { fill: none; stroke: #078dbd; stroke-width: 2.2 }
.pv-overview .pv-fixo { fill: none; stroke: #078dbd; stroke-width: 2.2 }
.pv-overview .pv-lateral { fill: none; stroke: #078dbd; stroke-width: 2 }
.pv-overview .pv-cota { stroke: #838383; stroke-width: 1.2 }
.pv-overview .pv-dim  { stroke: #838383; stroke-width: 1.2 }
.pv-overview .pv-label { font: 600 11px "Inter","Segoe UI",Arial,sans-serif; fill: #334155 }
.pv-overview .pv-fixed-text { font: 700 11px "Inter","Segoe UI",Arial,sans-serif; fill: #838383 }
.pv-overview .pv-piece-label { font: 700 15px "Inter","Segoe UI",Arial,sans-serif; fill: #0f172a }
.pv-overview .pv-ext { stroke: #838383; stroke-width: 1; stroke-dasharray: 0 }
.pv-overview .pv-ext-cad { stroke: #4b5563; stroke-width: 1 }
.pv-overview .pv-dim-cad { stroke: #111827; stroke-width: 1.2 }
.pv-overview .pv-cad-text { font: 700 12px "Inter","Segoe UI",Arial,sans-serif; fill: #838383 }
.pv-overview .pv-hole-note { font: 700 18px "Inter","Segoe UI",Arial,sans-serif; fill: #838383 }
.pv-overview .pv-piece-name { font: 700 24px "Inter","Segoe UI",Arial,sans-serif; fill: #078dbd }
.pv-overview .pv-note { font: 600 11px "Inter","Segoe UI",Arial,sans-serif; fill: #475569 }

/* ─── Estilos SVG – ISO por peça (svgPiece) ───
   Nota: a maioria dos estilos ISO agora vem inline no <style> do SVG,
   com dimensões dinâmicas calibradas para papel 1:15.
   Estas regras servem como fallback. ─── */

.pv-iso .pv-vidro, .pv-iso .pv-fixo, .pv-iso .pv-bandeira, .pv-iso .pv-lateral { fill: none }
.pv-iso .pv-erase { stroke: #fff }

/* ─── Folha A4 imprimível ─── */

.pvj-a4-page {
  position: relative;
  width: 100%;
  max-width: 650px;
  aspect-ratio: 2100 / 2910;
  margin: 16px auto;
  background: url('/img/fundo_pv.webp') center / cover no-repeat;
  overflow: hidden;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12);
}

.pvj-a4-drawing {
  position: absolute;
  top: 3%;
  left: 3%;
  right: 3%;
  bottom: 10%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.pvj-a4-svg-wrap {
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pvj-a4-svg-wrap svg {
  display: block;
  height: 100%;
  width: auto;
  max-width: 100%;
}

.pvj-a4-piecename {
  position: absolute;
  bottom: 10%;
  right: 70px;
  text-align: right;
  font: 700 16px "Inter", sans-serif;
  color: #85b1ad;
}

.pvj-a4-produto-desc {
  position: absolute;
  bottom: 25px;
  right: 45px;
  text-align: right;
  font: 700 15px "Inter", sans-serif;
  color: #197393;
}

/* ─── Detalhe técnico (imagem dentro da página A4) ─── */

.pvj-detalhe-img {
  position: absolute;
  bottom: 50%;
  right: 5%;
  width: 45%;
  object-fit: contain;
  pointer-events: none;
}

/* ─── Folha de Rosto (capa A4 com dados) ─── */

.pvj-cover-content {
  position: absolute;
  top: 4%;
  left: 6%;
  right: 6%;
  bottom: 12%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
}

.pvj-cover-title {
  margin: 0 0 2px;
  font-size: clamp(16px, 2.5vw, 22px);
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.pvj-cover-model {
  margin: 0;
  font-size: clamp(13px, 2vw, 17px);
  font-weight: 700;
  color: #078dbd;
}

.pvj-cover-desc {
  margin: 2px 0 0;
  font-size: clamp(10px, 1.4vw, 13px);
  color: #64748b;
  line-height: 1.4;
}

.pvj-cover-section {
  margin-top: clamp(10px, 2vw, 20px);
}

.pvj-cover-section-title {
  margin: 0 0 6px;
  font-size: clamp(10px, 1.4vw, 13px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #475569;
  padding-bottom: 4px;
  border-bottom: 2px solid #e2e8f0;
}

.pvj-cover-group {
  margin-top: clamp(8px, 1.2vw, 14px);
  font-size: clamp(10px, 1.3vw, 12px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #078dbd;
  padding-bottom: 2px;
  border-bottom: 1px solid #e2e8f0;
}

.pvj-cover-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 3px 0;
  font-size: clamp(10px, 1.3vw, 13px);
  line-height: 1.4;
}

.pvj-cover-row-label {
  color: #334155;
  white-space: nowrap;
}

.pvj-cover-row-dots {
  flex: 1;
  border-bottom: 1px dotted #cbd5e1;
  min-width: 20px;
  margin-bottom: 3px;
}

.pvj-cover-row-val {
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
}

/* ─── Campos de texto do projeto (Pedido, Obra, Ambiente) ─── */

.pvj-project-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e5e7eb;
}

.pvj-text-input {
  font-size: 14px;
}

/* Dados do projeto na capa (Pedido, Obra, Ambiente) */

.pvj-cover-row-project {
  gap: 8px;
}

.pvj-cover-row-val-project {
  color: #078dbd;
}

/* ─── Cabeçalho das folhas de peças (Pedido / Obra / Ambiente) ─── */

.pvj-a4-header {
  position: absolute;
  top: 3%;
  left: 5%;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  font-size: clamp(8px, 1.2vw, 11px);
  color: #334155;
  z-index: 1;
}

.pvj-a4-header-item {
  white-space: nowrap;
}

.pvj-a4-header-label {
  color: #64748b;
}

.pvj-a4-header-item strong {
  color: #078dbd;
  font-weight: 700;
}

/* ─── Botão Imprimir ─── */

.pvj-print-btn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
  color: #334155;
  font-weight: 600;
  font-size: 13px;
  padding: 9px 16px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.pvj-print-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

/* ─── Impressão ─── */

@media print {
  /* Esconder tudo que não é folha A4 */
  body.pvj-printing .layout-header,
  body.pvj-printing .vr-crumbs,
  body.pvj-printing .vr-hero,
  body.pvj-printing .pvj-header,
  body.pvj-printing .pvj-panel,
  body.pvj-printing .pvj-project-fields,
  body.pvj-printing .pvj-print-btn,
  body.pvj-printing .pvj-feedback,
  body.pvj-printing .pvj-model-name,
  body.pvj-printing .pvj-model-desc,
  body.pvj-printing #orcamento-parceiro-modal,
  body.pvj-printing footer,
  body.pvj-printing [class*="footer"],
  body.pvj-printing [class*="Footer"],
  body.pvj-printing noscript {
    display: none !important;
  }

  /* Limpar ancestrais para que as folhas A4 fluam direto */
  body.pvj-printing,
  body.pvj-printing .layout-container,
  body.pvj-printing .layout-main,
  body.pvj-printing .variacao-page,
  body.pvj-printing .pvj-card,
  body.pvj-printing .pvj-layout,
  body.pvj-printing .pvj-results,
  body.pvj-printing .pvj-pieces {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: none !important;
    max-width: none !important;
    width: 100% !important;
    gap: 0 !important;
    border-radius: 0 !important;
    overflow: visible !important;
  }

  /* Cada folha A4 ocupa uma página inteira */
  body.pvj-printing .pvj-a4-page {
    display: block !important;
    page-break-after: always;
    page-break-inside: avoid;
    width: 100% !important;
    max-width: none !important;
    height: 100vh;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    aspect-ratio: auto;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body.pvj-printing .pvj-a4-page:last-child {
    page-break-after: auto;
  }

  /* Background da folha no print */
  body.pvj-printing .pvj-a4-page {
    background: url('/img/fundo_pv.webp') center / cover no-repeat !important;
  }
}

/* ─── Mobile ─── */

@media (max-width: 600px) {
  .pvj-card {
    padding: 14px;
    border-radius: 16px;
  }

  .pvj-inputs {
    grid-template-columns: 1fr;
  }

  .pvj-piece-svg {
    padding: 4px;
  }

  .pvj-a4-page {
    max-width: 100%;
    margin: 10px auto;
  }

  .pvj-a4-piecename {
    font-size: 13px;
  }

  .pvj-a4-produto-desc {
    font-size: 11px;
    bottom: 10px;
    right: 15px;
  }

  .pvj-cover-content {
    top: 3%;
    left: 4%;
    right: 4%;
  }
}

/* ─── Select inputs (boolean, side, select) ─── */

.pvj-select {
  width: 100%;
  min-width: 0;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
  color: #111827;
  padding: 9px 10px;
  font-size: 14px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.pvj-select:focus {
  outline: 2px solid rgba(196, 30, 58, 0.2);
  border-color: #c41e3a;
}

.pvj-text-info {
  font-size: 13px;
  color: #64748b;
  font-style: italic;
  padding: 9px 0;
}

/* ─── Inverter Lados checkbox ─── */

.pvj-inverter-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #f0f4f8;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.pvj-inverter-wrap:hover {
  background: #e8edf3;
}

.pvj-inverter-wrap input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #c41e3a;
  cursor: pointer;
}

.pvj-inverter-label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.pvj-inverter-hint {
  font-size: 11px;
  color: #94a3b8;
  margin-left: auto;
}
