/* Hoja de impresión del TMS (A4). Se ve solo al imprimir; no depende del modo día/noche. */
#hoja-impresion { display: none; }
.icono-imprimir { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--linea); background: #fff; color: var(--muted); cursor: pointer; padding: 0; flex: 0 0 32px; }
.icono-imprimir:hover { color: var(--brillo); border-color: var(--brillo); }
:root[data-tema="noche"] .icono-imprimir { background: var(--panel-secundario); color: var(--tinta); }
.bandeja-viaje .tarjeta-cabecera .icono-imprimir { align-self: center; }
.celda-pdf { white-space: nowrap; }
.celda-pdf .icono-imprimir { width: 26px; height: 26px; flex-basis: 26px; margin-left: 6px; vertical-align: middle; }
.celda-pdf .icono-imprimir svg { width: 14px; height: 14px; }

/* La hoja en sí (la usan la impresión real y la vista previa) */
#hoja-impresion { box-sizing: border-box; background: #fff; color: #111; font: 11px/1.45 Arial, Helvetica, sans-serif; }
#hoja-impresion * { box-sizing: border-box; }
#hoja-impresion .hi-cab { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-bottom: 10px; border-bottom: 2.5px solid #0b2a44; margin-bottom: 12px; }
#hoja-impresion .hi-cab img { width: 170px; height: auto; display: block; }
#hoja-impresion .hi-titulo { text-align: right; }
#hoja-impresion h1 { margin: 0; font-size: 19px; color: #0b2a44; letter-spacing: -.01em; }
#hoja-impresion .hi-titulo p { margin: 3px 0 0; color: #555; font-size: 10px; }
#hoja-impresion h3 { margin: 0 0 6px; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: #0b2a44; padding-bottom: 3px; border-bottom: 1px solid #b9c7d3; }
#hoja-impresion h4 { margin: 0 0 4px; font-size: 10.5px; color: #0b2a44; text-transform: uppercase; letter-spacing: .06em; }
#hoja-impresion h5 { margin: 8px 0 3px; font-size: 10.5px; }
#hoja-impresion .hi-bloque { margin-bottom: 14px; break-inside: avoid-page; }
#hoja-impresion .hi-sunat { break-inside: auto; border-top: 1.5px dashed #888; padding-top: 10px; }
#hoja-impresion .hi-sec { margin-bottom: 8px; break-inside: avoid; }
#hoja-impresion table { width: 100%; border-collapse: collapse; }
#hoja-impresion .hi-tabla th { background: #e8eef4; color: #0b2a44; text-align: left; font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em; padding: 4px 6px; border: 1px solid #b9c7d3; }
#hoja-impresion .hi-tabla td { padding: 4px 6px; border: 1px solid #c9d4de; vertical-align: top; }
#hoja-impresion .hi-kv th { width: 34%; text-align: left; font-weight: 600; color: #444; padding: 3px 6px; border-bottom: 1px solid #dde5ec; vertical-align: top; }
#hoja-impresion .hi-kv td { padding: 3px 6px; border-bottom: 1px solid #dde5ec; font-weight: 700; }
#hoja-impresion .hi-kv td i { color: #b3151d; font-style: normal; font-weight: 800; }
#hoja-impresion small { color: #555; }
#hoja-impresion .hi-total { margin: 6px 0 0; text-align: right; }
#hoja-impresion .hi-aviso { margin: 0 0 8px; padding: 5px 8px; border: 1px solid #d98a0b; background: #fff6e2; font-size: 10px; }
#hoja-impresion .hi-vacio { margin: 0; color: #666; font-style: italic; }
#hoja-impresion .hi-firmas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 34px; text-align: center; font-size: 10px; color: #444; break-inside: avoid; }
#hoja-impresion .hi-firmas span { display: block; border-top: 1px solid #333; margin-bottom: 4px; height: 26px; }
#hoja-impresion .hi-pie { margin: 14px 0 0; text-align: center; color: #777; font-size: 9px; }

/* Vista previa en pantalla (para revisar la hoja sin imprimir) */
#hoja-impresion.hi-previa { display: block; position: fixed; top: 16px; left: 50%; transform: translateX(-50%); width: 794px; max-height: calc(100vh - 32px); overflow: auto; z-index: 3000; padding: 14mm; box-shadow: 0 0 0 100vmax rgba(5, 18, 32, .6), 0 20px 60px rgba(0, 0, 0, .5); border-radius: 4px; }

@media print {
  @page { size: A4; margin: 12mm; }
  html, body { background: #fff !important; height: auto !important; overflow: visible !important; }
  body > *:not(#hoja-impresion) { display: none !important; }
  #hoja-impresion, #hoja-impresion.hi-previa { display: block !important; position: static !important; transform: none !important; width: auto !important; max-height: none !important; overflow: visible !important; padding: 0 !important; box-shadow: none !important; border-radius: 0 !important; }
  #hoja-impresion { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* La hoja no hereda colores del tema (ni de noche): siempre tinta oscura sobre blanco. */
#hoja-impresion, #hoja-impresion td, #hoja-impresion th, #hoja-impresion p, #hoja-impresion b, #hoja-impresion h5 { color: #111; }
#hoja-impresion td, #hoja-impresion th { font-size: 11px; letter-spacing: 0; text-transform: none; }
#hoja-impresion .hi-kv th { background: transparent; font-size: 10.5px; color: #444; }
#hoja-impresion .hi-tabla th { color: #0b2a44; font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em; }
#hoja-impresion h1, #hoja-impresion h3, #hoja-impresion h4 { color: #0b2a44; }
#hoja-impresion .hi-kv td i { color: #b3151d; }
#hoja-impresion small, #hoja-impresion .hi-titulo p, #hoja-impresion .hi-pie, #hoja-impresion .hi-vacio { color: #555; }
