/* QBEUVERIE : terminal 5250, phosphore vert, aucune pitié. */
:root {
  --fond: #020503;
  --fond-2: #06120a;
  --vert: #3dff72;
  --vert-doux: #23944a;
  --blanc: #eef8ef;
  --turquoise: #52e9dc;
  --jaune: #ffe066;
  --rose: #ff86d8;
  --rouge: #ff5d5d;
  --bleu: #86abff;
  --lueur: 0 0 5px rgba(61, 255, 114, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  background: var(--fond);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at 50% 40%, var(--fond-2) 0%, var(--fond) 70%) fixed var(--fond);
  color: var(--vert);
  font-family: 'IBM Plex Mono', Consolas, 'Courier New', monospace;
  font-size: 15px;
  line-height: 1.55;
  text-shadow: var(--lueur);
}

/* Lignes de balayage du CRT */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  background: repeating-linear-gradient(180deg, transparent 0 2px, rgba(0, 0, 0, 0.22) 2px 3px);
}

::selection { background: var(--vert); color: var(--fond); text-shadow: none; }

h1, h2, p { margin: 0; font-size: inherit; font-weight: inherit; }
b { font-weight: 600; }
a { color: var(--turquoise); }
a:hover, a:focus-visible { background: var(--turquoise); color: var(--fond); text-shadow: none; outline: none; }
:focus-visible { outline: 1px dashed var(--jaune); outline-offset: 2px; }

.blanc { color: var(--blanc); }
.turquoise { color: var(--turquoise); }
.jaune { color: var(--jaune); }
.rose { color: var(--rose); }
.rouge { color: var(--rouge); }
.bleu { color: var(--bleu); }
.doux { color: var(--vert-doux); }
.vert-vif { color: var(--vert); font-weight: 600; }

