/* ============================================================
   ASSISTANCE — relecture et contrôle d'une lecture IA (0.5.4.P2, LIA)
   Maquette : Doc de travail/integration-ia/MAQUETTE-LIA-controle.html.
   Chargé après assistance.css.
   ============================================================ */
/* Couleurs : tokens.css seulement. Doré = --ambre (déduit), saisie = --saisie (0.5.4.P2). */

/* ---- Statut d'une ligne : forme ET couleur (U.2) ---- */
.ia-et { display: inline-grid; place-items: center; flex: none; width: 12px; height: 12px; border-radius: 50%;
  border: 1.5px solid transparent; vertical-align: middle; font: 700 8px/1 var(--sans); color: var(--panneau); }
.ia-et.absente { border: 1.5px dashed var(--encre3); background: none; }
.ia-et.deduit { background: var(--ambre); }
.ia-et.lue { background: var(--encre2); box-shadow: inset 0 0 0 2.5px var(--panneau); border-color: var(--encre2); }
.ia-et.saisie { background: var(--saisie); border-radius: 3px; }
.ia-et.controle { background: var(--ok); }
.ia-et.controle::after { content: "✓"; }
.ia-et.a_corriger { background: var(--alerte); border-radius: 2px; transform: rotate(45deg) scale(.85); }
.ia-et.a_corriger::after { content: "!"; transform: rotate(-45deg); }
.ia-et.retiree { background: none; border-color: var(--encre4); }

/* ---- En-tête collant : fil, titre, état du moteur, plein écran, original détaché (retour MOA) ---- */
.ia-tete { position: sticky; top: 0; z-index: 30; background: var(--panneau); padding-top: 6px; border-bottom: 1px solid var(--trait); margin-bottom: 10px; }
.ia-ecran.ia-plein > .ia-tete { margin: 0 -16px 10px; padding: 6px 16px 0; }
.ia-ecran .ia-apercu { top: calc(var(--ia-tete-h, 0px) + 8px); }

/* ---- Barre d'outils, plein écran, original détaché ---- */
.ia-outils { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 10px; }
.ia-outils .r { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.ia-detache-note { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--accent); }
.ia-prop.ia-detache { grid-template-columns: minmax(0, 1fr); }
.ia-source-seule { margin-bottom: 10px; border: 1px solid var(--trait); border-radius: var(--r-ctrl); background: var(--panneau); }
.ia-ecran.ia-plein { position: fixed; inset: 0; z-index: 55; overflow-x: hidden; overflow-y: auto; padding: 0 16px 12px; background: var(--fond); }
.ia-ecran.ia-plein .ia-page { min-height: calc(100vh - 220px); }
.ia-ecran.ia-plein .ia-original { height: calc(100vh - 230px); }
.ia-ecran.ia-plein .ia-tw { max-height: calc(100vh - 330px); }

/* ---- Avancement et filtres ---- */
.ia-avance { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--trait); }
.ia-avance .r { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ia-compteur { font-size: var(--fs-md); font-weight: 600; }
.ia-compteur .mono { font-size: var(--fs-md); }
.ia-jauge { display: flex; width: 180px; height: 8px; border-radius: 4px; overflow: hidden; background: var(--voile); }
.ia-jauge i { display: block; height: 100%; width: 0; }
.ia-jauge .c { background: var(--ok); }
.ia-jauge .x { background: var(--alerte); }
.ia-enreg { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--encre2); }
.ia-enreg i { width: 7px; height: 7px; border-radius: 50%; background: var(--encre4); display: inline-block; }
.ia-enreg.ok i { background: var(--ok); }
.ia-enreg.attente i, .ia-enreg.encours i { background: var(--ambre); }
.ia-enreg.erreur i { background: var(--alerte); }
.ia-enreg.erreur { color: var(--alerte); }
.ia-filtres { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; padding: 8px 14px; border-bottom: 1px solid var(--trait); }
.ia-hctl { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--encre2); cursor: pointer; }
.ia-hctl input { accent-color: var(--ok); width: 15px; height: 15px; }

/* ---- Tableau des lignes ---- */
/* Le tableau est son propre plan (retour MOA UIUX-LIA-4 : la colonne de la corbeille passait sur la barre de décision) :
   `isolation` crée un contexte d'empilement, les z-index des cellules collées (en-tête, corbeille) restent locaux au
   tableau. Bordures « separate » : en mode « collapse », c'est le tableau qui peint les bordures, et une cellule collée
   glisse sans elles, d'où un trait qui semblait décaler les lignes par rapport aux cases et aux points. */
.ia-tw { max-height: calc(100vh - 300px); overflow: auto; position: relative; isolation: isolate; }
table.tbl.ia-lignes { border-collapse: separate; border-spacing: 0; }
.ia-lignes thead th { position: sticky; top: 0; z-index: 2; background: var(--panneau); }
.ia-lignes td { padding-top: 3px; padding-bottom: 3px; }
.ia-lignes .ia-in { border-color: transparent; background: transparent; }
.ia-lignes .ia-in:hover { border-color: var(--trait); }
.ia-lignes .ia-in:focus { border-color: var(--accent); background: var(--panneau); }
.ia-lignes .ia-in:disabled { color: var(--encre3); }
.ia-lignes .ia-in.manque { border: 1px dashed var(--encre3);
  background: repeating-linear-gradient(135deg, var(--voile) 0 4px, transparent 4px 8px); }
