/* ============================================================================
   EasyCertif — Import PDF (.cip-*)
   ----------------------------------------------------------------------------
   Deux écrans : la liste des PDF déposés (bouton de dépôt, réglage de l'IA, rail
   d'états) et la relecture d'un PDF — le document à gauche, les champs lus à
   droite, côte à côte à partir de 1100 px, l'un sous l'autre en dessous. Le
   tableau des lignes est saisissable : ses champs prennent la largeur de leur
   colonne, les montants sont alignés à droite.
   ============================================================================ */

/* Le dépôt : un <label> habillé en bouton d'engagement, le champ fichier caché dedans. */
.appgrid .cip-deposer { position: relative; cursor: pointer; }
.appgrid .cip-deposer.est-occupe { cursor: progress; background: var(--et-action-off); color: var(--et-action-off-ink); border-color: var(--et-action-off); }
.appgrid .cip-fichier { position: absolute; inset: 0; opacity: 0; cursor: inherit; width: 100%; }
.appgrid .cip-deposer:has(.cip-fichier:focus-visible) { outline: 2px solid var(--et-form-blue); outline-offset: 2px; }

.appgrid .cip-refus { margin: 4px 0 0; padding-left: 18px; font-size: 13px; }
.appgrid .cip-refus-nom { font-weight: 600; }

.appgrid .cip-reglage {
    display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding: 8px 12px;
    background: var(--et-surface); border: 1px solid var(--et-hairline);
}
.appgrid .cip-reglage > i { color: var(--et-form-blue-encre); }
.appgrid .cip-reglage-txt { font-size: 13px; color: var(--et-muted); }
.appgrid .cip-case { display: inline-flex; align-items: center; gap: var(--et-coche-gap); font-size: 13px; color: var(--et-ink); cursor: pointer; }

/* ---- La relecture ---- */
.appgrid .cip-relecture { display: grid; grid-template-columns: 1fr; gap: 12px; align-items: start; }
@media (min-width: 1100px) {
    .appgrid .cip-relecture { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
    /* Le PDF reste sous les yeux pendant qu'on fait défiler les champs. */
    .appgrid .cip-pdf { position: sticky; top: 12px; }
}

.appgrid .cip-pdf { background: var(--et-surface); border: 1px solid var(--et-hairline); }
.appgrid .cip-pdf-cadre { display: block; width: 100%; height: calc(100vh - 220px); min-height: 480px; border: 0; }
.appgrid .cip-pdf-vide {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 240px; font-size: 13px; color: var(--et-muted);
}

.appgrid .cip-champs { background: var(--et-surface); border: 1px solid var(--et-hairline); padding: 4px 12px 12px; min-width: 0; }
.appgrid .cip-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.appgrid .cip-devise { width: 90px; }
.appgrid .cip-taxe { display: grid; grid-template-columns: minmax(0, 1fr) 150px 120px auto; gap: 6px; align-items: center; }
@media (max-width: 720px) { .appgrid .cip-taxe { grid-template-columns: minmax(0, 1fr) auto; } }
.appgrid .cip-champs .mx-input.num { text-align: right; }

.appgrid .cip-lignes-cadre { overflow-x: auto; }
.appgrid .cip-lignes { width: 100%; min-width: 640px; border-collapse: collapse; font-size: var(--et-fs-cell); }
.appgrid .cip-lignes th {
    padding: var(--et-cellule-tete-y) 4px; text-align: left; font-size: var(--et-fs-tete); font-weight: 600;
    color: var(--et-sur-ardoise-plein); background: var(--et-table-head);
}
.appgrid .cip-lignes th.num, .appgrid .cip-lignes td.num { text-align: right; }
/* densité voulue : rangée de saisie, chaque cellule porte un champ */
.appgrid .cip-lignes td { padding: 4px; border-bottom: 1px solid var(--et-hairline); vertical-align: middle; }
.appgrid .cip-lignes td > .mx-input { width: 100%; min-width: 72px; }
.appgrid .cip-lignes td:first-child > .mx-input { min-width: 180px; }
.appgrid .cip-lignes tfoot td { font-weight: 600; color: var(--et-ink); border-bottom: 0; }
.appgrid .cip-lignes-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

@media (max-width: 1024px) {
    /* La règle tactile du produit : une cible d'au moins 44 px. */
    .appgrid .cip-case { min-height: 44px; }
    .appgrid .cip-lignes .mx-btn-ico { min-width: 44px; min-height: 44px; }
}
