/* ═══════════════════════════════════════════════════════════════
   DTISoft — Import d'articles (namespace `ia-`)
   ═══════════════════════════════════════════════════════════════ */

.ia-overlay {
    position: fixed; inset: 0; z-index: 1200;
    background: rgba(15, 23, 42, .5);
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
}
.ia-panel {
    background: #fff; border-radius: 10px; width: 1180px; max-width: 100%;
    max-height: 92vh; display: flex; flex-direction: column;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .3); overflow: hidden;
}
.ia-busy { cursor: progress; }
.ia-busy .ia-panel { pointer-events: none; }
.ia-busy .ia-foot { pointer-events: auto; }

/* ⚠️ `[hidden]` ne masque plus rien dès qu'une règle d'auteur fixe `display`
   (spécificité : la feuille du navigateur est en (0,1,0), toute classe la bat).
   Ici c'était `.ia-head-btn { display: inline-flex }` : le bouton « Fichiers
   importés » restait visible même pour un utilisateur sans le droit
   `FichiersArchives`. Règle en (0,2,0), donc prioritaire. Même correctif que
   dans export-articles.css, cf. le commentaire détaillé qui s'y trouve. */
.ia-overlay [hidden] { display: none; }

/* `flex-wrap` : le libellé du bouton de modèle est long à dessein (il doit se
   comprendre sans explication). Sur une fenêtre étroite, les boutons passent
   donc à la ligne au lieu de pousser la croix de fermeture hors de la boîte. */
