/* Console QuickRemote.
   Un tableau de bord : on trouve une machine, on voit si elle est là, on
   l'ouvre. Pendant une session, l'écran distant est le sujet et l'interface
   s'efface. Les deux couleurs porteuses reprennent celles du produit : bleu
   pétrole pour la zone interne, ocre pour la zone exposée. */

:root {
  --encre: #131a21;
  --papier: #eceef1;
  --surface: #f7f8f9;
  --relief: #ffffff;
  --trait: #d2d7dd;
  --doux: #4a5560;
  --pale: #78838d;
  --interne: #1d4d6b;
  --barre: #1d4d6b;
  --barre-encre: #f2f6f9;
  --expose: #a8541f;
  --bon: #2f7a54;
  --bon-fond: #2f7a54;
  --eteint: #8a949d;
  --mauvais: #9e2b25;
  --ombre: 0 1px 2px rgba(19, 26, 33, .08), 0 2px 8px rgba(19, 26, 33, .06);
  --t-bleu: #2d5fa8;
  --t-vert: #2f7a54;
  --t-rouge: #b23a33;
  --t-ocre: #b07a12;
  --t-rose: #b0336a;
  --t-sarcelle: #13807e;
  --rayon: 6px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --encre: #e6ebef;
    --papier: #11161b;
    --surface: #182027;
    --relief: #1e272f;
    --trait: #2b353e;
    --doux: #a8b3bd;
    --pale: #7d8891;
    --interne: #69aed2;
    --barre: #18384d;
    --barre-encre: #e6eef4;
    --expose: #e0995c;
    --bon: #63b58c;
    --bon-fond: #1f7a52;
    --eteint: #56616b;
    --mauvais: #d97a72;
    --ombre: 0 1px 2px rgba(0, 0, 0, .3), 0 2px 10px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }

/* `hidden` doit cacher, même un élément que sa classe met en `display: flex`. */
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--papier);
  color: var(--encre);
  font: 14px/1.5 "Segoe UI", system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
code { font: 12.5px ui-monospace, "Cascadia Mono", Consolas, monospace; }

/* --- Contrôles de base ---------------------------------------------------- */

label {
  display: block;
  font-size: 12px;
  color: var(--doux);
  margin: 12px 0 4px;
}
.facultatif { color: var(--pale); }

input, select {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--trait);
  border-radius: 4px;
  background: var(--relief);
  color: var(--encre);
  font: 13px/1.4 "Segoe UI", system-ui, sans-serif;
}
input[type="file"] { padding: 5px; }

:focus-visible {
  outline: 2px solid var(--interne);
  outline-offset: 1px;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--interne);
  border-radius: 4px;
  background: var(--interne);
  color: var(--surface);
  font: 600 13px/1.1 "Segoe UI", system-ui, sans-serif;
  cursor: pointer;
}
button:disabled { opacity: .45; cursor: not-allowed; }
button.secondaire { background: transparent; color: var(--doux); border-color: var(--trait); }
button.secondaire:hover:not(:disabled) { border-color: var(--doux); color: var(--encre); }
/* Un geste qu'on ne défait pas : il doit avoir l'air de ce qu'il est, sans
   crier — il est légitime et parfois nécessaire. */
button.danger { background: transparent; color: var(--mauvais); border-color: var(--mauvais); }
button.compact { padding: 6px 12px; font-size: 12.5px; }

button.icone {
  background: transparent;
  border: 1px solid transparent;
  color: inherit;
  padding: 6px;
  border-radius: 4px;
}
button.icone:hover:not(:disabled) { background: rgba(127, 140, 150, .16); }

.bouton {
  display: block;
  text-align: center;
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 4px;
  background: var(--interne);
  color: var(--surface);
  font-weight: 600;
  margin: 8px 0;
}
.bouton:hover { filter: brightness(1.1); }
.bouton[aria-disabled="true"] { opacity: .45; pointer-events: none; }

.aide { font-size: 12px; line-height: 1.55; color: var(--pale); margin: 4px 0 8px; }
.centre { text-align: center; }
.espace { flex: 1; }
.vide { margin: 0; padding: 14px; font-size: 12.5px; color: var(--pale); text-align: center; }

