:root {
  --blue: #2563EB;
  --orange: #F97316;
  --text: #111827;
  --muted: #6B7280;
  --line: #E5E7EB;
  --bg: #F8FAFC;
  --soft: #F3F4F6;
  
  /* Colores específicos del PDF (Basados en tu imagen) */
  --pdf-navy: #2C3E50;       /* Azul oscuro del encabezado tabla */
  --pdf-bg-terms: #FFF7ED;   /* Fondo beige de términos */
  --pdf-text-head: #374151;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* =========================
   ESTILOS DE LA APP (Formulario)
   ========================= */
.page { max-width: 520px; margin: auto; padding: 12px; }

.header { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; text-align: center; }
.brand { display: flex; justify-content: center; gap: 8px; align-items: center; }
.brand__logo { font-size: 22px; }
.brand__name { font-size: 26px; font-weight: 900; letter-spacing: 0.3px; line-height: 1; }
.brand__name--accent { color: var(--orange); }
.subtitle { margin-top: 6px; font-size: 13px; color: var(--muted); }

.metaCard, .card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 12px; margin-top: 10px; }
.card__title { margin: 0 0 10px 0; font-size: 15px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.field { margin-bottom: 10px; }
.field label { font-size: 13px; margin-bottom: 6px; display: block; }
.req { color: var(--orange); font-weight: 800; font-size: 12px; }
.opt { color: var(--muted); font-size: 12px; font-weight: 700; }

input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 14px; outline: none; background: #fff; }
input:focus, textarea:focus { border-color: rgba(37,99,235,.55); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }

.card__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }

