/* Icônes d'interface : police couleur maison (COLR, bleu Inari) qui remplace à l'affichage les emojis d'interface (🛡️ 🔔 …).
   Les textes ne changent pas (traductions, copier-coller, données) ; seuls les points de code listés sont dessinés par la police.
   Hors de cette liste (visages, cœurs, objets de boutique…) et dans le sélecteur d'emojis ou les aperçus Discord, l'emoji natif reste. */
@font-face {
  font-family: "InariIcons";
  src: url("/fonts/inari-icons.woff2") format("woff2");
  font-display: swap;
}

@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@500;700&family=Inter:wght@400;500&display=swap");

* {
  box-sizing: border-box;
}

/* Focus clavier global, cohérent partout sur le site : visible uniquement
   lors d'une navigation au clavier (jamais au clic souris), via le bleu
   d'accent comme indicateur d'état actif. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

:root {
  /* ---------- Direction artistique : noir / blanc / bleu royal ----------
     ~60% fond très sombre, ~30% surfaces gris clair/blanc selon contexte,
     ~10% bleu #4169E1 réservé aux actions/éléments interactifs importants.
     Les couleurs sémantiques (success/danger) restent inchangées pour
     l'accessibilité. */
  --bg: #0a0b0e;
  --surface: #15171c;
  --surface-2: #1c1f26;
  --border: #2a2d35;
  --border-strong: #3a3e48;
  --text-primary: #f5f6f8;
  --text-secondary: #a8adb8;
  --text-muted: #6b7280;
  --accent: #4169e1;
  --accent-hover: #5578e8;
  --accent-soft: rgba(65, 105, 225, 0.18);
  /* "--ember" conservé par compatibilité (très référencé dans le code) mais
     recoloré en variante claire du bleu d'accent plutôt qu'en doré. */
  --ember: #7b93ea;
  --ember-soft: rgba(123, 147, 234, 0.18);
  --success: #4caf7d;
  --success-soft: rgba(76, 175, 125, 0.16);
  --danger: #e2574f;
  --danger-soft: rgba(226, 87, 79, 0.16);
  --radius: 10px;
  /* Échelle d'espacement unique (4 · 8 · 12 · 16 · 24 · 32) : les cartes, lignes et champs s'y réfèrent. */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  --row-h: 48px;        /* hauteur minimale d'une ligne de paramètre */
  --control-h: 40px;    /* hauteur des champs, sélecteurs et boutons de formulaire */
  --control-w: 280px;   /* largeur des contrôles alignés à droite d'une ligne */
  --font-display: "InariIcons", "Manrope", "Inter", system-ui, sans-serif;
  --font-native: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #0a0b0e, #101217);
  color: var(--text-primary);
  font-family: "InariIcons", "Inter", system-ui, sans-serif; /* pas de police système nommée ici : sinon le navigateur impose ses emojis et ignore InariIcons */
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

#ambient-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Le contenu applicatif doit rester au-dessus du canvas de braises. */
#app {
  position: relative;
  z-index: 1;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-fade {
  animation: fadeInUp 0.18s ease;
}

h1, h2, h3 {
  font-family: var(--font-display);
}

.muted {
  color: var(--text-secondary);
}

a {
  color: inherit;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand img,
.login-badge img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: transform 0.25s ease;
}

.login-badge img {
  width: 100%;
  height: 100%;
}

.brand img:hover,
.login-badge img:hover {
  transform: rotate(-8deg) scale(1.06);
}

/* Le logo est un vrai lien vers l'accueil public (il ne déconnecte jamais). */
a.brand {
  text-decoration: none;
  color: inherit;
  border-radius: 10px;
  cursor: pointer;
}

@keyframes logoPulse {
  0% { transform: scale(1) rotate(0deg); }
  35% { transform: scale(1.12) rotate(6deg); }
  70% { transform: scale(0.98) rotate(-3deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.logo-pulse {
  animation: logoPulse 0.5s ease;
}

@media (prefers-reduced-motion: reduce) {
  .brand img:hover,
  .login-badge img:hover,
  .logo-pulse {
    animation: none;
    transform: none;
  }
}

.brand span {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.01em;
}

/* ---------- Login ---------- */

/* ---------- Landing page (page de connexion) ---------- */

.landing-page {
  min-height: 100vh;
}

.landing-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 48px;
}

.landing-hero {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px 80px;
}

.landing-badge {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  margin-bottom: 24px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 20px 60px rgba(65, 105, 225, 0.25);
}

.landing-badge img {
  width: 100%;
  height: 100%;
}

.landing-hero h1 {
  font-size: 48px;
  font-weight: 700;
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}

.landing-hero .tagline {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 0 36px;
  line-height: 1.6;
}

.landing-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.landing-actions .btn {
  height: 46px;
  padding: 0 22px;
  font-size: 14px;
}

.landing-features {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 24px 100px;
  display: flex;
  flex-direction: column;
  gap: 90px;
}

.landing-feature {
  display: flex;
  align-items: center;
  gap: 56px;
}

.landing-feature.reverse {
  flex-direction: row-reverse;
}

.landing-feature-icon {
  flex-shrink: 0;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  background: rgba(10, 11, 14, 0.5);
  backdrop-filter: blur(8px);
}

.landing-feature-text h2 {
  font-size: 26px;
  color: var(--accent);
  margin: 0 0 12px;
}

.landing-feature-text p {
  font-size: 14.5px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 0;
  max-width: 520px;
}

.landing-cta {
  max-width: 720px;
  margin: 0 auto 100px;
  text-align: center;
  padding: 48px 40px;
  border-radius: 24px;
  background: rgba(65, 105, 225, 0.1);
  border: 1px solid rgba(65, 105, 225, 0.25);
}

.landing-cta h2 {
  font-size: 24px;
  margin: 0 0 10px;
}

.landing-cta p {
  color: var(--text-secondary);
  margin: 0 0 24px;
}

.landing-footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 12px;
}

.quick-create-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.quick-create-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.quick-create-modal {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 22px;
  margin: 0 16px;
}

.quick-create-modal-wide {
  max-width: 540px;
  max-height: 85vh;
  overflow-y: auto;
}

.emoji-picker-modal {
  max-width: 420px;
}

.emoji-picker-scroll {
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

.emoji-picker-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 14px 0 6px;
}

.emoji-picker-section-title:first-child {
  margin-top: 0;
}

.emoji-picker-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
}

.emoji-picker-item {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  font-size: 19px;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.12s ease;
}

.emoji-picker-item:hover {
  background: var(--surface-2);
  transform: scale(1.15);
}

.emoji-picker-item img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.legal-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--surface);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: max-content;
  max-width: min(220px, calc(100vw - 32px));
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 30;
}

.legal-menu.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.legal-menu a {
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: none;
}

.legal-menu a:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}

/* ---------- Page Documentation publique (docs.html) ---------- */

.docs-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 24px 100px;
}

.docs-page .doc-search {
  margin: 24px 0 32px;
  height: 44px;
}

.docs-page .doc-category h3 {
  font-size: 13px;
  margin-top: 28px;
}

@media (max-width: 720px) {
  .landing-feature,
  .landing-feature.reverse {
    flex-direction: column;
    text-align: center;
    gap: 24px;
  }

  .landing-feature-text p {
    max-width: none;
  }

  .landing-hero h1 {
    font-size: 34px;
  }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.btn:hover {
  background: var(--border);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0) scale(0.97);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-danger {
  border-color: var(--danger);
  color: var(--danger);
  background: transparent;
}

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

.btn-block {
  width: 100%;
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
}

.btn-ghost:hover {
  background: var(--surface-2);
}

/* ---------- Guild picker ---------- */

.picker-screen {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 24px;
}

.picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.picker-header h1 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

.guild-grid {
  display: grid;
  gap: 10px;
}

.guild-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.guild-card:hover {
  border-color: var(--border-strong);
}

.guild-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
  overflow: hidden;
}

.guild-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.guild-info p {
  margin: 0;
}

.guild-name {
  font-weight: 500;
  font-size: 14px;
}

.guild-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

/* ---------- Barre de navigation supérieure ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 68px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 28px;
  background: rgba(10, 11, 14, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.topbar .brand {
  flex-shrink: 0;
}

.mobile-menu-btn {
  display: none;
  height: 38px;
  width: 38px;
  padding: 0;
  font-size: 18px;
  flex-shrink: 0;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 35;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.sidebar-backdrop.show {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.topnav-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.topnav-item:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}

.topnav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  /* PAS flex-shrink:0 ici : ce groupe doit pouvoir rétrécir quand l'espace
     manque (nom de serveur un peu long à une largeur d'écran limite),
     sinon il pousse la barre entière en débordement horizontal plutôt que
     de laisser l'ellipse du nom de serveur faire son travail. */
  min-width: 0;
  flex-shrink: 1;
}

.topbar-guild {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 180px;
}

.guild-icon-sm {
  width: 26px;
  height: 26px;
  font-size: 10px;
}

.topbar-guild-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-switch-server {
  border-color: var(--border-strong);
}

/* ---------- Dashboard layout ---------- */

.app-shell {
  display: grid;
  grid-template-columns: 288px 1fr;
  align-items: start;
}

.sidebar {
  background: rgba(65, 105, 225, 0.18);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 68px;
  height: calc(100vh - 68px);
  overflow-y: auto;
}

.sidebar-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 10px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text-primary);
  transform: translateX(2px);
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}

/* ---------- Navigation en accordéon (groupes de catégories) ---------- */

.nav-group {
  margin-bottom: 4px;
}

.nav-group-header {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 10px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-group-header:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}

.nav-group-header.open {
  color: var(--text-primary);
}

.nav-group-arrow {
  display: inline-block;
  font-size: 9px;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.nav-group-header.open .nav-group-arrow {
  transform: rotate(90deg);
}

.nav-subitems {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.22s ease, opacity 0.18s ease, margin 0.22s ease;
  margin-top: 0;
}

.nav-subitems.open {
  max-height: 400px;
  opacity: 1;
  margin-top: 4px;
  margin-bottom: 6px;
}

.nav-subitem {
  padding-left: 30px;
  font-size: 12.5px;
}

@media (prefers-reduced-motion: reduce) {
  .nav-group-arrow,
  .nav-subitems {
    transition: none;
  }
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: auto;
  flex-shrink: 0;
}

.status-dot.on {
  background: var(--success);
}

.status-dot.off {
  background: var(--text-muted);
}

.sidebar-footer {
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-icon {
  font-size: 15px;
  line-height: 1;
}

.main {
  padding: 36px 56px;
  max-width: 1600px;
  width: 100%;
  /* Piège classique de CSS Grid : une colonne "1fr" ne rétrécit jamais
     sous la taille minimale du contenu de ses enfants (min-content) sans
     cette ligne — un seul élément interne non-wrappable suffirait sinon à
     étirer toute la colonne au-delà de l'espace réellement disponible,
     provoquant un débordement horizontal invisible à l'œil mais mesurable. */
  min-width: 0;
}

/* ---------- Grilles responsives : répartissent les section-blocks sur la
   largeur disponible plutôt que de tout empiler verticalement. ---------- */

/* Grilles "intelligentes" : utilisent des colonnes CSS plutôt qu'une grille
   stricte, afin que les cartes de hauteurs différentes remontent
   naturellement et comblent les espaces vides, sur toutes les pages du
   panneau (pas seulement Logs). */
.grid-2 {
  column-count: 2;
  column-gap: 18px;
}

.grid-3 {
  column-count: 3;
  column-gap: 18px;
}

.grid-2 .section-block,
.grid-3 .section-block {
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  display: inline-block;
  width: 100%;
  margin-bottom: 18px;
}

@media (max-width: 1200px) {
  .grid-3 {
    column-count: 2;
  }
}

@media (max-width: 900px) {
  .grid-2,
  .grid-3 {
    column-count: 1;
  }
}

.main-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.main-header h2 {
  font-size: 19px;
  font-weight: 600;
  margin: 0;
  min-width: 0;
}

.section-desc {
  color: var(--text-secondary);
  font-size: 13px;
  margin: 0 0 24px;
}

/* ---------- Toggle switch ---------- */

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.toggle-track {
  width: 36px;
  height: 20px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  position: relative;
  transition: background 0.15s ease;
}

.toggle-track.on {
  background: var(--success);
  border-color: var(--success);
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-primary);
  transition: left 0.15s ease;
}

.toggle-track.on .toggle-thumb {
  left: 18px;
  background: #0b1a12;
}

.toggle-label {
  font-size: 13px;
  font-weight: 500;
}

/* ---------- Form fields ---------- */

.field {
  margin-bottom: var(--sp-4);
}

.field label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.field select,
.field input[type="number"] {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
}

.field select:focus,
.field input:focus {
  outline: none;
  border-color: var(--accent);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
}

.chip button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  line-height: 1;
}

.section-block {
  background: rgba(10, 11, 14, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  animation: fadeInUp 0.32s ease both;
}

.section-block:nth-of-type(2) { animation-delay: 0.04s; }
.section-block:nth-of-type(3) { animation-delay: 0.08s; }
.section-block:nth-of-type(4) { animation-delay: 0.12s; }
.section-block:nth-of-type(5) { animation-delay: 0.16s; }
.section-block:nth-of-type(6) { animation-delay: 0.2s; }

.section-block:hover {
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

@media (prefers-reduced-motion: reduce) {
  .section-block {
    animation: none;
  }
  .section-block:hover,
  .btn:hover,
  .btn:active {
    transform: none;
  }
}

/* ---------- Statut de configuration (ex: Inari dit) ---------- */

.config-status {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
}

.section-block code {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12px;
  color: var(--ember);
}

.section-block h3 {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 600;
}

.warning-preview {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.embed-preview {
  display: flex;
  gap: 12px;
  background: rgba(0, 0, 0, 0.24);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  padding: 12px 14px;
}

.embed-preview-body {
  flex: 1;
  min-width: 0;
}

.embed-preview-title {
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  margin: 0 0 4px;
}

.embed-preview-desc {
  color: #dbdee1;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.embed-preview-footer {
  color: #949ba4;
  font-size: 11px;
  margin-top: 10px;
}

.embed-preview img.thumb {
  width: 64px;
  height: 64px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.embed-preview img.banner {
  width: 100%;
  border-radius: 6px;
  margin-top: 10px;
  max-height: 160px;
  object-fit: cover;
}

/* ---------- Aperçu "vrai message Discord" (avatar + nom + badge + heure) ---------- */

.discord-msg-preview {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 14px 16px;
}

.discord-msg-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.discord-msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

.discord-msg-name {
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}

.discord-msg-app-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #5865f2;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
}

.discord-msg-time {
  color: #949ba4;
  font-size: 11px;
}

.discord-msg-body {
  margin-left: 44px;
}

/* ---------- Micro-labels majuscules façon DraftBot ---------- */

.field-microlabel {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.textarea-with-tools {
  position: relative;
}

.textarea-with-tools textarea {
  padding-right: 40px;
}

/* Vraie grille à 2 colonnes (configuration | aperçu). Différent de .grid-2,
   qui est un empilement en colonnes CSS et répartirait le contenu d'une
   colonne sur l'autre. */
.split-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

@media (max-width: 900px) {
  .split-2 {
    grid-template-columns: minmax(0, 1fr);
  }
}


.textarea-emoji-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: none;
  border: none;
  font-size: 17px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

.textarea-emoji-btn:hover {
  opacity: 1;
}

.textarea-char-count {
  text-align: right;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.textarea-char-count .over-limit {
  color: var(--danger);
}

.preview-reactions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.preview-reaction-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 30px;
  padding: 0 8px;
  background: #2b2d31;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.preview-reaction-chip:hover {
  transform: scale(1.06);
}

.preview-reaction-chip.selected {
  background: rgba(88, 101, 242, 0.25);
  border-color: #5865f2;
}

.preview-reaction-chip img {
  width: 18px;
  height: 18px;
}

.save-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--surface);
  border: 1px solid var(--success);
  color: var(--text-primary);
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 13px;
  min-width: 240px;
  max-width: 320px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(14px) scale(0.96);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  z-index: 100;
}

.save-toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.save-toast.error {
  border-color: var(--danger);
}

.save-toast.warning {
  border-color: var(--ember);
}

.toast-title {
  margin: 0 0 3px;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--success);
}

.save-toast.error .toast-title {
  color: var(--danger);
}

.save-toast.warning .toast-title {
  color: var(--ember);
}

.toast-desc {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.loading-line {
  color: var(--text-muted);
  font-size: 13px;
  padding: 24px 0;
}

/* ---------- Guild picker : flèche ---------- */

.guild-arrow {
  margin-left: auto;
  font-style: normal;
  color: var(--text-muted);
  font-size: 16px;
}

/* ---------- Accueil / Statistiques : cartes ---------- */

.overview-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.overview-card {
  background: rgba(10, 11, 14, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  padding: 18px 20px;
  transition: transform 0.18s ease, border-color 0.18s ease;
  animation: fadeInUp 0.4s ease both;
}

.overview-cards .overview-card:nth-child(1) { animation-delay: 0s; }
.overview-cards .overview-card:nth-child(2) { animation-delay: 0.05s; }
.overview-cards .overview-card:nth-child(3) { animation-delay: 0.1s; }
.overview-cards .overview-card:nth-child(4) { animation-delay: 0.15s; }

.overview-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.14);
}

.overview-value {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-display);
  margin: 0 0 4px;
}

.overview-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
}

/* ---------- Accueil : grandes sections thématiques ---------- */

.home-section {
  background: rgba(10, 11, 14, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  padding: 32px 36px;
  margin-bottom: 22px;
  animation: fadeInUp 0.45s ease both;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.home-section:nth-of-type(1) { animation-delay: 0.08s; }
.home-section:nth-of-type(2) { animation-delay: 0.16s; }
.home-section:nth-of-type(3) { animation-delay: 0.24s; }
.home-section:nth-of-type(4) { animation-delay: 0.32s; }

.home-section:hover {
  transform: translateY(-4px);
  border-color: rgba(65, 105, 225, 0.35);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(65, 105, 225, 0.08);
}

@media (prefers-reduced-motion: reduce) {
  .overview-card,
  .home-section {
    animation: none;
  }
}

.home-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.home-section-header .icon {
  font-size: 24px;
  line-height: 1;
  display: inline-block;
}

@keyframes iconFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.icon-float {
  animation: iconFloat 3.2s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .icon-float {
    animation: none;
  }
}

.home-section-header h2 {
  margin: 0;
  font-size: 19px;
}

.home-section-desc {
  color: var(--text-secondary);
  font-size: 13px;
  margin: 0 0 24px;
  max-width: 640px;
}

.home-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  column-gap: 32px;
}

/* ---------- Accueil : lignes de statut cliquables ---------- */

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  transition: color 0.15s ease, padding-left 0.15s ease;
}

.status-row:last-child {
  border-bottom: none;
}

.status-row:hover {
  color: var(--accent);
  padding-left: 8px;
}

/* ---------- Journal d'activité ---------- */

.activity-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 18px;
}

.activity-scroll {
  max-height: 62vh;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 4px 14px;
  background: rgba(10, 11, 14, 0.35);
}

.activity-row {
  display: grid;
  grid-template-columns: 48px 160px 1fr;
  gap: 12px;
  align-items: center;
  padding: 9px 4px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.activity-time {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.activity-type {
  color: var(--text-secondary);
  font-size: 12px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 20px;
}

.pagination-info {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.pagination .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---------- Textarea (message HoneyPot) ---------- */

.field textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
}

.field textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* ---------- Base commune de TOUS les champs de saisie ----------
   Avant : seuls certains champs (.field select / number / textarea) étaient
   stylés ; tout autre champ retombait sur le fond blanc du navigateur et
   ressemblait à un bloc extérieur posé sur le site. :where() donne une
   spécificité nulle : tout style existant (classe, id, style en ligne)
   reste prioritaire, cette base ne fait que combler les trous. */
:where(
    input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):not([type="file"]):not([type="hidden"]):not([type="button"]):not([type="submit"]):not([type="reset"]),
    textarea,
    select
  ) {
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  padding: 8px 12px;
  min-width: 0; /* un champ dans une ligne flex doit pouvoir rétrécir (sinon il pousse la page en débordement) */
  max-width: 100%;
  font-family: inherit;
  font-size: 13px;
  color-scheme: dark; /* contrôles natifs (défilement, listes) en thème sombre */
}

:where(input, textarea)::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

:where(
    input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):not([type="file"]),
    textarea,
    select
  ):focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

:where(select) option {
  background: var(--surface);
  color: var(--text-primary);
}

/* Zones de message (Arrivées/Départs, Auto Bump…) : bloc discret, façon
   bulle de message, qui se fond dans la page. */
.textarea-with-tools textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px 44px 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  line-height: 1.55;
  resize: vertical;
}

/* ---------- Documentation : overlay + modal ---------- */

.doc-overlay,
.cmdk-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 50;
}

.cmdk-overlay {
  align-items: flex-start;
  padding-top: 14vh;
  z-index: 60;
}

