/* Agent ordinateur. Uniquement les variables existantes (couleurs, tailles, rayons). */

/* Verdicts : un signe et un mot, toujours sur une case ou une puce. */
.ord-etat { font-size: var(--t-aide); line-height: var(--i-aide); font-weight: var(--g-moyen); color: var(--text-secondary); overflow-wrap: anywhere; }
.ord-etat--reussi { color: var(--etat-reussi); }
.ord-etat--attention { color: var(--etat-attention); }
.ord-etat--echec { color: var(--etat-echec); }
.sm-ligne > .ord-etat, .sm-entete > .ord-etat, .ord-etat-carte > .ord-etat:first-child {
  justify-self: end; align-self: start; padding: 0 var(--espace-2); border: 1px solid currentColor; border-radius: var(--rayon-case); white-space: nowrap;
}
.ord-etat-carte > .ord-etat:first-child { align-self: flex-start; }

/* ===== Famille « Ordinateurs » ===== */
#outils-ordinateurs { min-width: 0; }
.ord-liste { margin: 0; padding-left: var(--espace-5); display: flex; flex-direction: column; gap: var(--espace-2); }
.ord-liste--signes { list-style: none; padding: 0; }
.ord-ok { color: var(--etat-reussi); }
.ord-ko { color: var(--etat-echec); }
.ord-inconnu { color: var(--etat-attention); }
.ord-capacites th, .ord-capacites td { white-space: normal; }
.ord-capacites td { text-align: left; }
.ord-deux { align-items: stretch; }
.ord-carte-panne { border: 1px solid var(--etat-echec); }
.ord-carte-panne > .ord-etat:first-child { align-self: flex-start; padding: 0 var(--espace-2); border: 1px solid currentColor; border-radius: var(--rayon-case); }
.ord-ligne { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--espace-3); }
.ord-ligne > div:first-child { flex: 1 1 240px; min-width: 0; }
.ord-code { margin: 0; font-size: var(--t-aide); line-height: var(--i-aide); white-space: pre-wrap; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.ord-coller { display: flex; align-items: flex-start; gap: var(--espace-3); padding: var(--espace-3); border-radius: var(--rayon-controle); background: var(--bg-surface); }
.ord-coller pre { flex: 1; min-width: 0; }
.ord-acces, .ord-taches { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--espace-3); }
.ord-acces li, .ord-taches li { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--espace-2) var(--espace-3); }
.ord-acces li > div, .ord-taches li > div:first-child { flex: 1 1 200px; min-width: 0; }
.ord-taches .actions { align-items: center; }
.ord-ligne-form { display: flex; flex-wrap: wrap; gap: var(--espace-3); }
.ord-ligne-form select { flex: 1 1 200px; min-width: 0; min-height: var(--controle-h); padding: var(--espace-2) var(--espace-3); border: 1px solid var(--border-controle); border-radius: var(--rayon-controle); background: var(--bg-surface); color: var(--text-primary); font: inherit; font-size: var(--t-texte); }
.ord-case { display: flex; align-items: center; justify-content: flex-start; gap: var(--espace-2); min-height: var(--cible-min); text-align: left; }
.ord-cases { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--espace-2); min-width: 0; }
.ord-cases legend { font-size: var(--t-nom); margin-bottom: var(--espace-2); }
.ord-case input { appearance: auto; padding: 0; flex: none; width: 16px; height: 16px; min-height: 0; margin: 0; accent-color: var(--text-primary); }
.ord-apercu-ecran { margin: 0; display: flex; flex-direction: column; gap: var(--espace-2); }
.ord-apercu-ecran img { width: 100%; height: auto; border-radius: var(--rayon-controle); border: 1px solid var(--border-subtle); }
.ord-retirer { border: 1px solid var(--border-subtle); }