/* --- Barre du haut --------------------------------------------------------- */

.barre {
  display: flex;
  align-items: stretch;
  gap: 4px;
  height: 46px;
  padding: 0 8px 0 4px;
  background: var(--barre);
  color: var(--barre-encre);
  flex: none;
}
.barre > button.icone { align-self: center; color: var(--barre-encre); }
.barre > button.icone svg { width: 22px; height: 22px; }
.marque {
  align-self: center;
  font-weight: 700;
  letter-spacing: .02em;
  padding: 0 10px 0 4px;
  white-space: nowrap;
}
.onglets { display: flex; align-items: stretch; gap: 2px; min-width: 0; overflow-x: auto; }
.onglet {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 6px 0 14px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--barre-encre);
  font-weight: 500;
  opacity: .78;
  white-space: nowrap;
}
.onglet:hover { opacity: 1; background: rgba(255, 255, 255, .08); }
.onglet[aria-selected="true"] { opacity: 1; background: rgba(255, 255, 255, .14); box-shadow: inset 0 -3px 0 var(--barre-encre); }
.onglet .fermer-onglet {
  display: inline-grid; place-items: center;
  width: 20px; height: 20px; border-radius: 3px; font-size: 15px; line-height: 1;
}
.onglet .fermer-onglet:hover { background: rgba(255, 255, 255, .2); }
.onglet .pastille-session { width: 8px; height: 8px; border-radius: 50%; background: #4cd38a; }
.onglet:not(:has(.fermer-onglet)) { padding-right: 14px; }

.barre-droite { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.barre-droite .icone { position: relative; color: var(--barre-encre); }
.pastille {
  position: absolute; top: 0; right: 0;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: #d9443b; color: #fff;
  font: 700 10px/16px "Segoe UI", sans-serif; text-align: center;
}
#etat-connexion {
  font: 600 10.5px/1 ui-monospace, "Cascadia Mono", monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 5px 9px;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 3px;
}
#etat-connexion[data-genre="ok"] { border-color: #4cd38a; color: #b9f2d3; }
#etat-connexion[data-genre="erreur"] { border-color: #ff8f86; color: #ffd1cd; }
.compte-nom { font-size: 13px; opacity: .9; white-space: nowrap; }

/* --- Les vues -------------------------------------------------------------- */

#vues { flex: 1; min-height: 0; display: flex; }
.vue { flex: 1; min-width: 0; min-height: 0; overflow: auto; }
.vue-centree { display: grid; place-items: center; padding: 24px 16px; }

/* Connexion */
.carte-connexion {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  padding: 28px 28px 20px;
}
.carte-connexion .logo { display: grid; place-items: center; color: var(--interne); }
.carte-connexion .logo svg { width: 44px; height: 44px; }
.carte-connexion h1 { text-align: center; margin: 6px 0 0; font-size: 22px; }
.sous-titre { text-align: center; color: var(--pale); margin: 2px 0 18px; }
.carte-connexion button { width: 100%; margin-top: 10px; }
.avance { margin-top: 18px; font-size: 12px; color: var(--pale); }
.avance summary { cursor: pointer; }
.identite { font-size: 13px; color: var(--doux); text-align: center; margin: 10px 0 0; }
.identite strong { color: var(--encre); }
.motif-refus { font-size: 12px; color: var(--mauvais); margin: 8px 0 0; }

/* Accueil : une recherche et des tuiles, comme un lanceur. */
.accueil { max-width: 980px; margin: 0 auto; padding: clamp(28px, 9vh, 96px) 16px 40px; }
.recherche-grande { display: flex; gap: 6px; max-width: 760px; margin: 0 auto 40px; }
.recherche-grande input {
  font-size: 20px; padding: 10px 14px; border-radius: 4px;
  background: var(--relief);
}
.recherche-grande button { color: var(--doux); }
.recherche-grande button svg { width: 26px; height: 26px; }
.tuiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 18px 12px;
  max-width: 860px;
  margin: 0 auto;
}
.tuile {
  flex-direction: column;
  justify-content: flex-start;
  gap: 6px;
  padding: 14px 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--encre);
  font-weight: 500;
  border-radius: var(--rayon);
}
.tuile:hover { background: var(--surface); border-color: var(--trait); }
.tuile-icone {
  display: grid; place-items: center;
  width: 52px; height: 52px; border-radius: 10px;
  background: var(--teinte); color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
}
.tuile-icone svg { width: 28px; height: 28px; }
.tuile-titre { font-size: 14px; }
.tuile-detail { font-size: 11.5px; color: var(--pale); font-weight: 400; min-height: 1.4em; }