/* ── Structure d'un écran ─────────────────────────────── */
.ecran {
  max-width: 1040px;
  margin: 0 auto;
  padding: 20px 16px 32px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.entete {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: baseline;
  gap: 12px;
}
.e-titre { color: var(--blanc); font-weight: 600; text-align: center; }
.e-sys { text-align: right; white-space: nowrap; }

.corps { flex: 1; }
.corps > * + * { margin-top: 12px; }
.corps > .kv + .kv { margin-top: 2px; }
.corps > .sous-titre {
  margin-top: 26px;
  padding-bottom: 4px;
  color: var(--blanc);
  font-weight: 600;
  border-bottom: 1px dashed var(--vert-doux);
}

/* ── Libellé . . . . : valeur ─────────────────────────── */
.kv {
  display: grid;
  grid-template-columns: 26ch 2ch minmax(0, 1fr);
  align-items: baseline;
}
.kv .k { white-space: nowrap; overflow: hidden; }
.kv .k::after {
  content: ' . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .';
  color: var(--vert-doux);
}
.kv .d { text-align: center; }
.kv .v { color: var(--blanc); min-width: 0; overflow-wrap: anywhere; }
.kv:has(textarea) { align-items: start; }

/* ── Boutons et touches de fonction ───────────────────── */
button { font: inherit; }

.btn {
  appearance: none;
  background: transparent;
  color: var(--jaune);
  border: 1px solid currentColor;
  border-radius: 0;
  padding: 3px 12px;
  cursor: pointer;
  text-shadow: inherit;
}
.btn:hover, .btn:focus-visible { background: var(--jaune); color: var(--fond); text-shadow: none; outline: none; }
.btn.actif { background: var(--vert); border-color: var(--vert); color: var(--fond); text-shadow: none; }
.btn[disabled] { color: var(--vert-doux); background: transparent; cursor: not-allowed; }
.btn-danger { color: var(--rouge); }
.btn-danger:hover, .btn-danger:focus-visible { background: var(--rouge); color: var(--fond); }

.touches { display: flex; flex-wrap: wrap; gap: 4px 22px; }
.touches button {
  appearance: none;
  background: none;
  border: 0;
  padding: 2px 0;
  color: var(--bleu);
  cursor: pointer;
  text-shadow: 0 0 5px rgba(134, 171, 255, 0.4);
}
.touches button:hover, .touches button:focus-visible { background: var(--bleu); color: var(--fond); text-shadow: none; outline: none; }

.message { min-height: 1.6em; color: var(--blanc); }
.message.m-erreur { color: var(--rouge); font-weight: 600; text-shadow: 0 0 6px rgba(255, 93, 93, 0.45); }
.mode { color: var(--rose); font-size: 13px; }

/* Zone d'information opérateur (ligne d'état du bas) */
.oia {
  display: flex;
  align-items: center;
  gap: 2ch;
  padding-top: 6px;
  border-top: 1px solid var(--vert-doux);
  color: var(--vert-doux);
  font-size: 13px;
}
.oia-im {
  appearance: none;
  padding: 0 6px;
  border: 1px solid var(--vert-doux);
  border-radius: 0;
  background: none;
  color: var(--vert-doux);
  font: inherit;
  text-shadow: inherit;
  cursor: pointer;
}
.oia-im.actif { background: var(--jaune); border-color: var(--jaune); color: var(--fond); font-weight: 600; text-shadow: none; }
.oia-sys { margin-left: auto; }

/* ── Champs de saisie ─────────────────────────────────── */
input:not([type]), input[type='password'], textarea {
  appearance: none;
  width: 100%;
  max-width: 40ch;
  padding: 2px 6px;
  border: 0;
  border-bottom: 2px solid var(--vert);
  border-radius: 0;
  background: rgba(61, 255, 114, 0.05);
  color: var(--blanc);
  font: inherit;
  text-shadow: inherit;
  caret-color: var(--vert);
}
input:focus, textarea:focus { outline: none; background: rgba(61, 255, 114, 0.13); }
/* Curseur bloc en écrasement, barre en insertion (navigateurs qui gèrent caret-shape) */
input, textarea { caret-shape: block; }
.mode-insertion input, .mode-insertion textarea { caret-shape: bar; }
input[disabled] { opacity: 0.4; }
textarea { max-width: 60ch; resize: vertical; }
::placeholder { color: var(--vert-doux); opacity: 1; }

.choix-groupe { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.choix-groupe.col { flex-direction: column; }
.choix { position: relative; cursor: pointer; color: var(--vert); }
.choix input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.choix span::before { content: '( ) '; white-space: pre; }
.choix.case span::before { content: '[ ] '; }
.choix input:checked + span { color: var(--blanc); }
.choix input:checked + span::before { content: '(X) '; color: var(--jaune); }
.choix.case input:checked + span::before { content: '[X] '; }
.choix input:focus-visible + span { outline: 1px dashed var(--jaune); outline-offset: 2px; }

/* ── Ouverture de session ─────────────────────────────── */
.signon-sys { width: min(100%, 46ch); margin-left: auto; }
.signon-sys .kv { grid-template-columns: 14ch 2ch minmax(0, 1fr); }
.corps > .signon-form { margin-top: 26px; max-width: 70ch; }
.signon-form input { text-transform: uppercase; max-width: 14ch; }
.signon-form .btn { margin-top: 14px; }
.corps > .banniere {
  margin: 36px 0 0;
  overflow: hidden;
  color: var(--turquoise);
  font-family: inherit;
  font-size: clamp(7px, 2.3vw, 15px);
  line-height: 1.15;
  text-shadow: 0 0 6px rgba(82, 233, 220, 0.45);
}
.copyright { color: var(--vert-doux); }

/* ── Menus ────────────────────────────────────────────── */
.menu-grille {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 44ch);
  gap: 28px;
  align-items: start;
}
.options { list-style: none; padding: 0; margin: 10px 0 0 2ch; }
.options li.sep { margin-top: 14px; }
.options button {
  appearance: none;
  display: grid;
  grid-template-columns: 4ch 32ch minmax(0, 1fr);
  width: 100%;
  padding: 2px 4px;
  border: 0;
  background: none;
  color: var(--vert);
  text-align: left;
  text-shadow: inherit;
  cursor: pointer;
}
.options .o-d { color: var(--vert-doux); }
.options button:hover, .options button:focus-visible { background: var(--vert); color: var(--fond); text-shadow: none; outline: none; }
.options button:hover .o-d, .options button:focus-visible .o-d { color: var(--fond); }

.boite { border: 1px solid var(--vert-doux); padding: 12px 14px; }
.boite h2 { color: var(--blanc); font-weight: 600; margin-bottom: 8px; }
.boite p { margin-top: 10px; }
.tdb .kv, .detail .kv { grid-template-columns: 15ch 2ch minmax(0, 1fr); }

.commande label { display: block; }
.invite { display: flex; gap: 1ch; align-items: baseline; }
.invite span { color: var(--blanc); white-space: nowrap; }
.invite input { flex: 1; max-width: none; text-transform: uppercase; }

/* ── Tableaux façon liste 5250 ────────────────────────── */
.tab-wrap { max-width: 100%; overflow-x: auto; }
.tab { border-collapse: collapse; min-width: 100%; }
.tab th {
  padding: 3px 18px 3px 0;
  border-bottom: 1px dashed var(--vert-doux);
  color: var(--blanc);
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}
.tab td { padding: 3px 18px 3px 0; vertical-align: top; }
.tab .num { text-align: right; }
.tab .opt { width: 4ch; color: var(--blanc); }
.tab tfoot td { border-top: 1px dashed var(--vert-doux); }
.tab tr[data-action] { cursor: pointer; }
.tab tr[data-action]:hover td,
.tab tr[data-action]:focus-visible td,
.tab tr.actif td { background: var(--vert); color: var(--fond); text-shadow: none; }
.tab tr[data-action]:focus-visible { outline: none; }
.tab-travaux td, .tab-sys td { white-space: nowrap; }
.tab-sys tr.sbs td:not([class*='e-']) { color: var(--blanc); }
.tab-sys tr.job td:nth-child(2) { padding-left: 2ch; }
.tab-profils td:last-child { min-width: 30ch; }

/* États IBM i */
.e-RUN, .e-RLS, .e-RDY { color: var(--vert); font-weight: 600; }
.e-SCD, .e-SAV { color: var(--bleu); }
.e-MSGW, .e-DSPW { color: var(--jaune); }
.e-LCKW { color: var(--rose); }
.e-HLD, .e-DLYW { color: var(--turquoise); }
.e-END { color: var(--rouge); }
.e-DEQW { color: var(--vert-doux); }
.e-MSGW { animation: clignote 1.2s steps(1) infinite; }
@keyframes clignote { 50% { opacity: 0.25; } }

.ligne-stats { display: flex; flex-wrap: wrap; gap: 4px 28px; }
.ligne-stats b { color: var(--blanc); font-weight: 400; }
.kv-compact .kv { grid-template-columns: 24ch 2ch minmax(0, 1fr); }

/* ── CAB ──────────────────────────────────────────────── */
.bandeau { padding: 6px 10px; background: var(--jaune); color: var(--fond); font-weight: 600; text-shadow: none; }
.votes { display: flex; flex-direction: column; gap: 8px; }
.vote-ligne { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.vote-ligne > span:first-child { min-width: 11ch; }

/* ── Couchages ────────────────────────────────────────── */
.ressources { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px; }
.ressource { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid var(--vert-doux); }
.ressource.a-moi { border-color: var(--jaune); box-shadow: inset 0 0 0 1px var(--jaune); }
.ressource.verrou { border-style: dashed; opacity: 0.8; }
.r-tete { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 4px 12px; }
.r-tete > :last-child { white-space: nowrap; }
.r-pied { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; }

/* ── Divers ───────────────────────────────────────────── */
.notes { margin: 0; padding-left: 2ch; }
.cgu p + p, .liste-messages > * + * { margin-top: 8px; }
.msg-op p + p { margin-top: 0; }
.noscript { padding: 16px; }

/* ── Mobile ───────────────────────────────────────────── */
@media (max-width: 860px) {
  .menu-grille { grid-template-columns: minmax(0, 1fr); }
}

/* ── Écran de refus (smartphone) ──────────────────────── */
.ecran-blocage .entete { grid-template-columns: minmax(0, 1fr); }
.ecran-blocage .e-titre { text-align: left; }
.blocage-titre { font-size: 1.25em; }
.corps > .pc {
  margin: 28px 0 0;
  overflow: hidden;
  color: var(--turquoise);
  font-family: inherit;
  line-height: 1.25;
  text-shadow: 0 0 6px rgba(82, 233, 220, 0.45);
}

@media (prefers-reduced-motion: reduce) {
  .e-MSGW { animation: none; }
}
