/*
 * Rapports imprimables — Trouvaille.
 *
 * L'écran montre une feuille A4 telle qu'elle sortira de l'imprimante, et le bloc
 * `@media print` ne fait presque rien d'autre que masquer le panneau de réglages : ce que
 * l'on voit est ce que l'on obtient, sans surprise au moment d'imprimer.
 *
 * Quatre modèles, distingués par une classe posée sur la feuille :
 *   .m-succession — liste tabulée avec valeurs et total, pour un notaire ou des héritiers
 *   .m-expertise  — une fiche développée par objet, façon rapport d'expert
 *   .m-catalogue  — présentation commerciale en grille, photo mise en avant
 *   .m-assurance  — valeurs de remplacement seules, sans fourchettes de revente
 */

/* ─────────────── Mise en page de l'écran ─────────────── */

.report-body {
    display: grid;
    grid-template-columns: 340px 1fr;
    min-height: 100vh;
    background: #e9e4da;
}

.editor {
    background: var(--ivoire);
    border-right: 1px solid var(--bordure-2);
    overflow-y: auto;
    max-height: 100vh;
    position: sticky;
    top: 0;
}
.editor-inner { padding: 24px 22px 60px; }
.back-link {
    display: inline-block;
    color: var(--gris);
    text-decoration: none;
    font-size: .84rem;
    margin-bottom: 14px;
}
.back-link:hover { color: var(--caramel); }