/* Machines : filtres à gauche, grille à droite. */
.vue-machines { display: grid; grid-template-columns: 220px 1fr; overflow: hidden; }
.filtres {
  border-right: 1px solid var(--trait);
  background: var(--surface);
  overflow-y: auto;
  padding: 10px 0 20px;
}
.filtres h3 {
  font: 700 11px/1 "Segoe UI", sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--pale);
  margin: 14px 14px 6px;
}
.liste-filtres { list-style: none; margin: 0; padding: 0; }
.liste-filtres button {
  width: 100%;
  justify-content: space-between;
  padding: 7px 14px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--doux);
  font-weight: 500;
  text-align: left;
}
.liste-filtres button:hover { background: rgba(127, 140, 150, .12); color: var(--encre); }
.liste-filtres button[aria-current="true"] {
  background: rgba(29, 77, 107, .14);
  color: var(--encre);
  box-shadow: inset 3px 0 0 var(--interne);
}
.liste-filtres .nombre { font-size: 11.5px; color: var(--pale); font-variant-numeric: tabular-nums; }
.liste-filtres .libre { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.machines { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.outils {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--trait);
  background: var(--surface);
}
.outils input[type="search"] { flex: 1 1 200px; max-width: 360px; }
.outils select { width: auto; }
.outils .icone { color: var(--doux); }
.bascule { display: flex; margin-left: auto; }
.bascule [aria-pressed="true"] { color: var(--interne); background: rgba(29, 77, 107, .14); }

.grille {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: 14px;
}
.vide-grand { margin: 60px auto; text-align: center; color: var(--pale); max-width: 46ch; }
.vide-grand strong { display: block; color: var(--encre); font-size: 16px; margin-bottom: 6px; }
.vide-grand button { margin-top: 14px; }

/* Une carte de machine. */
.carte {
  display: flex; flex-direction: column;
  background: var(--relief);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  cursor: pointer;
  overflow: hidden;
  transition: transform .08s ease, box-shadow .12s ease;
}
.carte:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(19, 26, 33, .14); }
.carte:focus-visible { outline: 2px solid var(--interne); outline-offset: 2px; }
.carte-tete { display: flex; align-items: flex-start; gap: 4px; padding: 10px 6px 0 12px; }
.carte-titres { flex: 1; min-width: 0; }
.carte-groupe { font-size: 12px; color: var(--pale); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.carte-nom { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.carte-tete .icone { color: var(--pale); margin-top: -2px; }
.carte-corps { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; padding: 10px 12px; min-height: 64px; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; }
.badge {
  font: 600 10.5px/1 "Segoe UI", sans-serif;
  padding: 3px 6px; border-radius: 3px;
  border: 1px solid var(--trait); color: var(--doux);
}
.badge.sensible { border-color: var(--expose); color: var(--expose); }
.badge.session { border-color: var(--bon); color: var(--bon); }
.os { color: var(--eteint); }
.os svg { width: 40px; height: 40px; }
.carte[data-etat="disponible"] .os { color: #1f8fd6; }
.carte-pied {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 6px 10px;
  font-size: 11.5px;
  background: var(--papier);
  color: var(--pale);
  border-top: 1px solid var(--trait);
}
.carte-pied .etat { font-weight: 700; color: var(--doux); white-space: nowrap; }
.carte[data-etat="disponible"] .carte-pied { background: var(--bon-fond); color: rgba(255, 255, 255, .85); border-top-color: var(--bon-fond); }
.carte[data-etat="disponible"] .carte-pied .etat { color: #fff; }
.carte[data-etat="indisponible"] { opacity: .82; }
.carte-pied .detail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* La vue en liste. */
.grille.liste { display: block; padding: 0; }
.tableau-machines { width: 100%; border-collapse: collapse; }
.tableau-machines th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface);
  text-align: left; font-size: 11.5px; font-weight: 700; color: var(--pale);
  text-transform: uppercase; letter-spacing: .05em;
  padding: 8px 12px; border-bottom: 1px solid var(--trait);
}
.tableau-machines td { padding: 8px 12px; border-bottom: 1px solid var(--trait); vertical-align: middle; }
.tableau-machines tr { cursor: pointer; }
.tableau-machines tbody tr:hover { background: var(--surface); }
.tableau-machines .nom { font-weight: 600; }
.tableau-machines .actions { text-align: right; width: 1%; white-space: nowrap; }
.point { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--eteint); margin-right: 6px; }
.point.disponible { background: #34b26c; }

/* --- Une machine : fiche et session ------------------------------------------ */

/* Sans session, la fiche occupe l'onglet ; pendant la session, l'écran
   distant prend toute la place et la fiche s'efface. */
.vue-machine { display: flex; flex-direction: column; }
.fiche { width: min(760px, 100%); margin: 0 auto; padding: 22px 18px 32px; }
.vue-machine .scene { display: none; }
.vue-machine.ouverture .fiche, .vue-machine.en-session .fiche { display: none; }
.vue-machine.ouverture .scene, .vue-machine.en-session .scene { display: flex; flex: 1; }
.fiche-tete { display: flex; align-items: flex-start; gap: 12px; }
.fiche-tete .os svg { width: 46px; height: 46px; }
.fiche-tete .os.disponible { color: #1f8fd6; }
.fiche-titres { flex: 1; min-width: 0; }
.fiche-groupe { font-size: 12.5px; color: var(--pale); }
.fiche-titres h2 { margin: 0; font-size: 19px; overflow-wrap: anywhere; }
.etat-pastille { font-size: 12.5px; color: var(--pale); margin-top: 2px; }
.etat-pastille.disponible { color: var(--bon); font-weight: 600; }
.bandeau-info {
  font-size: 12.5px; padding: 8px 10px; margin: 14px 0 0;
  border-left: 3px solid var(--expose); background: var(--papier); border-radius: 3px;
}

.gestes { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 18px 0 6px; }
.geste {
  flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 3px;
  padding: 12px;
  background: var(--relief);
  border: 1px solid var(--trait);
  color: var(--encre);
  text-align: left;
  border-radius: var(--rayon);
  font-weight: 600;
}
.geste svg { width: 24px; height: 24px; color: var(--interne); margin-bottom: 4px; }
.geste:hover:not(:disabled) { border-color: var(--interne); box-shadow: var(--ombre); }
.geste-detail { font-size: 11.5px; font-weight: 400; color: var(--pale); }

.infos { display: grid; grid-template-columns: max-content 1fr; gap: 5px 14px; margin: 18px 0 0; font-size: 12.5px; }
.infos dt { color: var(--pale); }
.infos dd { margin: 0; overflow-wrap: anywhere; }
.interrupteur { margin-top: 14px; }
.interrupteur label { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; cursor: pointer; }
.interrupteur .aide { margin: 4px 0 0 24px; }
.section-repliable { margin-top: 18px; border-top: 1px solid var(--trait); padding-top: 10px; }
.section-repliable summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.section-repliable button { margin-top: 12px; }

/* La scène : l'écran distant ou le terminal. */
.scene {
  position: relative;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-width: 0; min-height: 0;
  padding: 14px;
  overflow: auto;
  background: var(--papier);
}
.scene:fullscreen { background: #000; padding: 0; }
.vue-machine.en-session .scene { justify-content: flex-start; }
.barre-session {
  align-self: stretch;
  display: flex; align-items: center; gap: 8px;
  padding: 0 0 10px;
}
.session-titre { font-weight: 600; }

.attente { text-align: center; color: var(--doux); max-width: 44ch; }
.attente p { margin: 8px 0; }
.tourne {
  width: 34px; height: 34px; margin: 0 auto 6px;
  border: 3px solid var(--trait); border-top-color: var(--interne);
  border-radius: 50%;
  animation: tourne 1s linear infinite;
}
@keyframes tourne { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .tourne { animation: none; } .carte { transition: none; } }

#ecran { display: flex; flex-direction: column; max-width: 100%; }

/* Le bandeau de régime de confiance. Toujours visible pendant une session. */
#regime {
  font: 500 11px/1 ui-monospace, monospace;
  letter-spacing: .06em;
  padding: 7px 12px;
  color: var(--surface);
  border-radius: 4px 4px 0 0;
}
#regime[data-regime="support"] { background: var(--interne); }
#regime[data-regime="bastion"] { background: var(--expose); }

canvas {
  display: block;
  max-width: 100%;
  height: auto;
  background: #000;
  border: 1px solid var(--trait);
  cursor: crosshair;
}
.scene:fullscreen #ecran { width: 100%; height: 100%; }
.scene:fullscreen canvas { margin: 0 auto; border: none; }
.scene:fullscreen .barre-session { position: absolute; top: 6px; right: 10px; z-index: 2; padding: 0; opacity: .25; }
.scene:fullscreen .barre-session:hover { opacity: 1; }
.scene:fullscreen .session-titre { display: none; }

/* Le shell. */
#terminal {
  width: min(1100px, 100%);
  border: 1px solid var(--trait);
  border-top: none;
  background: var(--surface);
}
.terminal-barre {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid var(--trait);
}
.terminal-barre select { width: auto; }
.fichiers-barre { flex-wrap: wrap; }
.fichiers-barre input { width: auto; }
.fichiers-barre #fichier-chemin { flex: 1 1 20ch; min-width: 0; font-family: ui-monospace, Consolas, monospace; }
#sortie .transfert { color: var(--bon); }
#sortie {
  margin: 0;
  height: min(58vh, 560px);
  overflow: auto;
  padding: 10px 12px;
  font: 12.5px/1.45 ui-monospace, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--encre);
  background: var(--papier);
}
#sortie .commande { color: var(--interne); font-weight: 600; }
#sortie .erreur { color: var(--mauvais); }
#sortie .refus { color: var(--mauvais); font-style: italic; }
#sortie .fin { color: var(--pale); }
.saisie {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-top: 1px solid var(--trait);
}
.saisie .invite { font: 600 13px ui-monospace, monospace; color: var(--interne); }
.saisie input#ligne { flex: 1 1 14ch; min-width: 0; font-family: ui-monospace, Consolas, monospace; }
.saisie .masque { display: flex; gap: 4px; align-items: center; margin: 0; white-space: nowrap; font-size: 12px; }
.saisie .masque input { width: auto; }
#terminal .aide { margin: 0; padding: 6px 10px 10px; }
.systeme-barre { flex-wrap: wrap; }
#systeme-redemarrage { display: inline-flex; gap: 6px; align-items: center; margin-left: auto; }
#systeme-redemarrage select { width: auto; }
.systeme-barre .etiquette { font-weight: 600; color: var(--pale); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.systeme-barre #systeme-filtre { flex: 1 1 14ch; min-width: 0; width: auto; }
.systeme-barre #systeme-droits { font-size: 12px; }
.terminal-barre button { padding: 6px 12px; font-size: 12.5px; }
#systeme-vue {
  max-height: min(45vh, 420px);
  overflow: auto;
  border-bottom: 1px solid var(--trait);
  background: var(--papier);
  font-size: 12.5px;
}
#systeme-vue table { width: 100%; border-collapse: collapse; }
#systeme-vue th, #systeme-vue td { padding: 4px 8px; text-align: left; border-bottom: 1px solid var(--trait); vertical-align: middle; }
#systeme-vue th { position: sticky; top: 0; background: var(--surface); font-weight: 600; }
#systeme-vue td.nombre, #systeme-vue th.nombre { text-align: right; font-variant-numeric: tabular-nums; }
#systeme-vue td.actions { white-space: nowrap; text-align: right; }
#systeme-vue td.actions button { margin: 0 0 0 4px; padding: 2px 8px; font-size: 12px; }
#systeme-vue dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; padding: 10px 12px; }
#systeme-vue dt { color: var(--pale); }
#systeme-vue dd { margin: 0; overflow-wrap: anywhere; }
#systeme-vue h4 { margin: 8px 12px 4px; font-size: 12px; color: var(--pale); text-transform: uppercase; letter-spacing: .04em; }
#systeme-vue .etat-demarre { color: var(--bon); }
#systeme-vue .etat-arrete { color: var(--pale); }

