:root {
  --bg: #05070d;
  --bg-panel: #0a0e18;
  --bg-card: #10152400;
  --bg-card-solid: #111726;
  --bg-input: #0a0e18;
  --bg-hover: rgba(255, 255, 255, 0.035);
  --border: #1f2740;
  --border-soft: rgba(255, 255, 255, 0.06);
  --text: #e9ecf5;
  --text-dim: #8a93ab;
  --text-faint: #5b6479;

  /* Accent principal du panel : le turquoise déjà utilisé dans les embeds Discord (DISPATCH SASP,
     sessions PA...) plutôt qu'un bleu générique — donne au panel une identité reconnaissable au lieu
     d'un thème admin interchangeable. */
  --accent: #22e0b8;
  --accent-rgb: 34, 224, 184;
  --accent-dim: rgba(34, 224, 184, 0.14);

  --blue: #3b82f6;
  --blue-dim: rgba(59, 130, 246, 0.14);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.14);
  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.14);
  --amber: #f59e0b;
  --amber-dim: rgba(245, 158, 11, 0.14);
  --violet: #a78bfa;
  --violet-dim: rgba(167, 139, 250, 0.14);

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  --shadow-sm: 0 6px 20px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 0%, rgba(34, 224, 184, 0.07), transparent 42%),
    radial-gradient(circle at 88% 18%, rgba(239, 68, 68, 0.06), transparent 40%),
    var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
}

#app { min-height: 100vh; }

::selection { background: var(--accent-dim); color: var(--text); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #2a3450; }

/* ─────────────────────────── layout ─────────────────────────── */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 264px;
  flex-shrink: 0;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 14px;
  flex-shrink: 0;
}
.brand-badge {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--blue));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; color: #06251d;
  box-shadow: 0 0 24px rgba(var(--accent-rgb), .35);
}
.brand-title { font-weight: 700; font-size: 14.5px; letter-spacing: .3px; }
.brand-sub { font-size: 11px; color: var(--text-dim); }

.nav-search-wrap { padding: 0 14px 10px; flex-shrink: 0; }
.nav-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-input); border: 1px solid var(--border); border-radius: 9px;
  padding: 7px 10px;
}
.nav-search svg { flex-shrink: 0; opacity: .5; }
.nav-search input {
  border: none; background: none; padding: 0; width: 100%; font-size: 13px; color: var(--text);
}
.nav-search input:focus { outline: none; }
.nav-search input::placeholder { color: var(--text-faint); }

.sidebar-scroll { flex: 1; overflow-y: auto; padding: 2px 14px 14px; min-height: 0; }

.nav-category { margin-bottom: 2px; }
.nav-category-head {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: none; border: none; cursor: pointer;
  padding: 9px 8px; border-radius: 8px;
  color: var(--text-faint); font-size: 10.5px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .7px;
}
.nav-category-head:hover { color: var(--text-dim); background: var(--bg-hover); }
.nav-category-chevron { transition: transform .15s ease; opacity: .7; }
.nav-category.collapsed .nav-category-chevron { transform: rotate(-90deg); }
.nav-category.collapsed .nav-category-body { display: none; }
.nav-category-body { display: flex; flex-direction: column; gap: 1px; padding-bottom: 6px; }

.nav-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 8px 12px; border-radius: 8px;
  color: var(--text-dim); font-size: 13.5px; font-weight: 600;
  cursor: pointer; border: 1px solid transparent; background: none;
  text-align: left; width: 100%;
}
.nav-btn:hover { background: var(--bg-hover); color: var(--text); }
.nav-btn.active {
  background: var(--accent-dim);
  color: #b6f3e4;
}
.nav-btn.active .dot { background: var(--accent); opacity: 1; }
.nav-btn .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .45; flex-shrink: 0; }
.nav-btn-top { font-size: 14px; padding: 9px 10px 9px 12px; }

.sidebar-foot { padding: 12px 14px 14px; border-top: 1px solid var(--border); flex-shrink: 0; }
.logout-btn {
  width: 100%; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--border);
  background: transparent; color: var(--text-dim); font-size: 12.5px; cursor: pointer;
}
.logout-btn:hover { color: var(--red); border-color: rgba(239,68,68,.4); }

