/*
 * EliteWeb — feuille de style.
 *
 * Parti pris : **epure dense**. Le panel est un outil de travail quotidien ;
 * l'information prime sur la respiration. Traits fins, elevation discrete,
 * typographie compacte, aucun ornement qui ne porte pas de sens.
 *
 * Tout passe par des jetons declares une seule fois dans `:root`. Une retouche
 * de teinte, de densite ou de rayon se fait donc en un point unique, et non en
 * corrigeant trente regles. Aucune valeur brute n'est repetee dans les
 * composants.
 *
 * Theme sombre uniquement, assume : un panel d'administration se consulte
 * longtemps, et une seule palette bien reglee vaut mieux que deux approximatives.
 */

:root {
  /* --- Surfaces, du plus profond au plus eleve --------------------------- */
  --bg: #0a0c10;
  --surface: #10131a;
  --surface-2: #161a23;
  --surface-3: #1d222d;

  /* Deux graisses de trait : le fin pour separer, le fort pour delimiter. */
  --line: #212734;
  --line-strong: #2c3341;

  /* --- Encre ------------------------------------------------------------- */
  --text: #e6e9ef;
  --text-2: #9aa3b2;
  --text-3: #646d7d;

  /* --- Accent ------------------------------------------------------------ */
  --accent: #5865f2;
  --accent-hover: #6f7bf7;
  --accent-soft: rgba(88, 101, 242, .16);

  /* --- Etats ------------------------------------------------------------- */
  /* Steps choisis pour clairer 3:1 sur `--surface` : un statut doit rester
     lisible sans dependre de sa taille. */
  --ok: #3fb950;
  --warn: #d29922;
  --error: #f85149;
  --critical: #da3633;
  --info: #58a6ff;

  --ok-soft: rgba(63, 185, 80, .14);
  --warn-soft: rgba(210, 153, 34, .14);
  --error-soft: rgba(248, 81, 73, .14);

  /* --- Typographie ------------------------------------------------------- */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Consolas, monospace;

  --fs-xs: .6875rem;   /* 11px — etiquettes d'axe, mentions */
  --fs-sm: .75rem;     /* 12px — tableaux, aides */
  --fs-base: .8125rem; /* 13px — texte courant */
  --fs-md: .875rem;    /* 14px — champs, corps dense */
  --fs-lg: 1rem;       /* 16px — titres de section */
  --fs-xl: 1.25rem;    /* 20px — titres de vue */
  --fs-2xl: 1.75rem;   /* 28px — chiffres de synthese */

  /* --- Espacement -------------------------------------------------------- */
  --s1: .25rem;
  --s2: .5rem;
  --s3: .75rem;
  --s4: 1rem;
  --s5: 1.5rem;
  --s6: 2rem;

  /* --- Rayons ------------------------------------------------------------ */
  --r1: 4px;
  --r2: 6px;
  --r3: 8px;
  --r4: 12px;

  /* --- Elevation --------------------------------------------------------- */
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .32);
  --shadow-2: 0 6px 16px rgba(0, 0, 0, .40);
  --shadow-3: 0 16px 40px rgba(0, 0, 0, .52);

  /* --- Mouvement --------------------------------------------------------- */
  --ease: cubic-bezier(.2, 0, .1, 1);
  --fast: 120ms;
  --slow: 200ms;

  --topbar-h: 52px;
  --nav-w: 224px;
}

/* Une transition ne doit jamais s'imposer a qui l'a refusee au niveau systeme. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

* { box-sizing: border-box; }

/*
 * L'attribut HTML `hidden` ne masque que via la regle navigateur
 * `[hidden] { display: none }`, que n'importe quelle regle d'auteur declarant
 * `display` sur le meme element ecrase. `.login` porte `display: grid` : sans
 * cette declaration, l'ecran de connexion restait affiche par-dessus
 * l'application, malgre une session valide.
 */
[hidden] { display: none !important; }

html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-weight: 600; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-lg); margin: var(--s5) 0 var(--s3); }
h3 { font-size: var(--fs-md); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Anneau de focus unique pour tout le panel : la navigation au clavier doit
   etre visible partout, sans jamais s'afficher au clic a la souris. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r1);
}

::selection { background: var(--accent-soft); }