/* --- Pages simples ---------------------------------------------------------- */

.page { max-width: 820px; margin: 0 auto; padding: 24px 16px 40px; }
.page h2 { margin: 0 0 4px; font-size: 20px; }
.page > button { margin-top: 12px; }

/* Sessions en cours. */
.sessions {
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  background: var(--relief);
  margin-top: 14px;
}
.session {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--trait);
}
.session:last-child { border-bottom: none; }
.session .qui { font-weight: 600; word-break: break-all; }
.session .etat { font-size: 11.5px; color: var(--pale); display: flex; gap: 6px; flex-wrap: wrap; margin-top: 3px; }
.session .marque { border: 1px solid var(--trait); border-radius: 3px; padding: 0 5px; }
.session .marque.enregistree { color: var(--interne); border-color: var(--interne); }
.session button { padding: 5px 12px; font-size: 12px; background: transparent; color: var(--mauvais); border-color: var(--mauvais); }

/* Comptes de service. */
.comptes { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.comptes .compte {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 10px; padding: 7px 9px; border: 1px solid var(--trait); border-radius: 4px; background: var(--relief);
}
.comptes .compte .qui { font: 500 12.5px/1.3 inherit; }
.comptes .compte .detail { font-size: 11.5px; color: var(--pale); }
.comptes .compte .rotation {
  font: 500 10.5px/1 ui-monospace, monospace; letter-spacing: .05em;
  padding: 3px 6px; border-radius: 2px; background: var(--expose); color: var(--surface);
}
.comptes .vide { padding: 6px 0; text-align: left; }

/* Demandes d'approbation : une décision à prendre. */
.demandes { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.demandes .demande {
  padding: 12px 14px; border: 1px solid var(--trait); border-radius: var(--rayon);
  border-left: 4px solid var(--expose); background: var(--relief);
}
.demandes .demande .qui { font-weight: 600; }
.demandes .demande .motif { font-size: 12.5px; color: var(--doux); margin: 4px 0 10px; }
.demandes .demande .boutons { display: flex; gap: 8px; }
.demandes .demande button { padding: 6px 14px; font-size: 12.5px; }

/* Journal de la console. */
#journal {
  font: 12px/1.6 ui-monospace, "Cascadia Mono", monospace;
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  background: var(--relief);
  padding: 10px 12px;
  margin-top: 14px;
  min-height: 200px;
}
.ligne { color: var(--doux); padding: 1px 0; word-break: break-word; }
.ligne.ok { color: var(--bon); }
.ligne.erreur { color: var(--mauvais); }
.ligne.attention { color: var(--expose); }

/* Ce que le broker exige pour une élévation, mot pour mot. */
.exigence {
  font: 12px ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--papier);
  border-left: 3px solid var(--expose);
  padding: 6px 9px;
  margin: 6px 0 10px;
  word-break: break-word;
}

