:root {
  --fond: #f4f5f7; --carte: #fff; --texte: #1d2330; --discret: #5d6575; --bord: #dde1e8;
  --accent: #1f5fbf; --ok: #1e7b45; --attente: #a86a00; --ko: #b42318; --prod: #8a1c1c;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--texte); background: var(--fond);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* sinon un display: grid l'emporte sur l'attribut */
body { margin: 0; }
h1, h2 { margin: 0 0 .75rem; } h1 { font-size: 1.4rem; } h2 { font-size: 1.1rem; }
.discret { color: var(--discret); }
.erreur { color: var(--ko); }
code { background: #eef1f5; padding: 0 .3em; border-radius: 3px; }
button { font: inherit; cursor: pointer; border: 1px solid var(--bord); background: #fff; border-radius: 6px; padding: .5rem .9rem; white-space: nowrap; }
button.principal { background: var(--accent); color: #fff; border-color: var(--accent); }
button.lien { border: none; background: none; padding: 0; color: var(--accent); }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select { font: inherit; width: 100%; padding: .45rem .6rem; border: 1px solid var(--bord); border-radius: 6px; margin-top: .25rem; }
label { display: block; margin: .75rem 0; }

.connexion { min-height: 100vh; display: grid; place-items: center; }
.connexion .carte { width: min(380px, 92vw); }

.entete { display: flex; align-items: center; gap: 1.5rem; padding: .7rem 1.25rem; background: #fff; border-bottom: 1px solid var(--bord); }
.utilisateur { margin-left: auto; color: var(--discret); white-space: nowrap; }
.onglets { display: flex; gap: .25rem; }
.onglets button { border-radius: 999px; }
.onglets button[aria-current="true"] { background: var(--texte); color: #fff; border-color: var(--texte); }
.onglets button.prod[aria-current="true"] { background: var(--prod); border-color: var(--prod); }

.contenu { max-width: 1050px; margin: 1.25rem auto; padding: 0 1rem; display: grid; gap: 1rem; }
.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: 10px; padding: 1.1rem 1.25rem; }
.bandeau-prod { margin: 0; padding: .7rem 1rem; border-radius: 8px; background: #fbeaea; color: var(--prod); }

.etat { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .75rem; }
.case { border: 1px solid var(--bord); border-radius: 8px; padding: .7rem .85rem; }
.case .titre { font-size: .82rem; color: var(--discret); }
.case .valeur { font-size: 1.15rem; font-weight: 600; margin-top: .2rem; overflow-wrap: anywhere; }
.pastille { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .35rem; background: var(--discret); }
.pastille.ok { background: var(--ok); } .pastille.attente { background: var(--attente); } .pastille.ko { background: var(--ko); }

.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem; }
.action { text-align: left; white-space: normal; padding: .9rem 1rem; border-radius: 8px; display: grid; gap: .3rem; }
.action span { color: var(--discret); font-size: .9rem; }
.action:hover:not(:disabled) { border-color: var(--accent); }
.action.secondaire strong { font-weight: 500; }

.operation { border-top: 1px solid var(--bord); padding: .9rem 0; }
.operation:first-child { border-top: none; padding-top: 0; }
.operation .ligne { display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; }
.operation .quand { color: var(--discret); font-size: .9rem; }
.operation .message { margin: .4rem 0; }
.etapes { list-style: none; padding: 0; margin: .5rem 0 0; display: grid; gap: .3rem; }
.etapes li { display: flex; align-items: center; gap: .5rem; font-size: .93rem; }
.etapes li .duree { color: var(--discret); font-size: .85rem; }
.etapes li button { padding: .15rem .55rem; font-size: .85rem; }
.boutons { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }

dialog { border: none; border-radius: 12px; padding: 1.25rem 1.4rem; width: min(560px, 94vw); box-shadow: 0 12px 40px rgba(0,0,0,.2); }
dialog::backdrop { background: rgba(20, 25, 35, .45); }
dialog .explication { color: var(--discret); }
dialog ol { padding-left: 1.2rem; color: var(--discret); }
dialog.journal { width: min(1100px, 96vw); height: min(80vh, 900px); display: none; flex-direction: column; }
dialog.journal[open] { display: flex; }
.journal-entete { display: flex; align-items: center; gap: 1rem; }
.journal-entete button { margin-left: auto; }
#journal-texte { flex: 1; overflow: auto; background: #10141c; color: #d7dde8; padding: .8rem; border-radius: 8px; font-size: .82rem; line-height: 1.4; white-space: pre-wrap; margin: .75rem 0 0; }