/* Barres de defilement discretes : elles ne doivent pas concurrencer la
   donnee, tout en restant saisissables. */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: 6px;
}
*::-webkit-scrollbar-thumb:hover { background-color: var(--text-3); background-clip: content-box; }

/* --- Ecran de connexion ---------------------------------------------------- */

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--s4);
  /* Halo tres large derriere la carte : donne de la profondeur sans ajouter
     d'element decoratif. */
  background:
    radial-gradient(60rem 40rem at 50% -10%, rgba(88, 101, 242, .10), transparent 70%),
    var(--bg);
}

.login__card {
  width: min(23rem, 100%);
  padding: var(--s6) var(--s5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r4);
  box-shadow: var(--shadow-3);
  text-align: center;
}

.login__logo { font-size: 2.25rem; line-height: 1; }
.login__card h1 { margin: var(--s3) 0 var(--s1); }
.login__card p { margin: 0 0 var(--s5); color: var(--text-2); font-size: var(--fs-md); }

/* --- Barre superieure ------------------------------------------------------ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: var(--s4);
  height: var(--topbar-h);
  padding: 0 var(--s4);
  background: rgba(16, 19, 26, .82);
  /* Le flou laisse deviner le contenu qui defile dessous : la barre parait
     posee sur la page plutot que collee au-dessus. */
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar__brand { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-md); }
.topbar__logo { font-size: 1.125rem; }

.topbar__user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--s2);
  color: var(--text-2);
  font-size: var(--fs-base);
}

.avatar { width: 24px; height: 24px; border-radius: 50%; }

/* --- Mise en page ---------------------------------------------------------- */

.layout { display: flex; align-items: flex-start; }

.nav {
  width: var(--nav-w);
  flex-shrink: 0;
  padding: var(--s4) var(--s2) var(--s6);
  background: var(--surface);
  border-right: 1px solid var(--line);
  /* La navigation reste visible pendant le defilement d'un long tableau. */
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}

.nav__group { margin-bottom: var(--s4); }

.nav__title {
  padding: 0 var(--s3) var(--s1);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-3);
}

.nav__item {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--s2) var(--s3);
  margin-bottom: 1px;
  background: none;
  border: 0;
  border-radius: var(--r2);
  color: var(--text-2);
  font: inherit;
  font-size: var(--fs-base);
  cursor: pointer;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}

.nav__item:hover { background: var(--surface-2); color: var(--text); }

/* L'entree active est signalee par un fond doux ET une barre laterale : la
   couleur seule ne suffirait pas a qui la distingue mal. */
.nav__item.is-active { background: var(--accent-soft); color: var(--text); font-weight: 500; }

.nav__item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.nav-toggle { display: none; }

.views {
  flex: 1;
  min-width: 0;
  padding: var(--s5) var(--s5) var(--s6);
  max-width: 1600px;
}

.view { display: none; }
.view.is-active { display: block; }

.view__head {
  display: flex;
  align-items: center;
  gap: var(--s4);
  flex-wrap: wrap;
  margin-bottom: var(--s4);
}

.view__head h2 { margin: 0; font-size: var(--fs-xl); }
.controls { margin-left: auto; display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.controls--start { margin-left: 0; }

.muted { color: var(--text-2); font-size: var(--fs-base); }
.mono { font-family: var(--mono); font-size: var(--fs-sm); }

@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    z-index: 25;
    box-shadow: var(--shadow-3);
  }
  /* Sur petit ecran la navigation est repliee par defaut : elle mangerait
     sinon la moitie de la largeur utile. */
  .nav:not(.is-open) { display: none; }
  .views { padding: var(--s4); }
}

/* --- Conteneurs ------------------------------------------------------------ */

.panel,
.figure {
  padding: var(--s4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r3);
  margin-bottom: var(--s3);
}

.panel h3 { margin: 0 0 var(--s3); }
.figure__title { font-size: var(--fs-md); font-weight: 600; margin: 0 0 var(--s1); }
.figure__sub { font-size: var(--fs-base); color: var(--text-2); margin: 0 0 var(--s3); }
.figure__head { display: flex; align-items: center; gap: var(--s4); margin-bottom: var(--s1); }
.figure__head .figure__title { margin: 0; }
.figure__head .btn { margin-left: auto; }

.columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--s3);
  align-items: start;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: var(--s3);
}