.btn { border: none; border-radius: 12px; padding: 10px 12px; font-weight: 900; cursor: pointer; }
.btn--outline { background: #fff; color: var(--blue); border: 2px solid rgba(37,99,235,.4); padding: 8px 10px; }
.btn--primary { width: 100%; background: var(--orange); color: #fff; font-size: 16px; padding: 14px; }

/* Tabla App */
.tableWrap { overflow: visible; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.table th, .table td { padding: 8px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
.table th { background: var(--soft); text-align: center; font-weight: 900; }
.table th:nth-child(1), .table td:nth-child(1) { width: 40%; text-align: left; }
.table th:nth-child(2), .table td:nth-child(2) { width: 14%; text-align: center; }
.table th:nth-child(3), .table td:nth-child(3) { width: 18%; text-align: right; }
.table th:nth-child(4), .table td:nth-child(4) { width: 20%; text-align: right; }
.table th:nth-child(5), .table td:nth-child(5) { width: 8%; text-align: center; }

.table input { width: 100%; padding: 5px; height: 32px; border-radius: 10px; border: 1px solid var(--line); }
.table .qty { text-align: center; }
.table .price { text-align: right; }
.lineTotal { font-weight: 900; }
.iconBtn { width: 26px; height: 26px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.iconBtn:hover { border-color: var(--orange); color: var(--orange); }

.totals { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 8px; }
.totals__row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; }
.totals__hr { height: 1px; background: var(--line); margin: 8px 0; }
.totals__row--big { font-size: 16px; }
.totals__value--big { font-size: 20px; font-weight: 950; }

.promo { margin-top: 10px; background: linear-gradient(90deg,rgba(37,99,235,.08),rgba(249,115,22,.06)); border: 1px solid var(--line); border-radius: 16px; padding: 12px; display: flex; justify-content: space-between; align-items: center; }
.promo__title { font-weight: 950; font-size: 14px; }
.promo__subtitle { font-size: 12px; margin-top: 2px; }
.promo__cta { background: var(--blue); color: #fff; border: none; border-radius: 14px; padding: 10px 12px; font-weight: 950; cursor: pointer; }
.footer { margin-top: 10px; }

@media(max-width:420px) { .grid2 { grid-template-columns: 1fr; } .page { padding: 10px; } }


/* 1. Header */
.pdfHeader {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 40px;
}
.pdfBrand { display: flex; align-items: center; gap: 12px; }
.pdfLogoImg { width: 50px; height: 50px; } /* Si pones imagen real */
.pdfLogoText { font-size: 32px; font-weight: 800; color: #1F2937; letter-spacing: -0.5px; }
.pdfLogoText span { color: var(--orange); }

.pdfInfoRight { text-align: right; }
.pdfDocTitle { font-size: 24px; font-weight: 700; color: var(--pdf-navy); letter-spacing: 0.5px; text-transform: uppercase; }
.pdfDocNum { font-size: 18px; color: #64748B; margin-top: 4px; }
.pdfDocDate { font-size: 14px; color: #64748B; margin-top: 8px; }

/* 2. Grid Cliente / Emisor con divisor */
.pdfPeopleGrid {
  display: grid; grid-template-columns: 1fr 1px 1fr;
  gap: 30px; margin-bottom: 40px;
  border-top: 1px solid #F1F5F9; border-bottom: 1px solid #F1F5F9;
  padding: 20px 0;
}
.pdfDivider { background: #E2E8F0; height: 100%; }

.pdfCol h3 { font-size: 12px; text-transform: uppercase; color: #64748B; letter-spacing: 1px; margin: 0 0 8px 0; font-weight: 700; }
.pdfName { font-size: 18px; font-weight: 600; color: #1E293B; margin-bottom: 4px; }
.pdfMeta { font-size: 14px; color: #475569; }

/* 3. Tabla estilo "Dark Header" */
.pdfTable { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.pdfTable th {
  background-color: var(--pdf-navy);
  color: #fff;
  text-align: left;
  padding: 12px 15px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
}
/* Bordes redondeados en cabecera */
.pdfTable th:first-child { border-top-left-radius: 8px; }
.pdfTable th:last-child { border-top-right-radius: 8px; }

.pdfTable td {
  padding: 12px 15px;
  border-bottom: 1px solid #F1F5F9;
  font-size: 14px;
  color: #334155;
}
/* Zebra striping (filas pares gris claro) */
.pdfTable tbody tr:nth-child(even) { background-color: #F8FAFC; }

.pdfTable .center { text-align: center; }
.pdfTable .right { text-align: right; }

/* 4. Totales alineados a la derecha */
.pdfTotalsSection {
  display: flex; justify-content: flex-end;
  margin-bottom: 40px;
}
.pdfTotalsBox { width: 250px; }
.pdfTotalRow {
  display: flex; justify-content: space-between;
  padding: 6px 0; font-size: 14px; color: #475569;
}
.pdfTotalRow.final {
  font-size: 18px; font-weight: 800; color: #0F172A;
  border-top: 1px solid #E2E8F0; margin-top: 8px; padding-top: 10px;
}

/* 5. Términos (Caja beige) */
.pdfTerms {
  background-color: var(--pdf-bg-terms);
  border-radius: 8px;
  padding: 15px 20px;
  margin-top: auto; /* Empuja hacia abajo si hay espacio */
  margin-bottom: 60px;
}
.pdfTerms h4 { margin: 0 0 6px 0; font-size: 13px; color: #1F2937; font-weight: 700; }
.pdfTerms p { margin: 0; font-size: 13px; color: #4B5563; line-height: 1.5; white-space: pre-wrap; }

/* 6. Footer con Onda decorativa */
.pdfFooter {
  position: absolute; bottom: 0; left: 0; width: 100%;
  height: 80px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 1;
}
.pdfWeb { font-weight: 700; color: var(--pdf-navy); font-size: 14px; position: relative; z-index: 2; }
.pdfSlogan { color: #64748B; font-size: 12px; margin-top: 2px; position: relative; z-index: 2; }

/* Onda de fondo simulada con CSS (para no usar imagenes externas) */
.pdfWaveBg {
  position: absolute; bottom: 0; right: 0;
  width: 50%; height: 100%;
  background: #FFF7ED; /* Beige claro */
  border-top-left-radius: 100% 100%;
  z-index: 0;
  opacity: 0.8;
}