/* ===== Panneau « L’ordinateur en direct » ===== */
.activite-agent--ordinateur :is(#session-documents, #session-jauge) { display: none; }
.ord-direct, .ord-direct > [data-ord-region] { display: flex; flex-direction: column; gap: var(--espace-3); min-width: 0; }
.ord-direct > [data-ord-region]:empty { display: none; }
.ord-commandes { display: flex; flex-wrap: wrap; gap: var(--espace-2); }
.ord-commandes .btn { flex: 1 1 auto; min-height: var(--controle-h); }
.ord-commande--arreter { border-color: var(--etat-echec); color: var(--etat-echec); flex-grow: 0; }
.ord-commandes--compact .btn { flex: 0 1 auto; }
.ord-ecran { display: flex; flex-direction: column; gap: var(--espace-3); padding: var(--espace-3); min-width: 0; }
.ord-ecran [data-ord-region="ecran"] { position: relative; min-width: 0; }
.ord-ecran__vue { position: relative; overflow: hidden; border-radius: var(--rayon-controle); background: var(--bg-hover); }
.ord-ecran__vue--zoom { overflow: auto; aspect-ratio: 16 / 10; cursor: grab; scrollbar-width: thin; }
.ord-ecran__vue--zoom.ord-glisse { cursor: grabbing; }
.ord-ecran__vue:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 2px; }
.ord-ecran__toile { position: relative; width: 100%; }
.ord-ecran__toile img { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.ord-ecran--absente .ord-ecran__toile img { visibility: hidden; }
.ord-ecran--absente::after { content: "! Capture illisible"; position: absolute; inset: auto auto var(--espace-2) var(--espace-2); padding: 0 var(--espace-2); border-radius: var(--rayon-case); background: var(--bg-surface); color: var(--etat-attention); font-size: var(--t-aide); }
.ord-ecran__vide { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--espace-2); min-height: 120px; padding: var(--espace-4); text-align: center; border-radius: var(--rayon-controle); background: var(--bg-hover); }
.ord-ecran__titre { font-size: var(--t-titre-case); font-weight: var(--g-gras); }
.ord-ecran__etiquette { align-self: flex-start; margin: 0; padding: 0 var(--espace-2); border-radius: var(--rayon-case); background: var(--bg-hover); }
.ord-ecran__etiquette:empty { display: none; }

/* Repère du geste : point (clic), soulignement (saisie) ou cadre (zoom), avec une bulle de libellé. */
.ord-repere { position: absolute; width: 0; height: 0; pointer-events: none; }
.ord-repere__point { position: absolute; left: -11px; top: -11px; width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--texte-sur-accent); background: transparent; box-shadow: 0 0 0 3px var(--accent); animation: ord-pulse 600ms ease-out infinite alternate; }
.ord-repere--zone { border: 2px solid var(--accent); border-radius: 0; box-shadow: 0 0 0 1px var(--texte-sur-accent); width: auto; height: auto; }
.ord-repere__bulle { position: absolute; left: 14px; top: 10px; padding: 0 var(--espace-2); border-radius: var(--rayon-controle); background: var(--texte-sur-accent); color: var(--accent); font-size: var(--t-repere); line-height: var(--i-repere); font-weight: var(--g-gras); white-space: nowrap; }
.ord-repere--zone .ord-repere__bulle { left: 0; top: calc(100% + 4px); }
@keyframes ord-pulse { from { box-shadow: 0 0 0 3px var(--accent); } to { box-shadow: 0 0 0 7px transparent; } }

.ord-mini { position: absolute; top: var(--espace-2); right: var(--espace-2); width: 72px; border-radius: 0; overflow: hidden; border: 1px solid var(--border-controle); background: var(--bg-surface); pointer-events: none; }
.ord-mini img { display: block; width: 100%; height: auto; }
.ord-mini__cadre { position: absolute; border: 2px solid var(--accent); }

.ord-zoom { display: flex; align-items: center; flex-wrap: wrap; gap: var(--espace-2); }
.ord-zoom__pas, .ord-zoom__plein { width: var(--controle-h); height: var(--controle-h); border-radius: var(--rayon-rond); border: 1px solid var(--border-controle); background: var(--bg-surface); color: var(--text-primary); font-size: var(--t-titre-case); }
.ord-zoom__valeur { min-width: 48px; text-align: center; font-size: var(--t-nom); font-weight: var(--g-moyen); font-variant-numeric: tabular-nums; }
.ord-zoom__fin { margin-left: auto; display: flex; gap: var(--espace-2); }
.ord-zoom__ajuster { min-height: var(--controle-h); }