/* --- Chiffres de synthese -------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--s2);
  margin-bottom: var(--s4);
}

.stat {
  padding: var(--s3) var(--s4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r3);
  transition: border-color var(--fast) var(--ease);
}

.stat:hover { border-color: var(--line-strong); }

.stat__value {
  font-size: var(--fs-2xl);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.02em;
  /* Chiffres proportionnels : en grande taille, `tabular-nums` donne a chaque
     chiffre la largeur d'un zero et fait paraitre le nombre delave. */
}

.stat__label { color: var(--text-2); font-size: var(--fs-sm); margin-top: var(--s1); }
.stat--ok .stat__value { color: var(--ok); }
.stat--warn .stat__value { color: var(--warn); }
.stat--error .stat__value { color: var(--error); }

/* --- Cartes ---------------------------------------------------------------- */

.card {
  padding: var(--s4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r3);
  /* La bordure gauche porte l'etat : lisible d'un coup d'oeil sur la grille. */
  border-left: 3px solid var(--text-3);
  transition: border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}

/* Le survol n'eclaircit que trois cotes : `border-color` les toucherait tous,
   et comme `.card:hover` l'emporte en specificite sur `.card--ok`, la bordure
   gauche perdrait la couleur d'etat au passage de la souris. */
.card:hover {
  border-top-color: var(--line-strong);
  border-right-color: var(--line-strong);
  border-bottom-color: var(--line-strong);
}

.card--ok { border-left-color: var(--ok); }
.card--warn { border-left-color: var(--warn); }
.card--error { border-left-color: var(--error); }
.card--idle { border-left-color: var(--text-3); opacity: .6; }

.card__head { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s1); }
.card__title { font-weight: 600; }
.card__desc { color: var(--text-2); font-size: var(--fs-base); margin-bottom: var(--s3); }

.card__row {
  display: flex;
  justify-content: space-between;
  gap: var(--s2);
  padding: var(--s2) 0;
  font-size: var(--fs-base);
  border-top: 1px solid var(--line);
}

.card__row span:first-child { color: var(--text-2); }
.card__actions { display: flex; gap: var(--s1); margin-top: var(--s3); flex-wrap: wrap; }

/* --- Pastilles et badges --------------------------------------------------- */

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  background: var(--text-3);
}

/* Le halo signale l'activite sans recourir a une animation, qui distrairait
   sur une page ou dix pastilles coexistent. */
.dot--online { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot--stopped { background: var(--text-3); }
.dot--errored { background: var(--error); box-shadow: 0 0 0 3px var(--error-soft); }
.dot--absent { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: .1rem .4rem;
  border-radius: var(--r1);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .02em;
  background: var(--accent-soft);
  color: #b8c0ff;
  white-space: nowrap;
}

.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--error { background: var(--error-soft); color: var(--error); }
.badge--critical { background: var(--critical); color: #fff; }
.badge--muted { background: var(--surface-3); color: var(--text-2); }

/* --- Boutons --------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s1);
  padding: .4rem .75rem;
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: var(--r2);
  color: #fff;
  font: inherit;
  font-size: var(--fs-base);
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease);
}

.btn:hover { background: var(--accent-hover); }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--sm { padding: .25rem .55rem; font-size: var(--fs-sm); }

.btn--ghost {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--text-2);
}

.btn--ghost:hover { background: var(--surface-3); border-color: var(--line-strong); color: var(--text); }

.btn--danger { background: var(--error); }
.btn--danger:hover { background: var(--critical); }

.btn--discord { width: 100%; padding: .6rem; font-size: var(--fs-md); }

/* --- Champs ---------------------------------------------------------------- */

.input {
  padding: .35rem .55rem;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--r2);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-base);
  min-width: 7rem;
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
}

.input:hover { border-color: var(--text-3); }

