:root {
  --fond: #F7F6F2; --carte: #FFFFFF; --bord: #E8E6DF; --texte: #2A2A28; --texte-2: #6B6A64;
  --accent: #3D6B57; --accent-fonce: #2F5544; --danger: #A8433A; --ok: #3D7A4F; --attente: #9A6B1F;
  --console: #1F1F1D; --console-texte: #E6E4DC;
  --rayon: 10px;
  --police: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
}
[hidden] { display: none !important; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fond); color: var(--texte); font: 15px/1.5 var(--police); }
h1 { font-size: 1.45rem; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 1rem; margin: 0 0 .9rem; }
a { color: var(--accent); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.entete { background: var(--carte); border-bottom: 1px solid var(--bord); }
.entete-int { max-width: 1180px; margin: 0 auto; padding: .7rem 16px; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.5rem; }
.marque { font-weight: 650; color: var(--texte); text-decoration: none; display: flex; align-items: center; gap: .5rem; }
.pastille { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }
nav { display: flex; flex-wrap: wrap; gap: .25rem; flex: 1; }
nav a { color: var(--texte-2); text-decoration: none; padding: .35rem .65rem; border-radius: 7px; }
nav a:hover { background: var(--fond); color: var(--texte); }
nav a[aria-current="page"] { background: var(--fond); color: var(--texte); font-weight: 600; }
.sortie-compte { display: flex; align-items: center; gap: .6rem; margin: 0; }
.qui { color: var(--texte-2); font-size: .85rem; }

.contenu { max-width: 1180px; margin: 0 auto; padding: 1.5rem 16px 3rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.centre { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 16px; }
.titre-page { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .3rem 1rem; }
.maj { margin: 0; color: var(--texte-2); font-size: .85rem; }

.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 1.1rem 1.2rem; min-width: 0; }
.carte-etroite { width: 100%; max-width: 400px; }
.carte-moyenne { width: 100%; max-width: 520px; }
.carte h1 + .sous-titre { margin-top: .35rem; }
.sous-titre { color: var(--texte-2); margin: 0 0 1.2rem; }
.petit { color: var(--texte-2); font-size: .82rem; }

.grille-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; }
.stat { display: flex; flex-direction: column; gap: .2rem; }
.libelle { color: var(--texte-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.valeur { font-size: 1.6rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.valeur-texte { font-size: 1.1rem; overflow-wrap: anywhere; }
.detail { color: var(--texte-2); font-size: .82rem; min-height: 1.2em; overflow-wrap: anywhere; }

.formulaire { display: grid; gap: .9rem; }
.formulaire h2 { margin: .6rem 0 0; }
label { display: grid; gap: .3rem; font-size: .88rem; color: var(--texte-2); }
input, select { font: inherit; color: var(--texte); background: var(--carte); border: 1px solid var(--bord); border-radius: 8px; padding: .55rem .7rem; min-width: 0; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, pre:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input.code { font-family: var(--mono); font-size: 1.3rem; letter-spacing: .3em; text-align: center; }
.case { display: flex; align-items: center; gap: .4rem; }

.btn { font: inherit; font-size: .9rem; cursor: pointer; border: 1px solid var(--bord); background: var(--carte); color: var(--texte); border-radius: 8px; padding: .5rem .9rem; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; transition: background-color .15s, border-color .15s; }
.btn:hover { background: var(--fond); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn-principal { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-principal:hover { background: var(--accent-fonce); }
.btn-danger { color: var(--danger); border-color: #E2C3BF; }
.btn-danger:hover { background: #FBF1EF; }
.btn-discret { border-color: transparent; color: var(--texte-2); }
.btn-petit { padding: .3rem .6rem; font-size: .8rem; }
.rangee-boutons { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: .8rem; }
.rangee-form { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; }
.rangee-form input { flex: 1 1 200px; }

.alerte { border-radius: 8px; padding: .65rem .85rem; margin: 0 0 1rem; font-size: .9rem; }
.alerte p { margin: .2rem 0; }
.alerte-erreur { background: #FBF1EF; color: #7F2F28; border: 1px solid #EBCFCB; }
.alerte-ok { background: #EFF6F1; color: #275638; border: 1px solid #CFE3D5; }
.lien-invitation { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.lien-invitation code { background: var(--carte); border: 1px solid var(--bord); padding: .3rem .5rem; border-radius: 6px; overflow-wrap: anywhere; font-size: .82rem; }

.badge { display: inline-block; border-radius: 999px; padding: .1rem .6rem; font-size: .8rem; font-weight: 600; background: var(--fond); color: var(--texte-2); }
.badge-ok { background: #E6F2EA; color: var(--ok); }
.badge-alerte { background: #F8E6E3; color: var(--danger); }
.badge-attente { background: #F7EEDC; color: var(--attente); }

.table-defile { overflow-x: auto; position: relative; }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th { text-align: left; color: var(--texte-2); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; padding: .5rem .6rem; border-bottom: 1px solid var(--bord); }
.table td { padding: .55rem .6rem; border-bottom: 1px solid var(--bord); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.vide { color: var(--texte-2); text-align: center; }
.mono { font-family: var(--mono); font-size: .8rem; overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.actions-ligne { display: flex; flex-wrap: wrap; gap: .35rem; justify-content: flex-end; }
.actions-ligne form { margin: 0; }
.pagination { display: flex; gap: .5rem; justify-content: flex-end; margin-top: .8rem; }

pre.sortie { display: block; background: var(--console); color: var(--console-texte); font: .8rem/1.45 var(--mono); border-radius: 8px; padding: .8rem; margin: 0; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.sortie-courte { max-height: 220px; margin-top: .4rem; }
.sortie-logs { height: 68vh; min-height: 300px; }
.sortie-console { height: 52vh; min-height: 260px; margin-bottom: .8rem; }
.console-grille { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1rem; align-items: start; }
.historique { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow: auto; }
.historique li { display: flex; justify-content: space-between; gap: .5rem; padding: .35rem 0; border-bottom: 1px solid var(--bord); }
.lien-cmd { font: .8rem var(--mono); background: none; border: 0; padding: 0; color: var(--texte); cursor: pointer; text-align: left; overflow-wrap: anywhere; }
.lien-cmd:hover { color: var(--accent); }
.cmd-envoyee { color: #9BC4AE; }
.cmd-erreur { color: #E8A39B; }

.qr { display: flex; justify-content: center; padding: .5rem; background: #fff; border: 1px solid var(--bord); border-radius: 8px; }
.cle { font-family: var(--mono); overflow-wrap: anywhere; }

dialog { border: 1px solid var(--bord); border-radius: 12px; padding: 1.2rem 1.3rem; max-width: min(440px, calc(100vw - 32px)); color: var(--texte); }
dialog::backdrop { background: rgba(42, 42, 40, .35); }
dialog p { margin: .3rem 0 1rem; color: var(--texte-2); }
.actions-dialogue { display: flex; justify-content: flex-end; gap: .5rem; }

@media (max-width: 760px) {
  .console-grille { grid-template-columns: 1fr; }
  .sortie-compte { width: 100%; justify-content: space-between; }
  .valeur { font-size: 1.35rem; }
  .actions-ligne { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
#form-console { margin-top: .75rem; }

/* Page infos */
.infos-liste { display: grid; gap: .1rem; margin: 0; }
.infos-ligne { display: grid; grid-template-columns: 9rem minmax(0, 1fr) auto; align-items: center; gap: .4rem .8rem; padding: .55rem 0; border-top: 1px solid var(--bord); }
.infos-ligne:first-child { border-top: 0; }
.infos-ligne dt { color: var(--texte-2); font-size: .85rem; }
.infos-ligne dd { margin: 0; font-family: var(--mono); font-size: .9rem; overflow-wrap: anywhere; }
.carte .note { margin: .9rem 0 0; }
@media (max-width: 560px) {
  .infos-ligne { grid-template-columns: minmax(0, 1fr) auto; }
  .infos-ligne dt { grid-column: 1 / -1; }
}
.infos-actions { display: flex; gap: .4rem; }