.ord-maintenant { display: flex; flex-direction: column; gap: var(--espace-1); padding-top: var(--espace-3); border-top: 1px solid var(--border-subtle); }
.ord-maintenant:empty { display: none; }
.ord-phrase { margin: 0; font-size: var(--t-titre-case); font-weight: var(--g-gras); overflow-wrap: anywhere; }
.ord-etape { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--espace-1) var(--espace-3); margin: 0; }
.ord-chrono { margin: 0; font-variant-numeric: tabular-nums; }

.ord-suivi__tete { display: flex; align-items: baseline; justify-content: space-between; gap: var(--espace-2); }
.ord-etapes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--espace-2); }
.ord-etapes li { display: flex; gap: var(--espace-2); }
.ord-etapes__fait > span:first-child { color: var(--etat-reussi); }
.ord-etapes__encours { font-weight: var(--g-moyen); }
.ord-etapes__avenir { color: var(--text-secondary); }
.ord-derniers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--espace-1); }
.ord-derniers li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--espace-2); align-items: baseline; }
.ord-derniers time { font-size: var(--t-aide); color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.ord-derniers span:nth-child(2) { overflow-wrap: anywhere; }

.ord-etat-carte--echec { border-color: var(--etat-echec); }
.ord-etat-carte--attention { border-color: var(--etat-attention); }
.ord-actions-pile { flex-direction: column; flex-wrap: nowrap; }
.ord-actions-pile .btn { width: 100%; }
.ord-decision__ecran { margin: 0; border-radius: var(--rayon-controle); overflow: hidden; background: var(--bg-hover); }
.ord-decision .actions .btn[data-accord="refuse"], .ord-decision .actions .btn[data-accord="tout_le_lot"] { width: 100%; }
.ord-commande-texte { margin: 0; max-height: 9em; overflow: auto; white-space: pre-wrap; word-break: break-all; font-size: var(--t-aide); font-family: ui-monospace, monospace; background: var(--bg-hover); border-radius: var(--rayon-controle); padding: 6px 8px; }
.ord-garanties ul { margin-bottom: var(--espace-2); }

/* Bandeau au-dessus de la saisie, seulement quand le panneau est replié. */
#ordinateur-fil { flex: none; margin: 0 var(--espace-5) var(--espace-3); max-height: 60vh; overflow-y: auto; }
#main:not([data-view="chat"]) #ordinateur-fil { display: none; }
.ord-bandeau { display: none; }
.ord-bandeau > p { margin: 0; flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }

/* ===== Choix de l'ordinateur et du mode ===== */
.ord-choix { display: flex; flex-direction: column; gap: var(--espace-3); }
.ord-choix h3 { font-size: var(--t-titre-case); font-weight: var(--g-gras); }
.ord-choix__colonnes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--espace-4); }
.ord-groupe { display: flex; flex-direction: column; gap: var(--espace-2); min-width: 0; }
.ord-option { display: flex; align-items: flex-start; gap: var(--espace-3); padding: var(--espace-3); border: 1px solid var(--border-controle); border-radius: var(--rayon-controle); background: var(--bg-surface); cursor: pointer; }
.ord-option:has(input:checked) { border-color: var(--text-primary); background: var(--bg-hover); }
.ord-option:has(input:focus-visible) { outline: 2px solid var(--text-primary); outline-offset: 2px; }
.ord-option input { margin-top: 3px; accent-color: var(--text-primary); }
.ord-option > span { display: flex; flex-direction: column; gap: var(--espace-1); min-width: 0; }
.ord-option--off { cursor: not-allowed; border-color: var(--border-subtle); }
.ord-option--off strong { color: var(--text-secondary); }
.ord-choix .actions .btn { align-self: flex-start; }