.ia-head {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 6px 0;
    padding: 13px 18px; border-bottom: 1px solid #e5e7eb; background: #f8fafc;
}
.ia-title { font-weight: 600; color: #1e293b; font-size: 14px; }
.ia-title i { color: #2563eb; margin-right: 7px; }
/* Bouton d'en-tête, à DROITE du titre. `margin-right:auto` le colle au titre
   plutôt que de le renvoyer à côté de la croix de fermeture : `space-between`
   sur trois éléments les répartirait aux trois coins, et on cliquerait sur
   « Fichiers importés » en croyant fermer la fenêtre. */
.ia-head-btn {
    display: inline-flex; align-items: center; gap: 6px; margin: 0 0 0 14px;
    border: 1px solid #cbd5e1; background: #fff; color: #334155;
    border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer;
    text-decoration: none; white-space: nowrap;
}
/* Le DERNIER bouton pousse la croix de fermeture à droite : `margin-right:auto`
   sur le premier collerait les suivants à elle. */
.ia-head-btn:last-of-type { margin-right: auto; }
/* Sous 900 px, les deux boutons prennent leur propre ligne : la croix de
   fermeture doit rester atteignable, c'est le seul geste qu'on ne peut pas
   remplacer par un autre. */
@media (max-width: 900px) {
    .ia-head-btn { margin-left: 0; }
    .ia-head-btn:first-of-type { margin-left: auto; }
    .ia-head-btn:last-of-type  { margin-right: 0; }
    .ia-close { order: 9; }
}
/* Le modèle est le point d'entrée d'un nouvel utilisateur : il se remarque. */
#iaModele { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
#iaModele i { color: #16a34a; }
#iaModele:hover { background: #dcfce7; border-color: #86efac; color: #14532d; }
.ia-head-btn:hover { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.ia-head-btn i { color: #64748b; }
.ia-head-btn:hover i { color: #2563eb; }
.ia-close {
    border: 0; background: transparent; font-size: 24px; line-height: 1;
    color: #94a3b8; cursor: pointer; padding: 0 4px;
}
.ia-close:hover { color: #ef4444; }

.ia-body { padding: 16px 18px; overflow: auto; flex: 1; }
.ia-step { margin-bottom: 22px; }
.ia-h4 {
    margin: 0 0 10px 0; font-size: 12px; color: #64748b;
    text-transform: uppercase; letter-spacing: .5px;
    display: flex; align-items: center; gap: 8px;
}
.ia-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 19px; height: 19px; border-radius: 50%;
    background: #2563eb; color: #fff; font-size: 11px; font-weight: 700;
}

/* ── Dépôt du fichier ─────────────────────────────────────────── */
.ia-drop {
    border: 2px dashed #cbd5e1; border-radius: 10px; padding: 26px;
    text-align: center; cursor: pointer; transition: background .15s, border-color .15s;
    background: #f8fafc;
}
.ia-drop:hover, .ia-drop-on { border-color: #3b82f6; background: #eff6ff; }
.ia-drop > i { font-size: 30px; color: #16a34a; }
.ia-drop-txt { margin-top: 10px; font-size: 13px; color: #334155; }
.ia-drop-hint { margin-top: 8px; font-size: 11.5px; color: #94a3b8; }
.ia-link {
    border: 0; background: none; color: #2563eb; cursor: pointer;
    font: inherit; text-decoration: underline; padding: 0;
}
.ia-file-info {
    margin-top: 10px; font-size: 12.5px; color: #166534;
    background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 6px; padding: 8px 12px;
}
.ia-note { color: #94a3b8; font-size: 11.5px; margin-left: 8px; }

/* ── Sélecteurs ───────────────────────────────────────────────── */
.ia-sel {
    padding: 6px 10px; border: 1px solid #cbd5e1; border-radius: 5px;
    font-size: 13px; font-family: inherit; background: #fff; min-width: 260px;
}
.ia-sel-sm { min-width: 150px; }
.ia-sel:focus { outline: 2px solid #93c5fd; outline-offset: -1px; }

/* ── Bilan de reconnaissance ──────────────────────────────────── */
.ia-bilan { margin-bottom: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ia-pill {
    font-size: 11px; font-weight: 600; border-radius: 999px; padding: 3px 10px;
}
.ia-pill-ok  { background: #dcfce7; color: #15803d; }
.ia-pill-spe { background: #ede9fe; color: #6d28d9; }
.ia-pill-inc { background: #f1f5f9; color: #64748b; }
.ia-pill-dbl { background: #fef9c3; color: #a16207; }
.ia-alerte {
    width: 100%; margin-top: 6px; background: #fef2f2; border: 1px solid #fecaca;
    color: #b91c1c; border-radius: 6px; padding: 9px 12px; font-size: 12.5px;
}
.ia-alerte i { margin-right: 6px; }
/* Avertissement (feuille pauvre) : sérieux mais pas bloquant — l'import reste
   possible, c'est un doute sur le choix de la feuille. */
.ia-alerte-att { background: #fffbeb; border-color: #fde68a; color: #a16207; }

/* ── Grille d'aperçu ──────────────────────────────────────────── */
.ia-grid-wrap {
    border: 1px solid #e5e7eb; border-radius: 6px; overflow: auto; max-height: 340px;
}
.ia-grid { border-collapse: collapse; font-size: 11.5px; white-space: nowrap; }
.ia-grid th, .ia-grid td {
    border-right: 1px solid #eef2f7; border-bottom: 1px solid #eef2f7;
    padding: 4px 8px; text-align: left; max-width: 240px;
    overflow: hidden; text-overflow: ellipsis;
}
/* Les deux lignes d'en-tête restent visibles pendant le défilement : c'est
   tout l'intérêt de l'aperçu, vérifier la CIBLE d'une colonne loin à droite. */
.ia-grid thead th { position: sticky; background: #f8fafc; z-index: 2; }
.ia-r-ent th   { top: 0;    font-weight: 700; color: #1e293b; }
.ia-r-cible th { top: 25px; font-weight: 500; font-size: 10.5px; }
.ia-num-l { color: #cbd5e1; text-align: right !important; background: #f8fafc; }

.ia-c-ok    { background: #f6fef9; }
.ia-r-cible .ia-c-ok    { color: #15803d; }
.ia-c-alias { background: #f0f9ff; }
.ia-r-cible .ia-c-alias { color: #0369a1; }
.ia-c-spe   { background: #faf5ff; }
.ia-r-cible .ia-c-spe   { color: #6d28d9; }
.ia-c-inc   { background: #f8fafc; color: #cbd5e1; }
.ia-r-cible .ia-c-inc   { color: #94a3b8; font-style: italic; }
.ia-dbl {
    margin-left: 5px; font-size: 9px; font-weight: 700; text-transform: uppercase;
    background: #fef9c3; color: #a16207; border-radius: 999px; padding: 1px 6px;
}

/* ── Options ──────────────────────────────────────────────────── */
.ia-opts {
    display: grid; grid-template-columns: auto 1fr; gap: 9px 14px;
    align-items: center; max-width: 640px; margin-bottom: 14px;
}
.ia-opt-l { font-size: 12.5px; color: #475569; }
.ia-checks { display: flex; flex-direction: column; gap: 7px; }
.ia-ck {
    display: flex; align-items: center; gap: 8px;
    font-size: 12.5px; color: #334155; cursor: pointer;
}
.ia-ck input { cursor: pointer; }
.ia-ck-groupe {
    margin-top: 6px; border: 1px solid #fde68a; background: #fffbeb;
    border-radius: 7px; padding: 10px 12px; display: flex; flex-direction: column; gap: 7px;
}
.ia-ck-groupe-t { font-size: 12px; font-weight: 600; color: #a16207; }
.ia-ck-groupe-t i { margin-right: 5px; }
.ia-ck-groupe-h { font-weight: 400; color: #b45309; margin-left: 6px; font-size: 11.5px; }
/* Avertissement affiché quand « Ignorer les cases vides » est DÉCOCHÉE. */
.ia-ck-avert {
    margin: 2px 0 4px 24px; padding: 7px 11px; font-size: 11.5px;
    background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; border-radius: 6px;
}
.ia-ck-avert i { margin-right: 5px; }
/* Variante INFORMATIVE (coût de l'historique) : bleue tant que le volume reste
   raisonnable, ambre quand il devient notable. Jamais rouge — ce n'est pas
   une destruction, c'est un coût. */
.ia-ck-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.ia-ck-info.ia-ck-att { background: #fffbeb; border-color: #fde68a; color: #a16207; }
.ia-rap-att { background: #fffbeb; }
.ia-rap-att b { color: #a16207; }

/* ── Rapport ──────────────────────────────────────────────────── */
.ia-simu {
    background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8;
    border-radius: 7px; padding: 9px 12px; font-size: 12.5px; margin-bottom: 10px;
}
.ia-simu i { margin-right: 6px; }
.ia-rap {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 4px 18px;
}
.ia-rap-l {
    display: flex; justify-content: space-between; gap: 12px;
    font-size: 12.5px; color: #475569; padding: 4px 8px; border-radius: 4px;
}
.ia-rap-l b { color: #1e293b; }
.ia-rap-ok { background: #f0fdf4; }
.ia-rap-ok b { color: #15803d; }
.ia-rap-list, .ia-rap-err {
    margin-top: 12px; border-radius: 7px; padding: 10px 12px; font-size: 12px;
    max-height: 190px; overflow: auto;
}
.ia-rap-list { background: #f8fafc; border: 1px solid #e5e7eb; }
.ia-rap-err  { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.ia-rap-list-t { font-weight: 600; margin-bottom: 6px; color: #334155; }
.ia-rap-err .ia-rap-list-t { color: #b91c1c; }
.ia-rap-list ul, .ia-rap-err ul { margin: 0; padding-left: 18px; }
.ia-rap-list li, .ia-rap-err li { margin: 2px 0; }

/* Source du rapport : quel classeur, quelle feuille. En tête, car c'est la
   première question qu'on se pose en rouvrant un rapport depuis la cloche.
   `word-break` : un nom de fichier peut faire 120 caractères sans espace et
   élargirait la boîte au lieu de passer à la ligne. */
.ia-rap-src {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px;
    font-size: 12.5px; color: #334155; word-break: break-word;
    background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 7px;
    padding: 8px 11px; margin-bottom: 12px;
}
.ia-rap-src i   { color: #94a3b8; margin-right: 6px; }
.ia-rap-sep     { color: #cbd5e1; }

/* ── Confirmation avant import définitif ──────────────────────────
   z-index AU-DESSUS de .ia-overlay (1200) : la boîte se superpose à la
   fenêtre d'import, elle ne la remplace pas — on garde le contexte sous
   les yeux au moment de décider. */
.ia-conf-overlay {
    position: fixed; inset: 0; z-index: 1300;
    background: rgba(15, 23, 42, .55);
    display: flex; align-items: center; justify-content: center; padding: 24px;
}
.ia-conf-box {
    background: #fff; border-radius: 10px; width: 560px; max-width: 100%;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .35); overflow: hidden;
}
.ia-conf-box:focus { outline: none; }
.ia-conf-title {
    padding: 13px 18px; font-size: 14px; font-weight: 700; color: #b45309;
    background: #fffbeb; border-bottom: 1px solid #fde68a;
}
.ia-conf-title i { margin-right: 8px; }
.ia-conf-body { padding: 15px 18px; }
.ia-conf-cible {
    display: flex; flex-wrap: wrap; gap: 6px 18px;
    font-size: 12.5px; color: #334155;
    background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 7px;
    padding: 9px 12px; margin-bottom: 13px;
}
.ia-conf-cible i { color: #94a3b8; margin-right: 6px; }
.ia-conf-lbl { font-size: 12px; font-weight: 600; color: #475569; margin-bottom: 6px; }
.ia-conf-list { list-style: none; margin: 0 0 12px 0; padding: 0; }
.ia-conf-list li {
    display: flex; align-items: flex-start; gap: 9px;
    font-size: 12.5px; color: #7f1d1d; padding: 5px 10px; border-radius: 5px;
    background: #fef2f2; margin-bottom: 4px;
}
.ia-conf-list i { color: #dc2626; margin-top: 2px; width: 14px; text-align: center; }
.ia-conf-note {
    font-size: 12px; color: #64748b; line-height: 1.55; margin: 0;
    background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 6px; padding: 9px 11px;
}
.ia-conf-note + .ia-conf-note { margin-top: 8px; }
.ia-conf-note i { color: #2563eb; margin-right: 5px; }
/* Rapport rouvert depuis la cloche : même boîte, mais plus haute et neutre
   (ce n'est pas un avertissement, c'est un compte rendu). */
.ia-rap-box { width: 680px; max-height: 82vh; display: flex; flex-direction: column; }
.ia-rap-box .ia-conf-body { overflow: auto; }
.ia-rap-title {
    background: #eff6ff; border-bottom-color: #bfdbfe; color: #1d4ed8;
    display: flex; align-items: center; justify-content: space-between;
}
.ia-rap-close {
    border: 0; background: transparent; font-size: 22px; line-height: 1;
    color: #93c5fd; cursor: pointer; padding: 0 2px;
}
.ia-rap-close:hover { color: #1d4ed8; }

.ia-conf-btns {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 11px 18px; background: #fafafa; border-top: 1px solid #e5e7eb;
}

/* ── Avancement ───────────────────────────────────────────────────
   Placée JUSTE AU-DESSUS du pied, donc toujours visible quelle que soit
   la position de défilement du corps : pendant un import de plusieurs
   minutes, l'utilisateur ne doit pas avoir à chercher où ça en est. */
.ia-prog {
    padding: 10px 18px 12px; border-top: 1px solid #e5e7eb; background: #f8fafc;
}
.ia-prog-t {
    display: flex; justify-content: space-between; align-items: baseline;
    font-size: 12.5px; color: #334155; margin-bottom: 6px;
}
.ia-prog-t span:last-child { font-weight: 700; color: #1d4ed8; }
.ia-prog-bar {
    height: 8px; background: #e2e8f0; border-radius: 999px; overflow: hidden;
}
.ia-prog-fill {
    height: 100%; width: 0; border-radius: 999px;
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    transition: width .3s ease;
}

/* ── Pied ─────────────────────────────────────────────────────── */
.ia-foot {
    display: flex; align-items: center; gap: 8px;
    padding: 11px 18px; border-top: 1px solid #e5e7eb; background: #fafafa;
}
.ia-msg { flex: 1; font-size: 12.5px; color: #64748b; }
.ia-msg-ok  { color: #15803d; }
.ia-msg-err { color: #b91c1c; font-weight: 600; }
.ia-btn {
    padding: 7px 15px; border: 1px solid #cbd5e1; background: #fff;
    border-radius: 5px; cursor: pointer; font-size: 12.5px; font-family: inherit;
    color: #334155;
}
.ia-btn:hover:not(:disabled) { background: #f1f5f9; }
.ia-btn:disabled { opacity: .45; cursor: not-allowed; }
.ia-btn-sec { border-color: #93c5fd; color: #1d4ed8; }
.ia-btn-sec:hover:not(:disabled) { background: #eff6ff; }
.ia-btn-go { background: #2563eb; border-color: #2563eb; color: #fff; font-weight: 600; }
.ia-btn-go:hover:not(:disabled) { background: #1d4ed8; }
