/* EasyMarket (/admin/market/*, 2026-12-04) — le deviseur, la saisie des prix d'une grille et le
   devis imprimable. Écrit en --et-* : aucune couleur en dur. */

/* ---- Le deviseur : la saisie à gauche, ce que paie le client à droite ---------------------- */
.appgrid .mkt-fiche {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
    gap: var(--et-carte-ecart);
    align-items: start;
}
.appgrid .mkt-fiche-principal,
.appgrid .mkt-fiche-cote { display: flex; flex-direction: column; gap: var(--et-carte-ecart); min-width: 0; }
.appgrid .mkt-fiche-cote { position: sticky; top: var(--et-carte-ecart); }
.appgrid .mkt-fiche .mx-carte { margin: 0; }

@media (max-width: 1100px) {
    .appgrid .mkt-fiche { grid-template-columns: minmax(0, 1fr); }
    .appgrid .mkt-fiche-cote { position: static; }
}

/* Un pourcentage : le champ et son signe sur une ligne. */
.appgrid .mkt-pct { display: inline-flex; align-items: center; gap: var(--et-lbl-gap); }
.appgrid .mkt-pct .mx-input { width: 96px; }

/* Packs et ajout d'article, au-dessus des lignes. */
.appgrid .mkt-packs { display: flex; flex-wrap: wrap; gap: var(--et-coches-gap); margin-bottom: var(--et-carte-corps-py); }
.appgrid .mkt-ajout { display: flex; flex-wrap: wrap; gap: var(--et-outils-gap); margin-bottom: var(--et-carte-corps-py); }
.appgrid .mkt-ajout .mx-select { flex: 1 1 320px; min-width: 0; }
.appgrid .mkt-qte { width: 80px; text-align: right; }
.appgrid .mkt-montant { width: 120px; text-align: right; }
.appgrid .mkt-choix { display: flex; flex-direction: column; gap: var(--et-coches-gap); max-height: 260px; overflow-y: auto; }

/* ---- Les grilles de saisie (lignes du devis, prix d'une grille) ---------------------------- */
.appgrid .mkt-table-cadre { overflow-x: auto; }
.appgrid .mkt-lignes { width: 100%; border-collapse: collapse; font-size: var(--et-fs-cell); }
.appgrid .mkt-lignes th {
    text-align: left; font-size: 12px; font-weight: 600; color: var(--et-muted);
    padding: var(--et-cellule-tete-y) 8px; border-bottom: 1px solid var(--et-hairline); white-space: nowrap;
}
.appgrid .mkt-lignes td { padding: var(--et-cellule-y) 8px; border-bottom: 1px solid var(--et-rang); vertical-align: top; }
/* Le libellé de l'article se lit en entier : la règle commune des cellules le coupait en « EasyAd… »
   (mesuré au banc, 1280). Il passe à la ligne plutôt que de se tronquer. */
.appgrid .mkt-lignes td,
.appgrid .mkt-f-lignes td { white-space: normal; overflow: visible; text-overflow: clip; max-width: none; }
.appgrid .mkt-lignes td:first-child,
.appgrid .mkt-f-lignes td:first-child { min-width: 200px; }
.appgrid .mkt-lignes td .mx-sous { white-space: normal; overflow: visible; text-overflow: clip; }
.appgrid .mkt-lignes .est-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.appgrid .mkt-lignes tr.est-groupe td { background: var(--et-surface-2); font-weight: 600; color: var(--et-ink); }
.appgrid .mkt-lignes tr.est-absent td { color: var(--et-muted); }
.appgrid .mkt-lignes tr.est-plancher td:first-child { box-shadow: inset 3px 0 0 var(--et-avertissement-mark); }
.appgrid .mkt-lignes .mx-pastille { margin-left: 4px; }