/* --- Dialogues, menus, notes ------------------------------------------------- */

.dialogue {
  width: min(460px, calc(100vw - 32px));
  padding: 18px 20px;
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  background: var(--surface);
  color: var(--encre);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
}
.dialogue.large { width: min(620px, calc(100vw - 32px)); }
.dialogue::backdrop { background: rgba(10, 16, 22, .55); }
.dialogue-tete { display: flex; align-items: center; justify-content: space-between; margin: 0 0 6px; }
.dialogue-tete h2 { margin: 0; font-size: 17px; }
.dialogue-tete .icone { color: var(--pale); }
.dialogue-pied { display: flex; gap: 8px; margin-top: 16px; align-items: center; }

.etapes { margin: 8px 0 0; padding: 0; list-style: none; counter-reset: etape; }
.etapes li { position: relative; padding: 4px 0 14px 40px; counter-increment: etape; }
.etapes li::before {
  content: counter(etape);
  position: absolute; left: 0; top: 2px;
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--interne); color: var(--surface); font-weight: 700; font-size: 13px;
}
.etapes h3 { margin: 2px 0 4px; font-size: 14px; }
.etapes .bouton { display: inline-block; padding: 9px 16px; }
.copie { display: flex; gap: 8px; align-items: center; }
.copie code {
  flex: 1; min-width: 0; padding: 6px 8px; border: 1px solid var(--trait);
  border-radius: 4px; background: var(--relief); overflow-wrap: anywhere; user-select: all;
}
.ligne-code { display: flex; gap: 8px; }
.ligne-code input { font: 600 16px ui-monospace, "Cascadia Mono", monospace; letter-spacing: .08em; text-transform: uppercase; }

