/* Pantalla normal */
#map {
        width: 100% !important;
        height: 18rem !important;
        position: relative !important;
      }
@media print {
     /* 🔥 permitir que Google Maps pinte */
      #mapfinal,
      #mapfinal * {
        visibility: visible !important;
      }

    @page {
        size: letter portrait !important;
        margin: 5mm !important;
    }

    html, body {
        width: 100%;
        margin: 0;
        padding: 0;
    }

    body * {
        overflow: visible !important;
      }

    #logo-sidebar {
        display: none !important;
    }
    nav, header {
        display: none !important;
        height: 0 !important;
    }
    .sm\:ml-64 {
        margin-left: 0 !important;
    }

    main {
        margin-left: 0 !important;
        padding-left: 0 !important;
        width: 100% !important;
    }

    #printable, #printable * {
        visibility: visible;
    }

    #printable {
        position: relative;
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
        left: 0;
        top: 0;
        box-sizing: border-box;
        transform: none !important; /* pro  */
    }
    .first-page {
      height: 245mm;      /* alto real útil de carta */
      max-height: 245mm;
      overflow: hidden;  /* evita que empuje a segunda hoja */
      box-sizing: border-box;
    }    
    .first-page * {     /* evita que se rompa dentro */
      page-break-inside: avoid;
      break-inside: avoid;
    }
    .static-map { display:block !important; }      

    .no-break {
        page-break-inside: avoid;
      }

    /* Evita desbordes raros */
    table {
        width: 100% !important;
        border-collapse: collapse;
    }

    img, svg {
        max-width: 100% !important;
    }

    .pagebreak {
        break-before: page;
        page-break-before: always;
    }
    .croquis-page, .print-map-page {
        page-break-before: always;
        break-before: page;
        height: 245mm;
        max-height: 245mm;
        overflow: hidden;
        page-break-inside: avoid;
        break-inside: avoid;
    }

    /* contenedor del mapa */
    .print-map-page {
        height: calc(100vh - 20mm) !important;            
    }

      /* mapa ocupa toda la hoja */
    #mapfinal {
        width: 100% !important;
        height: calc(100vh - 30mm) !important;
        min-height: calc(100vh - 30mm) !important;
        max-height: calc(100vh - 30mm) !important;
    }

    /* contenedor que ocupa toda la hoja */
    /* excepto la primera */
    .croquis-page:first-of-type {
        page-break-before: auto;
        break-inside: ;break-before: auto;
    }
    .croquis-page {
        height: calc(100vh - 20mm);
        page-break-inside: avoid;
        break-inside: avoid;
        display: flex;
        flex-direction: column;
    }

    .croquis-wrapper {
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: stretch; /* 👈 estira vertical */
    }

    .croquis-img {
        height: 100%;       /* 🔥 esta es la clave */
        width: auto;        /* ancho automático */
        max-width: 100%;
        object-fit: contain;
    }

}