.input:focus {
  outline: none;
  border-color: var(--accent);
  /* Un anneau interieur plutot qu'un `outline` : le champ ne bouge pas d'un
     pixel au focus, et l'alignement des formulaires reste stable. */
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input::placeholder { color: var(--text-3); }
.input--color { padding: 2px; height: 30px; width: 46px; cursor: pointer; }
textarea.input { resize: vertical; font-family: inherit; line-height: 1.55; }
select.input { cursor: pointer; }

.check {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  color: var(--text-2);
  font-size: var(--fs-base);
  cursor: pointer;
}

.check input { accent-color: var(--accent); cursor: pointer; }

.field { margin-bottom: var(--s3); position: relative; }
.field > label { display: block; font-size: var(--fs-base); color: var(--text-2); margin-bottom: var(--s1); }
.field .input { width: 100%; }
.field--row { display: flex; gap: var(--s2); align-items: flex-end; }
.field--row .grow { flex: 1; min-width: 0; }

.counter {
  position: absolute;
  right: var(--s2);
  bottom: var(--s1);
  font-size: var(--fs-xs);
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  background: var(--bg);
  padding: 0 var(--s1);
}

.env-actions { display: flex; gap: var(--s2); margin-top: var(--s4); align-items: center; flex-wrap: wrap; }

/* --- Tableaux -------------------------------------------------------------- */

/*
 * Le defilement est confie a ce conteneur : sans lui, un tableau large
 * forcerait la page entiere a defiler lateralement.
 *
 * La hauteur maximale n'est pas cosmetique. Un en-tete `position: sticky` se
 * cale sur son conteneur de defilement ; sans plafond de hauteur, ce conteneur
 * ne defile jamais verticalement et l'en-tete ne colle a rien. Les tableaux
 * courts ne sont pas affectes — leur hauteur reste dictee par leur contenu.
 */
.table-wrap {
  overflow: auto;
  max-height: min(70vh, 44rem);
  border: 1px solid var(--line);
  border-radius: var(--r3);
  background: var(--surface);
  margin-bottom: var(--s3);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  /* Les colonnes de chiffres doivent s'aligner verticalement d'une ligne a
     l'autre : c'est le seul endroit ou `tabular-nums` se justifie. */
  font-variant-numeric: tabular-nums;
}

.table th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  padding: var(--s2) var(--s3);
  background: var(--surface-2);
  color: var(--text-2);
  font-weight: 600;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}

.table td {
  padding: .4rem var(--s3);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--fast) var(--ease); }
.table tbody tr:hover { background: var(--surface-2); }

/* Les valeurs longues (raisons de ban, messages) sont tronquees plutot que
   d'etirer le tableau ; le titre natif expose la valeur complete. */
.cell-clip {
  max-width: 22rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

.empty { padding: var(--s6); text-align: center; color: var(--text-3); font-size: var(--fs-base); }

/* --- Sous-onglets ---------------------------------------------------------- */

.subtabs {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r2);
}

.subtab {
  padding: .3rem .7rem;
  background: none;
  border: 0;
  border-radius: var(--r1);
  color: var(--text-2);
  font: inherit;
  font-size: var(--fs-base);
  cursor: pointer;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}