.cmdk-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.cmdk-modal {
  width: 100%;
  max-width: 520px;
  max-height: 60vh;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.cmdk-input {
  width: 100%;
  height: 42px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 14px;
  padding: 0 10px 10px;
  margin-bottom: 8px;
}

.cmdk-input:focus {
  outline: none;
}

.cmdk-results {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cmdk-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13.5px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.cmdk-item.active,
.cmdk-item:hover {
  background: var(--accent-soft);
  color: var(--text-primary);
}

.cmdk-hint kbd {
  font-family: inherit;
  font-size: 10.5px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 4px;
}

@media (max-width: 900px) {
  .cmdk-hint kbd {
    display: none;
  }
}

.doc-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.doc-modal {
  width: 100%;
  max-width: 660px;
  max-height: 80vh;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.doc-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.doc-search {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
}

.doc-search:focus {
  outline: none;
  border-color: var(--accent);
}

.doc-results {
  overflow-y: auto;
}

.doc-group {
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.doc-group:last-child {
  border-bottom: none;
}

.doc-group-header {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 10px 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: left;
  transition: color 0.15s ease;
}

.doc-group-header:hover,
.doc-group-header.open {
  color: var(--text-primary);
}

.doc-group-arrow {
  display: inline-block;
  font-size: 9px;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.doc-group-header.open .doc-group-arrow {
  transform: rotate(90deg);
}

.doc-group-items {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.22s ease, opacity 0.18s ease;
  padding-left: 22px;
}

.doc-group-items.open {
  max-height: 2000px;
  opacity: 1;
  padding-bottom: 8px;
}

.doc-entry {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.edit-badge {
  font-size: 11px;
  font-weight: 500;
  color: var(--ember);
  background: var(--ember-soft);
  padding: 2px 8px;
  border-radius: 20px;
  vertical-align: middle;
  margin-left: 6px;
}

.edit-badge:empty {
  display: none;
}

.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 700;
  cursor: help;
  vertical-align: middle;
  margin-left: 5px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.help-icon:hover,
.help-icon:focus-visible {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
  outline: none;
}

/* Infobulle partagée : une seule instance dans le DOM, repositionnée pour
   chaque déclencheur. Fonctionne identiquement à la souris et au doigt
   (voir wireTooltipSystem). Toujours maintenue dans les limites de
   l'écran. */
.shared-tooltip {
  position: fixed;
  z-index: 100;
  max-width: min(280px, calc(100vw - 16px));
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-secondary);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.shared-tooltip.show {
  opacity: 1;
}

/* Tag de variable ({server}, {user}...) : tappable/survolable comme une
   icône d'aide, avec son explication dans la même infobulle partagée. */
.variable-tag {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 11.5px;
  color: var(--accent);
  cursor: help;
  margin: 0 2px 2px 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.variable-tag:hover,
.variable-tag:focus-visible {
  background: var(--accent-soft);
  border-color: var(--accent);
  outline: none;
}


.doc-entry-name {
  font-size: 13px;
  font-weight: 500;
  margin: 0 0 2px;
}

.doc-entry-usage {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 12px;
}

.doc-entry-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin: 0;
}

/* ==========================================================================
   RESPONSIVE : téléphones et tablettes
   ========================================================================== */

html, body {
  overflow-x: hidden;
}

@media (max-width: 900px) {
  .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .topbar {
    padding: 0 14px;
    gap: 12px;
  }

  .topbar-nav {
    display: none;
  }

  .topbar-guild-name {
    display: none;
  }

  .btn-label-full {
    display: none;
  }

  .btn-switch-server {
    padding: 0 10px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    max-width: 82vw;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 40;
    padding-top: 84px;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.4);
  }

  .main {
    padding: 24px 18px;
    max-width: 100%;
  }
}

/* Marge de sécurité dédiée : entre 900px et 1180px, la barre supérieure
   complète (marque + recherche + nom de serveur + bouton changer) peut
   redevenir trop juste avec un nom de serveur un peu long, puisque rien
   n'est encore masqué par le breakpoint principal ci-dessus. On retire
   uniquement le texte du bouton "Changer de serveur" (son icône 🔄 reste
   cliquable) pour regagner l'espace nécessaire à l'ellipse du nom. */
@media (min-width: 901px) and (max-width: 1180px) {
  .btn-switch-server .btn-label-full {
    display: none;
  }
}

@media (min-width: 901px) {
  .sidebar-backdrop {
    display: none !important;
  }
}

@media (max-width: 620px) {
  .landing-hero h1 {
    font-size: 30px;
  }

  .landing-topbar {
    padding: 16px 18px;
  }

  .landing-actions {
    flex-direction: column;
    width: 100%;
  }

  .landing-actions .btn {
    width: 100%;
  }

  .overview-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .home-section {
    padding: 22px 20px;
  }

  .home-status-grid {
    grid-template-columns: 1fr;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .activity-row {
    grid-template-columns: 1fr;
    gap: 2px;
    padding: 10px 6px;
  }

  .activity-time {
    font-size: 11px;
  }

  .activity-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .activity-filters .field {
    min-width: 0 !important;
  }

  .doc-modal {
    max-width: calc(100vw - 32px);
    margin: 0 16px;
  }

  .legal-menu {
    left: auto;
    right: 0;
    max-width: calc(100vw - 32px);
    transform: translateY(4px);
  }

  .legal-menu.show {
    transform: translateY(0);
  }
}

/* Cibles tactiles suffisamment grandes sur mobile/tablette et écrans
   tactiles en général. */
@media (max-width: 900px), (pointer: coarse) {
  .btn,
  .nav-item,
  .topnav-item {
    min-height: 44px;
  }

  .field select,
  .field input[type="number"],
  .field input[type="text"],
  .field textarea {
    min-height: 44px;
  }
}

/* ==========================================================================
   SÉLECTEUR D'EMOJIS (voir openEmojiPicker dans app.js)
   ========================================================================== */

.ep-overlay {
  padding: 12px;
  z-index: 110; /* au-dessus des autres fenêtres (la palette, la doc…) */
}

/* display:flex/grid des classes ci-dessous écraserait l'attribut [hidden] :
   on le rétablit explicitement pour tout ce qui est dans le sélecteur. */
.ep [hidden] {
  display: none !important;
}

.ep {
  display: flex;
  flex-direction: column;
  width: min(440px, 100%);
  height: min(540px, calc(100vh - 24px));
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  position: relative;
}

.ep-top {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
}

.ep-search {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  -webkit-appearance: none;
  appearance: none;
}

.ep-icon-btn {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.ep-icon-btn:hover,
.ep-icon-btn:focus-visible {
  background: var(--accent-soft);
  border-color: var(--accent);
  outline: none;
}

.ep-skin-pop {
  position: absolute;
  top: 58px;
  right: 56px;
  z-index: 3;
  display: flex;
  gap: 2px;
  padding: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

.ep-skin-opt {
  width: 34px;
  height: 34px;
  font-size: 18px;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.ep-skin-opt:hover,
.ep-skin-opt:focus-visible {
  background: var(--accent-soft);
  outline: none;
}

.ep-tabs {
  display: flex;
  gap: 2px;
  padding: 0 8px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}

.ep-tabs::-webkit-scrollbar {
  display: none;
}

.ep-tab {
  flex: 0 0 auto;
  width: 40px;
  height: 38px;
  font-size: 18px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.15s ease;
}

.ep-tab:hover,
.ep-tab:focus-visible {
  opacity: 1;
  outline: none;
}

.ep-tab[aria-selected="true"] {
  opacity: 1;
  border-bottom-color: var(--accent);
}

.ep-body {
  flex: 1;
  min-height: 0; /* sans cela, le corps ne rétrécit pas et repousse le bandeau du bas hors du cadre */
  position: relative; /* référence des offsetTop pour les onglets */
  padding: 0 8px 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.ep-title {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0;
  padding: 10px 4px 6px;
  background: var(--surface);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.ep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 2px;
}

.ep-item {
  height: 38px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 22px;
  line-height: 1;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.ep-item:hover,
.ep-item:focus-visible {
  background: var(--accent-soft);
  outline: none;
  box-shadow: inset 0 0 0 1px var(--accent);
}

.ep-item img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.ep-empty {
  margin: 0;
  padding: 28px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

.ep-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 6px 14px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-secondary);
}

.ep-foot-emoji {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 26px;
  line-height: 1;
}

.ep-foot-emoji img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  vertical-align: middle;
}

/* Écrans tactiles : pas de survol, donc pas de bandeau d'aperçu. */
@media (hover: none) {
  .ep-foot {
    display: none;
  }
}

/* Téléphone : feuille qui monte du bas, cibles tactiles ≥ 44 px. */
@media (max-width: 640px) {
  .ep-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .ep {
    width: 100%;
    height: min(78vh, 600px);
    border-radius: 16px 16px 0 0;
    border-bottom: none;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .ep-grid {
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  }

  .ep-item {
    height: 44px;
    font-size: 24px;
  }

  .ep-tab {
    width: 44px;
    height: 44px;
  }

  .ep-icon-btn {
    width: 44px;
    height: 44px;
  }

  .ep-skin-pop {
    top: 64px;
    right: 12px;
  }

  .ep-skin-opt {
    width: 40px;
    height: 40px;
  }

  .ep-foot {
    display: none;
  }
}

.preview-emoji {
  width: 22px;
  height: 22px;
  vertical-align: -5px;
  object-fit: contain;
}

/* ==========================================================================
   NOUVELLES FONCTIONNALITÉS (rôles d'activité, groupes de rôles, histoire,
   partenariats, tickets numérotés, confessions)
   ========================================================================== */

.field-warning {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: #e88a85;
}

.field-warning.danger {
  color: var(--danger);
  font-weight: 600;
}

.rg-tree {
  margin: 4px 0 14px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
  white-space: pre;
  overflow-x: auto;
}

.rg-group {
  margin: 12px 0;
  padding: 12px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius);
}

.rg-inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-secondary);
  margin: 4px 0 8px;
}

.story-reading {
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-primary);
  max-height: 320px;
  overflow-y: auto;
  overflow-wrap: anywhere;
}

.story-item {
  padding: 10px 12px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius);
}

.story-item-text {
  font-size: 13.5px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.story-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.pt-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pt-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius);
  font-size: 13px;
}

.pt-rank {
  font-weight: 700;
  color: var(--accent);
}

.pt-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tn-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius);
  font-size: 13px;
}

.cf-row {
  padding: 10px 12px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius);
}

.cf-status {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-secondary);
}

.cf-status.revealed {
  color: var(--accent);
  border-color: var(--accent);
}

.mention {
  padding: 0 3px;
  border-radius: 3px;
  background: rgba(65, 105, 225, 0.25);
  color: #aab9f5;
}

@media (max-width: 640px) {
  .pt-row {
    grid-template-columns: 26px minmax(0, 1fr) auto;
  }

  .pt-row .muted {
    display: none;
  }
}

.field > input[type="text"],
.field > textarea,
.field > select {
  width: 100%;
  box-sizing: border-box;
}

/* ==========================================================================
   LAYOUT : TROIS ZONES INDÉPENDANTES
     ① Sidebar            → navigation
     ② Scène 3D (stage)   → l'arbre de navigation Inari, derrière
     ③ Panneau inférieur  → le contenu de la page, compact ou déployé (dock)

   Sans scène 3D (WebGL absent) : la mise en page « classique » ci-dessous
   s'applique, avec une sidebar correctement intégrée (voir plus bas).
   ========================================================================== */

/* Les conteneurs de la scène n'ont aucun effet de mise en page tant que la
   scène 3D n'est pas active : la grille voit directement la sidebar et .main. */
.stage,
.dock {
  display: contents;
}

.dock-handle,
.scene-hint {
  display: none;
}

/* ---------- Sidebar : intégrée à la grille (mise en page classique) ----------
   Avant : « position: sticky; height: calc(100vh - 68px); overflow-y: auto »
   sur une grille en « align-items: start » — une boîte flottante de hauteur
   fixe, avec sa propre scrollbar, qui laissait un grand vide sous elle dès
   que le contenu défilait. Maintenant la sidebar est une VRAIE colonne de la
   grille : elle s'étire sur toute la hauteur du contenu et défile avec lui. */
@media (min-width: 901px) {
  .app-shell {
    align-items: stretch;
  }

  .sidebar {
    position: relative;
    top: auto;
    height: auto;
    min-height: calc(100vh - 68px);
    overflow: visible;
  }

  .sidebar-footer {
    margin-top: auto;
  }
}

/* IMPORTANT : tout ce mode (layout plein écran, document qui ne défile plus,
   clics qui traversent vers la scène) ne s'applique qu'une fois le dashboard
   monté (.shell-ready, posée par renderAppShell). L'écran « Choisis un serveur »,
   lui, reste une page normale : scrollable et entièrement cliquable. */
/* Derrière l'écran de choix de serveur, la scène est un simple décor discret. */
body.scene-active:not(.shell-ready) #inari-3d {
  opacity: 0.5;
}

/* ==========================================================================
   MODE SCÈNE 3D (body.scene-active.shell-ready)
   ========================================================================== */

body.scene-active.shell-ready {
  overflow: hidden; /* le document ne défile plus : chaque zone gère son propre scroll */
}

body.scene-active.shell-ready #app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh; /* mobile : tient compte des barres du navigateur */
}

body.scene-active.shell-ready .topbar {
  position: relative;
  top: auto;
  flex: 0 0 auto;
}

body.scene-active.shell-ready .app-shell {
  flex: 1 1 auto;
  min-height: 0; /* sans cela un enfant flex ne rétrécit jamais sous son contenu */
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  align-items: stretch;
}

/* ① Sidebar : colonne pleine hauteur, avec son propre défilement si la liste
   des fonctionnalités dépasse la fenêtre. Écrans larges uniquement : sur
   mobile, la sidebar reste un tiroir (position: fixed) défini plus haut. */
@media (min-width: 901px) {
  body.scene-active.shell-ready .sidebar {
    position: relative;
    top: auto;
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }
}

/* ② Zone de scène : contient le panneau, ne défile jamais */
body.scene-active.shell-ready .stage {
  display: block;
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  --dock-compact: clamp(230px, 36%, 360px); /* % = hauteur de la zone de scène */
}

/* ③ Panneau inférieur */
body.scene-active.shell-ready .dock {
  display: flex;
  flex-direction: column;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--dock-compact);
  z-index: 3;
  background: linear-gradient(to top, rgba(5, 5, 5, 0.96) 55%, rgba(5, 5, 5, 0.8));
  border-top: 1px solid rgba(65, 105, 225, 0.4);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -24px 60px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: height 0.7s cubic-bezier(0.22, 0.8, 0.2, 1), border-radius 0.7s ease;
}

body.scene-active.shell-ready.dock-expanded .dock {
  height: 100%;
  border-radius: 0;
}

body.scene-active.shell-ready .dock-handle {
  display: flex;
  flex: 0 0 auto;
  justify-content: center;
  padding: 6px 0 0;
}

.dock-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 26px;
  padding: 0;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.dock-toggle:hover,
.dock-toggle:focus-visible {
  color: #fff;
  border-color: var(--accent);
  background: rgba(65, 105, 225, 0.18);
}

.dock-toggle svg {
  transition: transform 0.6s cubic-bezier(0.22, 0.8, 0.2, 1);
}

body.dock-expanded .dock-toggle svg {
  transform: rotate(180deg); /* ⌃ devient ⌄ */
}

/* Le contenu de la page : défile UNIQUEMENT quand il dépasse le panneau */
body.scene-active.shell-ready .main {
  flex: 1 1 auto;
  min-height: 0;
  width: auto;
  max-width: none; /* le panneau occupe toute la largeur disponible */
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 28px 28px;
  scrollbar-width: thin;
  transition: opacity 0.5s ease, transform 0.65s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.5s ease;
}

/* Lecture confortable sur très grand écran : le contenu reste centré */
body.scene-active.shell-ready .main > * {
  max-width: 1900px;
  margin-left: auto;
  margin-right: auto;
}

/* Pendant le voyage de la caméra, le contenu précédent s'efface ; le nouveau
   apparaît à l'arrivée. */
body.scene-active.shell-ready.is-traveling .main {
  opacity: 0;
  transform: translateY(18px) scale(0.985);
  filter: blur(6px);
  pointer-events: none;
}

.back-row {
  margin-bottom: 10px;
}

.back-to-inari {
  gap: 6px;
}

/* Indication au-dessus du panneau compact, à l'accueil uniquement */
body.scene-active.shell-ready.hub-mode:not(.dock-expanded) .scene-hint {
  display: block;
  position: absolute;
  left: 50%;
  bottom: calc(var(--dock-compact) + 14px);
  transform: translateX(-50%);
  max-width: calc(100% - 24px);
  padding: 6px 14px;
  font-size: 12.5px;
  color: var(--text-secondary);
  background: rgba(5, 5, 5, 0.6);
  border: 1px solid rgba(65, 105, 225, 0.3);
  border-radius: 999px;
  pointer-events: none;
  z-index: 2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Scène visible (panneau compact) : les clics sur le fond atteignent le canvas.
   Seuls la barre du haut, la sidebar, le panneau et les fenêtres modales
   captent les évènements. */
body.scene-active.shell-ready:not(.dock-expanded) #app,
body.scene-active.shell-ready:not(.dock-expanded) .app-shell,
body.scene-active.shell-ready:not(.dock-expanded) .stage {
  pointer-events: none;
}

/* Liste EXPLICITE : les calques plein écran (palette de commandes, documentation…)
   gèrent déjà leur propre pointer-events (none quand fermés, auto quand ouverts) ;
   les réactiver en bloc les rendrait bloquants même cachés. */
body.scene-active.shell-ready:not(.dock-expanded) .topbar,
body.scene-active.shell-ready:not(.dock-expanded) .sidebar,
body.scene-active.shell-ready:not(.dock-expanded) .dock {
  pointer-events: auto;
}

#inari-3d {
  transition: opacity 0.6s ease;
}

/* Mobile : la sidebar est un tiroir (déjà géré plus haut) ; la grille n'a plus
   qu'une colonne et le panneau compact est un peu plus généreux. */
@media (max-width: 900px) {
  body.scene-active.shell-ready .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  body.scene-active.shell-ready .stage {
    --dock-compact: clamp(210px, 40%, 340px);
  }

  body.scene-active.shell-ready .main {
    padding: 4px 16px 24px;
  }

  body.scene-active.shell-ready.hub-mode:not(.dock-expanded) .scene-hint {
    font-size: 11.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.scene-active.shell-ready .dock,
  body.scene-active.shell-ready .main,
  .dock-toggle svg {
    transition-duration: 0.01ms;
  }
}

/* Accueil : le panneau n'a aucune marge latérale inutile */
body.scene-active.shell-ready.hub-mode .main > * {
  max-width: none;
}

/* ==========================================================================
   PAGE DE CONNEXION : scène 3D (login-scene.js)
   Un voile sombre léger, plus dense derrière le texte du hero et sur les bords,
   garde le formulaire et le bouton Discord parfaitement lisibles.
   ========================================================================== */
body.login-scene::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1; /* au-dessus du canvas (z-index -1, plus tôt dans le DOM), sous la page */
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 55% at 50% 40%, rgba(5, 5, 5, 0.62) 0%, rgba(5, 5, 5, 0.3) 55%, rgba(5, 5, 5, 0) 100%),
    linear-gradient(to bottom, rgba(5, 5, 5, 0.25), rgba(5, 5, 5, 0.1) 40%, rgba(5, 5, 5, 0.35));
}

body.login-scene {
  background: #050505;
}

/* ==========================================================================
   GROUPES DE RÔLES : guide, éditeur | aperçu, vérifications
   ========================================================================== */
.rg-guide-steps {
  margin: 0;
  padding-left: 20px;
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--text-secondary);
}