/* ===== Plein écran ===== */
.ord-plein { position: fixed; inset: var(--espace-5); margin: auto; width: calc(100vw - 2 * var(--espace-5)); height: calc(100dvh - 2 * var(--espace-5)); max-width: none; max-height: none; border: 0; padding: var(--espace-4); color: var(--text-primary); }
.ord-plein[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; gap: var(--espace-3); }
.ord-plein::backdrop { background: var(--dialogue-voile); }
.ord-plein__tete { display: flex; align-items: center; flex-wrap: wrap; gap: var(--espace-3); padding: var(--espace-3) var(--espace-4); }
.ord-plein__tete > div:first-child { flex: 1 1 220px; min-width: 0; }
.ord-plein__etat { margin: 0; font-weight: var(--g-moyen); }
.ord-plein__ecran { min-height: 0; display: flex; }
.ord-plein__ecran > .ord-ecran__vue { flex: 1; min-height: 0; aspect-ratio: auto; display: flex; justify-content: center; align-items: flex-start; }
.ord-plein__ecran > .ord-ecran__vue--zoom { display: block; }
.ord-plein__ecran .ord-ecran__toile { flex: none; }
.ord-plein__ecran .ord-mini { display: none; }
.ord-plein__ecran:has(.ord-ecran__vue--zoom) { position: relative; }
.ord-plein > .ord-ecran__etiquette { justify-self: start; background: var(--bg-surface); }
.ord-plein__pied { display: flex; align-items: center; flex-wrap: wrap; gap: var(--espace-3); padding: var(--espace-3) var(--espace-4); }
.ord-plein__pied > div:first-child { flex: 1 1 260px; min-width: 0; }
.ord-plein__pied > div:empty { display: none; }
.ord-plein__pied p { margin: 0; }
.ord-decision-compacte { display: flex; align-items: center; flex-wrap: wrap; gap: var(--espace-3); padding: var(--espace-2) var(--espace-3); border: 1.5px solid var(--accent); border-radius: var(--rayon-case); }
.ord-decision-compacte .actions { flex-wrap: wrap; }
.ord-decision-compacte .ord-phrase { font-size: var(--t-nom); }

/* ===== Relire la tâche image par image ===== */
.ord-revoir { position: fixed; inset: var(--espace-5); margin: auto; width: min(1120px, calc(100vw - 2 * var(--espace-5))); max-height: calc(100dvh - 2 * var(--espace-5)); max-width: none; border: 0; padding: var(--espace-4); color: var(--text-primary); overflow-y: auto; }
.ord-revoir[open] { display: flex; flex-direction: column; gap: var(--espace-3); }
.ord-revoir::backdrop { background: var(--dialogue-voile); }
.ord-revoir__tete { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--espace-3); padding: var(--espace-3) var(--espace-4); }
.ord-revoir__tete h2 { font-size: var(--t-titre-case); font-weight: var(--g-gras); }
.ord-revoir__corps { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--espace-4); align-items: start; }
.ord-revoir__ecran { margin: 0; border-radius: var(--rayon-controle); overflow: hidden; background: var(--bg-hover); }
.ord-revoir__fiche { display: flex; flex-direction: column; gap: var(--espace-3); min-width: 0; }
.ord-revoir__fiche h3 { font-size: var(--t-titre-case); font-weight: var(--g-gras); overflow-wrap: anywhere; }
.ord-paires { margin: 0; }
.ord-paires dd { margin: 0; overflow-wrap: anywhere; }

@media (max-width: 1100px) {
  .ord-bandeau { display: flex; align-items: center; flex-wrap: wrap; gap: var(--espace-2) var(--espace-3); padding: var(--espace-3) var(--espace-4); }
  #ordinateur-fil { margin-inline: var(--espace-3); }
  .ord-revoir__corps { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .ord-choix__colonnes { grid-template-columns: minmax(0, 1fr); }
  .ord-plein, .ord-revoir { inset: 0; width: 100%; height: 100dvh; max-height: none; border-radius: 0; padding: var(--espace-2); }
  .ord-coller { flex-direction: column; }
  #outils-ordinateurs:not(.sm--detail) #ord-panneau { display: none; }
  .sm--detail#outils-ordinateurs #ord-liste { display: none; }
  .sm--detail#outils-ordinateurs [data-ord="retour"] { display: inline-flex; align-self: flex-start; }
}
#outils-ordinateurs [data-ord="retour"] { display: none; }
#outils-ordinateurs .sm-form [data-ord="retour"] { display: inline-flex; }
@media (prefers-reduced-motion: reduce) {
  .ord-repere__point { animation: none; }
}
