:root {
  --bg: #0f1216;
  --bg2: #161b21;
  --card: #1b2129;
  --line: #2a323c;
  --text: #e7e2d8;
  --muted: #9aa3ad;
  --accent: #d9a441;
  --accent-ink: #1a1305;
  --green: #5cc27a;
  --amber: #e0a43a;
  --red: #e0645a;
  --blue: #6aa7e0;
  --radius: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 500px at 50% -200px, #1f2730 0%, var(--bg) 70%) fixed, var(--bg);
  color: var(--text);
  font: 14px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
}
[hidden] { display: none !important; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.mono { font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; }
.wrap { max-width: 1120px; margin: 0 auto; padding-inline: 20px; }

/* Marque */
.brand { font-weight: 700; font-size: 18px; letter-spacing: .02em; display: flex; align-items: center; gap: 8px; }
.rune { color: var(--accent); font-size: 22px; line-height: 1; }

/* Boutons */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--text);
  padding: 8px 14px; border-radius: 8px; font: inherit; font-weight: 500; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; text-decoration: none;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { border-color: #3a4552; background: #212833; }
.btn:disabled { opacity: .5; cursor: progress; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #e6b556; }
.btn.danger { color: var(--red); border-color: #4a2a2a; }
.btn.danger:hover { background: #2a1b1b; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn .spin { width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg2); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #d9a44155; border-color: var(--accent); }
label { display: grid; gap: 6px; font-weight: 500; }

/* Connexion */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card {
  width: min(380px, 100%); background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 28px; display: grid; gap: 16px; box-shadow: 0 20px 60px #0008;
}
.login-card .brand { font-size: 22px; }
.login-card p { margin: -8px 0 4px; }
.error { color: var(--red); margin: 0; }

/* Barre du haut */
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 20px; border-bottom: 1px solid var(--line); background: #0f1216cc;
  backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 5;
}

/* Onglets serveurs */
.server-tabs { display: flex; gap: 10px; flex-wrap: wrap; max-width: 1120px; margin: 20px auto 0; padding-inline: 20px; }
.server-tab {
  flex: 1 1 220px; text-align: left; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px; color: var(--text); cursor: pointer; font: inherit;
  display: grid; gap: 2px;
}
.server-tab.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.server-tab .name { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.server-tab .sub { color: var(--muted); font-size: 13px; }

.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); display: inline-block; flex: none; }
.dot.on { background: var(--green); box-shadow: 0 0 0 3px #5cc27a22; }
.dot.boot { background: var(--amber); box-shadow: 0 0 0 3px #e0a43a22; }
.dot.off { background: var(--red); }

/* Fiche serveur */
#server { margin-top: 16px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.server-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.server-head h2 { margin: 0 0 4px; font-size: 22px; display: flex; align-items: center; gap: 10px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 16px; }
.fact { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; min-width: 0; }
.fact .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.fact .v { font-weight: 600; margin-top: 2px; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip { background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 12.5px; }
.chip b { color: var(--accent); font-weight: 600; }
.copy { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0 0 0 6px; font: inherit; }
.copy:hover { color: var(--text); }

.banner {
  margin-top: 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  background: #2a2112; border: 1px solid #5a451d; color: #f1d39a; border-radius: 8px; padding: 10px 14px;
}
.banner.info { background: #14222f; border-color: #28435c; color: #bcd6ee; }

.players { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* Onglets sections */
.section-tabs { display: flex; gap: 4px; margin-top: 22px; border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.section-tabs::-webkit-scrollbar { display: none; }
.section-tab {
  background: none; border: 0; color: var(--muted); padding: 10px 14px; font: inherit; font-weight: 500;
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.section-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.section { padding-block: 18px 60px; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1 1 280px; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 14px; }

/* Tableaux */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; background: var(--bg2); }
tr:last-child td { border-bottom: 0; }
td.right, th.right { text-align: right; }
td .files { color: var(--muted); font-size: 12px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { color: var(--green); border-color: #2a4a33; background: #15241a; }
.badge.warn { color: var(--amber); border-color: #4d3b1a; background: #241c0f; }
.badge.off { color: var(--muted); }
.badge.new { color: var(--blue); border-color: #28435c; background: #14222f; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

.empty { color: var(--muted); padding: 24px; text-align: center; }

/* Logs */
pre.logs {
  background: #0b0e11; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
  max-height: 65vh; overflow: auto; font: 12.5px/1.55 "JetBrains Mono", ui-monospace, Consolas, monospace;
  white-space: pre-wrap; word-break: break-word; margin: 0; color: #cfd6de;
}
textarea.cfg { min-height: 60vh; font: 12.5px/1.55 "JetBrains Mono", ui-monospace, Consolas, monospace; resize: vertical; }
.check { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; font-weight: 400; }
.check input { width: auto; }

/* Dialogue */
dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--text); padding: 0; width: min(460px, calc(100% - 32px)); }
dialog::backdrop { background: #000a; }
.dialog { padding: 22px; display: grid; gap: 12px; }
.dialog h3 { margin: 0; }
.dialog p { margin: 0; color: var(--muted); white-space: pre-line; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* Notifications */
.toasts { position: fixed; bottom: 18px; right: 18px; display: grid; gap: 8px; z-index: 50; max-width: min(420px, calc(100% - 36px)); }
.toast { background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px; padding: 10px 14px; box-shadow: 0 10px 30px #0008; white-space: pre-line; }
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }

@media (max-width: 640px) {
  .server-head h2 { font-size: 19px; }
  table.plugins th:nth-child(3), table.plugins td:nth-child(3) { display: none; }
  .actions .btn { flex: 1; justify-content: center; }
}