.editor-section {
    font-size: .68rem;
    letter-spacing: 1.3px;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--caramel);
    margin: 26px 0 4px;
    padding-top: 14px;
    border-top: 1px solid var(--bordure);
}
.editor input[type="text"], .editor textarea, .editor select {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--bordure-2);
    border-radius: 7px;
    background: var(--carte);
    font-family: inherit;
    font-size: .88rem;
    color: var(--encre);
}
.editor textarea { resize: vertical; }
.btn-fichier {
    display: inline-flex;
    align-items: center;
    padding: 7px 11px;
    border: 1px solid var(--bordure-2);
    border-radius: 7px;
    background: var(--fond-app, #f8f6f1);
    color: var(--encre);
    font-size: .82rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s ease;
}
.btn-fichier:hover {
    background: #eee8dc;
}
.check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .86rem;
    padding: 4px 0;
    cursor: pointer;
}
.check input { accent-color: #8a5a2b; width: 16px; height: 16px; }
.tpl-hint { font-size: .78rem; color: var(--gris); margin: 6px 0 0; font-style: italic; }

/* EN COLONNE, et non en ligne. La zone contient désormais la barre d'outils PUIS la
   feuille ; disposées en ligne, elles se plaçaient côte à côte et le document partait
   hors de l'écran, avec une barre de défilement horizontale sur toute la page. */
.paper-area {
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* La feuille : exactement les dimensions d'une A4 avec ses marges. */
.paper {
    width: 210mm;
    min-height: 297mm;
    padding: 18mm 16mm;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .12), 0 12px 40px rgba(0, 0, 0, .1);
    color: #22201d;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 10.5pt;
    line-height: 1.5;
}
.loading { color: var(--gris); }

/* ─────────────── En-tête du document ─────────────── */

.doc-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding-bottom: 12px;
    border-bottom: 1.5px solid #22201d;
}
.doc-logo { max-height: 22mm; max-width: 55mm; object-fit: contain; }
.doc-firm { font-family: "Playfair Display", Georgia, serif; font-size: 15pt; font-weight: 600; }
.doc-contact { font-size: 8.5pt; color: #6f665a; white-space: pre-line; line-height: 1.35; }
.doc-meta { text-align: right; font-size: 8.5pt; color: #6f665a; }

.doc-title {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 22pt;
    font-weight: 600;
    margin: 22px 0 2px;
    text-align: center;
}
.doc-sub { text-align: center; font-size: 9pt; color: #6f665a; margin-bottom: 22px; }
.doc-text { margin: 14px 0; text-align: justify; white-space: pre-line; }

.doc-legal {
    margin-top: 26px;
    padding-top: 10px;
    border-top: 1px solid #d9cdb8;
    font-size: 8pt;
    color: #6f665a;
    white-space: pre-line;
    text-align: justify;
}
.doc-sign { margin-top: 26px; font-size: 9pt; }
.doc-sign .line { margin-top: 16mm; border-top: 1px solid #22201d; width: 60mm; }

/* ─────────────── Modèle : inventaire tabulé ─────────────── */

table.inv { width: 100%; border-collapse: collapse; margin-top: 8px; }
table.inv th {
    text-align: left;
    font-size: 7.5pt;
    letter-spacing: .8px;
    text-transform: uppercase;
    border-bottom: 1.2px solid #22201d;
    padding: 6px 6px;
}
table.inv td { padding: 7px 6px; border-bottom: .5px solid #e8ddc8; vertical-align: top; }
table.inv tr { break-inside: avoid; }
table.inv .num { text-align: right; white-space: nowrap; }
table.inv .thumb { width: 22mm; }
table.inv .thumb img { width: 20mm; height: 15mm; object-fit: contain; background: #faf7f1; border-radius: 2px; }
.inv-name { font-weight: 600; }
.inv-desc { font-size: 8.5pt; color: #6f665a; margin-top: 2px; }
.inv-extra { font-size: 8pt; color: #6f665a; margin-top: 3px; }
.inv-justif { font-size: 8pt; font-style: italic; color: #6f665a; margin-top: 3px; line-height: 1.35; }
.inv-tiers { font-size: 7.8pt; color: #8a5a2b; margin-top: 3px; font-weight: 500; line-height: 1.35; }

.doc-total {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1.5px solid #22201d;
    display: flex;
    justify-content: space-between;
    font-size: 12pt;
    font-weight: 700;
    font-family: "Playfair Display", Georgia, serif;
}
.doc-total .amount { color: #8a5a2b; }

/* ─────────────── Modèle : expertise détaillée ─────────────── */

.entry {
    display: grid;
    grid-template-columns: 45mm 1fr;
    gap: 8mm;
    padding: 6mm 0;
    border-bottom: .5px solid #e8ddc8;
    break-inside: avoid;
}
.entry-photos img {
    width: 100%;
    border-radius: 3px;
    margin-bottom: 3mm;
    object-fit: contain;
    background: #faf7f1;
}
.entry h3 {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 13pt;
    font-weight: 600;
    margin: 0 0 2px;
}
.entry .lot { font-size: 8pt; color: #6f665a; letter-spacing: 1px; text-transform: uppercase; }
.entry .price { color: #8a5a2b; font-weight: 700; font-size: 11pt; margin: 3px 0; }
.entry dl { display: grid; grid-template-columns: auto 1fr; gap: 1px 8px; margin: 6px 0 0; font-size: 9pt; }
.entry dt { color: #6f665a; }
.entry dd { margin: 0; }
.entry .justif { font-size: 9pt; margin-top: 6px; text-align: justify; font-style: italic; color: #4a443c; }

.tiers { display: flex; gap: 4mm; margin-top: 5px; }
.tier-box {
    border: .5px solid #d9cdb8;
    border-radius: 3px;
    padding: 3px 7px;
    font-size: 8pt;
    text-align: center;
    flex: 1;
}
.tier-box b { display: block; font-size: 9.5pt; color: #8a5a2b; }

/* ─────────────── Modèle : catalogue ─────────────── */

.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6mm; margin-top: 6mm; }
.cat-item { break-inside: avoid; text-align: center; }
.cat-item img { width: 100%; height: 40mm; object-fit: contain; background: #faf7f1; border-radius: 3px; }
.cat-item .lot { font-size: 8pt; color: #6f665a; margin-top: 3px; letter-spacing: 1px; }
.cat-item .name { font-family: "Playfair Display", Georgia, serif; font-size: 10pt; font-weight: 600; }
.cat-item .price { color: #8a5a2b; font-weight: 700; font-size: 10.5pt; }

/* Une fiche par page, quand l'option est cochée. */
.page-break .entry, .page-break .cat-item { break-after: page; }
.page-break .entry:last-child, .page-break .cat-item:last-child { break-after: auto; }

/* ─────────────── Impression A4 de Haute Précision ─────────────── */

@page {
    size: A4;
    margin: 0;
}

@media print {
    /* Masquage de l'interface d'édition */
    .app-bar, .editor, .barre-doc, .sans-impression, .outil, .outils-ligne, .choix-photo { display: none !important; }
    .editor, .paper-area { all: unset; }
    .editor { display: none !important; }

    body {
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
    }
    .report-body { display: block !important; background: #fff !important; }
    .paper-area { display: block !important; padding: 0 !important; }

    /* Un titre ou un total ne doit jamais rester seul en bas de page */
    h1, h2, h3, .doc-title, .doc-notariat-head, .notariat-title-block, .sommaire-pieces-bloc { break-after: avoid; }
    .doc-total, .doc-sign, .signatures-notariat, .box-art764, .attestation-proprio-box, .balance-financiere-bloc, .decret-marcus-box { break-inside: avoid; }

    /* Liens propres à l'impression */
    a { text-decoration: none; color: inherit; }
}

/* ─────────────── Styles Notariat & Acte de Prisée ─────────────── */

.doc-notariat-head {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16mm;
    padding-bottom: 10px;
    border-bottom: 2px solid #22201d;
    margin-bottom: 12px;
}
.notariat-col {
    font-size: 8.5pt;
    line-height: 1.4;
    color: #4a443c;
}
.notariat-col-droite {
    text-align: right;
}
.notariat-col strong {
    font-size: 9.5pt;
    color: #22201d;
    display: block;
    margin-bottom: 2px;
}
.notariat-title-block {
    text-align: center;
    margin: 14px 0 16px;
    padding: 10px 14px;
    background: #fdfaf5;
    border: 1px solid #d9cdb8;
    border-radius: 4px;
}
.doc-notarial-act-title {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 14pt;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    margin: 0 0 6px;
    color: #22201d;
}
.notariat-preambule {
    font-size: 8.5pt;
    font-style: italic;
    color: #4a443c;
    margin: 4px 0 0;
    line-height: 1.45;
    text-align: justify;
}
.piece-entete {
    background: var(--sable, #f5efe4);
    border-left: 3px solid #8a5a2b;
    padding: 5px 8px;
    font-weight: 700;
    font-size: 9pt;
    letter-spacing: .5px;
    margin: 14px 0 6px;
    text-transform: uppercase;
    color: #22201d;
}
.piece-soustotal {
    text-align: right;
    font-size: 8.5pt;
    color: #6f665a;
    font-style: italic;
    padding: 4px 8px;
    margin-bottom: 6px;
}
.box-art764 {
    margin: 14px 0;
    padding: 10px 14px;
    background: #fcfaf5;
    border: 1px dashed #b5a995;
    border-radius: 4px;
    font-size: 8pt;
    line-height: 1.45;
    text-align: justify;
    color: #4a443c;
}
.box-art764 strong {
    color: #22201d;
}
.doc-total-lettres {
    margin: 8px 0 14px;
    font-size: 9pt;
    font-weight: 600;
    color: #22201d;
    background: #fdfaf5;
    border: 1px solid #e2d7c5;
    padding: 8px 12px;
    border-radius: 4px;
    text-align: center;
}
.signatures-notariat {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6mm;
    margin-top: 14mm;
    break-inside: avoid;
}
.signature-col {
    text-align: center;
    font-size: 8pt;
}
.signature-role {
    font-weight: 700;
    color: #22201d;
    margin-bottom: 2px;
}
.signature-mention {
    font-size: 7.5pt;
    font-style: italic;
    color: #6f665a;
    margin-bottom: 12mm;
}
.signature-ligne {
    border-top: 1px solid #22201d;
    margin: 0 auto;
    width: 80%;
}

/* ═══════════ Tableau récapitulatif préliminaire par pièce (Notariat) ═══════════ */
.sommaire-pieces-bloc {
    margin: 12px 0 16px;
    background: #fdfbf7;
    border: 1px solid #d9cdb8;
    border-radius: 4px;
    padding: 10px 14px;
    break-inside: avoid;
}
.sommaire-pieces-titre {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 10.5pt;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: #22201d;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #e2d7c5;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
table.table-sommaire-pieces {
    width: 100%;
    border-collapse: collapse;
    font-size: 8.5pt;
}
table.table-sommaire-pieces th {
    text-align: left;
    font-size: 7.5pt;
    letter-spacing: .5px;
    text-transform: uppercase;
    padding: 5px 6px;
    border-bottom: 1.5px solid #22201d;
    color: #4a443c;
}
table.table-sommaire-pieces td {
    padding: 5px 6px;
    border-bottom: .5px solid #e8ddc8;
}
table.table-sommaire-pieces tr.total-row th {
    border-top: 1.5px solid #22201d;
    border-bottom: 2px solid #22201d;
    padding: 7px 6px;
    font-size: 8.5pt;
    color: #8a5a2b;
    font-weight: 700;
}

/* ═══════════ Convention d'achat & Débarras de maison (Brocante) ═══════════ */
.attestation-proprio-box {
    margin: 10px 0 14px;
    padding: 10px 14px;
    background: #fdf8f4;
    border: 1px solid #d8a3a1;
    border-left: 4px solid #a0522d;
    border-radius: 4px;
    font-size: 8pt;
    line-height: 1.45;
    color: #4a443c;
    text-align: justify;
}
.attestation-proprio-box strong {
    color: #22201d;
}
.balance-financiere-bloc {
    margin-top: 14px;
    border-top: 1.5px solid #22201d;
    padding-top: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    font-size: 8.5pt;
}
.balance-col {
    background: #faf7f1;
    border: 1px solid #e8ddc8;
    border-radius: 4px;
    padding: 8px 12px;
}
.balance-col strong {
    display: block;
    margin-bottom: 4px;
    color: #22201d;
}
.solde-net-box {
    grid-column: 1 / -1;
    background: #fdfaf5;
    border: 1.5px solid #8a5a2b;
    border-radius: 6px;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 11pt;
    font-weight: 700;
}
.solde-net-box .montant-solde {
    font-size: 15pt;
    color: #8a5a2b;
}

/* ═══════════ Certificat d'authenticité & Décret Marcus ═══════════ */
.certificat-authenticite-cadre {
    border: 2.5px double #22201d;
    border-radius: 3px;
    padding: 8px 14px 10px;
    margin: 0;
    background: #fffdfa;
    position: relative;
    box-sizing: border-box;
    max-height: 255mm;
    display: flex;
    flex-direction: column;
}
.certificat-header {
    text-align: center;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid #ebdccb;
}
.certificat-emetteur {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 4px;
}
.certificat-logo {
    max-height: 11mm;
    max-width: 35mm;
    object-fit: contain;
}
.certificat-emetteur-texte {
    text-align: left;
}
.certificat-firm {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 10pt;
    font-weight: 700;
    color: #22201d;
    letter-spacing: .5px;
}
.certificat-coord {
    font-size: 7pt;
    color: #6f665a;
    white-space: pre-line;
    line-height: 1.25;
}
.certificat-titre-solennel {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 12.5pt;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #22201d;
}
.certificat-sub {
    font-size: 7.5pt;
    color: #6f665a;
    font-style: italic;
    margin-top: 2px;
}
.certificat-ref {
    font-size: 7pt;
    color: #8c8071;
    margin-top: 2px;
    letter-spacing: .5px;
}

/* Photo dans le certificat : contenue et centrée pour respecter l'A4 */
.certificat-authenticite-cadre .piece-photo {
    width: auto;
    max-width: 80mm;
    height: auto;
    max-height: 40mm;
    object-fit: contain;
    background: #faf7f1;
    border: 1px solid #ebdccb;
    border-radius: 2px;
    margin: 1.5mm auto 2.5mm;
    display: block;
    padding: 2px;
}

.certificat-authenticite-cadre h3 {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 13.5pt;
    font-weight: 700;
    margin: 0 0 2px;
    text-align: center;
    color: #22201d;
}

.certificat-authenticite-cadre .piece-sous {
    text-align: center;
    font-size: 8pt;
    color: #6f665a;
    margin-bottom: 2mm;
}

.certificat-authenticite-cadre .doc-text.multi {
    font-size: 8.5pt;
    line-height: 1.4;
    text-align: justify;
    margin: 1.5mm 0 2.5mm;
    color: #38342f;
}

.certificat-authenticite-cadre .piece-details {
    display: grid;
    grid-template-columns: auto 1fr auto 1fr;
    gap: 2px 10px;
    font-size: 7.8pt;
    margin: 1.5mm 0 2.5mm;
    padding: 3px 8px;
    background: #faf7f2;
    border: 1px solid #ebdccb;
    border-radius: 2px;
}
.certificat-authenticite-cadre .piece-details dt {
    color: #6f665a;
    font-weight: 600;
}
.certificat-authenticite-cadre .piece-details dd {
    margin: 0;
    color: #22201d;
}

.certificat-authenticite-cadre .piece-prix {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-top: 1px solid #22201d;
    border-bottom: 1px solid #22201d;
    margin-top: 2.5mm;
    padding: 1.5mm 4px;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 10pt;
    background: #faf7f2;
}
.certificat-authenticite-cadre .piece-prix .montant {
    font-size: 13.5pt;
    font-weight: 700;
    color: #8a5a2b;
}

/* Cartouche bas du certificat à 2 colonnes (Décret + Sceau + QR / Signature) */
.certificat-bas-grille {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 10px;
    margin-top: auto;
    padding-top: 2.5mm;
    align-items: start;
}
.certificat-bas-gauche {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.decret-marcus-box {
    margin-top: 0;
    padding: 4px 7px;
    background: #fcfaf5;
    border: 1px solid #ebdccb;
    font-size: 6.8pt;
    color: #5a544c;
    line-height: 1.35;
    text-align: justify;
    border-radius: 2px;
}
.certificat-sceau-qr-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    margin-top: 2px;
}
.sceau-expert-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 24mm;
    height: 24mm;
}
.sceau-expert {
    width: 24mm;
    height: 24mm;
    opacity: .9;
}
.guide-tampon-manuel {
    border-radius: 50%;
    background: transparent;
}
.guide-tampon-svg {
    width: 24mm;
    height: 24mm;
    display: block;
}
.tampon-officiel-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
}
.tampon-officiel-img {
    width: 24mm;
    height: 24mm;
    max-width: 24mm;
    max-height: 24mm;
    object-fit: contain;
    display: block;
}
.certificat-qr-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 6.8pt;
    color: #6f665a;
    line-height: 1.2;
}
.certificat-qr-wrap svg {
    width: 16mm !important;
    height: 16mm !important;
    max-width: 16mm !important;
    max-height: 16mm !important;
    min-width: 16mm !important;
    min-height: 16mm !important;
    flex-shrink: 0 !important;
    display: block !important;
}
.cat-qr-wrap svg,
.cartel-qr svg {
    width: 32px !important;
    height: 32px !important;
    max-width: 32px !important;
    max-height: 32px !important;
    flex-shrink: 0 !important;
    display: block !important;
}
.certificat-bas-droite {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding-left: 8px;
    border-left: 1px dashed #ebdccb;
    min-height: 28mm;
}
.certificat-date-ligne {
    font-size: 7.8pt;
    color: #5a544c;
    font-style: italic;
}
.certificat-qualite-expert {
    font-size: 8pt;
    font-weight: 700;
    color: #22201d;
    margin-top: 2px;
    font-family: "Playfair Display", Georgia, serif;
}
.certificat-signature-zone {
    margin-top: 13mm;
    border-top: 1px solid #22201d;
    padding-top: 2px;
    font-size: 7pt;
    color: #8c8071;
    text-align: center;
    letter-spacing: .5px;
}

/* ─────────────── Écrans étroits ─────────────── */

@media (max-width: 1000px) {
    .report-body { grid-template-columns: 1fr; }
    .editor { position: static; max-height: none; border-right: none; border-bottom: 1px solid var(--bordure-2); }
    .paper-area { padding: 14px; overflow-x: auto; }
}

/* Lien « Rapport de ce dossier », dans la fenêtre de réglages d'un dossier. */
.report-link {
    display: inline-flex;
    align-items: center;
    padding: 13px 18px;
    text-decoration: none;
}

/* Titre du panneau de composition. */
.editor-title {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.35rem;
    font-weight: 600;
    margin: 0 0 6px;
}

/*
 * Sur téléphone, la feuille abandonne ses dimensions A4 : 210 mm sur un écran de 375 px
 * imposerait un défilement latéral permanent pour lire trois mots. Le document se met à
 * la largeur de l'écran, et l'impression — qui se fait depuis un ordinateur — retrouve
 * ses marges exactes grâce au bloc @media print, qui reste inchangé.
 */
@media (max-width: 800px) {
    .paper {
        width: 100%;
        min-height: 0;
        padding: 20px 16px;
        font-size: 14px;
    }
    .paper-area { padding: 12px; }
    .entry { grid-template-columns: 34mm 1fr; gap: 5mm; }
    .cat-grid { grid-template-columns: repeat(2, 1fr); }
    .doc-head { flex-direction: column; gap: 10px; }
    .doc-meta { text-align: left; }
    table.inv .thumb { width: 16mm; }
    table.inv .thumb img { width: 15mm; height: 11mm; }
}

/* ═══════════ Édition directe sur le document ═══════════
   Le document se corrige à l'endroit où il se lit. Le repère visuel doit être franc à
   l'écran — sinon on ne devine pas qu'on peut écrire — et totalement absent à
   l'impression, où il n'a plus aucun sens. */
.modifiable {
    outline: none;
    border-radius: 2px;
    transition: background .12s ease, box-shadow .12s ease;
}
.modifiable:hover { background: #fbf6ea; }
.modifiable:focus {
    background: #fdfbf4;
    box-shadow: 0 0 0 2px #d8c69c;
}

.photo-modifiable { cursor: pointer; transition: outline-color .12s ease; outline: 2px solid transparent; }
.photo-modifiable:hover { outline-color: #b08b4f; }

/* Choix de la photographie, ouvert au clic sur une image du document. */
.choix-photo {
    position: absolute;
    z-index: 30;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-width: 260px;
    padding: 8px;
    background: #fff;
    border: 1px solid #d9cdb8;
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(33, 29, 23, .22);
}
.choix-photo img {
    width: 62px;
    height: 48px;
    object-fit: contain;
    background: #faf7f1;
    border-radius: 3px;
    border: 2px solid transparent;
    cursor: pointer;
}
.choix-photo img:hover { border-color: #b08b4f; }
.choix-photo img.retenue { border-color: #8a5a2b; }

/* La cellule qui porte une image devient le repère de position du choix. */
table.inv .thumb, .entry-photos, .cat-photo { position: relative; }

@media print {
    .modifiable, .modifiable:hover, .modifiable:focus {
        background: none !important;
        box-shadow: none !important;
    }
    .photo-modifiable { outline: none !important; }
    .choix-photo { display: none !important; }
}


/* ═══════════ Outils de ligne ═══════════
   Retirer un objet du document, revenir au texte d'origine.
   Ils étaient posés à droite DU TABLEAU, en dehors de la feuille : hors de l'écran sur un
   affichage étroit, donc inatteignables. Ils vivent maintenant DANS la cellule du prix,
   sous le montant, et se révèlent au survol de la ligne. */
.outils-ligne {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
    margin-top: 4px;
    opacity: 0;
    transition: opacity .12s ease;
}
table.inv tbody tr:hover .outils-ligne,
.outils-ligne:focus-within { opacity: 1; }

.outil {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border: 1px solid #d9cdb8;
    border-radius: 4px;
    background: #fff;
    color: #6f665a;
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    font-family: Inter, sans-serif;
}
.outil:hover { border-color: #b08b4f; color: #22201d; }
.outil-retirer:hover { border-color: #9c3330; color: #9c3330; }

@media print {
    .outils-ligne { display: none !important; }
}

/* Le montant modifiable et ses outils cohabitent dans la cellule sans se mélanger : le
   texte à gauche du regard, les boutons dessous. La zone éditable ne contient que le
   montant — c'est ce qui garantit qu'aucun symbole ne finisse dans la donnée. */
table.inv .num .montant { display: inline-block; }

/* ═══════════ Barre du document ═══════════
   Les commandes fréquentes, au-dessus de la feuille plutôt qu'au bas d'un panneau qu'il
   fallait faire défiler. Collante : elle reste sous la main quand on descend dans un
   inventaire de cinquante objets. */
.barre-doc {
    position: sticky;
    top: 0;
    z-index: 15;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    /* Même largeur que la feuille : la barre la surplombe exactement, elle ne flotte pas
       à côté. Au-delà de 210 mm elle s'arrêterait au bord du document. */
    width: 210mm;
    max-width: 100%;
    padding: 10px 14px;
    margin-bottom: 14px;
    background: #fffdf8;
    border: 1px solid #d9cdb8;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(33, 29, 23, .08);
}
.outil-barre {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border: 1px solid #d9cdb8;
    border-radius: 7px;
    background: #fff;
    color: #22201d;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}
.outil-barre:hover:not(:disabled) { border-color: #b08b4f; }
.outil-barre:disabled { opacity: .35; cursor: default; }
.etiquette-barre { font-size: .74rem; color: #6f665a; }
.champ-barre {
    width: auto;
    min-width: 110px;
    padding: 6px 9px;
    font-size: .84rem;
}
.separateur-barre { width: 1px; height: 22px; background: #e2d9c8; }


/* ═══════════ Allure du document ═══════════
   Police, taille et couleur passent par des variables : dix couleurs, dix polices et huit
   tailles feraient huit cents classes si chaque combinaison avait la sienne. */
.paper.allure-libre {
    font-family: var(--police-doc, "Playfair Display", Georgia, serif);
    font-size: var(--taille-doc, 10.5pt);
    color: var(--encre-doc, #22201d);
}
.paper.allure-libre .doc-title,
.paper.allure-libre .doc-firm,
.paper.allure-libre .inv-name,
.paper.allure-libre .entry h3 {
    font-family: var(--police-doc, "Playfair Display", Georgia, serif);
    color: var(--encre-doc, #22201d);
}
.paper.allure-libre .doc-total .amount,
.paper.allure-libre .entry .price { color: var(--encre-doc, #8a5a2b); }

/* Surlignage : la seule couleur vive du document, réservée à ce qu'on veut faire
   remarquer au lecteur. */
.paper mark, .paper [style*="background-color"] { padding: 0 1px; }

/* ═══════════ Barre : deux rangées ═══════════ */
.rangee-barre {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    width: 100%;
}
.rangee-barre + .rangee-barre {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee5d4;
}
/* Pousse l'impression à l'autre bout de la rangée : le geste qui termine ne se met pas
   au milieu de ceux qui préparent. */
.pousse { flex: 1; }

.champ-barre.etroit { min-width: 78px; }

.outil-barre.surligneur { color: #b8860b; }
.outil-barre b, .outil-barre i { font-size: 15px; font-family: Georgia, serif; }

/* Nuancier : dix pastilles, la teinte courante cerclée. */
.nuancier { display: flex; gap: 4px; flex-wrap: wrap; }
.pastille {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid transparent;
    box-shadow: 0 0 0 1px #d9cdb8;
    cursor: pointer;
    padding: 0;
}
.pastille:hover { border-color: #fff; box-shadow: 0 0 0 2px #b08b4f; }
.pastille.active { border-color: #fff; box-shadow: 0 0 0 2px #22201d; }

@media print {
    .barre-doc { display: none !important; }
}

/* ═══════════ Fenêtre d'accueil ═══════════ */
.aide-card {
    width: min(560px, 100%);
    max-height: 88vh;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #d9cdb8;
    border-radius: 16px;
    padding: 32px 28px 24px;
}
.aide-card h2 {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 8px;
}
.aide-intro { color: #6f665a; font-size: .93rem; margin: 0 0 20px; }

.aide-etapes { list-style: none; margin: 0; padding: 0; }
.aide-etapes li {
    display: grid;
    grid-template-columns: 52px 1fr;
    gap: 14px;
    align-items: start;
    padding: 13px 0;
    border-top: 1px solid #f0e9da;
}
.aide-etapes li:first-child { border-top: 0; padding-top: 0; }
.aide-etapes svg { width: 52px; height: 36px; }
.aide-etapes div { font-size: .89rem; color: #6f665a; line-height: 1.5; }
.aide-etapes b { display: block; color: #22201d; font-weight: 600; margin-bottom: 2px; }

#aide-compris { margin-top: 22px; }

/* ═══════════ Modèle : inventaire compact ═══════════ */
.compact-grille { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8mm; margin-top: 6px; }
table.inv.compact td { padding: 4px 3px; font-size: 8pt; }
table.inv.compact .thumb { width: 12mm; }
table.inv.compact .thumb img { width: 11mm; height: 8mm; }
table.inv.compact .inv-name { font-size: 8.5pt; }
/* Descriptions ramenées à deux lignes : c'est tout l'intérêt du modèle. */
.inv-desc.coupe {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ═══════════ Montants saisis sur le document ═══════════ */
.negocie.a-remplir { color: #b3a894; }
td.reference .montant { font-weight: 700; }
.deux-signatures { display: flex; justify-content: space-between; margin-top: 12mm; font-size: 9pt; }
.deux-signatures .line { margin-top: 14mm; border-top: 1px solid #22201d; width: 55mm; }

/* ═══════════ Modèles d'une seule pièce ═══════════ */
.piece { break-after: page; padding-bottom: 6mm; }
.piece:last-child { break-after: auto; }
.piece-photo { width: 100%; height: 90mm; object-fit: contain; background: #faf7f1; border-radius: 2px; margin-bottom: 6mm; }
.piece h3 {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 19pt;
    font-weight: 600;
    margin: 0 0 2px;
    text-align: center;
}
.piece-sous { text-align: center; font-size: 9pt; color: #6f665a; margin-bottom: 5mm; }
.piece-details { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 9pt; margin: 4mm 0; }
.piece-details dt { color: #6f665a; }
.piece-details dd { margin: 0; }
.piece-prix {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-top: 1.5px solid #22201d;
    margin-top: 5mm;
    padding-top: 3mm;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 13pt;
}
.piece-prix .montant { font-size: 20pt; font-weight: 700; color: #8a5a2b; }
/* L'attestation encadre son montant : c'est la ligne qui engage la signature. */
.piece.attestation .piece-prix { border-bottom: 1.5px solid #22201d; padding-bottom: 3mm; }

/* ═══════════ Cartels à découper ═══════════ */
.cartels { display: grid; grid-template-columns: 1fr 1fr; gap: 4mm; margin-top: 4mm; }
.cartel {
    border: 1px dashed #b3a894;
    padding: 4mm 5mm;
    height: 42mm;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    break-inside: avoid;
}
.cartel-lot { font-size: 7.5pt; letter-spacing: 2px; color: #8a5a2b; }
.cartel-nom { font-family: "Playfair Display", Georgia, serif; font-size: 12pt; font-weight: 600; margin-top: 1mm; }
.cartel-det { font-size: 8pt; color: #6f665a; margin-top: 1mm; }
.cartel-bas { display: flex; justify-content: space-between; align-items: flex-end; }
.cartel-prix { font-family: "Playfair Display", Georgia, serif; font-size: 15pt; font-weight: 700; color: #8a5a2b; }
/* Emplacement du QR code, vide tant qu'ils ne sont pas produits. */
.cartel-qr { width: 12mm; height: 12mm; background: #f0e9da; border: .5px solid #d9cdb8; }

/* ═══════════ Planche photo à cocher ═══════════ */
.planche-photo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5mm; margin-top: 4mm; }
.planche-photo figure { margin: 0; break-inside: avoid; }
.planche-photo img { width: 100%; height: 32mm; object-fit: contain; background: #faf7f1; border-radius: 2px; }
.planche-photo figcaption {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 4px;
    font-size: 8pt;
    margin-top: 2px;
}
.planche-photo .coche { width: 4mm; height: 4mm; border: .8px solid #22201d; flex: 0 0 auto; }


/* ═══════════ Des feuilles séparées ═══════════
 *
 * Le document est une suite de pages A4 distinctes, chacune avec son ombre,
 * son filigrane vectoriel et son pied de page officiel (paraphes notariés et page X sur Y).
 */
.feuilles { display: flex; flex-direction: column; align-items: center; gap: 22px; width: 100%; }

/* Chaque feuille garde une hauteur d'A4 EXACTE, avec réserve pour le pied de page */
.feuilles .paper {
    width: 210mm;
    height: 297mm;
    min-height: 297mm;
    max-height: 297mm;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
    padding: 16mm 14mm 24mm;
}

/* ═══════════ Pied de page officiel sur chaque feuille (Paraphes & Numérotation) ═══════════ */
.doc-pied-feuille {
    position: absolute;
    bottom: 8mm;
    left: 14mm;
    right: 14mm;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    font-size: 7.5pt;
    color: #6f665a;
    border-top: .5px solid #d9cdb8;
    padding-top: 4px;
    font-family: Inter, Arial, sans-serif;
    pointer-events: none;
    z-index: 10;
}
.doc-pied-gauche {
    font-style: italic;
    max-width: 42%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.doc-pied-centre {
    font-weight: 600;
    letter-spacing: .5px;
}
.doc-pied-paraphes {
    display: flex;
    gap: 6px;
    align-items: center;
}
.case-paraphe {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    font-size: 6.5pt;
    color: var(--gris, #6c6459);
    border: .5px dashed #b5a995;
    border-radius: 2px;
    padding: 1px 5px;
    min-width: 44px;
    text-align: center;
    background: rgba(255, 255, 255, 0.85);
}
.case-paraphe span {
    display: block;
    height: 8px;
}

/* ═══════════ Filigrane de sécurité vectoriel ═══════════ */
.filigrane-fond {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}
.filigrane-texte {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 56pt;
    font-weight: 700;
    letter-spacing: 8px;
    color: rgba(138, 90, 43, 0.07);
    transform: rotate(-35deg);
    text-transform: uppercase;
    user-select: none;
    white-space: nowrap;
    border: 3px dashed rgba(138, 90, 43, 0.12);
    padding: 10px 40px;
    border-radius: 8px;
}

/* ═══════════ Thèmes Éditoriaux ═══════════ */
.paper.style-notarial {
    font-family: "Playfair Display", Georgia, serif;
}
.paper.style-notarial .doc-notarial-act-title,
.paper.style-notarial .doc-title {
    border-top: 1px solid #22201d;
    border-bottom: 2px solid #22201d;
    padding: 6px 0;
}
.paper.style-drouot {
    font-family: "Playfair Display", Georgia, serif;
}
.paper.style-drouot .doc-title {
    color: #1a1a1a;
    letter-spacing: 1.5px;
}
.paper.style-drouot .entry-photos img,
.paper.style-drouot .cat-item img {
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
    border: 1px solid #d9cdb8;
}
.paper.style-brocante {
    font-family: Georgia, "Times New Roman", serif;
}
.paper.style-brocante th {
    background: var(--sable, #f5efe4);
}
.paper.style-moderne {
    font-family: Inter, "Segoe UI", sans-serif;
}
.paper.style-moderne .doc-title,
.paper.style-moderne .doc-firm {
    font-family: Inter, "Segoe UI", sans-serif;
    font-weight: 700;
}

@media print {
    /* Sur le papier, chaque feuille reste une page A4 stricte */
    .feuilles { display: block; gap: 0; }
    .feuilles .paper {
        box-shadow: none !important;
        width: 210mm !important;
        height: 297mm !important;
        min-height: 297mm !important;
        max-height: 297mm !important;
        overflow: hidden !important;
        position: relative !important;
        padding: 14mm 14mm 24mm !important;
        break-after: page;
        page-break-after: always;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .feuilles .paper:last-child {
        break-after: auto;
        page-break-after: auto;
    }
    .numero-page { display: none !important; }
    .doc-pied-feuille {
        position: absolute !important;
        bottom: 6mm !important;
        left: 14mm !important;
        right: 14mm !important;
        display: flex !important;
        border-top: .5px solid #22201d !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .filigrane-texte {
        color: rgba(0, 0, 0, 0.05) !important;
        border-color: rgba(0, 0, 0, 0.07) !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

.feuille-bloc { display: flex; flex-direction: column; align-items: flex-end; }
.numero-page {
    margin-top: 5px;
    font-family: Inter, sans-serif;
    font-size: 10px;
    color: #8c8071;
}

@media print {
    .feuille-bloc { display: block; }
}

@media print {
    .feuilles { zoom: 1 !important; }
}

/* ═══════════ Gestion & Réordonnancement des pièces (Panneau latéral) ═══════════ */

.gestion-pieces-doc {
    background: #fcfbf9;
    border: 1px solid var(--bordure, #e6ddcd);
    border-radius: var(--r-l, 10px);
    padding: 12px 14px;
    margin: 14px 0 16px;
}

.gestion-pieces-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.btn-ajouter-piece {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border: 1px solid var(--caramel, #8a5a2b);
    border-radius: 6px;
    background: #fff;
    color: var(--caramel, #8a5a2b);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s ease;
}

.btn-ajouter-piece:hover {
    background: var(--caramel, #8a5a2b);
    color: #fff;
}

.liste-pieces-ordonnables {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 290px;
    overflow-y: auto;
    padding-right: 2px;
    margin-top: 6px;
}

.piece-doc-vide {
    font-size: 0.8rem;
    color: var(--gris, #6c6459);
    font-style: italic;
    padding: 8px 4px;
    text-align: center;
}

.carte-piece-doc {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: #fff;
    border: 1px solid #e7dfd1;
    border-radius: 6px;
    transition: border-color .15s ease, background .15s ease;
}

.carte-piece-doc:hover {
    border-color: #c9bea9;
    background: #fffdf9;
}

.piece-doc-num {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--gris, #6c6459);
    min-width: 20px;
    text-align: right;
    font-family: Inter, sans-serif;
}

.piece-doc-vignette {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 4px;
    overflow: hidden;
    background: #f0ebe1;
    display: grid;
    place-items: center;
    border: 1px solid #e4dcd0;
}

.piece-doc-vignette img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.piece-doc-sans-photo {
    font-size: 0.75rem;
    color: #a89c8a;
}

.piece-doc-infos {
    flex: 1;
    min-width: 0;
}

.piece-doc-titre {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--encre, #1f1d1a);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
}

.piece-doc-details {
    font-size: 0.72rem;
    color: var(--gris, #6c6459);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.piece-doc-actions {
    display: flex;
    gap: 2px;
    align-items: center;
}

.btn-ordre {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border: 1px solid #d9cdb8;
    border-radius: 4px;
    background: #fff;
    color: #5a5247;
    font-size: 8px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    font-family: Inter, sans-serif;
    transition: all .12s ease;
}

.btn-ordre:hover:not(:disabled) {
    border-color: #8a5a2b;
    background: var(--sable, #f5efe4);
    color: var(--encre, #1f1d1a);
}

.btn-ordre:disabled {
    opacity: 0.3;
    cursor: default;
    background: #faf8f5;
    border-color: #eee7db;
}

.btn-ordre-retirer {
    font-size: 10px;
}

.btn-ordre-retirer:hover {
    border-color: #a83b38 !important;
    background: #fdf2f2 !important;
    color: #a83b38 !important;
}

/* ═══════════ Fenêtre pop-up / modale d'ajout d'objets ═══════════ */

.modal-objets-card {
    width: min(840px, 95vw);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #d9cdb8;
    border-radius: 14px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.24);
    overflow: hidden;
}

.modal-objets-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 18px 24px 14px;
    border-bottom: 1px solid #ece4d5;
    background: #faf8f4;
}

.modal-objets-header h2 {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.28rem;
    font-weight: 600;
    margin: 0;
    color: #22201d;
}

.modal-objets-sous-titre {
    font-size: 0.83rem;
    color: #6f665a;
    margin: 4px 0 0;
}

.modal-objets-barre-filtres {
    padding: 12px 24px;
    background: #fff;
    border-bottom: 1px solid #ece4d5;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal-recherche-champ {
    position: relative;
    display: flex;
    align-items: center;
}

.modal-recherche-champ input {
    width: 100%;
    padding: 9px 34px 9px 12px;
    font-size: 0.88rem;
    border: 1px solid #d9cdb8;
    border-radius: 7px;
    background: #faf8f5;
    font-family: inherit;
    color: #22201d;
}

.modal-recherche-champ input:focus {
    outline: none;
    border-color: #8a5a2b;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(138, 90, 43, 0.15);
}

.btn-effacer-recherche {
    position: absolute;
    right: 8px;
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    border: none;
    background: transparent;
    color: #8c8071;
    font-size: 11px;
    cursor: pointer;
    border-radius: 50%;
}

.btn-effacer-recherche:hover {
    color: #22201d;
    background: #ece4d5;
}

.modal-filtres-selects {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.filtre-select-groupe label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 700;
    color: #70685e;
    margin-bottom: 3px;
}

.filtre-select-groupe select {
    width: 100%;
    padding: 7px 10px;
    font-size: 0.84rem;
    border: 1px solid #d9cdb8;
    border-radius: 6px;
    background: #fff;
    color: #22201d;
    font-family: inherit;
}

.modal-insertion-barre {
    padding: 9px 24px;
    background: #fbf9f5;
    border-bottom: 1px solid #ece4d5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.83rem;
}

.modal-insertion-choix {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #3f3931;
}

.modal-insertion-choix select {
    padding: 5px 8px;
    font-size: 0.82rem;
    border: 1px solid #d9cdb8;
    border-radius: 5px;
    background: #fff;
    color: #22201d;
}

.modal-selection-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #6f665a;
}

.btn-lien-cocher {
    background: none;
    border: none;
    color: #8a5a2b;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

.btn-lien-cocher:hover {
    color: #5f3e1d;
}

.modal-objets-liste {
    flex: 1;
    overflow-y: auto;
    padding: 14px 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    max-height: 46vh;
    background: #f9f7f2;
}

.carte-objet-modal {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #e5ded2;
    border-radius: 8px;
    cursor: pointer;
    transition: all .14s ease;
    user-select: none;
}

.carte-objet-modal:hover:not(.deja-inclus) {
    border-color: #8a5a2b;
    background: #fffdfb;
}

.carte-objet-modal.selectionnee {
    border-color: #8a5a2b;
    background: #fbf5ec;
    box-shadow: 0 0 0 1px #8a5a2b;
}

.carte-objet-modal.deja-inclus {
    opacity: 0.92;
    background: #f7f4ed;
    border-color: #e4dcd0;
}

.carte-objet-modal.deja-inclus:hover {
    background: #f3efe6;
    border-color: #d8cebe;
}

.modal-objet-actions-droite {
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: flex-end;
    margin-left: auto;
    padding-left: 6px;
    flex-shrink: 0;
}

.btn-action-modal {
    padding: 3px 8px;
    font-size: 0.72rem;
    font-family: inherit;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid #d5cbba;
    background: #fff;
    color: #5a5246;
    transition: all .12s ease;
    white-space: nowrap;
    line-height: 1.35;
}

.btn-action-modal:hover {
    background: #f5efe6;
    border-color: #8a5a2b;
    color: #22201d;
}

.btn-action-modal.btn-retirer-doc {
    background: #fdf6f5;
    border-color: #e8c6c4;
    color: #a4423e;
    font-weight: 500;
}

.btn-action-modal.btn-retirer-doc:hover {
    background: #fbe8e6;
    border-color: #c93b34;
    color: #8a1f18;
}

.btn-action-modal.btn-supprimer-doc {
    background: #fff;
    border-color: #e5ded2;
    color: #8c8071;
}

.btn-action-modal.btn-supprimer-doc:hover {
    background: #fff5f5;
    border-color: #e57373;
    color: #c53030;
}

.modal-objet-check {
    margin-top: 3px;
    cursor: pointer;
    accent-color: #8a5a2b;
    width: 16px;
    height: 16px;
}

.modal-objet-vignette {
    width: 46px;
    height: 46px;
    min-width: 46px;
    border-radius: 6px;
    overflow: hidden;
    background: #eee8dc;
    display: grid;
    place-items: center;
    border: 1px solid #e0d7c7;
}

.modal-objet-vignette img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-objet-details {
    flex: 1;
    min-width: 0;
}

.modal-objet-titre {
    font-size: 0.86rem;
    font-weight: 600;
    color: #22201d;
    line-height: 1.25;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-objet-meta {
    font-size: 0.74rem;
    color: #6f665a;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-objet-prix {
    font-size: 0.82rem;
    font-weight: 600;
    color: #8a5a2b;
    margin-top: 3px;
}

.badge-deja-inclus {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    color: #6f665a;
    background: #e6dfd1;
    padding: 1px 5px;
    border-radius: 3px;
    margin-top: 3px;
}

.modal-objets-footer {
    padding: 12px 24px;
    background: #faf8f4;
    border-top: 1px solid #ece4d5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.modal-objets-footer-info {
    font-size: 0.8rem;
    color: #6f665a;
}

.modal-objets-actions {
    display: flex;
    gap: 10px;
}

.btn-secondaire {
    padding: 8px 16px;
    border: 1px solid #d9cdb8;
    background: #fff;
    color: #444;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: inherit;
    transition: background .12s ease;
}

.btn-secondaire:hover {
    background: #f3efe6;
}

.btn-primaire {
    padding: 8px 18px;
    border: 1px solid #8a5a2b;
    background: #8a5a2b;
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    transition: background .12s ease;
}

.btn-primaire:hover:not(:disabled) {
    background: #734a22;
}

.btn-primaire:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

@media (max-width: 720px) {
    .modal-objets-liste {
        grid-template-columns: 1fr;
    }
    .modal-filtres-selects {
        grid-template-columns: 1fr;
    }
}

/* En-tête de présentation pour fiche descriptive de vente / vitrine */
.fiche-vente-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1.5px solid var(--encre-doc, #22201d);
    padding-bottom: 3.5mm;
    margin-bottom: 5mm;
}
.fiche-vente-emetteur {
    display: flex;
    align-items: center;
    gap: 10px;
}
.fiche-vente-logo {
    max-height: 12mm;
    max-width: 38mm;
    object-fit: contain;
}
.fiche-vente-firm {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 11pt;
    font-weight: 700;
    color: var(--encre-doc, #22201d);
}
.fiche-vente-coord {
    font-size: 7.2pt;
    color: #6f665a;
    white-space: pre-line;
    line-height: 1.25;
}
.fiche-vente-titres {
    text-align: right;
}
.fiche-vente-titre-doc {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 11pt;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--encre-doc, #22201d);
}
.fiche-vente-ref {
    font-size: 7.2pt;
    color: #8c8071;
    margin-top: 2px;
}

/* Placeholders pour objets sans photo */
.planche-photo .planche-sans-photo {
    width: 100%;
    height: 32mm;
    background: #faf7f1;
    border: 1px dashed #d8d0c2;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8pt;
    color: #a89f91;
}
.cat-item .cat-sans-photo {
    width: 100%;
    height: 40mm;
    background: #faf7f1;
    border: 1px dashed #d8d0c2;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8pt;
    color: #a89f91;
    margin-bottom: 3px;
}