.ia-in.ia-deduit { box-shadow: inset 0 -2px 0 var(--ambre); }
.ia-in.ia-corrige { box-shadow: inset 0 -2px 0 var(--saisie); }
.ia-lignes select.ia-in { min-width: 104px; padding: 3px 4px; }
.ia-c-case { width: 34px; text-align: center; position: relative; }
.ia-c-case .ia-ctl { width: 16px; height: 16px; accent-color: var(--ok); cursor: pointer; vertical-align: middle; }
.ia-c-etat { width: 24px; text-align: center; }
/* Corbeille et « Rétablir » : toujours visibles (tactile, clavier) et dans une colonne collée au bord droit du tableau,
   pour rester à portée même quand le tableau défile en largeur (retour MOA : « impossible de supprimer une ligne »). */
.ia-c-outils { width: 40px; text-align: center; position: sticky; right: 0; z-index: 1; background: var(--panneau);
  box-shadow: inset 1px 0 0 var(--trait); }
.ia-lignes thead th.ia-c-outils { z-index: 3; }
.ia-c-outils .ia-ret { padding: 2px 6px; color: var(--encre3); }
.ia-c-outils .ia-ret:hover, .ia-c-outils .ia-ret:focus-visible { color: var(--alerte); }
.ia-l.retiree .ia-c-outils .ia-ret:hover { color: var(--ok); }
.ia-l.controle td { background: color-mix(in srgb, var(--ok-voile) 60%, var(--panneau)); }
.ia-l.a_corriger td.ia-c-etat { box-shadow: inset 3px 0 0 var(--alerte); }
.ia-l.retiree .ia-in { text-decoration: line-through; }
.ia-l.ia-vise td { background: var(--ambre-voile); }
.ia-sep td { padding: 3px 10px; background: var(--voile); font-size: var(--fs-micro); letter-spacing: .04em; text-transform: uppercase; color: var(--encre2); }

/* L'interligne : une bande de 12 px à cheval sur la bordure, dans la marge gauche (case et état), pour qu'un clic au
   bord d'une saisie n'insère jamais de ligne ; au survol, un « + » et un trait sur toute la largeur du tableau. */
.ia-inter { position: absolute; left: 0; bottom: -6px; z-index: 3; width: 58px; height: 12px; cursor: copy; }
.ia-inter.haut { top: -6px; bottom: auto; }
/* Le trait : un liseré sur la ligne elle-même (un pseudo-élément de 4000 px élargirait le défilement du tableau). */
.ia-l:has(.ia-inter:not(.haut):hover) td { box-shadow: inset 0 -2px 0 var(--accent); }
.ia-l:has(.ia-inter.haut:hover) td { box-shadow: inset 0 2px 0 var(--accent); }
.ia-inter button { position: absolute; left: 4px; top: -5px; width: 20px; height: 20px; padding: 0; display: grid; place-items: center;
  border: 1px solid var(--accent); border-radius: 50%; background: var(--panneau); color: var(--accent); font: 700 14px/1 var(--sans);
  opacity: 0; cursor: copy; transition: opacity var(--t-fast); }
.ia-inter:hover button { opacity: 1; }

@media (max-width: 900px) {
  .ia-jauge { width: 110px; }
  .ia-avance .r { margin-left: 0; }
}

/* ---- Liste des documents : avancement du contrôle ---- */
.ia-reprise { display: inline-flex; gap: 6px; align-items: center; margin-right: 8px; font-size: 12px; color: var(--encre2); }
.ia-mini { display: inline-flex; width: 70px; height: 6px; border-radius: 3px; overflow: hidden; background: var(--voile); }
.ia-mini i { display: block; height: 100%; background: var(--ok); }

/* ---- Boutons à icône de la relecture : le survol ne déplace jamais la zone survolée ----
   Retour MOA (essai sur harmonia-lia) : avec le libellé qui se déplie DANS le bouton (.btn.icone-revele), un bouton
   aligné à droite s'élargit vers la gauche ; l'icône quitte le curseur, le survol tombe, le bouton se replie, l'icône
   revient : clignotement sans fin. Ici le bouton garde sa taille ; le libellé est une étiquette posée par-dessus,
   à côté de l'icône, qui ne reçoit pas la souris. */
.btn.icone-revele.ia-fixe { position: relative; }
.btn.icone-revele.ia-fixe .lb {
  position: absolute; top: 50%; right: calc(100% + 6px); z-index: 6; transform: translateY(-50%);
  max-width: none; margin: 0; padding: 2px 8px; border-radius: 6px; pointer-events: none;
  background: var(--encre); color: var(--panneau); font-size: var(--fs-xs); font-weight: 500;
  opacity: 0; transition: opacity 260ms ease;
}
.btn.icone-revele.ia-fixe.ia-fixe-d .lb { right: auto; left: calc(100% + 6px); }
/* Au survol et au focus clavier seulement : pas au simple focus laissé par un clic (retour MOA : « Plein écran » restait
   affiché après le changement de mode). La règle commune `:focus-within` est neutralisée par la règle ci-dessus. */
.btn.icone-revele.ia-fixe:hover .lb, .btn.icone-revele.ia-fixe:focus-visible .lb { max-width: none; margin: 0; opacity: 1; }
@media (prefers-reduced-motion: reduce) { .btn.icone-revele.ia-fixe .lb { transition: none; } }