/* ---- Les totaux et le suivi ---------------------------------------------------------------- */
.appgrid .mkt-totaux { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; margin: 0; padding: var(--et-carte-corps-py) 14px; }
.appgrid .mkt-totaux dt { font-weight: 400; color: var(--et-muted); }
.appgrid .mkt-totaux dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.appgrid .mkt-totaux .est-fort { font-weight: 700; color: var(--et-ink); }
.appgrid .mkt-versions { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }

/* ---- Le devis imprimable ------------------------------------------------------------------- */
.appgrid .mkt-feuille {
    max-width: 210mm; margin: 0 auto; padding: 14mm 12mm;
    background: var(--et-surface); color: var(--et-ink); border: 1px solid var(--et-hairline);
    font-size: 13px;
}
.appgrid .mkt-f-tete { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 12px; border-bottom: 2px solid var(--et-blue); }
.appgrid .mkt-f-emetteur { font-size: 20px; font-weight: 700; color: var(--et-blue); }
.appgrid .mkt-f-sous { color: var(--et-muted); font-size: 12px; }
.appgrid .mkt-f-ref { text-align: right; }
.appgrid .mkt-f-titre { font-size: 18px; font-weight: 700; letter-spacing: .04em; }
.appgrid .mkt-f-client { margin: 16px 0 12px auto; width: 50%; padding: 10px 12px; border: 1px solid var(--et-hairline); }
.appgrid .mkt-f-label { font-size: 12px; color: var(--et-muted); text-transform: uppercase; letter-spacing: .04em; }
.appgrid .mkt-f-fort { font-weight: 700; }
.appgrid .mkt-f-objet, .appgrid .mkt-f-conditions { margin: 0 0 8px; }
.appgrid .mkt-f-lignes { width: 100%; border-collapse: collapse; margin: 8px 0 12px; }
.appgrid .mkt-f-lignes th { /* densité voulue : papier — le devis A4 remis au client */ text-align: left; font-size: 12px; padding: 6px 8px; border-bottom: 2px solid var(--et-blue); }
.appgrid .mkt-f-lignes td { /* densité voulue : papier — le devis A4 remis au client */ padding: 6px 8px; border-bottom: 1px solid var(--et-rang); vertical-align: top; }
.appgrid .mkt-f-lignes .est-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.appgrid .mkt-f-lignes tr.est-groupe td { background: var(--et-surface-2); font-weight: 700; }
.appgrid .mkt-f-totaux { margin-left: auto; width: 55%; display: flex; flex-direction: column; gap: 4px; }
.appgrid .mkt-f-totaux > div { display: flex; justify-content: space-between; gap: 16px; }
.appgrid .mkt-f-totaux .est-fort { font-weight: 700; }
.appgrid .mkt-f-totaux .est-net { font-weight: 700; padding-top: 6px; border-top: 2px solid var(--et-blue); }
.appgrid .mkt-f-note { margin-top: 16px; white-space: pre-line; }
.appgrid .mkt-f-pied { margin-top: 28px; }
.appgrid .mkt-f-signature { height: 70px; margin-top: 8px; border: 1px dashed var(--et-hairline); width: 50%; }

@media (max-width: 720px) {
    .appgrid .mkt-feuille { padding: 12px; }
    .appgrid .mkt-f-tete { flex-wrap: wrap; }
    .appgrid .mkt-f-ref { text-align: left; }
    .appgrid .mkt-f-client, .appgrid .mkt-f-totaux { width: 100%; }
}

@media print {
    body:where(:has(.mkt-feuille)) * { visibility: hidden; }
    .mkt-feuille, .mkt-feuille * { visibility: visible; }
    .mkt-feuille { position: absolute; left: 0; top: 0; width: 100%; max-width: none; border: 0; padding: 0; }
    .mkt-hors-impression { display: none !important; }
    .mkt-f-lignes thead { display: table-header-group; }
    .mkt-f-lignes tr, .mkt-f-totaux, .mkt-f-pied { break-inside: avoid; page-break-inside: avoid; }
    .mkt-f-lignes th, .mkt-f-lignes tr.est-groupe td, .mkt-f-tete, .mkt-f-totaux .est-net {
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
}
