/* Hoja de documento de Depot E-shop (proforma y acta). Ver b2b-doc.js. Es "papel": siempre fondo blanco y colores fijos, aunque la app esté en modo oscuro.
   Pantalla: tarjeta que se adapta al celular (la tabla se apila). Impresión: A4 vertical compacto, que cabe en una hoja cuando el contenido cabe. */
.b2b-doc {
  --navy: #16324D; --naranja: #E17B4A; --tinta: #111827; --suave: #6B7280; --linea: #E5E7EB; --fondo: #F8FAFC;
  container: bdoc / inline-size; /* el diseño compacto depende del ANCHO DEL DOCUMENTO (p. ej. vista previa junto al formulario), no del ancho de la ventana */
  box-sizing: border-box; width: 100%; max-width: 820px; margin: 0 auto; padding: 30px 34px 22px; background: #fff; color: var(--tinta);
  border: 1px solid var(--linea); border-radius: 14px; font: 13px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.b2b-doc *, .b2b-doc *::before, .b2b-doc *::after { box-sizing: border-box; }
.b2b-doc img { max-width: 100%; }

/* cabecera */
.b2b-doc .bd-cab { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.b2b-doc .bd-logo img { display: block; width: 168px; height: auto; }
.b2b-doc .bd-titulo { text-align: right; }
.b2b-doc .bd-tipo { font-size: 22px; font-weight: 800; letter-spacing: .06em; color: var(--navy); }
.b2b-doc .bd-num { font-size: 15px; font-weight: 700; color: var(--naranja); margin-top: 2px; }
.b2b-doc .bd-meta { font-size: 12px; color: var(--suave); margin-top: 2px; }
.b2b-doc .bd-meta b { color: var(--tinta); font-weight: 600; }
.b2b-doc .bd-barra { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--navy) 0 62%, var(--naranja) 62% 100%); margin: 14px 0 18px; }

