/**
 * Visor fullscreen mobile del recibo A4 (solo ≤900px).
 * Scoped bajo .recibo-fs-viewer — no afecta print/PDF ni #bloqueRecibo en desktop.
 */

.recibo-fs-viewer {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10300;
  flex-direction: column;
  background: #1c1917;
  color: #f5f5f4;
}

.recibo-fs-viewer.is-open {
  display: flex;
}

body.recibo-fs-viewer-open {
  overflow: hidden;
}

.recibo-fs-viewer__bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  padding: 0.55rem 0.75rem;
  padding-top: calc(0.55rem + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid rgba(168, 162, 158, 0.22);
  background: rgba(28, 25, 23, 0.97);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.recibo-fs-viewer__title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recibo-fs-viewer__zoom-label {
  flex-shrink: 0;
  min-width: 3rem;
  text-align: center;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  color: #a8a29e;
}

.recibo-fs-viewer__close,
.recibo-fs-viewer__reset {
  flex-shrink: 0;
  min-height: 40px;
}

.recibo-fs-viewer__stage {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  padding: 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(165deg, #44403c 0%, #292524 55%, #1c1917 100%);
}

.recibo-fs-viewer__canvas {
  position: relative;
  margin: 0 auto;
}

.recibo-fs-viewer__zoom {
  transform-origin: 0 0;
}

.recibo-fs-viewer__stack.receipt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

/* Geometría A4 fija (PC/print), sin responsive 720px */
.recibo-fs-viewer .receipt-a4sheet {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: 210mm;
  max-width: 210mm;
  min-width: 210mm;
  height: 297mm;
  max-height: 297mm;
  min-height: 297mm;
  margin: 0;
  padding: 10mm 14mm 5mm;
  overflow: hidden;
  flex-shrink: 0;
  background: #fff;
  color: #0f172a;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 10pt;
  line-height: 1.36;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.14);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.recibo-fs-viewer .receipt-a4sheet .receipt-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.recibo-fs-viewer .receipt-a4sheet .receipt-stretch {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.recibo-fs-viewer .receipt-a4sheet .receipt-detail-block {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.recibo-fs-viewer .receipt-a4sheet .receipt-detail-scroll {
  overflow-x: hidden;
  overflow-y: hidden;
}

.recibo-fs-viewer .receipt-a4sheet .receipt-tail {
  flex-shrink: 0;
  margin-top: auto;
}

.recibo-fs-viewer .receipt-facts.receipt-facts--dense.receipt-facts--hybrid {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 1px 22px !important;
}

.recibo-fs-viewer .receipt-top {
  flex-direction: row !important;
  align-items: flex-start;
}

.recibo-fs-viewer .receipt-meta.receipt-meta--dl {
  text-align: right !important;
  width: auto !important;
  max-width: none !important;
}

.recibo-fs-viewer .receipt-total-line--hero {
  flex-wrap: nowrap !important;
  align-items: center !important;
}

.recibo-fs-viewer .receipt-total-line--hero .receipt-total-amt {
  width: auto !important;
  margin-top: 0 !important;
  text-align: right !important;
}

.recibo-fs-viewer .receipt-sign {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 22px !important;
}

/* Vista Recibo: ocultar bloque embebido solo en mobile con recibo listo */
@media (max-width: 900px) {
  #recibo.recibo-vista--mobile-preview #bloqueRecibo {
    display: none !important;
  }

  #btnVerReciboPreviewMobile:not(.hidden) {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }

  #recibo.recibo-vista--mobile-preview .recibo-toolbar__frame {
    flex-wrap: wrap;
  }
}