.modale { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(10, 16, 22, .55); padding: 16px; }
.modale-corps {
  width: min(460px, 100%);
  background: var(--surface);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: 18px 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
}
.modale-corps h2 { margin: 0 0 6px; font-size: 17px; }
.modale-corps button { width: 100%; margin-top: 12px; }

.menu {
  position: fixed; z-index: 40;
  width: 240px;
  padding: 4px 0;
  background: var(--relief);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .25);
}
.menu button {
  width: 100%;
  justify-content: flex-start;
  gap: 10px;
  padding: 8px 14px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--encre);
  font-weight: 500;
}
.menu button:hover:not(:disabled), .menu button:focus-visible { background: rgba(127, 140, 150, .14); outline: none; }
.menu button.danger { color: var(--mauvais); }
.menu hr { border: none; border-top: 1px solid var(--trait); margin: 4px 0; }
.menu svg { width: 18px; height: 18px; color: var(--pale); }

.notes { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.note {
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 14px;
  border-radius: var(--rayon);
  background: var(--relief);
  border: 1px solid var(--trait);
  border-left: 4px solid var(--interne);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .2);
  font-size: 13px;
  animation: entre .18s ease-out;
}
.note.ok { border-left-color: var(--bon); }
.note.erreur { border-left-color: var(--mauvais); }
.note.attention { border-left-color: var(--expose); }
@keyframes entre { from { transform: translateY(8px); opacity: 0; } }

