/* ============================================================
   INFORMES IMPRIMIBLES (layout InformeLayout, sin menú ni cabecera).
   La página se maqueta como una HOJA A4 real (210 × 297 mm) sobre un fondo
   gris, con una barra fija de mandos que no se imprime. Al imprimir, la
   hoja ocupa la página física y el navegador pagina el contenido.
   Variables de color: las de app.css (--borde, --acento, --texto…).
   ============================================================ */
.informe-fondo { min-height: 100vh; background: #dfe3e8; padding: 72px 24px 48px; }
.informe-barra {
    position: fixed; top: 0; left: 0; right: 0; height: 52px; z-index: 20;
    background: #fff; border-bottom: 1px solid var(--borde);
    display: flex; align-items: center; gap: 12px; padding: 0 24px;
}
.informe-barra .filtro-label { font-size: 13px; color: var(--texto-suave); }
.informe-barra input, .informe-barra select {
    border: 1px solid var(--neutral-175); border-radius: var(--radio); padding: 6px 10px; font: inherit; font-size: 13px;
}
.informe-barra .btn-rojo, .informe-barra .btn-primario { margin-top: 0; }
.informe-barra-titulo { margin-left: auto; font-size: 13px; color: var(--texto-suave); }
.informe-fondo .login-error { width: 210mm; max-width: 100%; margin: 0 auto 16px; }
.informe-fondo > .subtexto { text-align: center; }

.informe {
    background: #fff; color: #000; width: 210mm; min-height: 297mm; margin: 0 auto;
    padding: 15mm 16mm; box-sizing: border-box; box-shadow: 0 2px 16px rgba(0,0,0,.22);
    font-family: "Fira Sans", Arial, Helvetica, sans-serif; font-size: 10.5pt; line-height: 1.35;
}
.informe-apaisado { width: 297mm; min-height: 210mm; }
.informe-hoja-carnet { display: flex; align-items: flex-start; justify-content: center; padding-top: 25mm; }

.informe-cabecera { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 14px; }
.informe-empresa { font-size: 15pt; font-weight: 700; }
.informe-titulo-bloque { text-align: right; }
.informe-cabecera .informe-titulo-bloque:only-child { text-align: left; }
.informe-titulo { font-size: 17pt; font-weight: 500; margin: 0; letter-spacing: .2px; }
.informe-sub { font-size: 9pt; color: #555; }
.informe-obra { font-size: 12.5pt; font-weight: 600; margin: 0 0 16px; }
.informe-logo { max-height: 14mm; max-width: 45mm; object-fit: contain; }

.informe-seccion { margin: 14px 0 18px; break-inside: avoid; }
.informe-seccion-titulo { font-size: 10.5pt; font-weight: 700; letter-spacing: .5px; margin: 0 0 4px; border-bottom: 1px solid #000; padding-bottom: 2px; }
.informe-vacio { font-size: 9.5pt; color: #555; margin: 4px 0; }
.informe-tabla { border-collapse: collapse; width: 100%; font-size: 9.5pt; }
.informe-tabla th { text-align: left; font-weight: 600; padding: 3px 6px; border-bottom: 1px solid #000; background: #f1f3f5; }
.informe-tabla td { padding: 2px 6px; border-bottom: 1px solid #ddd; vertical-align: top; }
.informe-tabla .num, .informe-totales .num, .informe-bloque .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.informe-tabla .col-fecha { white-space: nowrap; width: 22mm; }
.informe-tabla tr.informe-grupo td { border-top: 1px solid #888; font-weight: 500; }
.informe-tabla tfoot tr.total td { font-weight: 700; border-top: 2px solid #000; border-bottom: none; }
.informe-subtotal { text-align: right; font-size: 9.5pt; padding: 3px 6px; }
.informe-totales { margin: 20px 0 0 auto; font-size: 10pt; border-collapse: collapse; }
.informe-totales td { padding: 2px 12px; }
.informe-totales tr.informe-total-obra td { font-weight: 700; font-size: 11pt; border-top: 2px solid #000; padding-top: 5px; }
.informe-bloques { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 18px; margin: 6px 0 14px; }
.informe-apaisado .informe-bloques { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.informe-bloque { border-collapse: collapse; font-size: 9.5pt; width: 100%; break-inside: avoid; }
.informe-bloque caption { caption-side: top; text-align: left; font-weight: 700; padding: 0 0 3px; border-bottom: 1px solid #000; margin-bottom: 3px; }
.informe-bloque td { padding: 1.5px 4px; border-bottom: 1px dotted #ccc; }
.informe-bloque tr.total td { font-weight: 700; border-bottom: none; border-top: 1px solid #000; }

/* Ficha del trabajador / vehículo (foto + rejilla de campos) */
.ficha-informe-cuerpo { display: flex; gap: 10mm; align-items: flex-start; }
.ficha-informe-foto { width: 34mm; height: 43mm; object-fit: cover; border: 1px solid #999; flex-shrink: 0; background: #f2f2f2; }
.ficha-informe-foto-vehiculo { width: 55mm; height: 41mm; }
.ficha-informe-foto-hueco { display: flex; align-items: center; justify-content: center; color: #777; font-size: 9pt; }
.ficha-informe-datos { flex: 1; min-width: 0; }
.ficha-informe-nombre { font-size: 15pt; font-weight: 700; }
.ficha-informe-linea { font-size: 10pt; color: #444; }
.ficha-informe-acento { height: 1mm; background: var(--acento); margin: 6px 0 10px; }
.ficha-informe-campos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: row dense; gap: 6px 10mm; margin: 0; }
.ficha-informe-campos dt { font-size: 7.5pt; font-weight: 600; letter-spacing: .5px; color: #555; margin: 0; }
.ficha-informe-campos dd { font-size: 10.5pt; margin: 0 0 3px; min-height: 5mm; border-bottom: 1px dotted #bbb; overflow-wrap: anywhere; }
.ficha-informe-campos dt:nth-of-type(odd), .ficha-informe-campos dd:nth-of-type(odd) { grid-column: 1; }
.ficha-informe-campos dt:nth-of-type(even), .ficha-informe-campos dd:nth-of-type(even) { grid-column: 2; }
.ficha-informe-observaciones { margin-top: 10px; }
.ficha-informe-etq { font-size: 7.5pt; font-weight: 600; letter-spacing: .5px; color: #555; }
.ficha-informe-observaciones div:last-child { font-size: 10.5pt; white-space: pre-wrap; min-height: 5mm; border-bottom: 1px dotted #bbb; }

/* Carnet: tamaño real de la tarjeta del informe (9,95 × 4,87 cm). */
.carnet {
    position: relative; width: 9.95cm; height: 4.87cm; box-sizing: border-box;
    background: #fff; border: 1px solid #555; border-radius: 3mm;
    display: flex; gap: 4mm; padding: 4mm 4mm 4mm 6mm; overflow: hidden;
    font-family: "Fira Sans", Arial, sans-serif; color: #000;
}
.carnet-acento { position: absolute; left: 0; top: 0; bottom: 0; width: 1.5mm; background: var(--acento); }
.carnet-foto { width: 2.6cm; height: 3.05cm; object-fit: cover; border: 1px solid #999; flex-shrink: 0; background: #f2f2f2; }
.carnet-datos { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.carnet-nombre { font-size: 12pt; font-weight: 700; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.carnet-linea { font-size: 8pt; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.carnet-sep { height: 0.5mm; background: #000; margin: 1.5mm 0; }
.carnet-fila { display: grid; grid-template-columns: 11mm 1fr 1fr; font-size: 8pt; line-height: 1.4; gap: 2mm; }
.carnet-etq { font-weight: 700; }
.carnet-logo { position: absolute; right: 4mm; bottom: 3mm; max-width: 2.6cm; max-height: 1.3cm; object-fit: contain; }

/* Etiqueta de código de barras */
.informe-codbarras { text-align: center; }
.informe-codbarras .informe-titulo { font-size: 13pt; letter-spacing: .5px; border-bottom: 2px solid #000; padding-bottom: 5px; margin-bottom: 16mm; text-align: left; }
.codbarras-nombre { font-size: 14pt; font-weight: 600; margin-bottom: 8mm; }
.codbarras-svg { max-width: 100%; height: auto; }

/* Enlaces con aspecto de botón (informes que se abren en otra pestaña). */
a.btn-gris { display: inline-block; text-decoration: none; line-height: 1.2; }
a.btn-gris:hover { text-decoration: none; color: var(--texto); }
.ficha-cabecera-acciones { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.ficha-cabecera-acciones a.btn-gris { padding: 6px 12px; font-size: 13px; }

@media print {
    @page { size: A4; margin: 12mm; }
    html, body { background: #fff !important; }
    .informe-fondo { background: #fff; padding: 0; min-height: 0; }
    .informe-barra, .no-imprimir, .ficha-cabecera-acciones, .sidebar, .topbar { display: none !important; }
    .informe { width: auto; min-height: 0; margin: 0; padding: 0; box-shadow: none; }
    .informe-hoja-carnet { padding-top: 0; justify-content: flex-start; }
    .informe-tabla thead { display: table-header-group; }
    .informe-tabla tr, .carnet { break-inside: avoid; }
    .carnet { border-color: #000; }
    a { color: inherit; text-decoration: none; }
}