.subtab:hover { background: var(--surface-2); color: var(--text); }
.subtab.is-active { background: var(--accent); color: #fff; font-weight: 500; }

.subview { display: none; }
.subview.is-active { display: block; }

/* --- Journaux -------------------------------------------------------------- */

.logs {
  margin: 0;
  padding: var(--s3);
  height: calc(100vh - 200px);
  min-height: 20rem;
  overflow: auto;
  background: #06080c;
  border: 1px solid var(--line);
  border-radius: var(--r3);
  font-family: var(--mono);
  font-size: var(--fs-sm);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

/*
 * Retrait suspendu : l'horodatage occupe exactement 24 caracteres
 * (`[12-08-2026 - 13:39:47] `), et la police est a chasse fixe. Le retrait
 * negatif ramene la premiere ligne a la marge, si bien qu'un message long se
 * replie sous son texte et non sous sa date.
 */
.log-line {
  display: block;
  padding-left: 24ch;
  text-indent: -24ch;
}

.log-line--err { color: #ff9e9e; }
.log-line--out { color: var(--text-2); }

/* L'heure accompagne le message sans lui disputer l'attention. */
.log-line__at { color: var(--text-3); }
.log-line--err .log-line__at { color: #b8706f; }

@media (max-width: 40rem) {
  /* Sous cette largeur, 24 caracteres de marge ne laissent plus de place au
     message : les lignes repliees repartent simplement a gauche. */
  .log-line { padding-left: 0; text-indent: 0; }
}

/* --- Bandeaux d'alerte ----------------------------------------------------- */

.alert {
  padding: var(--s3) var(--s4);
  border-radius: var(--r3);
  border: 1px solid var(--line);
  border-left: 3px solid var(--text-3);
  background: var(--surface);
  margin-bottom: var(--s2);
  font-size: var(--fs-base);
}

.alert--ok { border-left-color: var(--ok); }
.alert--warn { border-left-color: var(--warn); }
.alert--error { border-left-color: var(--error); }
.alert--critical { border-left-color: var(--critical); }
.alert__title { font-weight: 600; margin-bottom: var(--s1); }
.alert__meta { color: var(--text-3); font-size: var(--fs-sm); margin-top: var(--s1); }

/* --- Notification ephemere ------------------------------------------------- */

.toast {
  position: fixed;
  bottom: var(--s5);
  right: var(--s5);
  z-index: 200;
  padding: var(--s3) var(--s4);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--r3);
  box-shadow: var(--shadow-3);
  max-width: 22rem;
  font-size: var(--fs-base);
  animation: toast-in var(--slow) var(--ease);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.toast--ok { border-left-color: var(--ok); }
.toast--error { border-left-color: var(--error); }

/* --- Configuration (.env) -------------------------------------------------- */

.env-grid { display: grid; gap: var(--s1); }

.env-row {
  display: grid;
  grid-template-columns: minmax(10rem, 17rem) 1fr;
  gap: var(--s3);
  align-items: center;
  padding: var(--s2) var(--s3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r2);
}

.env-row label {
  font-family: var(--mono);
  font-size: var(--fs-sm);
  color: var(--text-2);
  word-break: break-all;
}

.env-row input { width: 100%; }
.env-row--secret label::after { content: " 🔒"; }

@media (max-width: 640px) {
  .env-row { grid-template-columns: 1fr; }
}

/* --- Permissions ----------------------------------------------------------- */

.perm-form {
  display: flex;
  gap: var(--s2);
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: var(--s3);
}

.perm-form .input { flex: 1 1 9rem; }

/* --- Graphiques ------------------------------------------------------------ */

/*
 * Les graphiques sont du SVG produit par `js/charts.js`. La politique de
 * securite interdit tout script distant : embarquer une bibliotheque
 * signifierait la copier dans le depot et la maintenir.
 */
.chart { width: 100%; }

/* La hauteur est pilotee par `charts.js` via une variable : sans elle, un
   trace demande en 240 px serait etire dans une boite de 220. */
.viz { width: 100%; height: var(--viz-h, 220px); display: block; overflow: visible; }
.viz-axis { fill: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz-empty { padding: var(--s6); text-align: center; color: var(--text-3); font-size: var(--fs-base); }

.viz-legend {
  display: flex;
  gap: var(--s4);
  flex-wrap: wrap;
  margin-top: var(--s2);
  font-size: var(--fs-base);
  color: var(--text-2);
}

.viz-legend__item { display: inline-flex; align-items: center; gap: var(--s1); }
.viz-legend__dot { width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; }

.viz-tip {
  position: fixed;
  z-index: 250;
  padding: var(--s2) var(--s3);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r2);
  box-shadow: var(--shadow-2);
  font-size: var(--fs-base);
  line-height: 1.5;
  /* L'infobulle suit le pointeur : sans cela elle intercepterait le survol de
     la marque qu'elle decrit et clignoterait. */
  pointer-events: none;
  white-space: nowrap;
}

.viz-tip__title { font-weight: 600; margin-bottom: var(--s1); }
.viz-tip__dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: var(--s1); }

/* --- Carte de chaleur ------------------------------------------------------ */

.heatmap {
  display: grid;
  grid-template-columns: auto repeat(24, 1fr);
  gap: 2px;
  align-items: center;
}

.heatmap__cell {
  aspect-ratio: 1;
  border-radius: 2px;
  min-height: 13px;
  outline: 1px solid transparent;
  transition: outline-color var(--fast) var(--ease);
}

.heatmap__cell:hover { outline-color: var(--text-2); }
.heatmap__day { padding-right: var(--s2); font-size: var(--fs-xs); color: var(--text-2); text-align: right; }
.heatmap__hour {
  font-size: var(--fs-xs);
  color: var(--text-3);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* --- Editeur d'annonce ----------------------------------------------------- */

/* L'apercu reste visible pendant qu'on remplit le formulaire : c'est tout
   l'interet d'un editeur d'embed. */
.compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--s3);
  align-items: start;
}

.compose__form { min-width: 0; }
.compose__side { position: sticky; top: calc(var(--topbar-h) + var(--s3)); min-width: 0; }

@media (max-width: 1150px) {
  .compose { grid-template-columns: 1fr; }
  .compose__side { position: static; }
}

.embed-field {
  display: grid;
  grid-template-columns: 1fr 2fr auto auto;
  gap: var(--s2);
  align-items: center;
  margin-bottom: var(--s2);
}

@media (max-width: 700px) {
  .embed-field { grid-template-columns: 1fr; }
}

/* --- Apercu facon Discord -------------------------------------------------- */

.dc-message { display: flex; gap: var(--s3); padding: var(--s2) 0; }
.dc-avatar { width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; background: var(--surface-3); }
.dc-body { min-width: 0; flex: 1; }
.dc-header { display: flex; align-items: center; gap: var(--s1); margin-bottom: 2px; }
.dc-name { font-weight: 600; color: #f2f3f5; font-size: var(--fs-md); }

.dc-tag {
  background: var(--accent);
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 0 .25rem;
  border-radius: 3px;
}

.dc-content { color: #dbdee1; font-size: var(--fs-md); white-space: pre-wrap; word-break: break-word; margin-bottom: var(--s1); }

.dc-embed {
  display: flex;
  gap: var(--s3);
  max-width: 520px;
  padding: var(--s2) var(--s3);
  background: #2b2d31;
  /* La barre de couleur a gauche est la signature visuelle d'un embed. */
  border-left: 4px solid var(--accent);
  border-radius: var(--r1);
}

.dc-embed__inner { min-width: 0; flex: 1; }
.dc-author { display: flex; align-items: center; gap: var(--s1); margin-bottom: var(--s1); font-size: var(--fs-md); font-weight: 600; color: #f2f3f5; }
.dc-author__icon { width: 20px; height: 20px; border-radius: 50%; }
.dc-title { font-weight: 600; color: #00a8fc; margin-bottom: var(--s1); word-break: break-word; font-size: var(--fs-md); }
.dc-desc { color: #dbdee1; font-size: var(--fs-md); white-space: pre-wrap; word-break: break-word; }

.dc-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); margin-top: var(--s2); }
.dc-field { min-width: 0; }
/* Un champ non « inline » occupe toute la largeur, comme chez Discord. */
.dc-field--full { grid-column: 1 / -1; }
.dc-field__name { font-size: var(--fs-base); font-weight: 600; color: #f2f3f5; margin-bottom: 2px; }
.dc-field__value { font-size: var(--fs-base); color: #dbdee1; white-space: pre-wrap; word-break: break-word; }

.dc-image { max-width: 100%; border-radius: var(--r1); margin-top: var(--s2); display: block; }
.dc-thumb { width: 76px; height: 76px; object-fit: cover; border-radius: var(--r1); flex-shrink: 0; }
.dc-footer { display: flex; align-items: center; gap: var(--s1); margin-top: var(--s2); font-size: var(--fs-sm); color: #949ba4; }
.dc-footer__icon { width: 18px; height: 18px; border-radius: 50%; }

/* --- Moderation ------------------------------------------------------------ */

.role-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 2px;
}

/* La matrice peut compter dix colonnes : les cases restent centrees et la
   premiere colonne (le role) reste lisible pendant le defilement lateral. */
.matrix-cell { text-align: center; }
.matrix-cell input { width: 15px; height: 15px; cursor: pointer; accent-color: var(--accent); }

#mod-matrix th:first-child,
#mod-matrix td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface);
  white-space: nowrap;
}

#mod-matrix thead th:first-child { background: var(--surface-2); }
#mod-matrix tbody tr:hover td:first-child { background: var(--surface-2); }

.immune-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: var(--s1);
  margin-bottom: var(--s3);
}

/* --- Fiche membre ---------------------------------------------------------- */

.member-hits { display: flex; gap: var(--s1); flex-wrap: wrap; }
.member-hits .btn { gap: var(--s1); }

.profile__head { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s3); }
.profile__head h3 { margin: 0; font-size: var(--fs-lg); }

.profile__section {
  margin: var(--s5) 0 var(--s2);
  font-size: var(--fs-md);
  padding-top: var(--s3);
  border-top: 1px solid var(--line);
}

/* Deux colonnes tant que la place le permet : les lignes libelle/valeur sont
   courtes, une seule colonne gaspillerait la largeur. */
.profile__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 var(--s5); }
.profile__grid .card__row:first-child { border-top: 0; }

@media (max-width: 700px) {
  .profile__grid { grid-template-columns: 1fr; }
}

/* --- Fenetre modale -------------------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: var(--s4);
  background: rgba(4, 6, 9, .72);
  backdrop-filter: blur(3px);
  animation: fade-in var(--fast) var(--ease);
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal__box {
  width: min(46rem, 100%);
  max-height: 85vh;
  overflow-y: auto;
  padding: var(--s5);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r4);
  box-shadow: var(--shadow-3);
}

.modal__head { display: flex; align-items: center; gap: var(--s4); margin-bottom: var(--s4); }
.modal__head h3 { margin: 0; font-size: var(--fs-lg); }
.modal__head .btn { margin-left: auto; }
.modal__box textarea { width: 100%; font-family: var(--mono); font-size: var(--fs-sm); }

/* --- Fil de discussion d'un ticket ----------------------------------------- */

.chatlog {
  max-height: 26rem;
  overflow-y: auto;
  padding: var(--s2);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r2);
}

.chat { padding: var(--s2) var(--s3); border-radius: var(--r2); }
.chat + .chat { margin-top: 2px; }
.chat:hover { background: var(--surface); }

/* Un message supprime reste affiche : c'est souvent l'information la plus
   utile d'une transcription. Il est barre et attenue pour rester distinct. */
.chat--deleted { opacity: .6; }
.chat--deleted .chat__body { text-decoration: line-through; }

.chat__head { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin-bottom: 2px; }
.chat__author { font-weight: 600; font-size: var(--fs-base); }
.chat__time { color: var(--text-3); font-size: var(--fs-xs); }
.chat__body { font-size: var(--fs-base); white-space: pre-wrap; word-break: break-word; }

.chat__original,
.chat__files {
  margin-top: var(--s1);
  font-size: var(--fs-sm);
  color: var(--text-2);
  padding-left: var(--s2);
  border-left: 2px solid var(--line-strong);
}

code {
  font-family: var(--mono);
  font-size: .95em;
  padding: .05rem .25rem;
  background: var(--surface-2);
  border-radius: var(--r1);
}

/* --- Recherche de membre ou de role ---------------------------------------- */

.hit-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--s2);
  margin-top: var(--s3);
}

