:root {
  --bg: #0B0F1A;
  --bg2: #0f1524;
  --carte: rgba(255, 255, 255, 0.045);
  --carte2: rgba(255, 255, 255, 0.08);
  --bord: rgba(255, 255, 255, 0.09);
  --texte: #eef1f8;
  --doux: #a8b0c4;
  --pale: #6d7590;
  --violet: #8B5CF6;
  --violet-f: rgba(139, 92, 246, 0.16);
  --cyan: #22D3EE;
  --vert: #4ade80;
  --rouge: #f87171;
  --jaune: #facc15;
  --orange: #fb923c;
  --rayon: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  background-image: radial-gradient(1200px 600px at 85% -10%, rgba(139, 92, 246, 0.12), transparent 60%),
                    radial-gradient(900px 500px at -10% 110%, rgba(34, 211, 238, 0.07), transparent 60%);
  background-attachment: fixed;
  color: var(--texte);
  font: 14px/1.5 Inter, system-ui, sans-serif;
  min-height: 100vh;
}
h1, h2, h3 { font-family: Poppins, Inter, sans-serif; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: ui-monospace, "JetBrains Mono", Consolas, monospace; font-size: 12.5px; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- mise en page ---------- */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.menu {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  border-right: 1px solid var(--bord); background: rgba(8, 11, 20, 0.7);
  padding: 18px 12px; display: flex; flex-direction: column; gap: 2px;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.logo-a {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--violet), var(--cyan)); font: 800 18px Poppins, sans-serif; color: #fff;
}
.logo b { font-family: Poppins, sans-serif; font-size: 15px; display: block; }
.logo small { color: var(--doux); font-size: 11.5px; }
.menu .groupe { color: var(--pale); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; padding: 14px 12px 4px; }
.menu a {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px;
  color: var(--doux); font-weight: 500;
}
.menu a:hover { background: var(--carte); color: var(--texte); text-decoration: none; }
.menu a.actif { background: var(--violet-f); color: #fff; }
.menu a .pastille { margin-left: auto; }
.menu .bas { margin-top: auto; padding-top: 14px; }
.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.principal { min-width: 0; }
.barre {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px;
  padding: 12px 28px; border-bottom: 1px solid var(--bord);
  background: rgba(11, 15, 26, 0.82); backdrop-filter: blur(10px);
}
.barre .titre { font-family: Poppins, sans-serif; font-weight: 600; font-size: 15px; }
.barre .droite { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.btn.burger { display: none; }
.contenu { padding: 24px 28px 60px; max-width: 1400px; }

/* ---------- briques ---------- */
.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 18px; min-width: 0; }
.carte > h2 { margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.carte > h2 .droite { margin-left: auto; font: 500 12.5px Inter, sans-serif; color: var(--doux); }
.grille { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.pile { display: flex; flex-direction: column; gap: 16px; }
.ligne { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.entete-page { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.entete-page p { margin: 4px 0 0; color: var(--doux); }
.entete-page .droite { margin-left: auto; }
.vide { color: var(--pale); padding: 26px 0; text-align: center; }
.doux { color: var(--doux); }
.pale { color: var(--pale); }
.petit { font-size: 12.5px; }

.tuile { padding: 16px 18px; }
.tuile .lib { color: var(--doux); font-size: 12.5px; }
.tuile .val { font: 700 28px/1.15 Poppins, sans-serif; margin-top: 6px; font-variant-numeric: tabular-nums; }
.tuile .sous { color: var(--pale); font-size: 12px; margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: 10px; border: 1px solid var(--bord);
  background: var(--carte2); color: var(--texte); font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, 0.12); text-decoration: none; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.prim { background: var(--violet); border-color: transparent; color: #fff; }
.btn.prim:hover { background: #7c4ff0; }
.btn.danger { background: rgba(248, 113, 113, 0.14); border-color: rgba(248, 113, 113, 0.35); color: #fecaca; }
.btn.danger:hover { background: rgba(248, 113, 113, 0.24); }
.btn.mini { padding: 4px 9px; font-size: 12.5px; border-radius: 8px; }
.btn.fantome { background: transparent; }
.btn.steam { background: #171a21; border-color: #2a475e; padding: 12px 20px; font-size: 15px; }
.btn.steam:hover { background: #1b2838; }

.champ { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.champ > span { color: var(--doux); font-size: 12.5px; font-weight: 500; }
.champ small { color: var(--pale); font-size: 12px; }
input[type=text], input[type=password], input[type=number], input[type=search], input[type=datetime-local], select, textarea {
  width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--bord);
  background: rgba(0, 0, 0, 0.25); outline: none; min-width: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-f); }
select option { background: #151b2c; }
textarea { resize: vertical; min-height: 80px; }
.recherche { max-width: 320px; }

.interrupteur { position: relative; width: 38px; height: 22px; flex: none; display: inline-block; }
.interrupteur input { opacity: 0; width: 0; height: 0; position: absolute; }
.interrupteur i { position: absolute; inset: 0; border-radius: 99px; background: rgba(255, 255, 255, 0.14); transition: 0.15s; cursor: pointer; }
.interrupteur i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: 0.15s; }
.interrupteur input:checked + i { background: var(--violet); }
.interrupteur input:checked + i::after { transform: translateX(16px); }
.interrupteur input:disabled + i { opacity: 0.4; cursor: not-allowed; }

.pastille {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px;
  font-size: 12px; font-weight: 600; background: var(--carte2); color: var(--doux); white-space: nowrap;
}
.pastille.vert { background: rgba(74, 222, 128, 0.13); color: var(--vert); }
.pastille.rouge { background: rgba(248, 113, 113, 0.14); color: var(--rouge); }
.pastille.jaune { background: rgba(250, 204, 21, 0.13); color: var(--jaune); }
.pastille.violet { background: var(--violet-f); color: #c4b5fd; }
.pastille.cyan { background: rgba(34, 211, 238, 0.12); color: var(--cyan); }
.pastille.orange { background: rgba(251, 146, 60, 0.14); color: var(--orange); }
.point { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

/* tableaux */
.table-boite { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--pale); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; padding: 8px 10px; border-bottom: 1px solid var(--bord); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.025); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn { margin-left: 4px; }
.cliquable { cursor: pointer; }

.joueur { display: flex; align-items: center; gap: 10px; min-width: 0; }
.joueur .av {
  width: 32px; height: 32px; border-radius: 9px; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.5), rgba(34, 211, 238, 0.4)); font-weight: 700; font-size: 13px;
}
.joueur b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.joueur small { color: var(--pale); font-size: 12px; }

.jauge { height: 6px; background: rgba(255, 255, 255, 0.08); border-radius: 99px; overflow: hidden; min-width: 60px; }
.jauge i { display: block; height: 100%; border-radius: 99px; background: var(--vert); }

/* barres horizontales */
.hbarres { display: flex; flex-direction: column; gap: 10px; }
.hbarre { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; align-items: center; gap: 10px; }
.hbarre .nom { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--doux); }
.hbarre .piste { height: 10px; border-radius: 4px; background: rgba(255, 255, 255, 0.05); }
.hbarre .piste i { display: block; height: 100%; border-radius: 4px; background: var(--cyan); min-width: 2px; }
.hbarre .v { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 28px; text-align: right; }

/* graphiques */
.graph { position: relative; width: 100%; }
.graph svg { display: block; width: 100%; overflow: visible; }
.graph .axe { fill: var(--pale); font-size: 11px; }
.graph .grille-l { stroke: rgba(255, 255, 255, 0.06); }
.graph .infobulle {
  position: absolute; pointer-events: none; background: #1a2135; border: 1px solid var(--bord); border-radius: 8px;
  padding: 6px 10px; font-size: 12.5px; white-space: nowrap; transform: translate(-50%, -110%); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}
.graph .infobulle b { font-variant-numeric: tabular-nums; }

/* onglets */
.onglets { display: flex; gap: 4px; border-bottom: 1px solid var(--bord); margin-bottom: 18px; overflow-x: auto; }
.onglets button {
  background: none; border: 0; padding: 10px 14px; color: var(--doux); cursor: pointer; font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.onglets button.actif { color: #fff; border-bottom-color: var(--violet); }

/* fenêtres */
.voile { position: fixed; inset: 0; background: rgba(3, 5, 10, 0.7); backdrop-filter: blur(4px); z-index: 50; display: grid; place-items: center; padding: 16px; }
.fenetre { background: #121829; border: 1px solid var(--bord); border-radius: 18px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5); }
.fenetre.large { width: min(820px, 100%); }
.fenetre header { display: flex; align-items: center; gap: 10px; padding: 18px 20px 6px; }
.fenetre header .btn { margin-left: auto; }
.fenetre .corps { padding: 12px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.fenetre footer { display: flex; justify-content: flex-end; gap: 8px; padding: 0 20px 20px; }

.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 80; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: #1a2135; border: 1px solid var(--bord); border-left: 3px solid var(--cyan); border-radius: 10px; padding: 10px 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); animation: entre 0.2s ease-out; }
.toast.ok { border-left-color: var(--vert); }
.toast.err { border-left-color: var(--rouge); }
.toast small { display: block; color: var(--doux); word-break: break-word; }
@keyframes entre { from { transform: translateY(8px); opacity: 0; } }

/* connexion */
.connexion { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.connexion .boite { width: min(400px, 100%); }
.connexion .logo { justify-content: center; padding-bottom: 24px; }
.connexion .logo-a { width: 48px; height: 48px; font-size: 24px; border-radius: 14px; }
.connexion .etapes { display: flex; gap: 6px; margin-bottom: 18px; }
.connexion .etapes i { flex: 1; height: 4px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); }
.connexion .etapes i.fait { background: var(--violet); }
.erreur-txt { color: var(--rouge); font-size: 13px; }

/* logs */
.log { display: grid; grid-template-columns: 130px 220px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); align-items: baseline; }
.log:last-child { border-bottom: 0; }
.choix-objets { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; max-height: 360px; overflow: auto; padding: 2px; margin-top: 6px; }
.pastille .retirer { background: none; border: 0; color: var(--pale); cursor: pointer; padding: 0 0 0 6px; font-size: 11px; line-height: 1; }
.pastille .retirer:hover { color: var(--rouge); }
.choix-persos { max-height: 190px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.choix-objets .grp { grid-column: 1 / -1; color: var(--doux); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; padding: 10px 2px 2px; }
.choix-objets button { display: flex; flex-direction: column; gap: 2px; text-align: left; background: var(--carte); border: 1px solid var(--bord); border-radius: 10px; padding: 8px 10px; color: var(--texte); cursor: pointer; min-width: 0; }
.choix-objets button:hover { background: var(--carte2); }
.choix-objets button.actif { border-color: var(--violet); background: var(--violet-f); }
.choix-objets button b { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.choix-objets button small { color: var(--pale); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log[data-id] { cursor: pointer; border-radius: 8px; transition: background 0.15s; }
.log[data-id]:hover { background: rgba(255, 255, 255, 0.035); }
.log.nouveau { animation: log-nouveau 3s ease-out; }
@keyframes log-nouveau { from { background: rgba(74, 222, 128, 0.14); } to { background: transparent; } }
.log .quand { color: var(--pale); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.log .mod { font-size: 12px; min-width: 0; }
.log .mod .pastille { max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: inline-block; }
.log .j { color: var(--cyan); font-weight: 600; cursor: pointer; }
.log .j:hover { text-decoration: underline; }
.log .metier { color: var(--pale); font-size: 12px; }
.log .fort { color: var(--jaune); }
.log .argent { color: var(--vert); font-weight: 600; }

/* permissions */
.perms { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px 16px; }
.perm { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.perm > span:not(.interrupteur) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.perm em { font-style: normal; font-size: 11px; color: var(--pale); }
.rangs-liste { display: flex; flex-direction: column; gap: 4px; }
.rangs-liste button { text-align: left; padding: 9px 12px; border-radius: 10px; border: 1px solid transparent; background: none; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.rangs-liste button:hover { background: var(--carte); }
.rangs-liste button.actif { background: var(--violet-f); border-color: rgba(139, 92, 246, 0.35); }
.rangs-liste button small { margin-left: auto; color: var(--pale); }

/* commandes */
.cmds { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.cmd { text-align: left; border: 1px solid var(--bord); background: var(--carte); border-radius: 12px; padding: 12px 14px; cursor: pointer; }
.cmd:hover { border-color: rgba(139, 92, 246, 0.5); background: var(--carte2); }
.cmd b { font-family: ui-monospace, Consolas, monospace; font-size: 13.5px; }
.cmd p { margin: 4px 0 0; color: var(--doux); font-size: 12.5px; }
.cmd.off { opacity: 0.5; }

.profil-tete { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.profil-tete img, .profil-tete .av { width: 72px; height: 72px; border-radius: 18px; object-fit: cover; }
.profil-tete .av { display: grid; place-items: center; font: 700 28px Poppins, sans-serif; background: linear-gradient(135deg, var(--violet), var(--cyan)); }
.fonda { display: flex; flex-direction: column; gap: 12px; }
.fonda img, .fonda .av { width: 56px; height: 56px; border-radius: 14px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; }
.kv dt { color: var(--pale); }
.kv dd { margin: 0; word-break: break-word; }

.chargement { display: grid; place-items: center; padding: 60px; color: var(--pale); }

/* ---------- petits écrans ---------- */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-2-1, .g3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .menu { position: fixed; z-index: 40; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform 0.2s; }
  .menu.ouvert { transform: none; box-shadow: 0 0 60px rgba(0, 0, 0, 0.6); background: #0b0f1a; }
  .btn.burger { display: inline-flex; }
  .barre { padding: 10px 16px; }
  .contenu { padding: 18px 16px 50px; }
  .g2 { grid-template-columns: minmax(0, 1fr); }
  .log { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .hbarre { grid-template-columns: minmax(70px, 110px) 1fr auto; }
  .barre .masquer-mobile { display: none; }
}
@media (max-width: 480px) {
  .g4 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .tuile .val { font-size: 22px; }
}

/* ---------- gestion des serveurs ---------- */
.console-logs { background: rgba(0, 0, 0, 0.35); border: 1px solid var(--bord); border-radius: 10px; padding: 12px 14px; margin: 0; height: 380px; overflow: auto; white-space: pre-wrap; word-break: break-word; font-size: 12px; line-height: 1.45; color: #cfd6e6; }
.srv .kv { grid-template-columns: 110px 1fr; }
.srv .kv .jauge { margin-top: 6px; max-width: 260px; }
.tache { padding: 8px 6px; border-radius: 10px; }
.tache:hover { background: rgba(255, 255, 255, 0.025); }
.tache.faite b { color: var(--doux); text-decoration: line-through; text-decoration-color: rgba(255, 255, 255, 0.25); }
.docs-grille { grid-template-columns: 260px minmax(0, 1fr); align-items: start; }
.docs-menu { display: flex; flex-direction: column; gap: 2px; padding: 12px; position: sticky; top: 76px; }
.docs-menu .groupe-doc { color: var(--pale); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; padding: 10px 10px 4px; }
.docs-menu a { color: var(--doux); padding: 7px 10px; border-radius: 9px; }
.docs-menu a:hover { background: var(--carte); text-decoration: none; color: var(--texte); }
.docs-menu a.actif { background: var(--violet-f); color: #fff; }
.doc-texte { margin-top: 14px; line-height: 1.65; max-width: 760px; }
.doc-texte h2 { margin: 20px 0 6px; font-size: 18px; }
.doc-texte h3 { margin: 18px 0 6px; font-size: 15px; color: #c4b5fd; }
.doc-texte p { margin: 0 0 10px; }
.doc-texte ul { margin: 0 0 12px; padding-left: 20px; }
.doc-texte li { margin: 3px 0; }
.doc-texte code { background: rgba(255, 255, 255, 0.07); padding: 1px 6px; border-radius: 6px; }
select.mini { padding: 4px 8px; border-radius: 8px; background: var(--carte2); border: 1px solid var(--bord); font-size: 12.5px; }
@media (max-width: 820px) {
  .docs-grille { grid-template-columns: minmax(0, 1fr); }
  .docs-menu { position: static; }
}