/* --- Écrans étroits ---------------------------------------------------------- */

@media (max-width: 760px) {
  .marque, .compte-nom { display: none; }
  .vue-machines { grid-template-columns: 1fr; }
  .filtres { display: none; }
  .outils { flex-wrap: wrap; }
  .grille { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); padding: 10px; gap: 10px; }
}

/* Menu « Touches » de la session d'écran. */
.menu-touches { position: relative; }
.menu-touches > summary {
  list-style: none; cursor: pointer; user-select: none;
  padding: 6px 12px; font-size: 12.5px;
  border: 1px solid var(--trait); border-radius: 6px; background: var(--surface);
}
.menu-touches > summary::-webkit-details-marker { display: none; }
.menu-touches-liste {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 5;
  display: flex; flex-direction: column; min-width: 260px; padding: 4px;
  background: var(--surface); border: 1px solid var(--trait); border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}
.menu-touches-liste button {
  text-align: left; background: none; border: none; color: inherit;
  padding: 7px 10px; border-radius: 5px; font-size: 13px; cursor: pointer;
}
.menu-touches-liste button:hover, .menu-touches-liste button:focus-visible { background: var(--papier); }
.menu-touches-liste small { display: block; padding: 4px 10px 6px; color: var(--doux); font-size: 11.5px; }

/* Mise à jour de l'agent (§3.7.3). */
.badge.maj { border-color: var(--interne); color: var(--interne); }
.fiche-maj { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.fiche-maj .aide { margin: 0; }