.rg-categories {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.rg-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

@media (max-width: 1100px) {
  .rg-columns {
    grid-template-columns: minmax(0, 1fr);
  }
}

.rg-side {
  position: sticky;
  top: 8px;
  min-width: 0;
}

@media (max-width: 1100px) {
  .rg-side {
    position: static;
  }
}

.rg-side-title {
  margin: 0 0 8px;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rg-prev-group {
  margin: 10px 0 2px;
  font-weight: 700;
}

.rg-prev-subs {
  margin: 0;
  line-height: 1.7;
}

.rg-select-mock,
.rg-btn-mock {
  margin-top: 10px;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
}

.rg-select-mock {
  display: flex;
  justify-content: space-between;
}

.rg-btn-mock {
  display: inline-block;
  padding: 6px 14px;
}

.rg-checks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rg-check {
  font-size: 12.5px;
  line-height: 1.5;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.rg-check.ok {
  color: #7fd6a0;
}

.rg-check.warn {
  color: #e8c46f;
}

.rg-check.bad {
  color: #e88a85;
}

.rg-category .embed-preview-desc {
  white-space: normal;
}

/* ==========================================================================
   ÉCONOMIE
   ========================================================================== */
.eco-emoji { width: 1.25em; height: 1.25em; vertical-align: -0.25em; }
.eco-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.eco-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.eco-stat-value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.eco-stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.alert-box { padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface-2); font-size: 13px; line-height: 1.6; margin-bottom: 16px; }
.alert-box.warning { border-color: rgba(226, 160, 79, 0.5); background: rgba(226, 160, 79, 0.1); }
.alert-box.info { border-color: var(--accent); background: var(--accent-soft); }
.section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.eco-item { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.eco-item-head { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.eco-item-head input[type="text"] { flex: 1 1 200px; min-width: 0; font-weight: 600; }
.eco-del { margin-top: 12px; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.eco-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.eco-checks { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 8px 0 14px; }
.eco-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.eco-row select { flex: 1 1 180px; min-width: 0; } .eco-row input { width: 90px; }
.eco-hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.prob-bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--surface-2); margin: 10px 0; }
.prob-bar.small { height: 8px; width: 120px; flex: none; }
.prob-seg { display: block; height: 100%; min-width: 2px; }
.prob-legend-wrap { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; }
.prob-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.eco-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.eco-tab { background: var(--surface); border: 1px solid var(--border); color: var(--text-secondary); padding: 7px 14px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 13px; }
.eco-tab:hover { border-color: var(--border-strong); color: var(--text-primary); }
.eco-tab.active { background: var(--accent-soft); border-color: var(--accent); color: var(--text-primary); }
.table-wrap { overflow-x: auto; }
.eco-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.eco-table th, .eco-table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.eco-table th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-secondary); }
.eco-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.eco-table .pos { color: var(--success); } .eco-table .neg { color: var(--danger); }
.eco-user { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.eco-avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; flex: none; }
.eco-avatar-empty { background: var(--surface-2); display: inline-block; }
.eco-results { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.eco-result { display: flex; justify-content: space-between; gap: 12px; align-items: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; color: inherit; font: inherit; cursor: pointer; text-align: left; }
.eco-result:hover { border-color: var(--accent); }
.eco-member-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; font-weight: 600; }
.eco-ach { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.eco-ach.done { opacity: 0.7; }
@media (max-width: 640px) {
  .eco-item-head input[type="text"] { flex-basis: 100%; }
  .prob-bar.small { width: 70px; }
  .eco-stats { grid-template-columns: repeat(2, 1fr); }
}
.eco-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; margin-bottom: 12px; }
@media (max-width: 640px) { .eco-grid { grid-template-columns: minmax(0, 1fr); } }

/* ==========================================================================
   COMMUNICATION : membres, Inari dit (aperçu façon Discord)
   ========================================================================== */
.comms-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.comms-preview { position: sticky; top: 8px; }
@media (max-width: 1000px) { .comms-layout { grid-template-columns: minmax(0, 1fr); } .comms-preview { position: static; order: -1; } }
.dc-msg { display: flex; gap: 12px; background: #313338; border-radius: 8px; padding: 14px; color: #dbdee1; font-size: 14.5px; line-height: 1.45; overflow-wrap: anywhere; }
.dc-avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; object-fit: cover; background: #1e1f22; }
.dc-body { min-width: 0; flex: 1; }
.dc-name { font-weight: 600; color: #fff; }
.dc-content { margin: 2px 0 4px; }
.dc-mention { background: rgba(88, 101, 242, 0.3); color: #c9cdfb; border-radius: 3px; padding: 0 2px; font-weight: 500; }
.dc-code { background: #1e1f22; border-radius: 3px; padding: 1px 5px; font-family: var(--mono, monospace); font-size: 13px; }
.dc-pre { background: #1e1f22; border: 1px solid #1a1b1e; border-radius: 4px; padding: 8px; font-family: var(--mono, monospace); font-size: 13px; white-space: pre-wrap; margin: 4px 0; }
.dc-embed { position: relative; background: #2b2d31; border-left: 4px solid #4169e1; border-radius: 4px; padding: 8px 14px 12px 12px; margin-top: 6px; max-width: 520px; }
.dc-embed-title { font-weight: 700; color: #fff; margin: 4px 0; }
.dc-embed-desc { font-size: 14px; }
.dc-embed-footer { font-size: 12px; color: #b5bac1; margin-top: 8px; }
.dc-image { display: block; max-width: 100%; max-height: 300px; border-radius: 4px; margin-top: 10px; }
.dc-thumb { float: right; width: 72px; height: 72px; object-fit: cover; border-radius: 4px; margin: 4px 0 8px 12px; }
.dc-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.dc-btn { background: #4e5058; color: #fff; border-radius: 3px; padding: 6px 14px; font-size: 14px; font-weight: 500; }
.badge-bot { background: #5865f2; color: #fff; font-size: 10px; font-weight: 700; border-radius: 3px; padding: 1px 5px; vertical-align: middle; }
.role-pill { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border-strong); border-radius: 999px; padding: 1px 8px; margin: 2px 4px 2px 0; font-size: 11.5px; }
.role-pill i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dm-panel { border-color: var(--accent); }
.auto-pick { margin: 10px 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.auto-pick summary { cursor: pointer; padding: 9px 12px; font-size: 13px; }
.auto-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px 14px; padding: 8px 12px 12px; max-height: 190px; overflow: auto; }
.an-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-bottom: 4px; }
.an-custom { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 13px; }
.an-custom input[type="date"] { width: auto; }
.an-chart { width: 100%; height: auto; display: block; }
.an-grid { stroke: var(--border); stroke-width: 1; }
.an-axis { fill: var(--text-secondary); font-size: 11px; }
.an-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.an-bar { opacity: 0.92; } .an-bar:hover { opacity: 1; }
.an-key { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; margin-right: 12px; }
.an-key::before { content: ""; width: 10px; height: 10px; border-radius: 2px; background: var(--c); display: inline-block; }
.an-hbars { display: flex; flex-direction: column; gap: 10px; }
.an-hhead { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.an-hhead .eco-user { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-rank { width: 20px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.an-hval { font-variant-numeric: tabular-nums; color: var(--text-secondary); white-space: nowrap; }
.an-hbar { height: 6px; border-radius: 999px; background: var(--surface-2); margin: 4px 0 0 30px; overflow: hidden; }
.an-hbar span { display: block; height: 100%; background: var(--accent, #4169e1); border-radius: 999px; }

/* ==========================================================================
   UTILITAIRES COMMUNS
   ========================================================================== */
.hidden { display: none !important; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }

/* ==========================================================================
   NAVIGATION : vue d'ensemble, pastilles, fil d'Ariane
   ========================================================================== */
.nav-overview { display: flex; flex-direction: column; gap: 2px; padding-bottom: 12px; margin-bottom: 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.nav-overview .sidebar-section-title { margin: 0 0 6px; }
.nav-item-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-badge { margin-left: auto; flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; letter-spacing: 0; font-variant-numeric: tabular-nums; }
/* Un groupe peut contenir jusqu'à 9 pages (Économie) : la hauteur ouverte doit toutes les montrer. */
.nav-subitems.open { max-height: 560px; }

.topbar-nav { gap: 8px; min-width: 0; font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; }
.crumb-sep { color: var(--text-muted); }
.crumb-current { color: var(--text-primary); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.cmdk-group { margin-left: auto; font-size: 11.5px; color: var(--text-muted); }

/* ==========================================================================
   ACCUEIL
   ========================================================================== */
.home-status-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: -4px 0 16px; font-size: 12.5px; }
.home-online { display: inline-flex; align-items: center; gap: 8px; color: var(--text-secondary); }
.home-online::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.home-online.on::before { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.home-online.off::before { background: var(--danger); }

.kpi-cards { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpi-card { text-align: left; color: inherit; font: inherit; cursor: pointer; }
.kpi-card .overview-value { font-size: 24px; font-variant-numeric: tabular-nums; }
.kpi-card:hover { border-color: rgba(65, 105, 225, 0.5); }
.kpi-sub { margin: 6px 0 0; font-size: 11.5px; color: var(--text-muted); }
.kpi-sub.pos { color: var(--success); }
.kpi-sub.neg { color: var(--danger); }

.home-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 0 18px; align-items: start; }
.home-grid > .section-block { height: calc(100% - 18px); }
.home-list { display: flex; flex-direction: column; }
.home-week-foot { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 10px; font-size: 12px; color: var(--text-secondary); }
.home-activity-row { display: grid; grid-template-columns: 44px 130px minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 8px 2px; font-size: 12.5px; border-bottom: 1px solid rgba(255, 255, 255, 0.07); }
.home-activity-row:last-child { border-bottom: none; }
.home-activity-row .activity-msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-score { margin: 0 0 14px; font-family: var(--font-display); }
.home-score strong { font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; }
.home-score span { color: var(--text-muted); font-size: 14px; }
.home-score em { font-style: normal; font-size: 13px; margin-left: 8px; font-family: inherit; }
.home-score-rows > div { display: flex; justify-content: space-between; padding: 7px 2px; font-size: 13px; border-bottom: 1px solid rgba(255, 255, 255, 0.07); font-variant-numeric: tabular-nums; }
.home-score-rows > div:last-child { border-bottom: none; }
.home-features { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px 32px; }
.home-feature-title { margin: 0 0 4px; font-size: 12px; font-weight: 700; color: var(--text-secondary); }

/* Ligne cliquable : un vrai bouton (accessible au clavier), même rendu qu'avant. */
button.status-row { width: 100%; background: transparent; border: none; border-bottom: 1px solid rgba(255, 255, 255, 0.07); color: inherit; font: inherit; font-size: 13px; text-align: left; gap: 12px; }
button.status-row:last-child { border-bottom: none; }
.status-row.is-static { cursor: default; }
.status-row.is-static:hover { color: inherit; padding-left: 4px; }
.status-value { flex: none; color: var(--text-secondary); font-size: 12.5px; white-space: nowrap; }
.status-row:hover .status-value { color: inherit; }

/* ==========================================================================
   JOURNAL D'ACTIVITÉ
   ========================================================================== */
.activity-filters .field { margin-bottom: 0; min-width: 0; }
.activity-filter-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.activity-summary { font-size: 12.5px; margin: 0 0 12px; min-height: 18px; }
.activity-table-wrap { border: 1px solid rgba(255, 255, 255, 0.06); border-radius: 12px; background: rgba(10, 11, 14, 0.35); padding: 0 6px; }
.activity-table td { vertical-align: top; }
.activity-table th:nth-child(3) { width: 46%; }
.activity-table .activity-time { white-space: nowrap; }
.activity-table .activity-type { white-space: nowrap; }
.activity-table .activity-msg { overflow-wrap: anywhere; }
.activity-details { display: block; margin-top: 3px; font-size: 12px; color: var(--text-muted); }
.activity-day td { padding-top: 16px; font-size: 11.5px; font-weight: 700; color: var(--text-secondary); border-bottom-color: var(--border-strong); background: transparent; }
.activity-link { background: none; border: none; padding: 0; color: var(--text-primary); font: inherit; cursor: pointer; text-align: left; overflow-wrap: anywhere; }
.activity-link:hover { color: var(--accent); text-decoration: underline; }

/* ==========================================================================
   STATISTIQUES : modérateurs
   ========================================================================== */
.mod-list { display: flex; flex-direction: column; }
.mod-row { padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.07); }
.mod-row:last-child { border-bottom: none; }
.mod-head { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: none; padding: 2px 0; color: inherit; font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; }
.mod-head .eco-user { flex: 1; min-width: 0; }
.mod-head:hover .eco-user { color: var(--accent); }
.mod-score { flex: none; font-variant-numeric: tabular-nums; }
.mod-caret { flex: none; color: var(--text-muted); transition: transform 0.15s ease; }
.mod-row.open .mod-caret { transform: rotate(180deg); }
.mod-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0 30px; }
.mod-chip { font-size: 11.5px; color: var(--text-secondary); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px; font-variant-numeric: tabular-nums; }
.mod-detail { margin: 12px 0 4px 30px; padding: 14px 16px; background: rgba(10, 11, 14, 0.45); border: 1px solid var(--border); border-radius: var(--radius); }
.mod-detail .eco-stats { margin-bottom: 14px; }
.mod-detail-title { margin: 0 0 6px; font-size: 12px; font-weight: 700; color: var(--text-secondary); }
.mod-action { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; padding: 6px 0; font-size: 12.5px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.mod-actions .btn { margin-top: 10px; }

/* ==========================================================================
   CONVERSATIONS (messages privés)
   ========================================================================== */
.conv-layout { display: grid; grid-template-columns: minmax(250px, 320px) minmax(0, 1fr); height: clamp(420px, 68vh, 760px); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: rgba(10, 11, 14, 0.5); }
.conv-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); background: rgba(21, 23, 28, 0.6); }
.conv-side-head { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-bottom: 1px solid var(--border); }
.conv-side-head input, .conv-picker input { width: 100%; height: 36px; padding: 0 12px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-primary); font: inherit; font-size: 13px; }
.conv-side-head .eco-tab { padding: 5px 10px; font-size: 12px; }
.conv-list { flex: 1; min-height: 0; overflow-y: auto; padding: 6px; scrollbar-width: thin; }
.conv-empty { padding: 18px 12px; font-size: 12.5px; text-align: center; line-height: 1.6; margin: 0; }
.conv-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; background: none; border: none; border-radius: var(--radius); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.conv-item:hover { background: var(--surface-2); }
.conv-item.active { background: var(--accent-soft); }
.conv-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.conv-item-top { display: flex; align-items: baseline; gap: 8px; }
.conv-item-name { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item.unread .conv-item-name { font-weight: 700; }
.conv-item-time { flex: none; font-size: 11px; color: var(--text-muted); }
.conv-item-preview { font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item.unread .conv-item-preview { color: var(--text-primary); }
.conv-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none; }
.conv-avatar-empty { display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-secondary); font-size: 13px; font-weight: 700; }
.conv-avatar-lg { width: 40px; height: 40px; }

.conv-thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.conv-placeholder { margin: auto; padding: 24px; text-align: center; max-width: 360px; font-size: 13px; }
.conv-placeholder-title { margin: 0 0 6px; font-family: var(--font-display); font-size: 16px; font-weight: 700; }
.conv-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.conv-head-main { flex: 1; min-width: 0; }
.conv-head-name { margin: 0; font-weight: 700; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-head-sub { margin: 0; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-back { display: none; }
.conv-messages { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; }
.conv-day { display: flex; align-items: center; gap: 12px; margin: 6px 0; font-size: 11.5px; color: var(--text-muted); }
.conv-day::before, .conv-day::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.conv-msg { display: flex; flex-direction: column; max-width: min(76%, 620px); align-self: flex-start; }
.conv-msg.out { align-self: flex-end; align-items: flex-end; }
.conv-meta { display: flex; align-items: center; gap: 8px; margin: 0 4px 3px; font-size: 11px; color: var(--text-muted); }
.conv-author { color: var(--text-secondary); font-weight: 500; }
.conv-tag { border: 1px solid var(--border-strong); border-radius: 999px; padding: 0 7px; font-size: 10.5px; }
.conv-bubble { padding: 9px 13px; border-radius: 14px; border-top-left-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13.5px; line-height: 1.5; overflow-wrap: anywhere; }
.conv-msg.out .conv-bubble { border-radius: 14px; border-top-right-radius: 4px; background: var(--accent); border-color: var(--accent); color: #fff; }
.conv-msg.out .conv-bubble a { color: #fff; }
.conv-msg.failed .conv-bubble { background: transparent; border-color: var(--danger); color: var(--text-secondary); }
.conv-error { margin: 4px 4px 0; font-size: 11.5px; color: var(--danger); text-align: right; }
.conv-file { display: block; margin-top: 6px; }
.conv-file img { max-width: 240px; max-height: 200px; border-radius: 8px; display: block; }
.conv-file-link { display: inline-block; }
.conv-composer { display: flex; align-items: flex-end; gap: 10px; padding: 12px 16px 6px; border-top: 1px solid var(--border); }
.conv-composer textarea { flex: 1; min-height: 40px; max-height: 160px; resize: none; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-primary); font: inherit; font-size: 13.5px; line-height: 1.45; }
.conv-composer textarea:focus { outline: none; border-color: var(--accent); }
.conv-composer .btn { height: 40px; }
.conv-hint { display: flex; justify-content: space-between; gap: 12px; margin: 0; padding: 0 16px 10px; font-size: 11px; }
.conv-blocked { padding: 14px 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-secondary); background: var(--surface); }
.conv-picker { display: flex; flex-direction: column; gap: 10px; padding: 16px; min-height: 0; flex: 1; }
.conv-pick-results { overflow-y: auto; min-height: 0; scrollbar-width: thin; }

@media (max-width: 900px) {
  .conv-layout { grid-template-columns: minmax(0, 1fr); height: clamp(420px, 72vh, 760px); }
  .conv-layout .conv-thread { display: none; }
  .conv-layout.thread-open .conv-side { display: none; }
  .conv-layout.thread-open .conv-thread { display: flex; }
  .conv-back { display: inline-flex; }
  .conv-msg { max-width: 88%; }
}

/* ==========================================================================
   DM GROUPÉ
   ========================================================================== */
.b-recipients { margin: 4px 0 0; padding: 12px 14px; border-radius: var(--radius); background: rgba(10, 11, 14, 0.45); border: 1px solid var(--border); font-size: 13px; line-height: 1.6; }
.b-warn { color: #e2a04f; }
.b-progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 4px 0 14px; }
.b-progress span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.4s ease; }
.b-job.done .b-progress span { background: var(--success); }
.b-numbers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.b-numbers > div { display: flex; flex-direction: column; }
.b-numbers strong { font-size: 20px; font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.b-numbers span { font-size: 12px; color: var(--text-secondary); }
.b-failures { margin-top: 12px; font-size: 12.5px; }
.b-failures summary { cursor: pointer; color: var(--text-secondary); }
.b-failures ul { margin: 8px 0 0; padding-left: 18px; line-height: 1.7; }
.b-failed-list { max-height: 180px; overflow-y: auto; color: var(--text-secondary); }
#b-members .conv-pick-results { max-height: 220px; margin-top: 6px; }
#b-members input[type="search"] { width: 100%; margin-top: 8px; }

@media (max-width: 1000px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .home-activity-row { grid-template-columns: 44px minmax(0, 1fr); }
  .home-activity-row .activity-type { display: none; }
  .mod-chips, .mod-detail { margin-left: 0; }
  .activity-filter-actions { margin-left: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .b-progress span, .mod-caret { transition: none; }
}
.an-toolbar { margin: 0 0 18px; }
.an-chart { max-height: 320px; }
.home-activity-row { grid-template-columns: 44px 170px minmax(0, 1fr); }
.field > input[type="search"] { width: 100%; box-sizing: border-box; }
.activity-filters .field input, .activity-filters .field select { width: 100%; height: 38px; box-sizing: border-box; }
.activity-filters .field label { white-space: nowrap; }
.activity-filter-actions .btn { height: 38px; }

/* Filtres du journal : grille (les champs gardent la même hauteur sur toutes les largeurs d'écran). */
.activity-filters.af-grid { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1.3fr)) repeat(2, minmax(0, 1fr)); gap: 12px; align-items: end; }
.activity-filters.af-grid .activity-filter-actions { grid-column: 1 / -1; justify-content: flex-end; margin-left: 0; }
@media (max-width: 1250px) { .activity-filters.af-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .activity-filters.af-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .activity-filters.af-grid .field:first-child { grid-column: 1 / -1; }
  .activity-filters.af-grid .activity-filter-actions { justify-content: stretch; }
  .activity-filters.af-grid .activity-filter-actions .btn { flex: 1; }
}
.activity-table { min-width: 760px; }
/* Chiffres clés de l'accueil : toujours des lignes complètes (6, 3 ou 2 cartes par ligne). */
.kpi-cards { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1400px) { .kpi-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .kpi-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ==========================================================================
   BARRE DU HAUT : pages principales (Accueil · Statistiques · Journal d'activité)
   Visuellement distincte de la sidebar : bloc « onglets » en haut, jamais dans le menu de gauche.
   ========================================================================== */
.topbar-nav { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; overflow: visible; white-space: nowrap; }
.topnav-tabs { display: inline-flex; align-items: center; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.09); }
.topnav-tabs .topnav-item { height: 34px; padding: 0 14px; border-radius: 9px; font-size: 13.5px; }
.topnav-tabs .topnav-item.active { background: var(--accent-soft); color: var(--text-primary); box-shadow: inset 0 0 0 1px var(--accent); }
.topnav-icon { font-size: 15px; line-height: 1; }
.main-header-title { min-width: 0; }
.page-eyebrow { margin: 0 0 2px; font-size: 11.5px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-muted); }
@media (max-width: 900px) {
  /* Petits écrans : les trois pages restent accessibles en icônes (sinon elles disparaîtraient avec la sidebar). */
  .topbar-nav { display: flex; flex: 1; justify-content: center; }
  .topnav-tabs .topnav-label { display: none; }
  .topnav-tabs .topnav-item { padding: 0 11px; min-width: 38px; justify-content: center; }
  .topnav-icon { font-size: 17px; }
}
@media (max-width: 640px) {
  .topbar { gap: 8px; padding: 0 10px; }
  .topbar .brand span { display: none; }
}
@media (max-width: 440px) {
  .topbar-guild { display: none; }
}

/* ==========================================================================
   HUB « CONVERSATIONS » : onglets, sélection de membres, barre du haut à 4 pages
   ========================================================================== */
.hub-tabs { margin-bottom: 16px; position: sticky; top: 0; z-index: 4; padding: 6px 0; background: transparent; }
.hub-tab { display: inline-flex; align-items: center; gap: 8px; }
.hub-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: 11px; font-weight: 700; line-height: 1; }
.hub-badge-soft { background: var(--accent-soft); color: var(--text-primary); box-shadow: inset 0 0 0 1px var(--accent); }
.hub-pane { min-width: 0; }
.hub-check { width: 34px; text-align: center; padding-right: 0 !important; }
.hub-check input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }
.hub-selbar { position: sticky; top: 52px; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 10px 14px; margin-bottom: 12px; border-radius: var(--radius); border: 1px solid var(--accent); background: var(--accent-soft); backdrop-filter: blur(10px); }
.hub-selbar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.topnav-item { position: relative; }
.topnav-tabs .nav-badge { margin-left: 2px; }
/* Libellés des onglets : jamais coupés ni sur deux lignes (le compactage progressif les masque avant, cf. fitTopbar). */
.topnav-tabs .topnav-item { white-space: nowrap; flex-shrink: 0; }
@media (max-width: 640px) {
  .hub-tabs { overflow-x: auto; flex-wrap: nowrap; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  .topnav-tabs .topnav-item { min-width: 34px; padding: 0 8px; }
}

/* ==========================================================================
   SIDEBAR : le pied (Documentation / Inviter / Support / Sécurité…) reste FIXÉ au bas de la fenêtre
   et passe PAR-DESSUS les catégories, qui défilent derrière lui. Ne change pas l'organisation des catégories.
   ========================================================================== */
.sidebar { overflow: hidden; padding-bottom: 0; }
.nav-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
  padding-bottom: calc(var(--sidebar-footer-h, 250px) + 18px); /* la liste défile derrière le pied, dernière entrée atteignable */
}
.sidebar-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  margin: 0;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(rgba(65, 105, 225, 0.16), rgba(65, 105, 225, 0.16)), #090b11; /* opaque : le texte dessous ne transparaît jamais */
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 -16px 26px rgba(0, 0, 0, 0.55);
}
@media (min-width: 901px) {
  /* Mode classique (sans scène 3D) : le document défile, la sidebar reste collée sous la barre du haut, pleine hauteur de fenêtre. */
  .sidebar { position: sticky; top: 68px; height: calc(100vh - 68px); height: calc(100dvh - 68px); min-height: 0; align-self: start; overflow: hidden; }
  /* Mode scène 3D : la sidebar occupe la zone sous la barre du haut. */
  body.scene-active.shell-ready .sidebar { position: relative; top: auto; height: 100%; min-height: 0; align-self: stretch; overflow: hidden; }
}
@media (max-width: 900px) {
  .sidebar { height: 100vh; height: 100dvh; }
}
/* Écrans peu hauts : pied compact sur deux colonnes pour ne pas masquer les catégories. */
@media (max-height: 760px) {
  .sidebar-footer { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding-top: 10px; }
  .sidebar-footer .btn { height: 34px; padding: 0 8px; font-size: 12px; justify-content: center; }
  .sidebar-footer .btn-primary, .sidebar-footer .btn-ghost { grid-column: span 2; }
}
@media (max-height: 520px) {
  .sidebar-footer { max-height: 40vh; overflow-y: auto; }
}

/* Bouton d'accès au Owner Panel (uniquement affiché au propriétaire) et écran de maintenance. */
.btn-owner { border-color: var(--accent); color: var(--text-primary); background: var(--accent-soft); }
.btn-owner:hover { background: var(--accent); color: #fff; }
.maintenance-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.maintenance-card { max-width: 460px; text-align: center; padding: 36px 30px; border-radius: var(--radius); border: 1px solid var(--accent); background: var(--surface); box-shadow: 0 0 40px rgba(65, 105, 225, 0.18); }
.maintenance-card h1 { font-size: 22px; margin: 10px 0 8px; }
.maintenance-card p { color: var(--text-secondary); line-height: 1.6; margin: 0 0 20px; }
.maintenance-icon { font-size: 40px; }

/* Mode classique (sans scène 3D) : `overflow-x: hidden` sur le body en faisait un conteneur de défilement, ce qui empêchait
   la sidebar « sticky » de rester collée à la fenêtre. `clip` coupe le débordement sans créer de conteneur de défilement. */
@media (min-width: 901px) {
  body:not(.scene-active) { overflow-x: clip; overflow-y: visible; }
}

/* ==========================================================================
   BARRE DU HAUT — compactage progressif (app.js, fitTopbar) : selon la place réellement disponible, les libellés sont
   masqués par niveaux avant de se chevaucher. Les règles « téléphone » (≤ 900 px) plus bas restent la base sur mobile.
   ========================================================================== */
.topbar-nav { min-width: 0; }
.topbar-right > * { flex-shrink: 0; }
.topbar.tb-fit-1 .topbar-guild-name, .topbar.tb-fit-1 .cmdk-hint .btn-label-full, .topbar.tb-fit-1 .cmdk-hint kbd { display: none; }
.topbar.tb-fit-2 :is(.btn-setup, #whats-new-btn, .btn-owner, .btn-switch-server) .btn-label-full { display: none; }
.topbar.tb-fit-2 :is(.btn-setup, #whats-new-btn, .btn-owner, .btn-switch-server) { width: 36px; min-width: 36px; height: 36px; padding: 0; justify-content: center; gap: 0; }
.topbar.tb-fit-3 .topnav-tabs .topnav-item:not(.active) .topnav-label { display: none; }
.topbar.tb-fit-3 .topnav-tabs .topnav-item:not(.active) { padding: 0 10px; min-width: 36px; justify-content: center; }
.topbar.tb-fit-4 .topnav-tabs .topnav-label { display: none; }
.topbar.tb-fit-4 .topnav-tabs .topnav-item { padding: 0 9px; min-width: 34px; justify-content: center; }
.topbar.tb-fit-4 .topbar-guild { display: none; }
.topbar.tb-fit-4 .brand span { display: none; }
.topbar.tb-fit-5 { gap: 6px; }
.topbar.tb-fit-5 .topbar-right { gap: 6px; }
.topbar.tb-fit-5 .topnav-tabs { gap: 2px; padding: 3px; }
.topbar.tb-fit-5 .topnav-tabs .topnav-item { min-width: 32px; padding: 0 6px; }
.topbar.tb-fit-5 .cmdk-hint { display: none; }
.topbar.tb-fit-6 .lang-switch { display: none; } /* la langue reste réglable dans Paramètres généraux › Interface */
.topbar.tb-fit-6 .topbar-nav { overflow-x: auto; overflow-y: hidden; justify-content: flex-start; scrollbar-width: none; overscroll-behavior-x: contain; }
.topbar.tb-fit-6 .topbar-nav::-webkit-scrollbar { display: none; }
.topbar.tb-fit-6 .topnav-tabs { flex-shrink: 0; }

/* Écran de choix de serveur : le bouton Owner Panel y est visible dès la connexion (propriétaire uniquement). */
.picker-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

/* ==========================================================================
   BARRE DU HAUT SUR TÉLÉPHONE : rien ne se chevauche, quelle que soit la largeur (320 → 900 px).
   ☰ · logo · onglets (icônes) · 👑 · 🔄  — la loupe et le nom du serveur passent après (le menu ☰ reste le point d'entrée).
   ========================================================================== */
@media (max-width: 900px) {
  .topbar { gap: 6px; padding-left: 8px; padding-right: 8px; }
  .topbar > * { flex-shrink: 0; min-width: 0; }
  .topbar .brand span { display: none; }
  .topbar .brand img { width: 30px; height: 30px; }
  .topbar-nav { flex: 1 1 0 !important; min-width: 0; justify-content: center; overflow: hidden; }
  .topnav-tabs { gap: 2px; padding: 3px; max-width: 100%; }
  .topnav-tabs .topnav-item { min-width: 32px; height: 32px; padding: 0 6px; }
  .topnav-icon { font-size: 16px; }
  .topbar-right { flex: 0 0 auto; gap: 6px; }
  .topbar-guild { display: none !important; }
  .topbar .btn-owner, .topbar .btn-switch-server { width: 36px; min-width: 36px; height: 36px; padding: 0; justify-content: center; gap: 0; }
  .topbar .btn-owner .btn-label-full, .topbar .btn-switch-server .btn-label-full { display: none !important; }
  .mobile-menu-btn { width: 36px; min-width: 36px; padding: 0; justify-content: center; }
}
@media (max-width: 560px) { .cmdk-hint { display: none !important; } }
@media (max-width: 350px) { .topbar .brand { display: none; } }

/* ==========================================================================
   SCANNER DES RÔLES (page « Rôle automatique »)
   ========================================================================== */
.scanner-pill { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--text-secondary); white-space: nowrap; }
.scanner-pill.on { color: #4ade80; border-color: rgba(74, 222, 128, 0.45); }
.scanner-pill.running { color: var(--accent); border-color: var(--accent); }
.scanner-pill.off { color: var(--text-muted); }
.scanner-block [hidden] { display: none !important; }
.scanner-times-list { display: grid; gap: 8px; margin-bottom: 10px; }
.scanner-time-row { display: flex; align-items: center; gap: 8px; }
.scanner-time-row input[type="time"] { flex: 1; min-width: 0; height: 38px; padding: 0 12px; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius); color: var(--text-primary); font-size: 14px; color-scheme: dark; }
.scanner-time-row input[type="time"]:focus { outline: none; border-color: var(--accent); }
.scanner-next { margin: 16px 0 12px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); font-size: 13.5px; }
.scanner-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.scanner-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-top: 16px; }
.scanner-stat { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); min-width: 0; }
.scanner-stat span { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.scanner-stat strong { font-size: 14px; overflow-wrap: anywhere; }
.scanner-error { grid-column: 1 / -1; padding: 8px 12px; border-radius: var(--radius); border: 1px solid rgba(255, 107, 107, 0.5); color: #ff9a9a; font-size: 12.5px; }
@media (max-width: 900px) {
  /* 16 px minimum : sinon Safari (iPhone ET iPad) zoome la page au toucher d'un champ */
  .scanner-time-row input[type="time"], .scanner-block select, .scanner-block input[type="number"] { font-size: 16px; min-height: 44px; }
}
@media (max-width: 640px) {
  .scanner-actions .btn { flex: 1 1 100%; justify-content: center; min-height: 44px; }
  .scanner-time-del { min-width: 44px; min-height: 44px; }
}

/* ==========================================================================
   LOGS — page « Logs » (journal du serveur) — voir logs-ui.js
   Noir / blanc / bleu royal uniquement.
   ========================================================================== */
.alog-page { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.alog-card {
  background: rgba(10, 11, 14, 0.62);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  padding: 16px 18px;
  min-width: 0;
  animation: fadeInUp 0.32s ease both;
  transition: border-color 0.2s ease, opacity 0.2s ease;
}
.alog-card:hover { border-color: rgba(65, 105, 225, 0.35); }
.alog-hero { border-color: rgba(65, 105, 225, 0.35); background: linear-gradient(160deg, rgba(65, 105, 225, 0.14), rgba(10, 11, 14, 0.7) 55%); }
.alog-hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.alog-hero h3 { margin: 0 0 4px; font-family: var(--font-display); font-size: 17px; letter-spacing: 0.2px; }
.alog-hero p { margin: 0; color: var(--text-secondary); font-size: 13px; }
.alog-master { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border); }
.alog-master-label { font-size: 13px; color: var(--text-secondary); }
.alog-master-label strong { color: var(--text-muted); font-weight: 600; }
.alog-master-label strong.on { color: #8fa8ff; }
.alog-hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-top: 12px; align-items: start; }
.alog-field label { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-secondary); margin-bottom: 8px; }
.alog-field select {
  width: 100%; max-width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px;
  background: var(--surface-2); color: var(--text-primary); border: 1px solid var(--border-strong); font-size: 14px;
}
.alog-field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.alog-option { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border); }
.alog-note { margin-top: 8px; padding: 8px 12px; border-radius: 10px; font-size: 12.5px; line-height: 1.55; border: 1px solid rgba(65, 105, 225, 0.45); background: var(--accent-soft); color: var(--text-primary); }
.alog-note.danger { border-color: rgba(226, 87, 79, 0.55); background: var(--danger-soft); }
.alog-note-sub { color: var(--text-secondary); }

.alog-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 4px 2px; }
.alog-summary { color: var(--text-secondary); font-size: 13px; }
.alog-summary strong { color: var(--text-primary); font-size: 15px; }
.alog-toolbar-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.alog-toolbar-actions .btn { min-height: 40px; }

.alog-grid { column-count: 2; column-gap: 14px; }
.alog-grid > .alog-card { display: inline-block; width: 100%; margin: 0 0 14px; break-inside: avoid; -webkit-column-break-inside: avoid; }
.alog-page.is-off .alog-grid, .alog-page.is-off .alog-toolbar { opacity: 0.55; }
.alog-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.alog-card-title { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.alog-card-title h3 { margin: 0 0 2px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.8px; font-family: var(--font-display); }
.alog-card-title p { margin: 0; font-size: 12px; color: var(--text-muted); }
.alog-card-icon { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border-radius: 10px; background: var(--accent-soft); font-size: 17px; }
.alog-count { flex: 0 0 auto; font-size: 12px; font-weight: 600; color: #8fa8ff; background: rgba(65, 105, 225, 0.14); border: 1px solid rgba(65, 105, 225, 0.35); padding: 3px 9px; border-radius: 999px; }
.alog-rows { display: flex; flex-direction: column; }
.alog-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 40px; padding: 5px 4px; border-top: 1px solid rgba(255, 255, 255, 0.05); cursor: pointer; border-radius: 8px; }
.alog-row:first-child { border-top: 0; }
.alog-row:hover { background: rgba(65, 105, 225, 0.07); }
.alog-row-text { display: flex; flex-direction: column; min-width: 0; }
.alog-row-label { font-size: 13.5px; color: var(--text-primary); overflow-wrap: anywhere; }
.alog-row-hint { font-size: 11.5px; color: var(--text-muted); line-height: 1.45; margin-top: 2px; }

/* Interrupteur bleu royal (zone tactile ≥ 44 px) */
.alog-switch {
  position: relative; flex: 0 0 auto; width: 46px; height: 26px; padding: 0; border-radius: 999px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border-strong); transition: background 0.15s ease, border-color 0.15s ease;
}
.alog-switch::before { content: ""; position: absolute; inset: -10px -6px; } /* agrandit la zone cliquable sans changer le dessin */
.alog-switch-thumb { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--text-secondary); transition: left 0.15s ease, background 0.15s ease; }
.alog-switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.alog-switch[aria-checked="true"] .alog-switch-thumb { left: 23px; background: #fff; }
.alog-switch:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.alog-switch.lg { width: 52px; height: 30px; }
.alog-switch.lg .alog-switch-thumb { width: 22px; height: 22px; }
.alog-switch.lg[aria-checked="true"] .alog-switch-thumb { left: 25px; }

.alog-footnote { margin: 0; font-size: 12.5px; color: var(--text-muted); }
.alog-footnote a { color: #8fa8ff; }
.alog-saved { margin: 0; min-height: 18px; font-size: 12px; color: #8fa8ff; }

@media (max-width: 1100px) {
  .alog-grid { column-count: 1; }
}
@media (max-width: 760px) {
  .alog-hero-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .alog-card { padding: 12px 12px; }
  .alog-master { width: 100%; justify-content: space-between; }
  .alog-toolbar-actions { width: 100%; }
  .alog-toolbar-actions .btn { flex: 1 1 0; min-width: 0; }
  .alog-card-icon { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .alog-card { animation: none; }
  .alog-switch, .alog-switch-thumb { transition: none; }
}

/* --- Page Logs unique : sélection des salons, événements à la carte, salons ignorés --- */
.alog-sections { display: flex; flex-direction: column; gap: 14px; min-width: 0; transition: opacity 0.2s ease; }
.alog-sections.is-dim { opacity: 0.55; }
.alog-section-head { margin-bottom: 10px; }
.alog-section-head p { margin: 4px 0 0; color: var(--text-secondary); font-size: 13px; line-height: 1.55; }
.alog-section-title { margin: 0; font-family: var(--font-display); font-size: 14px; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text-primary); }
.alog-hero > .alog-section-head { margin-bottom: 10px; }
.alog-toolbar .alog-section-title { flex: 1 1 100%; }
.alog-chan-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 10px; align-items: start; }
.alog-chan-card { padding: 12px 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border); min-width: 0; }
.alog-chan-default { border-color: rgba(65, 105, 225, 0.4); background: rgba(65, 105, 225, 0.07); }
.alog-chan-card h4 { margin: 0 0 4px; font-size: 14px; font-family: var(--font-display); }
.alog-chan-desc { margin: 0 0 8px; font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.alog-chan-card .alog-field select { width: 100%; max-width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: var(--text-primary); border: 1px solid var(--border-strong); font-size: 14px; }
.alog-chan-card .alog-field select:focus, .alog-event-chan select:focus, .alog-ignored-field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.alog-effective { margin: 8px 0 0; font-size: 12.5px; color: var(--text-secondary); overflow-wrap: anywhere; }
.alog-effective strong { color: #8fa8ff; font-weight: 600; }
.alog-effective-none { color: var(--text-muted); }
.alog-chan-tail { margin: 4px 0 0; font-size: 11.5px; color: var(--text-muted); line-height: 1.45; }
.alog-priority { margin: 10px 0 0; font-size: 12.5px; color: var(--text-secondary); line-height: 1.6; }
.alog-priority strong { color: var(--text-primary); }

.alog-event .alog-row { border-top: 0; }
.alog-event + .alog-event { border-top: 1px solid rgba(255, 255, 255, 0.05); }
.alog-row-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.alog-gear {
  width: 32px; height: 32px; min-width: 32px; border-radius: 8px; padding: 0; cursor: pointer; font-size: 14px; font-weight: 700;
  color: var(--text-muted); background: transparent; border: 1px solid var(--border);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.alog-gear::before { content: ""; position: absolute; }
.alog-gear { position: relative; }
.alog-gear:hover, .alog-gear.is-open { color: #8fa8ff; border-color: rgba(65, 105, 225, 0.55); background: var(--accent-soft); }
.alog-gear:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.alog-event-chan { padding: 2px 6px 8px; }
.alog-event-chan[hidden] { display: none; }
.alog-event-chan label { display: block; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary); margin-bottom: 6px; }
.alog-event-chan select { width: 100%; max-width: 100%; min-height: 40px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); color: var(--text-primary); border: 1px solid var(--border-strong); font-size: 13.5px; }
.alog-badge { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 11px; color: #8fa8ff; background: rgba(65, 105, 225, 0.14); border: 1px solid rgba(65, 105, 225, 0.35); vertical-align: middle; }
.alog-scoped { margin: -2px 0 8px; font-size: 11.5px; color: var(--text-muted); }

.alog-ignored-explain { display: grid; gap: 8px; margin: 0 0 14px; padding: 12px 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border); font-size: 12.5px; line-height: 1.55; color: var(--text-secondary); }
.alog-ignored-explain strong { color: var(--text-primary); }
.alog-chip-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.alog-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 5px 6px 5px 11px; border-radius: 999px; font-size: 13px; background: var(--accent-soft); border: 1px solid rgba(65, 105, 225, 0.45); color: var(--text-primary); overflow-wrap: anywhere; }
.alog-chip.is-bad { border-color: rgba(226, 87, 79, 0.55); background: var(--danger-soft); }
.alog-chip button { width: 28px; height: 28px; border-radius: 50%; border: 0; cursor: pointer; color: var(--text-secondary); background: rgba(255, 255, 255, 0.06); }
.alog-chip button:hover { color: #fff; background: rgba(255, 255, 255, 0.14); }
#alog-ignored .alog-field select { width: 100%; max-width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: var(--text-primary); border: 1px solid var(--border-strong); font-size: 14px; }
.alog-feature { display: block; min-width: 0; }

@media (max-width: 760px) {
  .alog-chan-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .alog-gear { width: 40px; height: 40px; min-width: 40px; }
  .alog-row-actions { gap: 8px; }
  .alog-chan-card { padding: 10px; }
}

/* ==========================================================================
   PROTECTION — page unique (protection-ui.js)
   ========================================================================== */
.pp-page { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.pp-section { min-width: 0; }
.pp-h { margin: 0 0 4px; font-family: var(--font-display); font-size: 15px; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text-primary); }
.pp-intro { margin: 0 0 14px; font-size: 13px; line-height: 1.55; color: var(--text-secondary); }
/* Cartes de hauteurs différentes : colonnes « maçonnerie » (aucun grand vide sous une carte courte). */
.pp-grid { column-count: 2; column-gap: var(--sp-4); }
.pp-grid > * { break-inside: avoid; margin-bottom: var(--sp-4); }
.pp-grid > .pp-card.section-block { margin-bottom: var(--sp-4); }
.pp-filters { display: flex; flex-direction: column; gap: 10px; }
.pp-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3) var(--sp-4); align-items: start; }
.pp-card.section-block { margin-bottom: 0; padding: var(--sp-4) var(--sp-5); min-width: 0; }
.pp-card.section-block:hover { transform: none; box-shadow: none; border-color: rgba(65, 105, 225, 0.35); }
.pp-card-title { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.pp-card-title strong { display: block; font-size: 14px; font-weight: 600; }
.pp-card-desc { display: block; margin-top: 2px; font-size: 12px; line-height: 1.5; color: var(--text-muted); font-weight: 400; }
.pp-card-icon { flex: 0 0 34px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--accent-soft); font-size: 17px; }
.pp-sys-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.pp-sys-body > .field:last-child, .pp-card-body > .field:last-child { margin-bottom: 0; }

/* Cartes de filtres repliables */
.pp-card > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; min-height: 44px; }
.pp-card > summary::-webkit-details-marker { display: none; }
.pp-card > summary::after { content: "▾"; color: var(--text-muted); font-size: 14px; transition: transform 0.15s ease; order: 3; margin-left: 4px; }
.pp-card[open] > summary::after { transform: rotate(180deg); }
.pp-card-side { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.pp-card-state { font-size: 11.5px; font-weight: 600; color: var(--text-muted); padding: 2px 9px; border-radius: 999px; border: 1px solid var(--border); }
.pp-card-state.on { color: #8fa8ff; border-color: rgba(65, 105, 225, 0.45); background: rgba(65, 105, 225, 0.14); }
.pp-card-body { margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid rgba(255, 255, 255, 0.06); }
.pp-common { margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.06); }

/* Champs */
.pp-field { margin-bottom: var(--sp-3); min-width: 0; }
.pp-field label { display: block; }
.pp-field input[type="number"], .pp-field select { min-height: var(--control-h); }
/* Champ seul dans une carte : libellé à gauche, contrôle aligné à droite (une pile verticale sur petit écran). */
@media (min-width: 761px) {
  .pp-card-body > .pp-field, .cfg-body > .pp-field { display: grid; grid-template-columns: minmax(0, 1fr) minmax(160px, var(--control-w)); column-gap: var(--sp-4); align-items: center; }
  .pp-card-body > .pp-field > label, .cfg-body > .pp-field > label { margin: 0; grid-column: 1; }
  .pp-card-body > .pp-field > input, .pp-card-body > .pp-field > select, .cfg-body > .pp-field > input, .cfg-body > .pp-field > select { grid-column: 2; width: 100%; box-sizing: border-box; }
  .pp-card-body > .pp-field > :not(label):not(input):not(select), .cfg-body > .pp-field > :not(label):not(input):not(select) { grid-column: 1 / -1; }
}
.pp-hint { display: block; margin: -2px 0 8px; font-size: 11.5px; line-height: 1.5; color: var(--text-muted); }
.pp-hint code, .pp-check code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: #8fa8ff; background: rgba(65, 105, 225, 0.12); padding: 1px 5px; border-radius: 5px; }
.pp-note { margin: 12px 0 0; font-size: 12px; line-height: 1.55; color: var(--text-muted); }
.pp-limit { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 14px; padding: 11px 14px; border-radius: 12px; font-size: 12.5px; line-height: 1.55; color: var(--text-primary); border: 1px solid rgba(65, 105, 225, 0.45); background: var(--accent-soft); }

/* Ligne « libellé + interrupteur » */
.pp-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); min-height: var(--row-h); padding: var(--sp-2) 0; border-top: 1px solid rgba(255, 255, 255, 0.05); }
.pp-card-body > .pp-row:first-of-type, .pp-common > .pp-row:first-child { border-top: 0; }
.pp-row-text { display: flex; flex-direction: column; min-width: 0; }
.pp-row-label { font-size: 13.5px; overflow-wrap: anywhere; }
.pp-row-hint { font-size: 11.5px; line-height: 1.45; color: var(--text-muted); margin-top: 2px; }
.pp-toggle { flex: 0 0 auto; position: relative; padding: 6px 2px; }
.pp-toggle:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-radius: 12px; }
.pp-two > .pp-field, .pp-common > .pp-field { margin-bottom: var(--sp-3); }

/* Sélecteurs rôle / salon / membre */
.pp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; max-height: 140px; overflow-y: auto; }
.pp-chip { max-width: 100%; overflow-wrap: anywhere; }
.pp-chip button { min-width: 22px; min-height: 22px; border-radius: 50%; }
.pp-chip-missing { background: var(--danger-soft); color: #f0928c; }
.pp-empty { font-size: 12px; margin: 4px 0; }
.pp-add { min-height: 40px; }
.pp-pop { margin-top: 8px; padding: 8px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border-strong); }
.pp-pop[hidden] { display: none; }
.pp-search, .pp-text-input, .pp-text-filter, .pp-edit-input { width: 100%; min-height: 42px; padding: 0 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text-primary); font-size: 14px; }
.pp-search:focus, .pp-text-input:focus, .pp-text-filter:focus, .pp-edit-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pp-list { margin-top: 8px; max-height: 240px; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; }
.pp-opt { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text-primary); font-size: 13.5px; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.pp-opt:hover, .pp-opt:focus-visible { background: rgba(65, 105, 225, 0.14); outline: none; }
.pp-opt img { border-radius: 50%; flex: 0 0 24px; }
.pp-dot { flex: 0 0 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--text-muted); }

/* Listes de textes (mots, domaines, invitations…) */
.pp-addrow { display: flex; gap: 8px; margin-bottom: 8px; }
.pp-addrow .btn { flex: 0 0 auto; min-height: 42px; }
.pp-text-filter { margin-bottom: 8px; }
.pp-words { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; overscroll-behavior: contain; border-radius: 10px; }
.pp-word { display: flex; align-items: center; gap: 6px; min-height: 40px; padding: 4px 8px; border-top: 1px solid rgba(255, 255, 255, 0.05); }
.pp-word:first-child { border-top: 0; }
.pp-word:hover { background: rgba(255, 255, 255, 0.03); }
.pp-word-text { flex: 1 1 auto; min-width: 0; font-size: 13.5px; overflow-wrap: anywhere; }
.pp-mono .pp-word-text { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.pp-badge { flex: 0 0 auto; font-size: 11px; font-weight: 700; color: #8fa8ff; background: rgba(65, 105, 225, 0.14); border: 1px solid rgba(65, 105, 225, 0.35); padding: 0 7px; border-radius: 999px; }
.pp-icon { flex: 0 0 auto; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: 14px; }
.pp-icon:hover, .pp-icon:focus-visible { background: rgba(255, 255, 255, 0.08); color: #fff; outline: none; }
.pp-icon-del:hover { background: var(--danger-soft); color: #f0928c; }
.pp-edit-input { flex: 1 1 auto; min-height: 36px; }

/* Cases Markdown */
.pp-md { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); margin-bottom: var(--sp-3); }
.pp-check { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.03); cursor: pointer; min-width: 0; }
.pp-check:hover { border-color: rgba(65, 105, 225, 0.45); }
.pp-check input { width: 18px; height: 18px; accent-color: var(--accent); flex: 0 0 18px; }
.pp-check span { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 13px; }
.pp-check code { align-self: flex-start; max-width: 100%; overflow-wrap: anywhere; }

.pp-log-status { margin: 0 0 12px; font-size: 13px; line-height: 1.55; color: var(--text-secondary); }
.pp-log-status strong { color: var(--text-primary); }

@media (max-width: 900px) {
  .pp-grid { column-count: 1; }
  .pp-md { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .pp-two { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .pp-card.section-block { padding: 14px 12px; }
  .pp-card-icon { display: none; }
  .pp-card-state { display: none; }
  .pp-md { grid-template-columns: minmax(0, 1fr); }
  .pp-addrow { flex-wrap: wrap; }
  .pp-addrow .pp-text-input { flex: 1 1 100%; }
  .pp-addrow .btn { flex: 1 1 100%; }
}

/* ===== Rôle auto : liste de configurations repliables ===== */
.ra-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.ra-head > div:first-child { flex: 1 1 280px; min-width: 0; }
.ra-head-actions { flex: 0 0 auto; }
.ra-count { margin: 0 0 12px; font-size: 12px; }
.ra-list { gap: 10px; }
.ra-card.ra-off { opacity: 0.8; }
.ra-sum { min-width: 0; }
.ra-sum strong { overflow-wrap: anywhere; }
.ra-chip { font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-secondary); white-space: nowrap; }
.ra-chip-never { color: #8fa8ff; border-color: rgba(65, 105, 225, 0.45); font-size: 14px; line-height: 1.2; }
.ra-never { margin: 0 0 14px; padding: 11px 14px; border-radius: 12px; font-size: 12.5px; line-height: 1.55; border: 1px solid rgba(65, 105, 225, 0.4); background: rgba(65, 105, 225, 0.1); }
.ra-error { margin: 0 0 14px; padding: 10px 14px; border-radius: 12px; font-size: 13px; line-height: 1.5; border: 1px solid var(--danger); background: rgba(220, 70, 70, 0.12); overflow-wrap: anywhere; }
.ra-role-btn { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 44px; padding: 0 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text-primary); font: inherit; cursor: pointer; text-align: left; }
.ra-role-btn:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ra-role-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-opt:disabled { opacity: 0.45; cursor: not-allowed; }
.pp-opt small { margin-left: auto; font-size: 11px; }
.ra-opt-current { background: rgba(65, 105, 225, 0.14); }
.ra-scan { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.ra-status { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; margin: 14px 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: 12.5px; }
.ra-status dt { color: var(--text-muted); font-size: 11.5px; }
.ra-status dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.ra-status-err { grid-column: 1 / -1; color: #e88a85; }
.ra-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: space-between; }
.ra-reset { margin-top: 14px; text-align: right; }
.ra-empty { text-align: center; }
@media (max-width: 640px) {
  .ra-head-actions, .ra-head-actions .btn { width: 100%; }
  .ra-status { grid-template-columns: minmax(0, 1fr); }
  .ra-card > summary { flex-wrap: wrap; }
  .ra-card .pp-card-side { gap: 8px; }
  .ra-card .pp-two { grid-template-columns: minmax(0, 1fr); }
  .ra-actions .btn { flex: 1 1 140px; min-height: 44px; }
}

/* ===== Arrivées / départs : embed, images et GIF ===== */
.wl-block .pp-card.section-block { margin-bottom: 0; }
.wl-media { padding: 10px 0 4px; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.wl-media:first-of-type { border-top: 0; }
.wl-media-body { padding: 0 0 8px; }
.wl-media-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; align-items: center; }
.wl-upload { cursor: pointer; display: inline-flex; align-items: center; }
.wl-upload.is-busy { opacity: 0.6; pointer-events: none; }
.wl-file { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border-strong); font-size: 13px; overflow-wrap: anywhere; }
.wl-file code { font-size: 11.5px; color: #8fa8ff; }
.wl-error { margin: 8px 0 0; padding: 8px 12px; border-radius: 10px; font-size: 12.5px; line-height: 1.5; border: 1px solid var(--danger); background: rgba(220, 70, 70, 0.12); overflow-wrap: anywhere; }
.wl-color { width: 100%; min-height: 42px; padding: 2px; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 10px; cursor: pointer; }
.wl-mention { color: #8fa8ff; background: rgba(65, 105, 225, 0.18); border-radius: 4px; padding: 0 3px; }
.wl-plain { margin: 0; }
.wl-img-missing { display: inline-block; font-size: 11.5px; color: var(--text-muted); padding: 6px 0; }
.wl-embed { flex-wrap: wrap; }
.wl-embed .embed-preview-body { flex: 1 1 200px; }
.wl-embed img.banner { max-height: 220px; }
.wl-preview { position: sticky; top: 12px; }
@media (max-width: 640px) {
  .wl-preview { position: static; }
  .wl-media-actions .btn { flex: 1 1 130px; min-height: 44px; justify-content: center; }
}
.check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
/* --- Langue (sélecteur FR | EN, cartes de langue) --- */
.lang-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border-strong); }
.lang-switch-btn { border: 0; cursor: pointer; padding: 5px 10px; border-radius: 999px; background: transparent; color: var(--text-muted, #9aa3b5); font: 600 12px/1 inherit; font-family: inherit; min-height: 28px; }
.lang-switch-btn.active { background: var(--accent); color: #fff; }
.lang-switch-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lang-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.lang-card { display: flex; align-items: center; gap: 10px; padding: 12px 14px; min-height: 48px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface-2); color: inherit; font: inherit; cursor: pointer; text-align: left; }
.lang-card:hover { border-color: var(--accent); }
.lang-card.active { border-color: var(--accent); background: var(--accent-soft); }
.lang-card-flag { font-size: 22px; }
.lang-card-name { font-weight: 600; flex: 1; }
.lang-card-check { color: var(--accent); font-weight: 700; }
@media (max-width: 640px) { .topbar-right .lang-switch { order: -1; } }

/* Sections repliables des pages de configuration (ui-kit.js) */
.cfg-section { margin-bottom: 14px; }
.cfg-section > summary strong { font-size: 14.5px; }
.cfg-section .pp-card-body > .field:last-child { margin-bottom: 0; }
.cfg-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 46px; padding: 8px 0; border-top: 1px solid rgba(255,255,255,.05); }
.cfg-row:first-child { border-top: 0; }
.cfg-row .cfg-row-text { display: flex; flex-direction: column; min-width: 0; font-size: 13.5px; }
.cfg-row .cfg-row-text small { color: var(--text-muted); font-size: 11.5px; line-height: 1.45; }
.cfg-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.cfg-chip { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; color: #8fa8ff; background: rgba(65,105,225,.12); border: 1px solid rgba(65,105,225,.35); border-radius: 999px; padding: 3px 9px; cursor: pointer; }
.cfg-chip:hover { background: rgba(65,105,225,.24); }
.cfg-error { color: #ff8a8a; font-size: 12px; margin: 4px 0 0; }
.cfg-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.cfg-people { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.cfg-person { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 999px; background: rgba(255,255,255,.06); border: 1px solid var(--border); font-size: 12.5px; }
.cfg-person button { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 14px; line-height: 1; padding: 2px 5px; }
.cfg-results { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; max-height: 220px; overflow: auto; }
.cfg-results button { text-align: left; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: rgba(255,255,255,.03); color: inherit; cursor: pointer; font-size: 13px; }
.cfg-results button:hover { border-color: rgba(65,105,225,.5); }
.cfg-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 14px; }
.cfg-stat { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: rgba(255,255,255,.03); }
.cfg-stat b { display: block; font-size: 20px; }
.cfg-stat span { font-size: 11.5px; color: var(--text-muted); }
.cfg-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cfg-table th, .cfg-table td { text-align: left; padding: 7px 8px; border-top: 1px solid rgba(255,255,255,.06); }
.cfg-table th { font-size: 11.5px; color: var(--text-muted); font-weight: 600; }
.cfg-table-wrap { overflow-x: auto; }
.cfg-status { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 12px; font-size: 13px; line-height: 1.5; border: 1px solid var(--border); margin-bottom: 14px; }
.cfg-status.ok { border-color: rgba(65,105,225,.5); background: var(--accent-soft); }
.cfg-status.warn { border-color: rgba(255,138,138,.5); background: rgba(255,138,138,.08); }
.cfg-preview { border-radius: 12px; border: 1px solid var(--border); background: #1b1d22; padding: 12px 14px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.cfg-preview .pv-mention { color: #8fa8ff; background: rgba(65,105,225,.2); border-radius: 4px; padding: 0 3px; }
.cfg-preview .pv-embed { display: flex; gap: 12px; border-left: 4px solid #4169E1; background: #23262c; border-radius: 6px; padding: 10px 12px; }
.cfg-preview .pv-embed-main { flex: 1; min-width: 0; }
.cfg-preview .pv-embed-title { font-weight: 700; margin-bottom: 4px; }
.cfg-preview .pv-thumb { width: 56px; height: 56px; border-radius: 8px; background: linear-gradient(135deg, #4169E1, #1c2a66); flex: 0 0 56px; }
.cfg-row .toggle-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.cfg-row .toggle { flex: 0 0 auto; }

/* ---- Statistiques : carte, bannière, aperçu ---- */
.st-color { display: inline-flex; align-items: center; gap: 10px; }
.st-color input[type="color"] { width: 44px; height: 32px; padding: 0; border: 1px solid rgba(255,255,255,.15); border-radius: 8px; background: none; cursor: pointer; }
.st-color code { font-size: 12px; color: var(--text-muted); }
.st-radios { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.st-radio { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid rgba(255,255,255,.08); border-radius: 10px; cursor: pointer; }
.st-radio:has(input:checked) { border-color: #4169E1; background: rgba(65,105,225,.12); }
.st-radio span { display: flex; flex-direction: column; min-width: 0; font-size: 13px; }
.st-radio small { color: var(--text-muted); font-size: 11.5px; line-height: 1.4; }
.st-effective { margin: 8px 0 12px; }
.st-thumbs { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 14px; }
.st-thumb { margin: 0; min-width: 0; }
.st-thumb > div { aspect-ratio: 3 / 1; border-radius: 10px; overflow: hidden; background: rgba(255,255,255,.04); border: 1px dashed rgba(255,255,255,.12); display: grid; place-items: center; color: var(--text-muted); font-size: 12px; text-align: center; }
.st-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.st-thumb figcaption { margin-top: 4px; font-size: 11.5px; color: var(--text-muted); }
.st-urlrow { display: flex; gap: 8px; flex-wrap: wrap; }
.st-urlrow input { flex: 1 1 220px; min-width: 0; }
.st-pv-controls { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-bottom: 12px; }
.st-seg { display: inline-flex; flex-wrap: wrap; border: 1px solid rgba(255,255,255,.12); border-radius: 10px; overflow: hidden; }
.st-seg button { background: transparent; color: inherit; border: 0; padding: 7px 12px; font: inherit; font-size: 12.5px; cursor: pointer; }
.st-seg button.on { background: #4169E1; color: #fff; }
.st-pv-stage { background: #0b0b0e; border-radius: 12px; padding: 8px; min-height: 120px; display: grid; place-items: center; transition: opacity .15s; overflow: hidden; }
.st-pv-stage.loading { opacity: .55; }
.st-pv-stage img { display: block; max-width: 100%; height: auto; border-radius: 10px; }
@media (max-width: 560px) { .st-radios { grid-template-columns: 1fr; } .st-seg button { padding: 7px 9px; } }

/* Invitations : aperçu fidèle des espacements (lignes vides visibles, marqueurs ¶ optionnels) */
.cfg-preview .pv-line { min-height: 1.5em; white-space: pre-wrap; }
.cfg-preview .pv-pilcrow { display: none; margin-left: 4px; color: rgba(143,168,255,.55); font-size: .8em; user-select: none; }
.cfg-preview.show-spacing .pv-pilcrow { display: inline; }
.cfg-preview.show-spacing .pv-blank { background: repeating-linear-gradient(135deg, rgba(143,168,255,.08) 0 6px, transparent 6px 12px); border-radius: 4px; }

/* Rôle auto : sections « Attribution à l'arrivée » et « Retrait automatique » clairement séparées */
.ra-block { margin: 0 0 14px; padding: 12px 14px 4px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.025); }
.ra-block-title { margin: 0 0 6px; font-size: 13.5px; font-weight: 700; letter-spacing: .01em; }
.ra-assign { border-color: rgba(65, 105, 225, 0.45); }

/* ==========================================================================
   MOBILE : AUCUN DÉFILEMENT FANTÔME EN MODE SCÈNE 3D
   --------------------------------------------------------------------------
   Cause : `body { min-height: 100vh }` (et `.app-shell`) — sur iPhone / navigateur intégré à Discord, « 100vh » est la
   hauteur MAXIMALE (barres du navigateur repliées), plus grande que l'écran réellement visible, alors que #app mesure
   100dvh. Le document devenait donc plus haut que la fenêtre : `html` (overflow-x: hidden ⇒ overflow-y: auto) défilait de
   la hauteur de la barre d'outils, décalant la barre du haut, le panneau et laissant voir le fond sous le panneau.
   Correctif : en mode scène, le corps de page est ancré à la fenêtre visible (position: fixed; inset: 0). Le document
   n'a plus de hauteur propre : il ne peut plus défiler, seule la zone de contenu (.main) défile, et rien d'autre.
   Le fond 3D (canvas fixe) n'influence plus aucune hauteur. Les pages hors scène 3D gardent leur défilement normal.
   ========================================================================== */
html:has(body.scene-active.shell-ready),
html.inari-scene-lock {
  overflow: hidden;
  height: 100%;
  overscroll-behavior: none;
}

body.scene-active.shell-ready {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
}

body.scene-active.shell-ready #app {
  height: 100%; /* suit la zone réellement visible (dvh/svh inutiles : le corps est déjà ancré à la fenêtre visible) */
  min-height: 0;
}

/* Le contenu défile de façon fluide et ne « rebondit » pas vers le document. */
body.scene-active.shell-ready .main,
body.scene-active.shell-ready .dock {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

/* Le canvas 3D est décoratif : jamais de hauteur, jamais de capture de clic en dehors de la scène. */
#inari-3d { position: fixed; inset: 0; width: 100%; height: 100%; max-height: 100%; }

/* Encoche / barre d'accueil iPhone : le panneau et le contenu ne passent pas dessous. */
@supports (padding: max(0px)) {
  body.scene-active.shell-ready .main { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
  body.scene-active.shell-ready .topbar { padding-top: env(safe-area-inset-top, 0); }
}

/* Téléphone en paysage : le panneau compact ne mange pas toute la hauteur. */
@media (max-height: 520px) and (orientation: landscape) {
  body.scene-active.shell-ready .stage { --dock-compact: clamp(130px, 52%, 240px); }
  body.scene-active.shell-ready .topbar { min-height: 0; }
}

/* Pages hors scène 3D : le document défile normalement, sans hauteur artificielle. */
body:not(.scene-active) { min-height: 100vh; min-height: 100dvh; }

/* ===== Rôles à réaction (rr-*) ===== */
.rr-behaviors { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rr-behavior { text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: transparent; color: var(--text-secondary); font: inherit; font-size: 12px; line-height: 1.4; cursor: pointer; min-width: 0; }
.rr-behavior strong { color: var(--text); font-size: 13px; }
.rr-behavior.active { border-color: #4169e1; background: rgba(65, 105, 225, 0.14); }
.rr-entries .rr-entry { display: grid; grid-template-columns: 44px minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.rr-emoji-btn { width: 44px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: transparent; color: inherit; font-size: 20px; cursor: pointer; display: grid; place-items: center; }
.rr-entry-tools { display: inline-flex; gap: 2px; }
.rr-entry-warn { grid-column: 1 / -1; font-size: 12px; }
.rr-warn { color: #f0b34a; font-size: 12.5px; overflow-wrap: anywhere; }
.rr-color { display: flex; gap: 8px; align-items: center; }
.rr-color input[type="color"] { width: 44px; height: 38px; padding: 2px; border-radius: 10px; border: 1px solid var(--border); background: transparent; flex: none; }
.rr-check { display: flex; gap: 8px; align-items: center; font-size: 13px; margin: 0 0 14px; }
.rr-preview { border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: rgba(255, 255, 255, 0.02); min-width: 0; }
.rr-embed { display: flex; gap: 12px; justify-content: space-between; border-left: 4px solid var(--rr-color, #4169e1); border-radius: 6px; padding: 10px 12px; background: #2b2d31; color: #dbdee1; max-width: 520px; }
.rr-embed-main { min-width: 0; flex: 1; }
.rr-embed-title { font-weight: 700; margin-bottom: 4px; overflow-wrap: anywhere; }
.rr-embed-desc { font-size: 13.5px; line-height: 1.5; overflow-wrap: anywhere; }
.rr-embed-desc img.emoji, .rr-embed-desc img { max-width: 20px; }
.rr-embed-img { display: block; max-width: 100%; max-height: 220px; border-radius: 6px; margin-top: 8px; }
.rr-embed-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; flex: none; }
.rr-embed-footer { font-size: 11.5px; color: #949ba4; margin-top: 8px; }
.rr-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.rr-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 8px; background: #2b2d31; border: 1px solid #3f4147; color: #dbdee1; font-size: 14px; }
.rr-chip small { color: #b5bac1; font-size: 12px; }
.rr-notes { margin: 10px 0 0; padding-left: 18px; font-size: 12.5px; line-height: 1.5; }
.rr-legacy { margin: 0 0 14px; padding: 10px 14px; border-radius: 12px; font-size: 13px; line-height: 1.5; border: 1px solid rgba(65, 105, 225, 0.45); background: rgba(65, 105, 225, 0.1); }
.rr-diag { margin: 0 0 14px; padding: 10px 14px; border-radius: 12px; font-size: 13px; border: 1px solid var(--border); overflow-wrap: anywhere; }
.rr-diag.ok { border-color: rgba(80, 200, 120, 0.5); }
.rr-diag.ko { border-color: var(--danger); }
.rr-diag ul { margin: 6px 0 0; padding-left: 18px; }
.rr-actions { flex-wrap: wrap; }
@media (max-width: 640px) {
  .rr-behaviors { grid-template-columns: minmax(0, 1fr); }
  .rr-entries .rr-entry { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .rr-entries .rr-entry .rr-label { grid-column: 1 / -1; grid-row: 2; }
  .rr-actions .btn { flex: 1 1 auto; }
}

/* ==========================================================================
   CENTRE DE SÉCURITÉ (security-ui.js) — réutilise les composants .pp-* de la page Protection
   ========================================================================== */
.sec-page { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.sec-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; border-bottom: 1px solid var(--border); }
.sec-tab { flex: 0 0 auto; min-height: 44px; padding: 0 14px; border: 1px solid transparent; border-bottom: 0; border-radius: 10px 10px 0 0; background: transparent; color: var(--text-muted); font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.sec-tab:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.04); }
.sec-tab.active { color: #fff; background: var(--accent-soft); border-color: rgba(65, 105, 225, 0.45); }
.sec-tab:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.sec-panel { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
.sec-stack { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.sec-sub { margin: var(--sp-3) 0 0; font-family: var(--font-display); font-size: 13px; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text-secondary); }

/* ---------- Composants de configuration communs (InariKit.card / row / choices / seg) ---------- */
.cfg-card { background: rgba(10, 11, 14, 0.55); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, 0.07); border-radius: 14px; min-width: 0; overflow: hidden; }
.cfg-card + .cfg-card { margin-top: var(--sp-4); }
.cfg-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); padding: var(--sp-3) var(--sp-5); min-height: 56px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.cfg-head h3, .cfg-head h4 { margin: 0; font-size: 15px; font-weight: 600; }
.cfg-head .cfg-sub { display: block; margin-top: 2px; font-size: 12px; color: var(--text-muted); font-weight: 400; }
.cfg-body { padding: var(--sp-2) var(--sp-5) var(--sp-4); }
.cfg-intro { margin: var(--sp-3) 0 var(--sp-2); color: var(--text-secondary); font-size: 13px; }
.cfg-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, var(--control-w)); gap: var(--sp-2) var(--sp-4); align-items: center; min-height: var(--row-h); padding: var(--sp-2) 0; border-top: 1px solid rgba(255, 255, 255, 0.05); }
.cfg-row:first-child { border-top: 0; }
.cfg-row.cfg-wide { grid-template-columns: minmax(0, 1fr); }
.cfg-label { font-size: 13px; color: var(--text-primary); min-width: 0; }
.cfg-hint { display: block; margin-top: 2px; font-size: 12px; color: var(--text-muted); }
.cfg-control { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2); flex-wrap: wrap; min-width: 0; }
.cfg-control > select, .cfg-control > input[type="text"], .cfg-control > input[type="number"] { width: 100%; min-height: var(--control-h); box-sizing: border-box; }
.cfg-row.is-hidden { display: none; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--sp-2); width: 100%; }
.choice-card { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: var(--sp-3); min-height: 56px; border: 1px solid var(--border); border-radius: var(--radius); background: rgba(255, 255, 255, 0.02); color: var(--text-primary); font: inherit; cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease; }
.choice-card:hover { border-color: var(--border-strong); }
.choice-card strong { font-size: 13px; font-weight: 600; }
.choice-card small { font-size: 11px; color: var(--text-muted); }
.choice-card[aria-pressed="true"], .choice-card[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.choice-card[disabled] { cursor: default; }
.choice-card[disabled]:not([aria-pressed="true"]) { opacity: 0.45; cursor: not-allowed; }
.seg { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius); background: rgba(255, 255, 255, 0.02); flex-wrap: wrap; }
.seg button { min-width: 36px; min-height: 32px; padding: 0 var(--sp-3); border: 0; border-radius: 8px; background: transparent; color: var(--text-secondary); font: inherit; font-size: 13px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--text-primary); box-shadow: inset 0 0 0 1px var(--accent); }
@media (max-width: 760px) {
  .cfg-head { padding: var(--sp-3) var(--sp-4); }
  .cfg-body { padding: var(--sp-2) var(--sp-4) var(--sp-4); }
  .cfg-row { grid-template-columns: minmax(0, 1fr); }
  .cfg-control { justify-content: flex-start; }
}

/* ---------- Centre de protection (onglet Protections) ---------- */
.pc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; }
.pc-title-h { margin: 0 0 var(--sp-1); font-size: 16px; }
.pc-top p { margin: 0; }
.pc-tools { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.pc-layout { display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: var(--sp-5); align-items: start; }
.pc-side { display: flex; flex-direction: column; gap: var(--sp-3); position: sticky; top: var(--sp-4); min-width: 0; }
.pc-search input { width: 100%; box-sizing: border-box; min-height: var(--control-h); }
.pc-groups { display: flex; flex-direction: column; gap: var(--sp-1); }
.pc-group { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); min-height: 40px; padding: 0 var(--sp-3); border: 1px solid transparent; border-radius: var(--radius); background: transparent; color: var(--text-secondary); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.pc-group:hover { background: rgba(255, 255, 255, 0.04); color: var(--text-primary); }
.pc-group.active { background: var(--accent-soft); border-color: rgba(65, 105, 225, 0.45); color: var(--text-primary); }
.pc-count { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.pc-total { padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius); background: rgba(255, 255, 255, 0.02); }
.pc-total-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2); font-size: 12px; color: var(--text-secondary); margin-bottom: var(--sp-2); }
.pc-total-row strong { font-size: 16px; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.pc-bar { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.pc-bar span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width 0.25s ease; }
.pc-main { min-width: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.pc-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.pc-item { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); min-height: 64px; padding: var(--sp-3) var(--sp-4); border: 1px solid rgba(255, 255, 255, 0.07); border-radius: var(--radius); background: rgba(10, 11, 14, 0.55); }
.pc-item.on { border-color: rgba(65, 105, 225, 0.35); }
.pc-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.pc-item-name { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); font-size: 14px; font-weight: 600; }
.pc-item-desc { font-size: 12px; color: var(--text-muted); }
.pc-item-side { display: flex; align-items: center; gap: var(--sp-3); flex: none; }
.pc-config { min-height: 32px; padding: 0 var(--sp-3); font-size: 12px; }
.pc-badge { padding: 1px var(--sp-2); border-radius: 999px; border: 1px solid var(--border); font-size: 11px; font-weight: 500; color: var(--text-secondary); }
.pc-badge-warn { border-color: rgba(226, 87, 79, 0.5); color: var(--danger); }
.pc-empty { padding: var(--sp-5) 0; text-align: center; }
.pc-detail { display: flex; flex-direction: column; gap: var(--sp-4); }
.pc-detail .cfg-card + .cfg-card { margin-top: 0; }
.pc-head-switch { display: flex; align-items: center; gap: var(--sp-3); }
.pc-state { font-size: 12px; color: var(--text-muted); }
.pc-state.on { color: var(--success); }
.pc-explain { font-size: 13px; color: var(--text-secondary); }
.pc-num { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: var(--sp-2); border: 1px solid var(--border-strong); border-radius: 50%; font-size: 12px; color: var(--text-secondary); }
.pc-section .pp-field { margin-bottom: var(--sp-3); }
@media (max-width: 900px) {
  .pc-layout { grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); }
  .pc-side { position: static; }
  .pc-groups { flex-direction: row; overflow-x: auto; padding-bottom: var(--sp-1); -webkit-overflow-scrolling: touch; }
  .pc-group { flex: none; }
}
@media (max-width: 560px) {
  .pc-item { flex-wrap: wrap; }
  .pc-item-side { width: 100%; justify-content: space-between; }
}

/* ---------- Configuration assistée et visite guidée ---------- */
.pg-overlay { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: var(--sp-4); background: rgba(5, 6, 8, 0.72); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.pg-modal { display: flex; flex-direction: column; width: min(760px, 100%); max-height: calc(100vh - var(--sp-5) * 2); border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55); overflow: hidden; }
.pg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); padding: var(--sp-4) var(--sp-5) var(--sp-3); }
.pg-head h2 { margin: 0; font-size: 20px; }
.pg-head p { margin: var(--sp-1) 0 0; }
.pg-steps { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--sp-2); margin: 0; padding: 0 var(--sp-5) var(--sp-3); list-style: none; font-size: 11px; color: var(--text-muted); }
.pg-steps li { display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; }
.pg-steps li.current { color: var(--text-primary); }
.pg-bar { height: 3px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); }
.pg-steps li.done .pg-bar, .pg-steps li.current .pg-bar { background: var(--accent); }
.pg-body { flex: 1; min-height: 0; overflow-y: auto; padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--border); }
.pg-body h3 { margin: 0 0 var(--sp-3); font-size: 16px; }
.pg-body .muted { margin: 0 0 var(--sp-3); }
.pg-body select { width: 100%; min-height: var(--control-h); margin-bottom: var(--sp-3); }
.pg-note { font-size: 12px; margin: var(--sp-3) 0 0; }
.pg-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--border); }
.pg-foot-r { display: flex; gap: var(--sp-2); }
.pg-review { display: flex; flex-direction: column; gap: var(--sp-3); }
.pg-group { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-2) var(--sp-3); }
.pg-group-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-height: 36px; }
.pg-conf { min-height: 28px; padding: 0 var(--sp-2); font-size: 12px; }
.pg-change { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--sp-3); min-height: 36px; border-top: 1px solid rgba(255, 255, 255, 0.05); font-size: 13px; cursor: pointer; }
.pg-change input { width: 18px; height: 18px; accent-color: var(--accent); }
.pg-change-val { font-size: 12px; text-align: right; }
.pg-spot { position: fixed; z-index: 1100; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(5, 6, 8, 0.66); outline: 2px solid var(--accent); pointer-events: none; transition: left 0.2s ease, top 0.2s ease, width 0.2s ease, height 0.2s ease; }
.pg-bubble { position: fixed; z-index: 1101; width: min(320px, calc(100vw - 24px)); padding: var(--sp-4); border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface-2); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); }
.pg-bubble-step { font-size: 12px; color: var(--accent-hover); margin-bottom: var(--sp-1); }
.pg-bubble h4 { margin: 0 0 var(--sp-2); font-size: 16px; }
.pg-bubble p { margin: 0 0 var(--sp-4); font-size: 13px; color: var(--text-secondary); }
.pg-bubble-actions { display: flex; align-items: center; gap: var(--sp-2); }
.pg-spacer { flex: 1; }
.pg-skip { background: transparent; border-color: transparent; color: var(--text-secondary); }
@media (max-width: 560px) {
  .pg-overlay { padding: 0; align-items: end; }
  .pg-modal { width: 100%; max-height: 92vh; border-radius: 14px 14px 0 0; }
  .pg-steps li > span:last-child { display: none; }
  .pg-head, .pg-body, .pg-foot, .pg-steps { padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .pg-change { grid-template-columns: auto minmax(0, 1fr); }
  .pg-change-val { grid-column: 2; text-align: left; }
}
.sec-note { margin: 0; }
.sec-note.sec-warn, .pp-limit.sec-warn { border-color: rgba(245, 166, 35, 0.55); background: rgba(245, 166, 35, 0.1); }
.sec-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.sec-stat { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: inherit; text-align: left; cursor: pointer; min-width: 0; font: inherit; }
.sec-stat:hover { border-color: rgba(65, 105, 225, 0.45); }
.sec-stat.on { border-color: rgba(65, 105, 225, 0.45); }
.sec-stat-icon { flex: 0 0 34px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--accent-soft); font-size: 17px; }
.sec-stat-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.sec-stat-text strong { font-size: 13.5px; }
.sec-stat-text small { font-size: 11.5px; line-height: 1.4; color: var(--text-muted); overflow-wrap: anywhere; }
.sec-dot { flex: 0 0 9px; width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, 0.18); }
.sec-stat.on .sec-dot { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sec-emergency { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(229, 72, 77, 0.6); background: rgba(229, 72, 77, 0.12); font-size: 13px; line-height: 1.5; }
.sec-checks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sec-check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.03); font-size: 13px; min-width: 0; }
.sec-check strong { display: block; font-weight: 600; }
.sec-check small { display: block; margin-top: 2px; font-size: 11.5px; line-height: 1.45; color: var(--text-muted); }
.sec-check.ko { border-color: rgba(245, 166, 35, 0.5); }
.sec-actions h5, .sec-diff h5, .sec-plan h5 { margin: 0 0 6px; font-size: 12px; letter-spacing: 0.6px; text-transform: uppercase; color: var(--text-secondary); }
.sec-btnrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.sec-btnrow .btn { min-height: 44px; }
.sec-create { margin: 0 0 14px; }
.sec-create .pp-text-input { flex: 1 1 200px; width: auto; }
.sec-backups { display: flex; flex-direction: column; gap: 8px; }
.sec-backup { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.03); }
.sec-backup-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 240px; font-size: 13.5px; }
.sec-backup-main small, .sec-incident-main small, .sec-item small { color: var(--text-muted); font-size: 11.5px; line-height: 1.45; }
.sec-backup-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sec-backup-actions .btn { min-height: 44px; }
.sec-compare { margin-top: 4px; }
.sec-diff { margin: 14px 0; }
.sec-item { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 8px 10px; border-radius: 10px; cursor: pointer; font-size: 13.5px; overflow-wrap: anywhere; }
.sec-item:hover { background: rgba(65, 105, 225, 0.1); }
.sec-item input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: 0 0 18px; }
.sec-item span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sec-plan { margin-top: 14px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.03); }
.sec-plan ul { margin: 0 0 8px; padding-left: 18px; font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.sec-plan code, .sec-result code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; color: #8fa8ff; background: rgba(65, 105, 225, 0.12); padding: 1px 5px; border-radius: 5px; }
.sec-result { margin-top: 10px; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.sec-result ul { margin: 6px 0 0; padding-left: 18px; }
.sec-trust-add { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 10px; align-items: start; }
.sec-trust-add select { min-height: 44px; }
.sec-trust-target { min-width: 0; }
.sec-trust-target select { width: 100%; min-height: 44px; }
.sec-trust-add .btn { min-height: 44px; }
.sec-trust-rows { display: flex; flex-direction: column; }
.sec-trust-row { display: grid; grid-template-columns: minmax(0, 1fr) 200px 90px; gap: 10px; align-items: center; min-height: 48px; padding: 6px 0; border-top: 1px solid rgba(255, 255, 255, 0.05); font-size: 13.5px; }
.sec-trust-row select, .sec-trust-row input { min-height: 40px; }
.sec-trust .pp-card-side .btn { min-height: 40px; }
.sec-filter { display: flex; align-items: center; gap: 10px; }
.sec-filter select { min-height: 42px; max-width: 280px; }
.sec-incidents { display: flex; flex-direction: column; gap: 8px; }
.sec-incident { display: flex; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.03); min-width: 0; }
.sec-incident-icon { flex: 0 0 34px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--accent-soft); font-size: 16px; }
.sec-incident-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: 13.5px; overflow-wrap: anywhere; }
.sec-incident-main code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.sec-member-search .sec-mresults { max-height: 200px; }
.sec-texts .cfg-person code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: transparent; padding: 0; }
.sec-page textarea { width: 100%; min-height: 84px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text-primary); font: inherit; font-size: 14px; resize: vertical; box-sizing: border-box; }
.sec-page textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sec-page .cfg-people { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.sec-page .cfg-person button { min-width: 28px; min-height: 28px; }
@media (max-width: 900px) {
  .sec-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sec-checks { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .sec-stats { grid-template-columns: minmax(0, 1fr); }
  .sec-trust-add { grid-template-columns: minmax(0, 1fr); }
  .sec-trust-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .sec-trust-row > span { grid-column: 1 / -1; font-weight: 600; }
  .sec-trust-row input { grid-column: 1 / -1; }
  .sec-backup-actions .btn { flex: 1 1 auto; }
  .sec-btnrow .btn { flex: 1 1 auto; }
  .sec-filter select { max-width: none; flex: 1; }
}


/* Aperçus fidèles de Discord (messages, réactions) : les emojis y restent natifs, comme sur Discord. */
/* Icônes blanches sur les boutons bleus (la palette 0 de la police est le bleu Inari). */
@font-palette-values --on-accent { font-family: "InariIcons"; override-colors: 0 #ffffff; }
.btn-primary, .btn-primary * { font-palette: --on-accent; }

/* Les boutons et champs ont leur propre police par défaut (UA) : on y ajoute InariIcons en tête, sans changer leur police de texte (system-ui). */
button, input, select, textarea, summary { font-family: "InariIcons", system-ui, sans-serif; }

.dc-msg, .preview-emoji, .preview-reaction-chip, .preview-reactions-row { font-family: var(--font-native); }

/* Actions de cybersécurité Discord (invitations / MP) */
.inc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.inc-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.02); font-size: 13.5px; flex-wrap: wrap; }
.inc-row.on { border-color: rgba(65, 105, 225, 0.5); background: var(--accent-soft); }
.inc-dot { flex: 0 0 9px; width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, 0.2); }
.inc-row.on .inc-dot { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.inc-label { font-weight: 600; }
.inc-state { margin-left: auto; color: var(--text-muted); font-size: 12.5px; text-align: right; }
.inc-tag { display: inline-block; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); border: 1px solid rgba(65, 105, 225, 0.45); font-size: 11px; color: var(--text); }
.inc-modal { max-width: 460px; max-height: 92vh; overflow-y: auto; }
.inc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.inc-head h3 { margin: 0; font-size: 18px; }
.inc-x { background: none; border: 0; color: var(--text-muted); font-size: 18px; cursor: pointer; min-width: 44px; min-height: 44px; }
.inc-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 14px; margin-top: 10px; border-radius: 12px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.02); }
.inc-item-text { min-width: 0; flex: 1; }
.inc-item-text strong { font-size: 14.5px; }
.inc-item-text p { margin: 6px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--text-muted); }
.inc-until { display: block; margin-top: 6px; font-size: 12px; }
.inc-until:empty { display: none; }
.inc-error { margin-top: 12px; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(229, 72, 77, 0.6); background: rgba(229, 72, 77, 0.12); font-size: 13px; line-height: 1.5; }
.inc-actions { display: flex; gap: 10px; margin-top: 16px; }
.inc-actions .btn { flex: 1; min-height: 44px; }
.inc-actions .btn:disabled { opacity: 0.5; cursor: not-allowed; }
@media (max-width: 640px) { .inc-state { margin-left: 0; text-align: left; flex-basis: 100%; } .inc-modal { margin: 0 12px; padding: 18px; } }


