:root {
  --bg: #0d1016;
  --bg-2: #131823;
  --card: #171d2a;
  --card-2: #1d2433;
  --line: #262f41;
  --text: #e6e9ef;
  --muted: #8b93a7;
  --faint: #5d667a;
  --accent: #5b8cff;
  --accent-2: #8a6bff;
  --ok: #3ccf91;
  --warn: #f2b84b;
  --bad: #ff5d6c;
  --radius: 14px;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
button {
  font: inherit; color: var(--text); background: var(--card-2); border: 1px solid var(--line);
  border-radius: 9px; padding: 7px 13px; cursor: pointer; transition: background .15s, border-color .15s;
}
button:hover { border-color: #3a4560; background: #232b3d; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover { filter: brightness(1.1); }
button.danger { color: var(--bad); }
button.small { padding: 4px 9px; font-size: 12.5px; }
button:disabled { opacity: .45; cursor: default; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 11px; outline: none; min-width: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { font-family: var(--mono); font-size: 12.5px; width: 100%; min-height: 380px; resize: vertical; }

/* ---------- mise en page ---------- */
.layout { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.side {
  background: var(--bg-2); border-right: 1px solid var(--line); padding: 20px 14px;
  display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; font-weight: 700; font-size: 16px; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 15px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
}
.brand small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 9px; color: var(--muted);
  font-weight: 500;
}
.nav a:hover { color: var(--text); background: var(--card); }
.nav a.active { color: var(--text); background: var(--card-2); box-shadow: inset 2px 0 0 var(--accent); }
.nav .ico { width: 18px; text-align: center; }
.side .grow { flex: 1; }
.conn { font-size: 12px; color: var(--muted); padding: 8px 11px; display: flex; align-items: center; gap: 8px; }
.main { padding: 26px 30px 60px; min-width: 0; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.head h1 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.head .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 5px 11px; font-size: 12.5px; color: var(--muted); }
.chip b { color: var(--text); font-weight: 600; }

.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.card h2 { margin: 0 0 14px; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.card h2 .hint { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--faint); }
.mt { margin-top: 16px; }

/* ---------- tuiles de mesure ---------- */
.stat .big { font-size: 30px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .big small { font-size: 15px; color: var(--muted); font-weight: 500; margin-left: 3px; }
.stat .line { color: var(--muted); font-size: 12.5px; display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .line b { color: var(--text); font-weight: 600; }
.spark { width: 100%; height: 44px; display: block; margin-top: 12px; }
.bar { height: 7px; background: var(--bg-2); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .5s; }
.bar.warn > i { background: var(--warn); } .bar.bad > i { background: var(--bad); }

/* ---------- cœurs ---------- */
.cores { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 10px; }
.core { background: var(--bg-2); border: 1px solid var(--line); border-radius: 11px; padding: 9px 9px 8px; }
.core .lbl { font-size: 11px; color: var(--faint); display: flex; justify-content: space-between; margin-bottom: 6px; }
.thread { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; padding: 3px 0; }
.thread .ghz { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 15px; }
.thread .ghz small { font-size: 10px; color: var(--muted); font-weight: 500; }
.thread .ld { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tbar { height: 4px; background: var(--card); border-radius: 99px; overflow: hidden; }
.tbar > i { display: block; height: 100%; border-radius: 99px; transition: width .5s, background .5s; }
.legend { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); }
.legend .ramp { width: 120px; height: 6px; border-radius: 99px; background: linear-gradient(90deg, #3b5bdb, #5b8cff, #3ccf91, #f2b84b, #ff5d6c); }

/* ---------- tableaux ---------- */
.list { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: minmax(0, 2.2fr) 1.1fr 1fr 1fr auto; gap: 14px; align-items: center; padding: 12px 4px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .nm { font-weight: 600; } .row .ds { color: var(--muted); font-size: 12.5px; }
.row .num { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.row .btns { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; padding: 3px 10px 3px 8px; border-radius: 99px; background: var(--bg-2); border: 1px solid var(--line); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.ok .dot, .dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(60, 207, 145, .15); }
.warn .dot, .dot.warn { background: var(--warn); }
.bad .dot, .dot.bad { background: var(--bad); box-shadow: 0 0 0 3px rgba(255, 93, 108, .15); }
.section-title { font-size: 12px; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; margin: 22px 4px 8px; font-weight: 600; }
.empty { color: var(--muted); padding: 18px 4px; }

/* ---------- jeux ---------- */
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.game { cursor: pointer; transition: border-color .15s, transform .15s; position: relative; overflow: hidden; }
.game:hover { border-color: #3a4560; transform: translateY(-1px); }
.game .tag { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.game h3 { margin: 6px 0 12px; font-size: 17px; }
.t-minecraft { --g: #62c462; } .t-zomboid { --g: #d9534f; } .t-reforger { --g: #c7a45a; }
.game.t-minecraft, .game.t-zomboid, .game.t-reforger { border-top: 3px solid var(--g); }
.game .tag, .ghead .tag { color: var(--g, var(--accent)); }
.ghead { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.ghead h1 { margin: 4px 0 0; font-size: 22px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tagx { background: var(--bg-2); border: 1px solid var(--line); border-radius: 7px; padding: 3px 8px; font-size: 12.5px; display: inline-flex; gap: 6px; align-items: center; }
.tagx button { padding: 0 5px; border: 0; background: none; color: var(--faint); }
.form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.form input, .form select { flex: 1 1 160px; }
.console { background: #090c11; border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-family: var(--mono); font-size: 12.5px; min-height: 140px; max-height: 320px; overflow: auto; white-space: pre-wrap; color: #c8d0e0; }
.console .cmd { color: var(--accent); }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs button.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- tableau de bord : jeux & services ---------- */
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dgame { cursor: pointer; display: flex; flex-direction: column; gap: 8px; }
.dg-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.dg-top h3 { margin: 4px 0 0; }
.dg-players { display: flex; align-items: baseline; gap: 6px; margin-top: 4px; }
.dg-players b { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.dg-players span { color: var(--muted); }
.dgame .bar { margin-top: 0; }
.dgame .bar > i { background: var(--g, var(--accent)); }
.dg-meta { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; }
.dg-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.muted { color: var(--muted); }
.srow { display: flex; align-items: center; gap: 11px; padding: 9px 0; border-top: 1px solid var(--line); }
.card h2 + .srow { border-top: 0; }
.srow .sn { flex: 1; min-width: 0; }
.srow .sn > div:first-child { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srow .ss { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1200px) { .g3 { grid-template-columns: 1fr; } }

/* ---------- éditeur de serveur (Reforger) ---------- */
.summary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.sum { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.sum span { display: block; font-size: 11.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.sum b { display: block; margin-top: 4px; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ed-tabs { background: var(--bg-2); border-right: 1px solid var(--line); padding: 10px; display: flex; flex-direction: column; gap: 3px; }
.ed-tabs button { display: flex; align-items: center; gap: 10px; text-align: left; border: 0; background: none; color: var(--muted); padding: 9px 11px; font-weight: 500; position: relative; }
.ed-tabs button:hover { background: var(--card); color: var(--text); }
.ed-tabs button.on { background: var(--card-2); color: var(--text); box-shadow: inset 2px 0 0 var(--g, var(--accent)); }
.ed-tabs .ico { width: 18px; text-align: center; color: var(--g, var(--accent)); }
.ed-dot { margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: transparent; flex: none; }
.ed-dot.on { background: var(--warn); }
.ed-body { padding: 22px 26px 26px; min-width: 0; }
.ed-head h2 { margin: 0; font-size: 18px; }
.ed-head p { margin: 4px 0 14px; color: var(--muted); font-size: 13px; }
.field { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 20px; align-items: center; padding: 14px 12px; margin: 0 -12px; border-top: 1px solid var(--line); border-radius: 10px; transition: background .2s; }
.field:first-of-type { border-top: 0; }
.field.changed { background: rgba(242, 184, 75, .07); box-shadow: inset 3px 0 0 var(--warn); }
.fn { font-weight: 600; }
.fn .def { font-size: 11px; font-weight: 500; color: var(--faint); border: 1px solid var(--line); border-radius: 99px; padding: 1px 7px; margin-left: 6px; }
.fh { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.fh.mono { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.fc { display: flex; justify-content: flex-end; min-width: 0; }
.fc > input, .fc > select { width: 100%; }
.switch { position: relative; width: 44px; height: 24px; flex: none; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 99px; transition: background .2s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.slider { display: flex; align-items: center; gap: 12px; width: 100%; justify-content: flex-end; }
.slider input[type=range] { flex: 1; accent-color: var(--g, var(--accent)); min-width: 80px; padding: 0; border: 0; background: none; }
.num-in { width: 110px; text-align: right; font-variant-numeric: tabular-nums; }
.unit { color: var(--muted); font-size: 12.5px; min-width: 14px; }
.secret { display: flex; align-items: center; gap: 8px; width: 100%; justify-content: flex-end; flex-wrap: wrap; }
.secret input { flex: 1 1 180px; }
.checks { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.check { display: inline-flex; align-items: center; gap: 7px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 9px; padding: 7px 11px; cursor: pointer; }
.check input { accent-color: var(--g, var(--accent)); }
.chiplist { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; width: 100%; }
.chiplist input { flex: 1 1 160px; }
.scen { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.scen input { font-family: var(--mono); font-size: 12.5px; }
.warnbox { background: rgba(242, 184, 75, .1); border: 1px solid rgba(242, 184, 75, .35); color: #f6d38f; border-radius: 10px; padding: 10px 13px; font-size: 13px; margin-bottom: 8px; }
.modadd { display: flex; gap: 8px; flex-wrap: wrap; width: 100%; }
.modadd input { flex: 1 1 140px; }
input.short { width: 120px; flex: 0 0 120px; }
.mods { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.mod { display: grid; grid-template-columns: 30px minmax(0, 1fr) 120px auto; gap: 10px; align-items: center; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; }
.mnum { color: var(--faint); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.mi { display: flex; flex-direction: column; min-width: 0; }
.mname { background: none; border: 1px solid transparent; padding: 3px 6px; font-weight: 600; }
.mname:hover { border-color: var(--line); }
.mid { font-family: var(--mono); font-size: 11px; color: var(--faint); padding-left: 7px; }
.mod .btns { display: flex; gap: 4px; }
.mh-search { width: 100%; margin-bottom: 12px; }
details.mh { border: 1px solid var(--line); border-radius: 11px; padding: 4px 14px; margin-bottom: 10px; background: var(--bg-2); }
details.mh summary { cursor: pointer; padding: 10px 0; font-weight: 600; list-style-position: inside; }
details.mh summary .hint { font-weight: 400; color: var(--faint); font-size: 12px; margin-left: 6px; }
details.mh .field { margin: 0 -14px; padding: 11px 14px; }
details.expert summary { cursor: pointer; font-weight: 600; color: var(--muted); }
details.expert[open] summary { margin-bottom: 14px; }
details.expert summary .hint { font-weight: 400; color: var(--faint); font-size: 12px; margin-left: 6px; }
.savebar { position: sticky; bottom: 16px; margin-top: 16px; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  background: rgba(29, 36, 51, .96); backdrop-filter: blur(8px); border: 1px solid #3a4560; border-radius: 13px; padding: 11px 14px 11px 18px; box-shadow: 0 10px 40px rgba(0, 0, 0, .45); }
.savebar b { color: var(--warn); }
.savebar .btns { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 1100px) { .summary { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .ed-layout { grid-template-columns: 1fr; }
  .ed-tabs { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .ed-tabs button { white-space: nowrap; }
  .field { grid-template-columns: 1fr; gap: 10px; }
  .fc { justify-content: flex-start; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mod { grid-template-columns: 24px minmax(0, 1fr) auto; }
  .mod > input.short { display: none; }
}

/* ---------- modale & toasts ---------- */
.modal { position: fixed; inset: 0; background: rgba(5, 7, 11, .7); display: grid; place-items: center; padding: 20px; z-index: 20; }
.modal .box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); width: min(1000px, 100%); max-height: 88vh; display: flex; flex-direction: column; }
.modal .bh { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); gap: 10px; }
.modal pre { margin: 0; padding: 16px 18px; overflow: auto; font: 12px/1.5 var(--mono); color: #c8d0e0; }
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 30; }
.toast { background: var(--card-2); border: 1px solid var(--line); border-left: 3px solid var(--ok); border-radius: 10px; padding: 10px 14px; max-width: 380px; box-shadow: 0 8px 30px rgba(0, 0, 0, .35); }
.toast.err { border-left-color: var(--bad); }

/* ---------- connexion ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1000px 500px at 50% -10%, rgba(91, 140, 255, .18), transparent 60%), var(--bg); }
.login .box { width: min(400px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 30px 28px; text-align: center; }
.login .logo { width: 52px; height: 52px; border-radius: 14px; margin: 0 auto 16px; display: grid; place-items: center; font-size: 24px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.login h1 { margin: 0 0 6px; font-size: 21px; }
.login p { color: var(--muted); margin: 0 0 22px; }
.login button { width: 100%; padding: 12px; font-size: 15px; }
.login input { width: 100%; margin-bottom: 12px; }
.login .msg { margin-top: 14px; min-height: 20px; font-size: 13px; color: var(--muted); }
.login .msg.err { color: var(--bad); }
.login .foot { margin-top: 22px; font-size: 12px; color: var(--faint); }

@media (max-width: 1200px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cores { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 12px 16px; }
  .brand { padding: 4px 8px; width: 100%; }
  .nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .side .grow, .conn { display: none; }
  .main { padding: 18px 16px 50px; }
  .g4, .g2 { grid-template-columns: 1fr; }
  .cores { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row { grid-template-columns: 1fr auto; }
  .row .num { display: none; }
}