/* cliente y detalles */
.b2b-doc .bd-info { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; margin-bottom: 20px; }
.b2b-doc .bd-bloque { background: var(--fondo); border: 1px solid var(--linea); border-radius: 10px; padding: 12px 14px; }
.b2b-doc .bd-et { font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--suave); margin-bottom: 6px; }
.b2b-doc .bd-nombre { font-size: 16px; font-weight: 700; color: var(--navy); line-height: 1.25; }
.b2b-doc .bd-sub { color: #374151; font-weight: 500; }
.b2b-doc .bd-linea { color: #374151; margin-top: 3px; overflow-wrap: anywhere; }
.b2b-doc .bd-linea span { color: var(--suave); margin-right: 6px; }
.b2b-doc .bd-campo { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-bottom: 1px dashed var(--linea); }
.b2b-doc .bd-campo:last-child { border-bottom: 0; }
.b2b-doc .bd-campo span { color: var(--suave); }
.b2b-doc .bd-campo b { text-align: right; font-weight: 600; overflow-wrap: anywhere; }

/* tabla de productos */
.b2b-doc .bd-sec { margin: 4px 0 8px; }
.b2b-doc .bd-tabla { width: 100%; border-collapse: collapse; }
.b2b-doc .bd-tabla th { background: var(--navy); color: #fff; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; text-align: left; padding: 8px 10px; }
.b2b-doc .bd-tabla th:first-child { border-radius: 8px 0 0 8px; } .b2b-doc .bd-tabla th:last-child { border-radius: 0 8px 8px 0; }
.b2b-doc .bd-tabla td { padding: 9px 10px; border-bottom: 1px solid var(--linea); vertical-align: middle; }
.b2b-doc .bd-tabla tbody tr:nth-child(even) td { background: #FAFBFC; }
.b2b-doc .bd-tabla td.bd-ref { width: 16%; font-weight: 600; color: var(--navy); overflow-wrap: anywhere; }
.b2b-doc .bd-tabla th.bd-ref { width: 16%; }
.b2b-doc .bd-tabla .bd-n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.b2b-doc .bd-tabla .bd-c { text-align: left; font-size: 12px; }
.b2b-doc .bd-tabla td.bd-med, .b2b-doc .bd-tabla th.bd-med { width: 14%; white-space: nowrap; }
.b2b-doc .bd-tabla td.bd-sw, .b2b-doc .bd-tabla th.bd-sw { width: 13%; font-weight: 600; }
.b2b-doc .bd-tabla th.bd-c { white-space: nowrap; }
.b2b-doc .bd-tabla td.bd-x, .b2b-doc .bd-tabla th.bd-x { width: 12%; overflow-wrap: break-word; }
.b2b-doc .bd-sub-d { display: block; margin-top: 2px; font-size: 11px; line-height: 1.35; color: var(--suave); overflow-wrap: break-word; }
.b2b-doc .bd-conf { font-style: italic; }
.b2b-doc .bd-comunes { margin: 0 0 10px; padding: 8px 12px; border: 1px solid var(--linea); border-left: 3px solid var(--naranja); border-radius: 8px; background: var(--fondo); }
.b2b-doc .bd-comunes p { margin: 3px 0 0; font-size: 11.5px; color: #374151; }
.b2b-doc .bd-tabla th.bd-n { text-align: right; }
.b2b-doc .bd-tabla .bd-tot { font-weight: 700; }
/* td.bd-desc sigue siendo una celda de tabla (si fuera flex rompería la geometría de la tabla); el flex va en el contenedor interior */
.b2b-doc .bd-desc-in { display: flex; align-items: center; gap: 10px; min-width: 0; }
.b2b-doc .bd-desc span { overflow-wrap: break-word; } .b2b-doc .bd-desc-c { min-width: 0; } .b2b-doc .bd-desc-t { white-space: pre-line; } .b2b-doc .bd-desc em { color: var(--suave); font-style: normal; }
.b2b-doc .bd-mini { width: 38px; height: 38px; object-fit: cover; border-radius: 6px; border: 1px solid var(--linea); flex: none; }
.b2b-doc .bd-tabla-acta .bd-n { width: 12%; }

/* totales y notas */
.b2b-doc .bd-final { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-top: 16px; break-inside: avoid; }
.b2b-doc .bd-notas { flex: 1; font-size: 12px; color: #374151; }
.b2b-doc .bd-notas p { margin: 0; }
.b2b-doc .bd-notas .bd-condicion + .bd-condicion { margin-top: 8px; }
.b2b-doc .bd-anexos { margin-top: 14px; font-size: 12px; color: #374151; break-inside: avoid; }
.b2b-doc .bd-anexos ul { margin: 4px 0 0 18px; padding: 0; }
.b2b-doc .bd-anexos a { color: #c2410c; text-decoration: underline; }
.b2b-doc .bd-anexo-tipo, .b2b-doc .bd-anexo-nota { color: #6b7280; }
.b2b-doc .bd-anexo-nota { margin-top: 4px; font-size: 11px; }
/* Anexos mostrados en la misma página del enlace (23oct2026): una "hoja" más debajo de la proforma, con su encabezado. */
.b2b-doc.bd-anexo-hoja { margin-top: 20px; }
.b2b-doc .bd-anexo-cab { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--navy); color: #fff; padding: 10px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.b2b-doc .bd-anexo-cab .bd-anexo-tipo { color: #cbd5e1; font-weight: 400; }
.b2b-doc .bd-anexo-et { text-transform: uppercase; letter-spacing: .08em; font-size: 11px; color: var(--naranja); margin-right: 4px; }
.b2b-doc .bd-anexo-desc { color: #fff; font-size: 12px; font-weight: 400; text-decoration: underline; }
.b2b-doc .bd-anexo-pag { display: block; width: 100%; height: auto; border: 1px solid var(--linea); border-radius: 4px; margin: 0 0 10px; background: #fff; }
.b2b-doc .bd-anexo-hoja-n { margin: 12px 0 6px; }
.b2b-doc .bd-anexo-tabla-w { overflow-x: auto; border: 1px solid var(--linea); border-radius: 6px; }
.b2b-doc .bd-anexo-tabla { border-collapse: collapse; width: 100%; font-size: 11px; color: var(--tinta); }
.b2b-doc .bd-anexo-tabla td { border-bottom: 1px solid var(--linea); padding: 5px 8px; vertical-align: top; white-space: pre-wrap; }
.b2b-doc .bd-anexo-tabla tr:nth-child(even) td { background: var(--fondo); }
@media print {
  .b2b-doc.bd-anexo-hoja { break-before: page; margin-top: 0; }
  .b2b-doc .bd-anexo-pag { break-inside: avoid; page-break-inside: avoid; max-height: 260mm; width: auto; max-width: 100%; margin: 0 auto 6mm; }
  .b2b-doc .bd-anexo-desc { display: none; }
  .b2b-doc .bd-anexo-tabla-w { overflow: visible; }
}
.b2b-doc .bd-totales { width: 290px; flex: none; }
.b2b-doc .bd-t { display: flex; justify-content: space-between; padding: 5px 4px; color: #374151; }
.b2b-doc .bd-t b { color: var(--tinta); font-weight: 600; }
.b2b-doc .bd-gran { margin-top: 6px; padding: 10px 12px; border-radius: 10px; background: var(--navy); color: #fff; font-size: 15px; font-weight: 700; }
.b2b-doc .bd-gran b { color: #fff; font-size: 17px; font-weight: 800; }
.b2b-doc .bd-moneda { text-align: right; font-size: 10px; color: var(--suave); margin-top: 3px; }

/* respuesta del cliente (proforma) */
.b2b-doc .bd-resp { margin-top: 14px; padding: 10px 14px; border-radius: 10px; font-size: 12.5px; break-inside: avoid; }
.b2b-doc .bd-resp.ok { background: #ECFDF5; border: 1px solid #A7F3D0; color: #065F46; }
.b2b-doc .bd-resp.no { background: #FEF2F2; border: 1px solid #FECACA; color: #991B1B; }

/* acta: evidencias y firma */
.b2b-doc .bd-galeria { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 8px; }
.b2b-doc .bd-galeria figure { margin: 0; break-inside: avoid; }
.b2b-doc .bd-galeria img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; border: 1px solid var(--linea); display: block; }
.b2b-doc .bd-galeria figcaption { font-size: 10.5px; color: var(--suave); margin-top: 3px; overflow-wrap: anywhere; }
.b2b-doc .bd-firmas { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--linea); break-inside: avoid; }
.b2b-doc .bd-firma-img { height: 70px; display: flex; align-items: flex-end; }
.b2b-doc .bd-firma-img img { max-height: 70px; }
.b2b-doc .bd-firma-linea { border-top: 1px solid var(--navy); padding-top: 4px; color: #374151; }
.b2b-doc .bd-firma-linea small { display: block; color: var(--suave); }
.b2b-doc .bd-aprob p { margin: 6px 0 0; color: #374151; font-size: 12px; }
.b2b-doc .bd-chip { display: inline-block; padding: 3px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #E5E7EB; color: #374151; }
.b2b-doc .bd-chip.aprobada { background: #D1FAE5; color: #065F46; } .b2b-doc .bd-chip.rechazada { background: #FEE2E2; color: #991B1B; }

/* pie */
.b2b-doc .bd-pie { margin-top: 20px; padding-top: 10px; border-top: 2px solid var(--naranja); text-align: center; font-size: 11px; color: var(--suave); break-inside: avoid; }
.b2b-doc .bd-pie-marca { font-weight: 800; letter-spacing: .08em; color: var(--navy); text-transform: uppercase; }
.b2b-doc .bd-gracias { margin-top: 2px; font-style: italic; }

/* ancho estrecho (celular o vista previa angosta): el cliente y los detalles se apilan y la tabla pasa a tarjetas por producto */
@media screen and (max-width: 620px) { .b2b-doc { padding: 18px 16px 16px; border-radius: 10px; } }
@supports (container-type: inline-size) {
  @media screen { @container bdoc (max-width: 620px) {
    .b2b-doc .bd-cab { flex-direction: column; align-items: flex-start; }
    .b2b-doc .bd-titulo { text-align: left; }
    .b2b-doc .bd-logo img { width: 140px; }
    .b2b-doc .bd-info { grid-template-columns: 1fr; }
    .b2b-doc .bd-tabla thead { display: none; }
    .b2b-doc .bd-tabla, .b2b-doc .bd-tabla tbody, .b2b-doc .bd-tabla tr, .b2b-doc .bd-tabla td { display: block; width: 100%; }
    .b2b-doc .bd-tabla tr { border: 1px solid var(--linea); border-radius: 10px; margin-bottom: 8px; padding: 6px 10px; background: #fff !important; }
    .b2b-doc .bd-tabla td { border: 0; padding: 3px 0; background: transparent !important; }
    .b2b-doc .bd-tabla td.bd-ref { width: auto; font-size: 11px; }
    .b2b-doc .bd-tabla .bd-n, .b2b-doc .bd-tabla .bd-c, .b2b-doc .bd-tabla td.bd-med, .b2b-doc .bd-tabla td.bd-sw, .b2b-doc .bd-tabla td.bd-x { display: flex; justify-content: space-between; text-align: left; width: 100%; }
    .b2b-doc .bd-tabla .bd-n::before, .b2b-doc .bd-tabla .bd-c::before { content: attr(data-et); color: var(--suave); font-weight: 500; }
    .b2b-doc .bd-tabla-acta .bd-n { width: 100%; }
    .b2b-doc .bd-final, .b2b-doc .bd-firmas { flex-direction: column; grid-template-columns: 1fr; }
    .b2b-doc .bd-totales { width: 100%; }
    .b2b-doc .bd-galeria { grid-template-columns: repeat(2, 1fr); }
  } }
}
@supports not (container-type: inline-size) {
  @media screen and (max-width: 620px) {
  .b2b-doc .bd-cab { flex-direction: column; align-items: flex-start; }
  .b2b-doc .bd-titulo { text-align: left; }
  .b2b-doc .bd-logo img { width: 140px; }
  .b2b-doc .bd-info { grid-template-columns: 1fr; }
  .b2b-doc .bd-tabla thead { display: none; }
  .b2b-doc .bd-tabla, .b2b-doc .bd-tabla tbody, .b2b-doc .bd-tabla tr, .b2b-doc .bd-tabla td { display: block; width: 100%; }
  .b2b-doc .bd-tabla tr { border: 1px solid var(--linea); border-radius: 10px; margin-bottom: 8px; padding: 6px 10px; background: #fff !important; }
  .b2b-doc .bd-tabla td { border: 0; padding: 3px 0; background: transparent !important; }
  .b2b-doc .bd-tabla td.bd-ref { width: auto; font-size: 11px; }
  .b2b-doc .bd-tabla .bd-n, .b2b-doc .bd-tabla .bd-c, .b2b-doc .bd-tabla td.bd-med, .b2b-doc .bd-tabla td.bd-sw, .b2b-doc .bd-tabla td.bd-x { display: flex; justify-content: space-between; text-align: left; width: 100%; }
  .b2b-doc .bd-tabla .bd-n::before, .b2b-doc .bd-tabla .bd-c::before { content: attr(data-et); color: var(--suave); font-weight: 500; }
  .b2b-doc .bd-tabla-acta .bd-n { width: 100%; }
  .b2b-doc .bd-final, .b2b-doc .bd-firmas { flex-direction: column; grid-template-columns: 1fr; }
  .b2b-doc .bd-totales { width: 100%; }
  .b2b-doc .bd-galeria { grid-template-columns: repeat(2, 1fr); }
  }
}

/* impresión: A4 vertical compacto (el @page lo pone cada página: ver b2bPaginaVertical y proforma.html/firmar.html) */
@media print {
  .b2b-doc { max-width: none; width: 100%; padding: 0; border: 0; border-radius: 0; font-size: 9.6pt; line-height: 1.38; background: #fff; }
  .b2b-doc .bd-logo img { width: 42mm; }
  .b2b-doc .bd-tipo { font-size: 17pt; } .b2b-doc .bd-num { font-size: 11.5pt; }
  .b2b-doc .bd-barra { margin: 3mm 0 4mm; }
  .b2b-doc .bd-info { grid-template-columns: 1.4fr 1fr; gap: 4mm; margin-bottom: 5mm; }
  .b2b-doc .bd-bloque { padding: 3mm 3.5mm; }
  .b2b-doc .bd-nombre { font-size: 12pt; }
  .b2b-doc .bd-tabla thead { display: table-header-group; }
  .b2b-doc .bd-tabla tr { break-inside: avoid; }
  .b2b-doc .bd-tabla th, .b2b-doc .bd-tabla td { padding: 2mm 2.5mm; }
  .b2b-doc .bd-mini { width: 9mm; height: 9mm; }
  .b2b-doc .bd-sub-d { font-size: 8.2pt; color: #4b5563; }
  .b2b-doc .bd-tabla td.bd-n { font-size: 9pt; font-weight: 600; }
  .b2b-doc .bd-tabla .bd-c { font-size: 8.6pt; }
  .b2b-doc .bd-comunes { padding: 2mm 3mm; margin-bottom: 3mm; break-inside: avoid; } .b2b-doc .bd-comunes p { font-size: 8pt; }
  .b2b-doc .bd-totales { width: 68mm; }
  .b2b-doc .bd-gran { font-size: 11.5pt; } .b2b-doc .bd-gran b { font-size: 13pt; }
  .b2b-doc .bd-galeria { grid-template-columns: repeat(4, 1fr); gap: 3mm; }
  .b2b-doc .bd-firma-img { height: 18mm; } .b2b-doc .bd-firma-img img { max-height: 18mm; }
  .b2b-doc .bd-pie { margin-top: 6mm; }
}