.hit {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r2);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
}

.hit:hover { background: var(--surface-3); border-color: var(--accent); }

.hit__avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--surface-3);
  object-fit: cover;
}

/* Un role n'a pas d'avatar : sa pastille porte sa couleur Discord. */
.hit__avatar--role { border-radius: var(--r1); }

.hit__name { font-weight: 500; }
.hit__meta { font-size: var(--fs-xs); color: var(--text-2); }

/* --- Grille des sections --------------------------------------------------- */

.perm-group { margin-top: var(--s4); }

.perm-group__title {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-3);
  padding-bottom: var(--s1);
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--s1);
}

.perm-row {
  display: flex;
  align-items: center;
  gap: var(--s4);
  padding: var(--s2) 0;
  border-bottom: 1px solid var(--line);
}

.perm-row:last-child { border-bottom: 0; }
.perm-row__label { display: flex; align-items: center; gap: var(--s2); font-weight: 500; }
.perm-row__desc { font-size: var(--fs-sm); color: var(--text-2); margin-top: 1px; }

/* Groupe a trois etats : un seul actif, comme des boutons radio — mais avec la
   couleur qui porte le sens (rien / autorise / refuse). */
.tri-group {
  display: inline-flex;
  margin-left: auto;
  flex-shrink: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--r2);
  overflow: hidden;
}

.tri {
  padding: .25rem .6rem;
  background: var(--surface);
  border: 0;
  color: var(--text-2);
  font: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}

.tri + .tri { border-left: 1px solid var(--line-strong); }
.tri:hover { background: var(--surface-2); color: var(--text); }
.tri--on { font-weight: 600; }
.tri--on.tri--muted { background: var(--surface-3); color: var(--text); }
.tri--on.tri--ok { background: var(--ok-soft); color: var(--ok); }
.tri--on.tri--error { background: var(--error-soft); color: var(--error); }

@media (max-width: 700px) {
  .perm-row { flex-direction: column; align-items: flex-start; gap: var(--s2); }
  .tri-group { margin-left: 0; }
}