/* ---------- Pings : cooldown individuel + cooldown universel ---------- */
.ping-cd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.ping-cd {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 12px 14px 2px;
  min-width: 0;
  transition: border-color 0.15s ease;
}
.ping-cd.is-on { border-color: var(--accent); }
.ping-cd .toggle { margin-bottom: 6px; }
.ping-cd-hint {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-secondary);
}
.ping-cd .field input[type="number"]:disabled { opacity: 0.5; cursor: not-allowed; }
@media (max-width: 640px) {
  .ping-cd-grid { grid-template-columns: 1fr; }
}

.ping-slots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 430px), 1fr));
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}
.ping-slots .section-block { margin-bottom: 0; }


/* Noms de salons, de rôles et de catégories : texte du serveur, pas du produit. Leurs emojis restent ceux de Discord (couleur d'origine) :
   la police d'icônes d'Inari ne doit pas les remplacer, sinon on ne reconnaît plus le salon qu'on cherche. */
option[translate="no"], optgroup[translate="no"], select:has(option[translate="no"]), .cfg-person, .cfg-people, .chip, .pp-opt, .pp-opt span, .auto-pick-grid {
  font-family: var(--font-native);
}
/* Menu de salons : catégorie = ligne en gras avec filet, salons en retrait dessous. */
select option.opt-cat { font-weight: 700; letter-spacing: .02em; text-transform: uppercase; font-size: .86em; }
select option.opt-child { font-weight: 400; }