.main { flex: 1; min-width: 0; padding: 30px 40px 60px; }
.main-inner { max-width: 1440px; margin: 0 auto; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-title { font-size: 22px; font-weight: 800; margin: 0 0 4px; }
.page-sub { color: var(--text-dim); font-size: 13px; margin: 0; max-width: 720px; line-height: 1.5; }

/* ─────────────────────────── cards / grid ─────────────────────────── */

.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-fit { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
@media (max-width: 1150px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px 20px;
}
.card + .card { margin-top: 14px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .section-title { padding: 16px 20px 0; }
.card.flush table { margin-top: 4px; }

/* Fine bande de couleur en tête de carte, pour distinguer visuellement un domaine (présence,
   modération, contenu...) sans dupliquer un jeu de couleurs par onglet — purement une pointe de
   couleur, jamais une teinte de fond entière qui rendrait le texte moins lisible. */
.card-accent { border-top: 2px solid var(--accent); }
.card-accent-red { border-top: 2px solid var(--red); }
.card-accent-amber { border-top: 2px solid var(--amber); }
.card-accent-violet { border-top: 2px solid var(--violet); }

.stat-card { position: relative; overflow: hidden; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-dim); font-weight: 700; }
.stat-value { font-size: 26px; font-weight: 800; margin-top: 6px; line-height: 1.15; }
.stat-hint { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
}
.status-pill.online { background: var(--green-dim); color: #7ee2a8; }
.status-pill.offline { background: var(--red-dim); color: #f38b8b; }
.status-pill .pulse {
  width: 7px; height: 7px; border-radius: 50%; background: currentColor;
  animation: pulse 1.6s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; box-shadow: 0 0 0 0 currentColor; } 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .status-pill .pulse { animation: none; } }

.section-title { font-size: 13.5px; font-weight: 800; margin: 0 0 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.section-title-plain { display: flex; align-items: center; gap: 8px; }

/* ─────────────────────────── forms/buttons ─────────────────────────── */

button.btn {
  border-radius: 999px; padding: 9px 16px; font-size: 13px; font-weight: 700;
  border: 1px solid rgba(var(--accent-rgb), .35); background: var(--accent-dim); color: #b6f3e4;
  cursor: pointer; transition: background .12s ease, border-color .12s ease;
}
button.btn:hover { background: rgba(var(--accent-rgb), .24); }
button.btn:disabled { opacity: .4; cursor: default; }
button.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.btn.danger { border-color: rgba(239,68,68,.4); background: var(--red-dim); color: #f8b4b4; }
button.btn.secondary { border-color: var(--border); background: transparent; color: var(--text-dim); }
button.btn.secondary:hover { color: var(--text); border-color: #2a3450; }
button.btn.small { padding: 5px 11px; font-size: 12px; }

input[type=text], input[type=password], input[type=search], input[type=color], select, textarea {
  background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 9px 11px; font-size: 13.5px; width: 100%;
  font-family: inherit;
}
textarea { resize: vertical; line-height: 1.5; }
input[type=color] { padding: 3px; height: 38px; cursor: pointer; max-width: 110px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: rgba(var(--accent-rgb), .5); box-shadow: 0 0 0 3px var(--accent-dim); }
label { font-size: 12px; color: var(--text-dim); font-weight: 700; display: block; margin-bottom: 5px; }

.field-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.field-row > div { flex: 1; min-width: 140px; }
.field-row-tight > div { flex: 0 0 auto; min-width: 0; }

/* ─────────────────────────── tables ─────────────────────────── */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--text-dim); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,.015); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
tr:hover td { background: var(--bg-hover); }
.card.flush th:first-child, .card.flush td:first-child { padding-left: 20px; }
.card.flush th:last-child, .card.flush td:last-child { padding-right: 20px; }

.tag { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.tag.ok { background: var(--green-dim); color: #7ee2a8; }
.tag.warn { background: var(--amber-dim); color: #f5c76a; }
.tag.bad { background: var(--red-dim); color: #f38b8b; }
.tag.neutral { background: rgba(255,255,255,.06); color: var(--text-dim); }

/* ─────────────────────────── rank ladder ─────────────────────────── */

.ladder { display: flex; flex-direction: column; gap: 6px; }
.ladder-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-input); border: 1px solid var(--border); border-radius: 9px;
  padding: 8px 10px;
}
.ladder-idx { width: 22px; text-align: center; font-size: 11px; color: var(--text-dim); font-weight: 800; }
.ladder-swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.ladder-name { flex: 1; font-weight: 600; font-size: 13.5px; }
.ladder-name.missing { color: var(--red); font-style: italic; }
.ladder-move { display: flex; gap: 3px; }
.icon-btn {
  width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--border);
  background: transparent; color: var(--text-dim); cursor: pointer; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { color: var(--text); border-color: #2a3450; }
.icon-btn.remove:hover { color: var(--red); border-color: rgba(239,68,68,.4); }
.min-rank-marker { color: var(--amber); font-size: 10.5px; font-weight: 800; }

/* ─────────────────────────── login / setup ─────────────────────────── */

.center-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card {
  width: 380px; background: var(--bg-card-solid); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 30px 28px; box-shadow: var(--shadow);
}
.auth-title { font-size: 18px; font-weight: 800; margin: 14px 0 2px; }
.auth-sub { font-size: 12.5px; color: var(--text-dim); margin-bottom: 22px; }
.field { margin-bottom: 14px; }
.error-box {
  background: var(--red-dim); border: 1px solid rgba(239,68,68,.35); color: #f8b4b4;
  border-radius: 8px; padding: 9px 12px; font-size: 12.5px; margin-bottom: 14px;
}
.ok-box {
  background: var(--green-dim); border: 1px solid rgba(34,197,94,.35); color: #a9edc0;
  border-radius: 8px; padding: 9px 12px; font-size: 12.5px; margin-bottom: 14px;
}

.hint-text { color: var(--text-dim); font-size: 12px; line-height: 1.5; }
.empty { color: var(--text-dim); font-size: 13px; padding: 28px 0; text-align: center; }
.loading { color: var(--text-dim); font-size: 13px; padding: 20px 0; text-align: center; }

.searchbar { margin-bottom: 14px; max-width: 320px; }

.results-list { display: flex; flex-direction: column; gap: 8px; }
.result-line { font-size: 12.5px; color: var(--text-dim); padding-left: 2px; }
