/* --------------------------------------------------------------------------
   Le document imprimable du devis (chantier 6, décision V4) : une page A4,
   imprimée ou enregistrée en PDF par le navigateur. Toujours noir sur blanc,
   même en thème sombre : c'est du papier.
   -------------------------------------------------------------------------- */

.barre-document {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-bottom: var(--espace);
}

.document {
    position: relative;
    background: #fff;
    color: #1a1a1a;
    font-size: 10.5pt;
    line-height: 1.35;
    width: 100%;
    max-width: 210mm;
    margin: 0 auto;
    padding: 14mm 12mm;
    box-shadow: var(--ombre);
    border-radius: 4px;
    overflow-wrap: anywhere;
}

.document .petit {
    font-size: 8.5pt;
}

.filigrane {
    margin: 0 0 6mm;
    padding: 2mm 4mm;
    border: 1.5px dashed #b00;
    color: #b00;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    text-align: center;
}

.doc-entete,
.doc-parties,
.doc-bas {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6mm;
}

.doc-emetteur,
.doc-titre,
.doc-client,
.doc-chantier {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.doc-logo {
    max-width: 50mm;
    max-height: 22mm;
    object-fit: contain;
    object-position: left;
    margin-bottom: 3mm;
}

.doc-nom {
    font-size: 12.5pt;
}

.doc-titre {
    text-align: right;
}

.doc-titre h1 {
    margin: 0 0 2mm;
    font-size: 20pt;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.doc-parties {
    margin: 8mm 0 5mm;
}

.doc-client {
    min-width: 70mm;
    padding: 3mm 4mm;
    border: 1px solid #999;
    border-radius: 2px;
}

.doc-etiquette {
    font-size: 8pt;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #555;
}

.doc-objet {
    margin: 0 0 4mm;
}

.doc-lignes,
.doc-totaux {
    width: 100%;
    border-collapse: collapse;
}

.doc-lignes th {
    text-align: left;
    font-size: 8.5pt;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1.5px solid #1a1a1a;
    padding: 1.5mm 1.5mm;
}

.doc-lignes td {
    vertical-align: top;
    padding: 1.5mm;
    border-bottom: 1px solid #ddd;
}

.doc-lignes .nombre,
.doc-totaux .nombre {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.doc-lot td {
    font-weight: 700;
    background: #f1f1f1;
}

.doc-texte td {
    font-style: italic;
    color: #444;
}

.doc-paragraphe {
    white-space: pre-line;
    margin: 0;
}

.doc-bas {
    margin-top: 5mm;
    align-items: flex-start;
}

.doc-textes {
    flex: 1 1 90mm;
    display: flex;
    flex-direction: column;
    gap: 2mm;
}

.doc-textes p {
    margin: 0;
}

.doc-totaux {
    flex: 0 1 75mm;
    width: auto;
    min-width: 65mm;
}

.doc-totaux th {
    text-align: left;
    font-weight: 500;
    padding: 1mm 3mm 1mm 0;
}

.doc-totaux td {
    padding: 1mm 0;
}

.doc-total-fort th,
.doc-total-fort td {
    font-weight: 700;
    font-size: 12pt;
    border-top: 1.5px solid #1a1a1a;
    padding-top: 2mm;
}

.doc-mention {
    font-weight: 600;
}

.doc-accord {
    margin-top: 8mm;
    break-inside: avoid;
}

.doc-accord p {
    margin: 0 0 1mm;
}

.doc-cadre {
    width: 85mm;
    height: 32mm;
    border: 1px solid #999;
    border-radius: 2px;
    padding: 2mm;
    margin-left: auto;
}

.doc-pied {
    margin-top: 8mm;
    padding-top: 2mm;
    border-top: 1px solid #ccc;
    font-size: 7.5pt;
    color: #555;
    text-align: center;
}

/* Sur un téléphone, le document garde sa mise en page, en plus petit. */
@media (max-width: 600px) {
    .document {
        padding: 6mm 5mm;
        font-size: 9pt;
    }

    .doc-titre {
        text-align: left;
    }
}

@page {
    size: A4;
    margin: 10mm;
}

@media print {
    html,
    body {
        background: #fff !important;
    }

    .ne-pas-imprimer,
    .bandeau-maj {
        display: none !important;
    }

    .application {
        max-width: none;
        padding: 0;
    }

    .document {
        box-shadow: none;
        border-radius: 0;
        padding: 0;
        max-width: none;
        font-size: 10pt;
    }

    .doc-lignes tr,
    .doc-bas {
        break-inside: avoid;
    }

    .doc-lignes thead {
        display: table-header-group;
    }
}