/* Sécurité › Messages et filtres */
.mp-root { min-width: 0; }
.mp-jump { display: flex; gap: 8px; margin: 0 0 -8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.mp-jump::-webkit-scrollbar { display: none; }
.mp-jump .btn { padding: 6px 12px; font-size: 12px; flex: 0 0 auto; white-space: nowrap; }
.mp-sub { margin: 0 0 10px; font-size: 12px; letter-spacing: .6px; text-transform: uppercase; color: var(--text-secondary); font-weight: 600; }
.mp-recap { margin-top: var(--sp-4); }
.mp-recap-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 18px; }
.mp-recap-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border, rgba(255,255,255,.07)); font-size: 13px; }
.mp-recap-name { background: none; border: 0; padding: 0; color: var(--accent, #4169E1); font: inherit; cursor: pointer; text-align: left; }
.mp-recap-name:hover { text-decoration: underline; }
.mp-flash { animation: mp-flash 1.4s ease; }
@keyframes mp-flash { 0%, 100% { box-shadow: none; } 25% { box-shadow: 0 0 0 2px #4169E1; } }
.pc-moved { margin-top: 6px !important; font-size: 12.5px; }
.pc-moved a { color: var(--accent, #4169E1); }
@media (prefers-reduced-motion: reduce) { .mp-flash { animation: none; } }

/* ==========================================================================
   ✨ CONFIGURATION GUIDÉE (setup-wizard-ui.js) et 🆕 NOUVEAUTÉS (whats-new-ui.js)
   Fenêtre centrée sur ordinateur, plein écran sur téléphone ; seul le contenu défile (jamais la page en largeur).
   ========================================================================== */
.btn-setup { border-color: var(--accent); background: linear-gradient(135deg, rgba(65, 105, 225, 0.32), rgba(123, 147, 234, 0.18)); color: var(--text-primary); }
.btn-setup:hover { background: var(--accent); color: #fff; }
@media (max-width: 900px) {
  .topbar .btn-setup, .topbar #whats-new-btn { width: 36px; min-width: 36px; height: 36px; padding: 0; justify-content: center; gap: 0; }
  .topbar .btn-setup .btn-label-full, .topbar #whats-new-btn .btn-label-full { display: none !important; }
}
@media (max-width: 420px) { .topbar #whats-new-btn { display: none; } }
body.wz-open { overflow: hidden; }

.wz-overlay, .wn-overlay { position: fixed; inset: 0; z-index: 120; background: rgba(0, 0, 0, 0.66); display: flex; align-items: center; justify-content: center; padding: 16px; }
.wz-modal { position: relative; width: 100%; max-width: 980px; height: min(92vh, 900px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 16px; box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55); overflow: hidden; }
.wz-loading { margin: auto; padding: 40px; text-align: center; color: var(--text-secondary); line-height: 1.8; }
.wz-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.wz-title-wrap { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.wz-head h2 { margin: 0; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wz-saved { font-size: 12px; color: var(--success); opacity: 0; transition: opacity 0.2s; }
.wz-saved.show { opacity: 1; }
.wz-steps { display: flex; gap: 6px; padding: 10px 18px 6px; overflow-x: auto; scrollbar-width: thin; }
.wz-step { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--text-muted); font: inherit; font-size: 12.5px; cursor: pointer; }
.wz-step:disabled { cursor: default; }
.wz-step.current { border-color: var(--accent); background: var(--accent-soft); color: var(--text-primary); font-weight: 600; }
.wz-step.done { color: var(--text-secondary); border-color: var(--border-strong); }
.wz-step.done .wz-step-icon::after { content: " ✓"; color: var(--success); }
.wz-step.skipped { color: var(--text-muted); border-style: dashed; }
.wz-step small { font-size: 10.5px; opacity: 0.8; }
.wz-progress { height: 4px; margin: 0 18px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.wz-progress > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--ember)); transition: width 0.3s ease; }
.wz-progress.big { height: 10px; margin: 12px 0; }
.wz-body { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding: 16px 18px 24px; display: flex; flex-direction: column; gap: 12px; }
.wz-intro h3 { margin: 0 0 4px; font-size: 16px; }
.wz-intro p { margin: 0; font-size: 13px; line-height: 1.55; }
.wz-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface); }
.wz-foot-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.wz-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; min-width: 0; }
/* Import d'un modèle Discord par lien (Premium) */
.wz-import { margin: 12px 0; border-color: rgba(240, 178, 50, 0.35); }
.wz-import-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wz-import p { margin: 6px 0; font-size: 13px; }
.wz-import-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.wz-import-row input { flex: 1 1 240px; min-width: 0; }
.wz-import-hint { font-size: 12px; }
.wz-import-error { color: #ffb3b3; }
.wz-import-result { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.wz-import-warn { color: #ffd27a; }
.wz-import-notes { margin: 4px 0 8px; padding-left: 18px; font-size: 12.5px; color: var(--text-secondary); }
.wz-card > summary { cursor: pointer; font-weight: 600; font-size: 13.5px; }
.wz-card h4 { margin: 0 0 8px; font-size: 14px; }
.wz-card h5 { margin: 10px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.wz-card ul { margin: 6px 0 0; padding-left: 18px; line-height: 1.6; font-size: 13px; overflow-wrap: anywhere; }
.wz-card.off { opacity: 0.55; }
.wz-banner { padding: 10px 12px; border-radius: 10px; font-size: 13px; line-height: 1.5; border: 1px solid var(--border-strong); background: var(--surface-2); }
.wz-banner.info { border-color: rgba(65, 105, 225, 0.5); background: var(--accent-soft); }
.wz-banner.ok { border-color: rgba(76, 175, 125, 0.5); background: var(--success-soft); }
.wz-banner.warn { border-color: rgba(240, 180, 60, 0.55); background: rgba(240, 180, 60, 0.12); }
.wz-banner.danger { border-color: rgba(226, 87, 79, 0.55); background: var(--danger-soft); }
.wz-overlay .link-btn { background: none; border: none; padding: 0; color: var(--ember); font: inherit; font-size: 12.5px; text-decoration: underline; cursor: pointer; }
.wz-pill { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; border: 1px solid var(--border-strong); color: var(--text-secondary); white-space: nowrap; }
.wz-pill.ok { color: var(--success); border-color: rgba(76, 175, 125, 0.5); }
.wz-pill.info { color: var(--ember); border-color: rgba(123, 147, 234, 0.5); }
.wz-pill.danger { color: var(--danger); border-color: rgba(226, 87, 79, 0.5); }
.wz-pill.muted { color: var(--text-muted); }
.wz-server p { margin: 6px 0 0; font-size: 13px; }
.wz-templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.wz-template { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; padding: 14px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-primary); font: inherit; cursor: pointer; min-height: 120px; }
.wz-template:hover { border-color: var(--ember); }
.wz-template.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.wz-template-icon { font-size: 24px; }
.wz-template .muted { font-size: 12.5px; line-height: 1.45; }
.wz-inline-field { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0; }
.wz-inline-field label { margin: 0; font-size: 13px; }
.wz-overlay select, .wz-overlay input[type="text"], .wz-overlay input[type="number"] { height: 36px; padding: 0 10px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; color: var(--text-primary); font: inherit; font-size: 13px; min-width: 0; max-width: 100%; }
.wz-overlay select:focus, .wz-overlay input:focus { outline: none; border-color: var(--accent); }
.wz-overlay input[type="color"] { width: 36px; height: 36px; padding: 2px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); flex: 0 0 auto; }
.wz-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.wz-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border-strong); font-size: 12.5px; cursor: pointer; }
.wz-chip.on { border-color: var(--accent); background: var(--accent-soft); }
.wz-check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; line-height: 1.45; margin: 4px 0; cursor: pointer; }
.wz-check input { margin-top: 2px; flex: 0 0 auto; }
.wz-check.sensitive { color: #f0b43c; }
.wz-check.critical { color: var(--danger); }
.wz-confirm { margin-top: 10px; padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(240, 180, 60, 0.5); background: rgba(240, 180, 60, 0.1); }
.wz-confirm.danger { border-color: rgba(226, 87, 79, 0.6); background: var(--danger-soft); }
.wz-confirm.needed { box-shadow: 0 0 0 1px rgba(240, 180, 60, 0.6) inset; }
.wz-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.wz-name { flex: 1 1 180px; }
.wz-tools { display: flex; gap: 4px; margin-left: auto; }
.wz-icon-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-secondary); cursor: pointer; font-size: 14px; }
.wz-icon-btn:hover { color: var(--text-primary); border-color: var(--ember); }
.wz-icon-btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.wz-switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: 0 0 auto; }
.wz-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.wz-switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--border-strong); transition: background 0.15s; }
.wz-switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.wz-switch input:checked + span { background: var(--accent); }
.wz-switch input:checked + span::after { transform: translateX(16px); }
.wz-switch input:focus-visible + span { box-shadow: 0 0 0 2px var(--ember); }
.wz-cat-head { margin-bottom: 6px; }
.wz-channels { list-style: none; margin: 8px 0 0; padding: 0 0 0 12px; border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.wz-ch { padding: 6px 0; }
.wz-ch.off { opacity: 0.5; }
.wz-type { width: 22px; text-align: center; color: var(--text-muted); flex: 0 0 auto; }
.wz-add-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.wz-decision { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; width: 100%; margin-top: 6px; padding: 6px 8px; border-radius: 8px; background: rgba(123, 147, 234, 0.08); font-size: 12.5px; }
.wz-decision.ask { background: rgba(240, 180, 60, 0.14); box-shadow: 0 0 0 1px rgba(240, 180, 60, 0.55) inset; }
.wz-match { color: var(--text-secondary); overflow-wrap: anywhere; }
.wz-segs { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.wz-seg { border: none; background: transparent; color: var(--text-secondary); padding: 5px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.wz-seg + .wz-seg { border-left: 1px solid var(--border-strong); }
.wz-seg.on { background: var(--accent); color: #fff; }
.wz-existing ul ul { padding-left: 16px; }
.wz-legend { font-size: 12.5px; margin: 0; }
.wz-role-opts { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 8px; }
.wz-pos { min-width: 22px; height: 22px; display: inline-grid; place-items: center; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); font-size: 11.5px; color: var(--text-muted); }
.wz-perms { margin-top: 8px; }
.wz-perms summary { cursor: pointer; font-size: 13px; color: var(--text-secondary); }
.wz-perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 12px; }
.wz-adv-toggle { margin: 0; }
.wz-error { color: var(--danger); font-size: 12.5px; margin: 8px 0 0; }
.wz-matrix-wrap { overflow-x: auto; margin-top: 8px; border-radius: 8px; border: 1px solid var(--border); }
.wz-matrix { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 560px; }
.wz-matrix th, .wz-matrix td { padding: 6px 8px; text-align: center; border-bottom: 1px solid var(--border); white-space: nowrap; }
.wz-matrix thead th { color: var(--text-muted); font-weight: 600; background: var(--surface); }
.wz-matrix tbody th { text-align: left; font-weight: 600; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.wz-matrix td.yes { color: var(--success); font-weight: 700; }
.wz-matrix td.no { color: var(--danger); opacity: 0.85; }
.wz-matrix td.na { color: var(--text-muted); }
.wz-matrix tr.bot th { color: var(--ember); }
.wz-perm-item.cat { border-color: var(--border-strong); }
.wz-issues { list-style: none; padding-left: 0 !important; }
.wz-issue.error { color: #ff9a9a; }
.wz-issue.warning { color: #f0c46c; }
.wz-adv { margin-top: 8px; padding: 10px; border-radius: 8px; border: 1px dashed var(--border-strong); }
.wz-rules { list-style: none; padding-left: 0 !important; }
.wz-rules .allow { color: var(--success); }
.wz-rules .deny { color: var(--danger); }
.wz-adv-add { margin-top: 8px; }
.wz-features { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.wz-feature p { margin: 2px 0 0; font-size: 12.5px; line-height: 1.45; }
.wz-feature.on { border-color: rgba(65, 105, 225, 0.6); }
.wz-feature-body { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.wz-feature-body .field { margin: 0; }
.wz-feature-body .field select { width: 100%; }
.wz-cmd input:first-child { flex: 0 1 120px; }
.wz-cmd input:nth-child(2) { flex: 1 1 160px; }
.wz-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.wz-tile { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.wz-tile strong { font-size: 22px; }
.wz-tile span { font-size: 12px; color: var(--text-muted); }
.wz-ops { margin: 0; font-size: 13px; color: var(--text-secondary); }
.wz-block.danger { border-color: rgba(226, 87, 79, 0.55); }
.wz-block.warn { border-color: rgba(240, 180, 60, 0.5); }
.wz-tree { list-style: none; padding-left: 0 !important; }
.wz-tree ul { list-style: none; padding-left: 18px; }
.wz-notes { list-style: none; padding-left: 0 !important; color: var(--text-secondary); }
.wz-confirm-box { border-color: var(--accent); }
.wz-log { list-style: none; margin: 8px 0 0; padding: 0; font-size: 12.5px; max-height: 320px; overflow-y: auto; }
.wz-log li { padding: 3px 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.wz-log li.error { color: #ff9a9a; }
.wz-log li.success { color: var(--text-primary); }
.wz-log time { color: var(--text-muted); margin-right: 6px; font-variant-numeric: tabular-nums; }
.wz-dialog-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 2; }
.wz-dialog { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; padding: 20px; }
.wz-dialog h3 { margin: 0 0 8px; font-size: 16px; }
.wz-dialog p { margin: 0 0 16px; color: var(--text-secondary); font-size: 13.5px; line-height: 1.55; }
.wz-dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

.wn-modal { width: 100%; max-width: 620px; max-height: 86vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 16px; box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55); overflow: hidden; }
.wn-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.wn-head h2 { margin: 0; font-size: 18px; }
.wn-body { overflow-y: auto; padding: 8px 18px 18px; }
.wn-entry { padding: 14px 0; border-bottom: 1px solid var(--border); }
.wn-entry:last-child { border-bottom: none; }
.wn-entry header { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.wn-entry h3 { margin: 0; font-size: 15.5px; }
.wn-version { padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border-strong); font-size: 11.5px; color: var(--text-secondary); }
.wn-version.current { border-color: var(--accent); color: var(--text-primary); background: var(--accent-soft); }
.wn-entry time { font-size: 12px; color: var(--text-muted); }
.wn-entry h4 { margin: 12px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ember); }
.wn-entry ul { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.6; color: var(--text-secondary); }
.wn-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); }

@media (max-width: 700px) {
  .wz-overlay, .wn-overlay { padding: 0; align-items: stretch; }
  .wz-modal, .wn-modal { max-width: none; height: 100%; max-height: none; border-radius: 0; border: none; }
  .wz-head, .wz-foot, .wn-head, .wn-foot { padding-left: 16px; padding-right: 16px; }
  .wz-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .wz-body { padding: 12px 16px 20px; }
  .wz-steps { padding: 8px 16px 6px; }
  .wz-step-label { display: none; }
  .wz-step.current .wz-step-label { display: inline; }
  .wz-progress { margin: 0 16px; }
  .wz-hide-sm { display: none; }
  .wz-templates { grid-template-columns: 1fr 1fr; }
  .wz-template { min-height: 0; }
  .wz-row > select { flex: 1 1 140px; }
  .wz-tools { margin-left: 0; }
  .wz-features, .wz-perm-grid { grid-template-columns: 1fr; }
  .wz-foot .btn, .wz-dialog-actions .btn { min-height: 44px; }
  .wz-overlay select, .wz-overlay input[type="text"], .wz-overlay input[type="number"] { font-size: 16px; min-height: 40px; }
}
@media (max-width: 380px) { .wz-templates { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .wz-progress > div, .wz-switch span, .wz-switch span::after { transition: none; } }

/* — Assistant plein écran : parcours à gauche, contenu à droite (setup-wizard-ui.js, classe wz-full) — */
.wz-overlay.wz-full { padding: 0; align-items: stretch; background: rgba(5, 6, 9, 0.82); backdrop-filter: blur(4px); }
.wz-overlay.wz-full .wz-modal { max-width: none; width: 100%; height: 100%; max-height: none; border-radius: 0; border: none; display: grid; grid-template-columns: 260px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); background: var(--bg); }
.wz-full .wz-head { grid-column: 1 / -1; background: var(--surface); }
.wz-full .wz-title-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; }
.wz-guild { font-size: 12.5px; color: var(--text-secondary); padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.wz-full .wz-steps { flex-direction: column; align-items: stretch; gap: 4px; padding: 18px 14px; overflow-y: auto; overflow-x: hidden; border-right: 1px solid var(--border); background: var(--surface); }
.wz-full .wz-steps .wz-progress { margin: 0 4px 12px; }
.wz-full .wz-step { border-radius: 10px; padding: 10px 12px; justify-content: flex-start; border-color: transparent; font-size: 13.5px; }
.wz-full .wz-step.current { background: var(--accent-soft); border-color: var(--accent); color: var(--text-primary); }
.wz-full .wz-step.done { color: var(--text-secondary); }
.wz-step-num { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); font-size: 11.5px; font-weight: 700; flex: 0 0 auto; }
.wz-step.current .wz-step-num { background: var(--accent); color: #fff; }
.wz-step.done .wz-step-num { background: var(--success-soft); color: var(--success); }
.wz-full .wz-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.wz-full .wz-body { padding: 22px 28px 32px; }
.wz-full .wz-body > * { width: 100%; max-width: 1180px; margin-left: auto; margin-right: auto; }
.wz-full .wz-foot { padding: 12px 28px; }

/* — États des éléments (existant · à créer · à relier · à trancher · ignoré · erreur) — */
.wz-state { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; flex: 0 0 auto; }
.wz-state.create { background: var(--success-soft); color: var(--success); }
.wz-state.existing { background: var(--accent-soft); color: #9db4ff; }
.wz-state.modify { background: rgba(240, 178, 50, 0.16); color: #f0b232; }
.wz-state.ask { background: rgba(240, 178, 50, 0.1); color: #f0b232; border-color: rgba(240, 178, 50, 0.45); }
.wz-state.skip { background: var(--surface-2); color: var(--text-muted); }
.wz-state.error { background: var(--danger-soft); color: var(--danger); }
.wz-legend-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; font-size: 12.5px; color: var(--text-secondary); }
.wz-pill.premium { background: linear-gradient(90deg, rgba(240, 178, 50, 0.22), rgba(226, 69, 93, 0.22)); color: #ffd27a; border: 1px solid rgba(240, 178, 50, 0.4); }
.wz-template { position: relative; }
.wz-template.locked { opacity: 0.78; }
.wz-template.locked::after { content: "🔒"; position: absolute; top: 10px; right: 12px; font-size: 14px; }

/* — Fonctionnalités : cartes groupées et ressources proposées — */
.wz-group-title { margin: 10px 0 0; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.wz-feature-icon { font-size: 20px; line-height: 1; flex: 0 0 auto; }
.wz-feature.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft) inset; }
.wz-ref label { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wz-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wz-sub { border: 1px dashed var(--border); border-radius: 10px; padding: 8px 10px; }
.wz-sub > summary { cursor: pointer; font-size: 12.5px; color: var(--text-secondary); }
.wz-resources { border-top: 1px solid var(--border); padding-top: 8px; }
.wz-res-title { margin: 0 0 6px; font-size: 12.5px; font-weight: 600; }
.wz-resources ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.wz-resources li { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wz-resources li .wz-name { flex: 1 1 160px; }
.wz-res-hint { font-size: 11.5px; margin: 6px 0 0; }
.wz-overlay textarea { width: 100%; padding: 8px 10px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; color: var(--text-primary); font: inherit; font-size: 13px; resize: vertical; }

/* — Structure : aperçu façon Discord + panneau de réglages — */
.wz-structure { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.wz-discord { background: #2b2d31; border: 1px solid #1e1f22; border-radius: 12px; padding: 0 0 12px; color: #dbdee1; overflow: hidden; }
.dc-server { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; font-weight: 700; color: #f2f3f5; border-bottom: 1px solid #1e1f22; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2); }
.dc-tree, .dc-channels { list-style: none; margin: 0; padding: 0; }
.dc-tree { padding: 6px 8px; }
.dc-cat { margin-top: 10px; border-radius: 8px; }
.dc-cat-head { display: flex; align-items: center; gap: 4px; padding: 2px 4px; font-size: 12px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; color: #949ba4; border-radius: 6px; }
.dc-cat-head:hover, .dc-ch:hover { background: rgba(78, 80, 88, 0.3); }
.dc-cat-tools { margin-left: auto; display: inline-flex; gap: 2px; opacity: 0.75; }
.dc-cat-tools .wz-icon-btn, .dc-ch .wz-icon-btn { width: auto; min-width: 30px; height: 28px; padding: 0 6px; white-space: nowrap; font-size: 12px; }
.wz-overlay .wz-emoji::placeholder { color: #5c5f66; opacity: 1; }
.dc-channels { padding-left: 10px; min-height: 8px; }
.dc-ch { display: flex; align-items: center; gap: 6px; margin: 1px 0; padding: 3px 6px; border-radius: 6px; color: #b5bac1; }
.dc-ch.selected, .dc-cat.selected > .dc-cat-head { background: rgba(78, 80, 88, 0.6); color: #f2f3f5; }
.dc-ch.off, .dc-cat.off > .dc-cat-head { opacity: 0.45; text-decoration: line-through; }
.dc-icon { width: 20px; text-align: center; color: #80848e; flex: 0 0 auto; }
.dc-grip { cursor: grab; color: #5c5f66; font-size: 11px; letter-spacing: -2px; user-select: none; flex: 0 0 auto; }
.dc-caret { font-size: 10px; flex: 0 0 auto; }
.dc-empty { font-size: 12px; padding: 4px 8px; font-style: italic; }
.wz-discord .wz-emoji, .wz-role-list .wz-emoji { width: 42px; flex: 0 0 42px; text-align: center; padding: 0 4px; }
.wz-discord input[type="text"] { height: 28px; background: transparent; border-color: transparent; color: inherit; font-size: 13px; }
.wz-discord input[type="text"]:hover { border-color: #3f4147; }
.wz-discord input[type="text"]:focus { background: #1e1f22; border-color: var(--accent); }
.wz-discord .wz-name { flex: 1 1 120px; }
.dc-cat-head .wz-name { text-transform: uppercase; font-weight: 700; font-size: 12px; }
.wz-discord .wz-icon-btn { color: #b5bac1; }
.wz-add-cat { margin: 10px 12px 0; }
.dragging { opacity: 0.4; }
.drop-before { box-shadow: 0 -2px 0 0 var(--accent) inset, 0 -2px 0 0 var(--accent); }
.drop-after { box-shadow: 0 2px 0 0 var(--accent); }
.drop-into { outline: 2px dashed var(--accent); outline-offset: 2px; }
.wz-inspector { position: sticky; top: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 220px); overflow-y: auto; }
.wz-inspector-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wz-inspector .field { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.wz-inspector-tools { flex-wrap: wrap; }
.wz-used { margin: 0; font-size: 12.5px; color: #f0b232; }

/* — Rôles : hiérarchie — */
.wz-role-bot { padding: 8px 12px; border: 1px dashed var(--border-strong); border-radius: 10px; font-size: 13px; }
.wz-role-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.wz-role-row { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.wz-role-row.off { opacity: 0.55; }
.wz-role-head { flex-wrap: wrap; }
.wz-role-head .wz-name { flex: 1 1 140px; }
.wz-role-name { flex: 1 1 140px; }

/* — Permissions : simulation « voir en tant que » — */
.wz-sim .wz-row { flex-wrap: wrap; }
.wz-sim-table tr.cat th { font-weight: 700; text-transform: uppercase; font-size: 11.5px; letter-spacing: 0.03em; }
.wz-sim-table tr.hidden-row th { opacity: 0.55; }
.wz-perm-group > summary { cursor: pointer; font-weight: 600; }
.wz-perm-group .wz-perm-item { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }

@media (max-width: 1100px) {
  .wz-structure { grid-template-columns: 1fr; }
  .wz-inspector { position: static; max-height: none; }
}
@media (max-width: 900px) {
  .wz-overlay.wz-full .wz-modal { display: flex; flex-direction: column; }
  .wz-full .wz-steps { flex-direction: row; overflow-x: auto; overflow-y: hidden; border-right: none; border-bottom: 1px solid var(--border); padding: 8px 12px; flex: 0 0 auto; }
  .wz-full .wz-steps .wz-progress { display: none; }
  .wz-full .wz-step { flex: 0 0 auto; padding: 6px 10px; }
  .wz-full .wz-main { flex: 1 1 auto; }
  .wz-full .wz-body { padding: 14px 16px 24px; }
  .wz-full .wz-foot { padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
  .wz-guild { display: none; }
  .wz-grid-2 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .wz-overlay.wz-full { backdrop-filter: none; } }

/* — Configuration guidée 2.6 : modes Rapide / Avancé, aperçu en direct, cartes simples, « Personnaliser » (setup-wizard-ui.js) — */
.wz-head-tools { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.wz-mode { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface-2); }
.wz-mode-btn { border: none; background: transparent; color: var(--text-secondary); font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.wz-mode-btn.on { background: var(--accent); color: #fff; }
.wz-mode-btn:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }
.wz-quick-note { margin: 10px 4px 0; font-size: 12px; line-height: 1.5; color: var(--text-muted); }

/* Deux colonnes : contenu à gauche, aperçu du serveur à droite (une seule colonne sur téléphone et tablette). */
.wz-full .wz-body > .wz-split { max-width: 1320px; }
.wz-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 400px); gap: 18px; align-items: start; }
.wz-split-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.wz-split-side { position: sticky; top: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }

/* Liste des modèles */
.wz-tpl-list { display: grid; gap: 8px; }
.wz-tpl { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-primary); font: inherit; cursor: pointer; }
.wz-tpl:hover { border-color: var(--ember); }
.wz-tpl.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.wz-tpl.locked { opacity: 0.85; }
.wz-tpl:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }
.wz-tpl .wz-template-icon { font-size: 24px; flex: 0 0 auto; }
.wz-tpl-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.wz-tpl-text .muted { font-size: 12.5px; line-height: 1.45; }
.wz-tpl-stats { font-size: 11.5px; color: var(--ember); font-weight: 600; }

/* Aperçu du serveur, façon Discord (lecture seule, toujours à jour) */
.wz-live { background: #2b2d31; border: 1px solid #1e1f22; border-radius: 12px; color: #dbdee1; overflow: hidden; max-height: calc(100vh - 230px); display: flex; flex-direction: column; }
.wz-live-empty { padding: 40px 16px; text-align: center; }
.wz-live-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid #1e1f22; color: #f2f3f5; }
.wz-live-sync { font-size: 11.5px; }
.wz-live-stats { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 8px 14px; font-size: 12px; color: #b5bac1; border-bottom: 1px solid #1e1f22; }
.wz-live-stats strong { color: #f2f3f5; }
.wz-live-tree, .wz-live-tree ul, .wz-live-roles ul, .wz-live-legend { list-style: none; margin: 0; padding: 0; }
.wz-live-tree { padding: 4px 8px 10px; overflow-y: auto; flex: 1 1 auto; }
.wz-live-cat { margin-top: 10px; }
.wz-live-cat-head { display: flex; align-items: center; gap: 6px; width: 100%; padding: 3px 4px; border: none; background: transparent; color: #949ba4; font: inherit; font-size: 11.5px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; text-align: left; border-radius: 4px; cursor: pointer; }
.wz-live-cat-head:hover { background: rgba(78, 80, 88, 0.3); color: #dbdee1; }
.wz-live-cat-head:focus-visible { outline: 2px solid var(--ember); }
.wz-live-count { margin-left: auto; font-weight: 600; }
.wz-live-ch { display: flex; align-items: center; gap: 6px; padding: 3px 6px 3px 14px; border-radius: 4px; font-size: 13.5px; color: #b5bac1; border-left: 3px solid transparent; }
.wz-live-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; }
.wz-live-feats { font-size: 11px; letter-spacing: 1px; opacity: 0.85; flex: 0 0 auto; }
.wz-live-roles { padding: 8px 14px 4px; border-top: 1px solid #1e1f22; max-height: 180px; overflow-y: auto; }
.wz-live-sub { margin: 0 0 6px; font-size: 11.5px; font-weight: 700; color: #949ba4; text-transform: uppercase; letter-spacing: 0.02em; }
.wz-live-roles li { display: flex; align-items: center; gap: 6px; padding: 2px 0; font-size: 13px; }
.wz-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.wz-live-legend { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 14px 12px; border-top: 1px solid #1e1f22; }
/* Origine d'un élément : barre de couleur + pastille (le texte de la pastille rend l'information lisible sans la couleur). */
.wz-orig { display: inline-block; padding: 0 6px; border-radius: 999px; font-size: 10.5px; font-weight: 700; white-space: nowrap; border: 1px solid transparent; flex: 0 0 auto; }
.wz-orig.template { background: rgba(148, 155, 164, 0.16); color: #c4c9d0; }
.wz-orig.auto { background: rgba(76, 175, 125, 0.18); color: #6fdba2; }
.wz-orig.custom { background: rgba(167, 112, 255, 0.18); color: #c7a6ff; }
.wz-orig.existing { background: rgba(65, 105, 225, 0.22); color: #a9bfff; }
.wz-orig.shared { background: rgba(240, 178, 50, 0.18); color: #f3c766; }
.wz-orig.ask { background: rgba(240, 178, 50, 0.1); color: #f3c766; border-color: rgba(240, 178, 50, 0.45); }
.wz-live-ch.auto { border-left-color: #4caf7d; }
.wz-live-ch.custom { border-left-color: #a770ff; }
.wz-live-ch.existing { border-left-color: #4169e1; }
.wz-live-ch.shared { border-left-color: #f0b232; }
.wz-live-ch.ask { border-left-color: #f0b232; border-left-style: dashed; }

/* Cartes de fonctionnalités : icône, nom, description courte, interrupteur, « Personnaliser » */
.wz-fcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.wz-fcard { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "icon text" "actions actions"; gap: 8px 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.wz-fcard.on { border-color: rgba(76, 175, 125, 0.55); background: linear-gradient(135deg, rgba(76, 175, 125, 0.08), var(--surface-2)); }
.wz-fcard .wz-feature-icon { grid-area: icon; font-size: 22px; line-height: 1.2; }
.wz-fcard-text { grid-area: text; min-width: 0; }
.wz-fcard-text p { margin: 2px 0 0; font-size: 12.5px; line-height: 1.45; }
.wz-fcard-actions { grid-area: actions; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wz-fstatus { color: var(--success) !important; font-weight: 600; font-size: 12px !important; margin-top: 6px !important; }
.wz-fstatus.warn { color: #f0b232 !important; }
.wz-not-covered { font-size: 12.5px; line-height: 1.5; }

/* Panneau « Personnaliser » : à droite sur ordinateur, plein écran sur téléphone */
.wz-drawer-backdrop { position: fixed; inset: 0; z-index: 130; background: rgba(0, 0, 0, 0.5); }
.wz-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 131; width: min(520px, 100vw); display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--border-strong); box-shadow: -18px 0 60px rgba(0, 0, 0, 0.45); }
.wz-drawer:focus { outline: none; }
/* Le panneau et son fond sont des enfants directs du contenu : la largeur centrée du contenu ne s'applique pas à eux. */
.wz-full .wz-body > .wz-drawer { width: min(520px, 100vw); max-width: none; margin: 0; }
.wz-full .wz-body > .wz-drawer-backdrop { width: auto; max-width: none; margin: 0; }
.wz-drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.wz-drawer-head h3 { margin: 0; font-size: 16px; }
.wz-drawer-body { flex: 1 1 auto; overflow-y: auto; padding: 14px 18px 24px; display: flex; flex-direction: column; gap: 10px; }
.wz-drawer-body .field { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.wz-drawer-body textarea, .wz-drawer-body input[type="text"], .wz-drawer-body select { width: 100%; }
.wz-drawer-foot { display: flex; justify-content: flex-end; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }
.wz-vars { font-size: 12px; margin: -4px 0 0; }
.wz-vars code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

/* Profils de protection */
.wz-levels { display: grid; gap: 8px; }
.wz-level { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "radio name" "radio desc"; gap: 2px 10px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 10px; cursor: pointer; }
.wz-level input { grid-area: radio; margin-top: 3px; }
.wz-level strong { grid-area: name; }
.wz-level .muted { grid-area: desc; font-size: 12.5px; line-height: 1.45; }
.wz-level.on { border-color: var(--accent); background: var(--accent-soft); }

/* Vérification et bilan */
.wz-decision-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 6px 0; border-top: 1px solid var(--border); }
.wz-decision-row:first-of-type { border-top: none; }
.wz-ready { list-style: none; padding: 0 !important; }
.wz-ready li { padding: 4px 0; border-bottom: 1px solid var(--border); }
.wz-ready li.action { color: #f3c766; }
.wz-ready li.error { color: var(--danger); }

@media (max-width: 1100px) {
  .wz-split { grid-template-columns: minmax(0, 1fr); }
  .wz-split-side { position: static; }
  .wz-live { max-height: none; }
  .wz-live-tree { max-height: 60vh; }
}
@media (max-width: 900px) {
  .wz-head { flex-wrap: wrap; }
  .wz-head-tools { width: 100%; justify-content: space-between; }
  .wz-quick-note { display: none; }
  .wz-fcards { grid-template-columns: minmax(0, 1fr); }
  .wz-drawer { width: 100vw; border-left: none; }
}

/* Rôles d'activité : avertissement en ligne (historique incomplet). */
.warn-inline { color: #f0b232; line-height: 1.6; }

/* Commandes avec préfixe (prefix-commands-ui.js) */
.pc-commands { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.pc-command { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; background: var(--surface-2); }
.pc-command.off { opacity: .55; }
.pc-command code, .pc-examples code { white-space: pre-wrap; word-break: break-word; }
.pc-examples { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.pc-examples > div { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px dashed var(--border); border-radius: var(--radius); }
@media (max-width: 600px) { .pc-commands, .pc-examples { grid-template-columns: 1fr; } }

/* Inari Premium (premium-ui.js) */
.pm-hero { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; background: linear-gradient(120deg, rgba(240, 178, 50, 0.12), rgba(65, 105, 225, 0.12)); }
.pm-plan { margin: 0; font-size: 20px; font-weight: 800; }
.pm-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pm-pending { border-color: #f0b232; }
.pm-facts, .pm-guilds { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pm-facts li, .pm-guilds li { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.pm-facts li span { color: var(--text-secondary); }
.pm-guilds li span[translate] { flex: 1 1 140px; font-weight: 600; }
.pm-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.pm-badge.ok { background: rgba(240, 178, 50, 0.18); color: #ffd27a; }
.pm-badge.off { background: var(--surface-2); color: var(--text-muted); }
.pm-table-wrap { overflow-x: auto; }
.pm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pm-table th, .pm-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.pm-table .num { text-align: right; }
.pm-table tr.over td { color: #f0b232; }
/* Formules Premium (espace abonné) et options verrouillées */
.pm-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.pm-plan-card { border: 1px solid var(--border); border-radius: 14px; padding: 16px; background: var(--surface-2); display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.pm-plan-card.featured { border-color: rgba(240, 178, 50, 0.55); }
.pm-plan-card.current { opacity: 0.85; }
.pm-plan-name { margin: 0; font-weight: 800; font-size: 15px; }
.pm-plan-price { margin: 0; font-size: 24px; font-weight: 800; }
.pm-plan-price small { font-size: 12.5px; font-weight: 500; color: var(--text-secondary); }
.pm-keep-box { margin-top: 12px; padding: 12px 14px; border: 1px solid rgba(240, 178, 50, 0.45); border-radius: 12px; }
.pm-keep-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13.5px; cursor: pointer; }
/* Quotas en cartes (espace Premium) */
.pm-quotas { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.pm-quota { border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--surface-2); min-width: 0; }
.pm-quota-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.pm-quota-head span { min-width: 0; }
.pm-bar { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); margin: 8px 0; overflow: hidden; }
.pm-bar span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.pm-quota.near .pm-bar span { background: #f0b232; }
.pm-quota.full .pm-bar span, .pm-quota.over .pm-bar span { background: #f0b232; }
.pm-quota.over { border-color: rgba(240, 178, 50, 0.55); }
.pm-quota-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; flex-wrap: wrap; }
.pm-select { margin-top: 8px; font-size: 12.5px; }
.pm-select summary { cursor: pointer; color: #ffd27a; }
.pm-select-item { display: flex; align-items: center; gap: 6px; padding: 3px 0; }
.pm-unlocks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.pm-unlock { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); }
.pm-unlock.on { color: #ffd27a; background: rgba(240, 178, 50, 0.14); }
.pm-lock { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 12.5px; color: #ffd27a; }
.pm-lock .link-btn, .pm-lock-btn { background: none; border: 0; padding: 0; color: #ffd27a; text-decoration: underline; cursor: pointer; font: inherit; }

/* ==========================================================================
   🎫 Tickets : formulaire et message d'ouverture (Inari Premium), dans chaque type (ticket-extras-ui.js)
   ========================================================================== */
.tx-sections { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 12px; min-width: 0; }
.tx-block { min-width: 0; }
.tx-block { border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); padding: 0 12px; }
.tx-block[open] { padding-bottom: 12px; }
.tx-block > summary { list-style: none; cursor: pointer; padding: 10px 0; }
.tx-block > summary::-webkit-details-marker { display: none; }
.tx-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tx-head .pm-badge { background: rgba(240, 178, 50, 0.18); color: #ffd27a; }
.tx-switch { position: relative; display: inline-block; width: 38px; height: 22px; margin-left: auto; flex: 0 0 auto; }
.tx-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.tx-switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--border-strong); transition: background 0.15s; }
.tx-switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.tx-switch input:checked + span { background: var(--accent); }
.tx-switch input:checked + span::after { transform: translateX(16px); }
.tx-switch input:focus-visible + span { outline: 2px solid var(--ember); outline-offset: 2px; }
.tx-locked .tx-fields { opacity: 0.6; }
.tx-fields { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.tx-hint { font-size: 12px; line-height: 1.5; margin: 0; }
.tx-questions { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tx-question { border: 1px solid var(--border); border-radius: 10px; padding: 8px; background: var(--surface-2); display: grid; gap: 6px; }
.tx-row { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.tx-row > input[type="text"], .tx-row > textarea { flex: 1 1 180px; min-width: 0; }
.tx-row select { flex: 0 1 190px; min-width: 0; }
.tx-row input[type="number"] { width: 76px; }
.tx-sub { padding-left: 30px; font-size: 12.5px; }
.tx-sub textarea { width: 100%; }
.tx-question { grid-template-columns: minmax(0, 1fr); }
.tx-scope { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; max-width: 100%; min-width: 0; }
.tx-scope select { flex: 1 1 140px; max-width: 100%; min-width: 0; }
.tx-num { width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--text-primary); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.tx-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; white-space: nowrap; }
.tx-tools { display: inline-flex; gap: 4px; margin-left: auto; }
.tx-grow { flex: 1 1 200px; min-width: 0; }
.tx-roles { display: flex; flex-wrap: wrap; gap: 6px; }
.tx-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border-strong); font-size: 12.5px; cursor: pointer; }
.tx-chip.on { border-color: var(--accent); background: var(--accent-soft); }
.tx-preview-title { margin: 6px 0 0; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
/* Aperçu du formulaire : fenêtre Discord (fond sombre fixe, comme le client Discord). */
.tx-modal { background: #313338; color: #dbdee1; border-radius: 10px; padding: 16px; max-width: 460px; display: grid; gap: 12px; font-size: 13.5px; }
.tx-modal-title { margin: 0; font-size: 17px; font-weight: 700; color: #f2f3f5; }
.tx-q-label { margin: 0 0 4px; font-weight: 600; color: #f2f3f5; }
.tx-q-desc { margin: -2px 0 6px; font-size: 12px; color: #b5bac1; }
.tx-req { color: #f23f43; }
.tx-input { background: #1e1f22; border-radius: 6px; padding: 9px 10px; color: #87898c; min-height: 18px; display: flex; justify-content: space-between; align-items: center; overflow-wrap: anywhere; }
.tx-input.tall { min-height: 70px; align-items: flex-start; }
.tx-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.tx-btn { background: #5865f2; color: #fff; border-radius: 4px; padding: 7px 16px; font-weight: 600; font-size: 13px; }
.tx-btn.ghost { background: transparent; color: #dbdee1; }
.tx-msg { background: #313338; color: #dbdee1; border-radius: 10px; padding: 12px 14px; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.tx-msg-text, .tx-pings { margin: 0 0 6px; }
.tx-mention { background: rgba(88, 101, 242, 0.3); color: #c9cdfb; border-radius: 3px; padding: 0 2px; font-weight: 500; }
.tx-link { color: #00a8fc; }
@media (max-width: 640px) {
  .tx-sub { padding-left: 0; }
  .tx-tools { margin-left: 0; }
  .tx-row select, .tx-row > input[type="text"] { flex-basis: 100%; }
}

/* Partenariats : retirer une entrée de l'historique (features-ui.js › loadPartnershipBoard). */
.pt-history .link-btn { background: none; border: none; padding: 0; margin-left: 6px; color: var(--ember); font: inherit; font-size: 12px; text-decoration: underline; cursor: pointer; }
.pt-history .link-btn:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }
