/* ==========================================================================
   Capys Bot — Dashboard
   Thème clair chaud, construit sur la palette extraite des visuels du bot :
   crème #f9eace, or #f3d48f, bronze #b18c4d, brun #6f532f, fourrure #ac754b.
   Thème sombre disponible via le bouton (data-theme="dark").
   ========================================================================== */

/* Inter en local (police variable, 48 Ko pour tous les poids) : plus de requête
   bloquante vers Google Fonts à chaque navigation. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC,
                 U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Fondu entre les pages au lieu du flash blanc (Chrome / Edge). */
@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.18s;
}

@property --angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

:root {
  /* Fond de page : la scène du bot, lavée pour rester lisible */
  --wallpaper: url('/img/scene.jpg');
  --page-wash: linear-gradient(rgba(250, 244, 234, 0.93), rgba(250, 244, 234, 0.955));

  /* Surfaces */
  --bg: #faf4ea;
  --bg-subtle: #f4ebda;
  --surface: #fffdf8;
  --surface-raised: #fbf4e6;
  --surface-hover: #f6ecd9;
  --surface-input: #fffefb;
  --glass: rgba(255, 253, 248, 0.93);
  --glass-soft: rgba(255, 253, 248, 0.82);

  /* Bordures */
  --border: #e9dcc4;
  --border-strong: #d6c3a2;
  --border-input: #ded0b4;

  /* Texte — le brun profond des visuels */
  --text: #3b2d1b;
  --text-secondary: #6f5a3f;
  --text-muted: #96805f;

  /* Accent : l'or du soleil, assombri pour tenir le contraste sur crème */
  --accent: #9c6522;
  --accent-hover: #b0762f;
  --accent-tint: #7d4f19;
  --accent-fill: #f0dcb4;
  --accent-soft: rgba(156, 101, 34, 0.1);
  --accent-ring: rgba(156, 101, 34, 0.22);
  --accent-line: rgba(156, 101, 34, 0.32);

  /* Rose cerisier */
  --blossom: #cf6f8e;
  --blossom-soft: rgba(207, 111, 142, 0.12);

  /* Bleu Discord — réservé aux actions qui partent vers Discord */
  --discord: #5865f2;
  --discord-hover: #4f5bdb;
  --discord-soft: rgba(88, 101, 242, 0.1);
  --discord-text: #4650d4;
  --discord-line: rgba(88, 101, 242, 0.3);

  /* États */
  --success: #4a8341;
  --success-soft: rgba(74, 131, 65, 0.1);
  --success-line: rgba(74, 131, 65, 0.28);
  --danger: #c0392f;
  --danger-soft: rgba(192, 57, 47, 0.09);
  --danger-line: rgba(192, 57, 47, 0.28);
  --warning: #a9741a;
  --warning-glow: rgba(169, 116, 26, 0.35);

  /* Boutons pleins */
  --on-accent: #fffaf0;
  --on-discord: #ffffff;

  /* Formes */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;

  /* Élévation — ombres teintées brun, jamais du noir pur */
  --shadow-sm: 0 1px 2px rgba(90, 66, 34, 0.07);
  --shadow: 0 6px 20px rgba(90, 66, 34, 0.1);
  --shadow-lg: 0 26px 64px rgba(90, 66, 34, 0.18);
  --glow-warm: 0 14px 38px rgba(156, 101, 34, 0.16);
  --inset-hi: inset 0 1px 0 rgba(255, 255, 255, 0.7);

  /* Aurore d'ambiance */
  --aura-1: rgba(243, 212, 143, 0.5);
  --aura-2: rgba(240, 165, 189, 0.28);
  --aura-3: rgba(140, 190, 170, 0.22);
  --grain-opacity: 0.028;
  --grain-blend: multiply;

  /* Métriques du shell */
  --sidebar-w: 264px;
  --topbar-h: 60px;

  --ease: cubic-bezier(0.32, 0.72, 0, 1);
}

/* ---- Thème sombre : uniquement sur choix explicite (bouton) ---- */
:root[data-theme="dark"] {
  --page-wash: linear-gradient(rgba(16, 13, 10, 0.9), rgba(16, 13, 10, 0.93));

  --bg: #100d0a;
  --bg-subtle: #171310;
  --surface: #1c1713;
  --surface-raised: #221c17;
  --surface-hover: #29221b;
  --surface-input: #15110e;
  --glass: rgba(28, 23, 19, 0.92);
  --glass-soft: rgba(28, 23, 19, 0.8);

  --border: #33291f;
  --border-strong: #46392c;
  --border-input: #3a2f24;

  --text: #f6efe3;
  --text-secondary: #b6a68e;
  --text-muted: #8b7a63;

  --accent: #e5a45f;
  --accent-hover: #f2b878;
  --accent-tint: #f7d3a2;
  --accent-fill: #3d2e1c;
  --accent-soft: rgba(229, 164, 95, 0.14);
  --accent-ring: rgba(229, 164, 95, 0.3);
  --accent-line: rgba(229, 164, 95, 0.35);

  --blossom: #f0a5bd;
  --blossom-soft: rgba(240, 165, 189, 0.14);

  --discord: #5865f2;
  --discord-hover: #6b76f5;
  --discord-soft: rgba(88, 101, 242, 0.16);
  --discord-text: #b3baff;
  --discord-line: rgba(88, 101, 242, 0.36);

  --success: #6cc47f;
  --success-soft: rgba(108, 196, 127, 0.13);
  --success-line: rgba(108, 196, 127, 0.3);
  --danger: #e5686b;
  --danger-soft: rgba(229, 104, 107, 0.14);
  --danger-line: rgba(229, 104, 107, 0.32);
  --warning: #e8b04b;
  --warning-glow: rgba(232, 176, 75, 0.4);

  --on-accent: #2a1a08;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45);
  --shadow: 0 6px 22px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6);
  --glow-warm: 0 14px 44px rgba(229, 164, 95, 0.18);
  --inset-hi: inset 0 1px 0 rgba(255, 255, 255, 0.05);

  --aura-1: rgba(255, 199, 128, 0.16);
  --aura-2: rgba(240, 165, 189, 0.12);
  --aura-3: rgba(127, 201, 194, 0.1);
  --grain-opacity: 0.035;
  --grain-blend: overlay;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

/* Le fond d'écran vit dans sa propre couche fixe et composée par le GPU.
   Avant, `background-attachment: fixed` forçait le navigateur à repeindre l'image
   entière à chaque pixel de défilement — c'était la principale source de saccades. */
html::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background: var(--page-wash), var(--wallpaper) center center / cover no-repeat;
  transform: translateZ(0);
  pointer-events: none;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  background: transparent;
}

/* Sur la page de connexion, la photo respire : bien moins de lavis.
   Le sélecteur porte sur :root, car c'est html::before qui lit --page-wash. */
:root:has(.login-page) {
  --page-wash: linear-gradient(rgba(250, 244, 234, 0.72), rgba(250, 244, 234, 0.84));
}

:root[data-theme="dark"]:has(.login-page) {
  --page-wash: linear-gradient(rgba(16, 13, 10, 0.76), rgba(16, 13, 10, 0.86));
}

/* Version légère de l'image sur petits écrans. */
@media (max-width: 860px) {
  :root {
    --wallpaper: url('/img/scene-small.jpg');
  }
}

/* ==========================================================================
   Couches d'ambiance
   ========================================================================== */

body::before,
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

/* Aurore : la lumière dorée qui dérive lentement, comme un soleil rasant. */
body::before {
  background:
    radial-gradient(48% 42% at 18% 6%, var(--aura-1), transparent 70%),
    radial-gradient(42% 40% at 86% 16%, var(--aura-2), transparent 70%),
    radial-gradient(46% 44% at 82% 92%, var(--aura-3), transparent 70%);
  animation: auroraDrift 34s ease-in-out infinite alternate;
  will-change: transform, opacity;
}

/* Grain : casse les dégradés, donne la texture « peinture » des visuels.
   Sans mix-blend-mode : le mélange forçait une recomposition de tout ce qui est
   dessous à chaque image, y compris pendant l'animation de l'aurore. */
body::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: var(--grain-opacity);
}

@keyframes auroraDrift {
  0% { transform: translate3d(0, 0, 0) scale(1); opacity: 0.8; }
  50% { transform: translate3d(2%, 1.5%, 0) scale(1.06); opacity: 1; }
  100% { transform: translate3d(-1.5%, -1%, 0) scale(1.03); opacity: 0.88; }
}

/* ---- Pétales de cerisier (pages publiques) ---- */

.petals {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.petals span {
  position: absolute;
  top: -8vh;
  display: block;
  width: 16px;
  height: 17px;
  background: url('/petal.svg') center / contain no-repeat;
  opacity: 0;
  animation: petalFall linear infinite;
  will-change: transform, opacity;
  filter: drop-shadow(0 2px 3px rgba(120, 80, 60, 0.12));
}

.petals span:nth-child(1)  { left: 6%;  width: 13px; height: 14px; animation-duration: 15s; animation-delay: 0s;   }
.petals span:nth-child(2)  { left: 18%; width: 19px; height: 21px; animation-duration: 21s; animation-delay: -4s;  }
.petals span:nth-child(3)  { left: 31%; width: 11px; height: 12px; animation-duration: 17s; animation-delay: -9s;  }
.petals span:nth-child(4)  { left: 44%; width: 16px; height: 17px; animation-duration: 24s; animation-delay: -2s;  }
.petals span:nth-child(5)  { left: 57%; width: 12px; height: 13px; animation-duration: 19s; animation-delay: -13s; }
.petals span:nth-child(6)  { left: 68%; width: 21px; height: 23px; animation-duration: 26s; animation-delay: -6s;  }
.petals span:nth-child(7)  { left: 79%; width: 14px; height: 15px; animation-duration: 16s; animation-delay: -17s; }
.petals span:nth-child(8)  { left: 88%; width: 17px; height: 18px; animation-duration: 22s; animation-delay: -11s; }
.petals span:nth-child(9)  { left: 95%; width: 12px; height: 13px; animation-duration: 18s; animation-delay: -20s; }
.petals span:nth-child(10) { left: 25%; width: 15px; height: 16px; animation-duration: 28s; animation-delay: -24s; }

@keyframes petalFall {
  0%   { transform: translate3d(0, -10vh, 0) rotate(0deg); opacity: 0; }
  8%   { opacity: 0.85; }
  50%  { transform: translate3d(6vw, 50vh, 0) rotate(220deg); opacity: 0.7; }
  92%  { opacity: 0.4; }
  100% { transform: translate3d(-3vw, 112vh, 0) rotate(460deg); opacity: 0; }
}

h1, h2, h3 {
  letter-spacing: -0.015em;
  font-weight: 650;
  text-wrap: balance;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
  font-size: 0.9em;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 5px;
  padding: 1px 5px;
  color: var(--accent-tint);
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: 999px;
}

/* ==========================================================================
   Shell applicatif
   ========================================================================== */

.app {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

/* ---- Barre latérale ---- */

.app-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 12px;
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 14px;
  font-size: 14.5px;
  font-weight: 650;
  color: var(--text);
  letter-spacing: -0.01em;
}

.sidebar-brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 9px;
  background: var(--accent-fill);
  border: 1px solid var(--accent-line);
  font-size: 16px;
  line-height: 1;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.sidebar-brand:hover .brand-mark,
.topbar-left:hover .brand-mark {
  transform: rotate(-8deg) scale(1.08);
  box-shadow: 0 0 18px var(--accent-ring);
}

/* Carte du serveur en cours de configuration */
.sidebar-guild {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s var(--ease);
}

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

.sidebar-guild img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
  object-fit: cover;
}

.sidebar-guild-text {
  min-width: 0;
}

.sidebar-guild-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
}

.sidebar-guild-name {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-section {
  padding: 14px 10px 6px;
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

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

.sidebar-spacer {
  flex: 1;
  min-height: 16px;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1;
  padding: 4px 6px;
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: var(--accent-fill);
  color: var(--accent-tint);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  object-fit: cover;
  border: 1px solid var(--accent-line);
}

.sidebar-username {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Zone principale ---- */

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar h1 {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-crumb {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.topbar-crumb::before {
  content: '/';
  color: var(--border-strong);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Bascule clair / sombre */
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.3s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.theme-toggle:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: rotate(-18deg) scale(1.08);
}

.app-content {
  flex: 1;
  padding: 28px;
  max-width: 1080px;
  width: 100%;
  animation: riseIn 0.24s var(--ease) backwards;
}

.app-content.is-wide {
  max-width: 1280px;
}

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

.page-header {
  margin-bottom: 22px;
}

.page-header h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 5px;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 13.5px;
  max-width: 62ch;
}

/* ==========================================================================
   Boutons
   ========================================================================== */

.btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  height: 34px;
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
  font-family: inherit;
  font-weight: 550;
  font-size: 13.5px;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.14s var(--ease), border-color 0.14s var(--ease),
              color 0.14s var(--ease), transform 0.14s var(--ease),
              box-shadow 0.2s var(--ease), opacity 0.14s var(--ease);
}

/* Reflet qui balaie le bouton au survol */
.btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: -120%;
  width: 55%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-18deg);
  transition: left 0.55s var(--ease);
  pointer-events: none;
}

.btn:hover:not(:disabled)::after {
  left: 130%;
}

.btn:hover {
  text-decoration: none;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn:disabled::after,
.btn[disabled]::after {
  display: none;
}

/* Action principale (Enregistrer) */
.btn-primary {
  background: linear-gradient(165deg, var(--accent-hover), var(--accent));
  color: var(--on-accent);
  box-shadow: 0 3px 10px rgba(156, 101, 34, 0.24);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 7px 18px rgba(156, 101, 34, 0.32);
}

/* Action qui part vers Discord */
.btn-discord {
  background: var(--discord);
  color: var(--on-discord);
  box-shadow: 0 3px 10px rgba(88, 101, 242, 0.26);
}

.btn-discord:hover:not(:disabled) {
  background: var(--discord-hover);
  box-shadow: 0 7px 20px rgba(88, 101, 242, 0.34);
}

.btn-secondary {
  background: var(--discord-soft);
  color: var(--discord-text);
  border-color: var(--discord-line);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(88, 101, 242, 0.18);
  border-color: var(--discord);
}

.btn-outline {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text-secondary);
}

.btn-outline:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-small {
  height: 28px;
  padding: 0 10px;
  font-size: 12.5px;
}

.btn-block {
  width: 100%;
}

.btn-lg {
  height: 44px;
  font-size: 15px;
  padding: 0 22px;
}

/* État de chargement */
.btn.is-loading {
  color: transparent !important;
  pointer-events: none;
}

.btn.is-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--on-discord);
  background: none;
  transform: none;
  animation: spin 0.6s linear infinite;
  transition: none;
}

.btn-primary.is-loading::after {
  border-color: rgba(255, 250, 240, 0.35);
  border-top-color: var(--on-accent);
}

.btn-outline.is-loading::after,
.btn-secondary.is-loading::after {
  border-color: var(--border-strong);
  border-top-color: var(--text);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  height: 28px;
  min-width: 28px;
  padding: 0 6px;
  border-radius: var(--radius-xs);
  transition: background 0.14s var(--ease), color 0.14s var(--ease), transform 0.14s var(--ease);
}

.icon-btn:hover {
  background: var(--danger-soft);
  color: var(--danger);
  transform: scale(1.08);
}

/* ==========================================================================
   Navigation par onglets
   ========================================================================== */

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 0 10px;
  height: 34px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.14s var(--ease), color 0.14s var(--ease), padding-left 0.18s var(--ease);
}

.nav-item .nav-icon {
  font-size: 14px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.9;
  transition: transform 0.22s var(--ease), opacity 0.22s var(--ease);
}

.nav-item:hover {
  background: var(--surface-hover);
  color: var(--text);
  padding-left: 14px;
}

.nav-item:hover .nav-icon {
  transform: scale(1.15);
  opacity: 1;
}

.nav-item.active {
  background: var(--accent-fill);
  color: var(--accent-tint);
  font-weight: 650;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 2px;
  height: 0;
  border-radius: 2px;
  background: var(--accent);
  transform: translateY(-50%);
  animation: growBar 0.3s var(--ease) forwards;
}

@keyframes growBar {
  to { height: 18px; }
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: panelIn 0.28s var(--ease);
}

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

/* ==========================================================================
   Cartes & sections
   ========================================================================== */

/* Pas de backdrop-filter ici : flouter le fond derrière chaque carte coûtait un
   repaint par carte à chaque défilement. La surface est quasi opaque, le rendu
   est le même à l'œil pour une fraction du coût. */
.card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm), var(--inset-hi);
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
  animation: riseIn 0.22s var(--ease) backwards;
}

.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow), var(--inset-hi);
}

.card:nth-of-type(2) { animation-delay: 0.06s; }
.card:nth-of-type(3) { animation-delay: 0.12s; }

.card:last-child {
  margin-bottom: 0;
}

.card h2 {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 12px;
  font-weight: 700;
}

.card h3 {
  font-size: 15px;
  margin-bottom: 4px;
}

.section + .section {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.005em;
}

.section-title .section-icon {
  font-size: 14px;
  transition: transform 0.25s var(--ease);
}

.card:hover .section-title .section-icon {
  transform: rotate(-6deg) scale(1.1);
}

.section-hint,
.hint {
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.55;
  margin-bottom: 12px;
}

.section-hint {
  margin-bottom: 14px;
}

.action-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.action-bar-spacer {
  flex: 1;
}

.unsaved-pill {
  display: none;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--warning);
  font-weight: 550;
}

.unsaved-pill.visible {
  display: inline-flex;
  animation: fadeIn 0.25s var(--ease);
}

.unsaved-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warning);
  animation: pulseDot 1.8s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 0 var(--warning-glow); }
  50% { box-shadow: 0 0 0 5px transparent; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ==========================================================================
   Formulaires
   ========================================================================== */

.form-group {
  margin-bottom: 14px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text-secondary);
}

.form-group select,
.form-group input,
.form-group textarea,
.password-form input,
.reaction-row input,
.reaction-row select,
.button-row input {
  width: 100%;
  padding: 8px 11px;
  min-height: 34px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-input);
  background: var(--surface-input);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color 0.14s var(--ease), box-shadow 0.14s var(--ease), background 0.14s var(--ease);
}

.form-group input::placeholder,
.form-group textarea::placeholder,
.password-form input::placeholder,
.reaction-row input::placeholder,
.button-row input::placeholder {
  color: var(--text-muted);
  opacity: 0.75;
}

.form-group select:hover,
.form-group input:hover,
.form-group textarea:hover {
  border-color: var(--border-strong);
}

.form-group select:focus,
.form-group input:focus,
.form-group textarea:focus,
.password-form input:focus,
.reaction-row input:focus,
.reaction-row select:focus,
.button-row input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.form-group textarea {
  resize: vertical;
  line-height: 1.55;
  min-height: 80px;
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5L6 8l3.5-3.5' fill='none' stroke='%2396805f' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px !important;
  cursor: pointer;
}

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

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px 18px;
}

.field-grid .form-group {
  margin-bottom: 0;
}

.channel-select-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ---- Cases à cocher ---- */

.checkbox-list {
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0 -8px;
  padding: 0 8px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: 13.5px;
  transition: background 0.14s var(--ease), padding-left 0.18s var(--ease);
}

.checkbox-row:hover {
  background: var(--surface-hover);
  padding-left: 14px;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--accent);
}

/* ---- Réseaux sociaux ---- */

.social-field {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.social-field:last-child {
  border-bottom: none;
}

.social-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 148px;
  flex-shrink: 0;
  font-size: 13.5px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.14s var(--ease);
}

.social-toggle:hover {
  color: var(--text);
}

.social-field input[type="url"] {
  flex: 1;
  padding: 8px 11px;
  min-height: 34px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-input);
  background: var(--surface-input);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  transition: opacity 0.2s var(--ease), border-color 0.14s var(--ease), box-shadow 0.14s var(--ease);
}

.social-field input[type="url"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.social-field input[type="url"]:read-only {
  opacity: 0.4;
  cursor: not-allowed;
}

.social-field input[type="url"]:read-only:focus {
  box-shadow: none;
  border-color: var(--border-input);
}

/* ==========================================================================
   Page « Mes serveurs »
   ========================================================================== */

.guild-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.guild-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm), var(--inset-hi);
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
  animation: riseIn 0.26s var(--ease) backwards;
}

/* Cascade resserrée : la dernière carte arrive en 130 ms, pas en 340. */
.guild-grid .guild-card:nth-child(2) { animation-delay: 0.03s; }
.guild-grid .guild-card:nth-child(3) { animation-delay: 0.06s; }
.guild-grid .guild-card:nth-child(4) { animation-delay: 0.09s; }
.guild-grid .guild-card:nth-child(5) { animation-delay: 0.11s; }
.guild-grid .guild-card:nth-child(n + 6) { animation-delay: 0.13s; }

.guild-card:hover {
  border-color: var(--accent-line);
  transform: translateY(-3px);
  box-shadow: var(--glow-warm), var(--inset-hi);
}

.guild-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.guild-card-text {
  min-width: 0;
}

.guild-icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  flex-shrink: 0;
  object-fit: cover;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.guild-card:hover .guild-icon {
  transform: scale(1.07) rotate(-3deg);
  border-color: var(--accent-line);
  box-shadow: 0 0 16px var(--accent-ring);
}

.guild-name {
  font-weight: 650;
  font-size: 14.5px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--bg-subtle);
  margin-top: 3px;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-online {
  color: var(--success);
  border-color: var(--success-line);
  background: var(--success-soft);
}

.badge-online::before {
  animation: pulseOnline 2.4s ease-in-out infinite;
}

@keyframes pulseOnline {
  0%, 100% { box-shadow: 0 0 0 0 var(--success-line); }
  50% { box-shadow: 0 0 0 5px transparent; }
}

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

.empty-state {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
  background: var(--glass-soft);
}

.empty-state-icon {
  font-size: 34px;
  display: block;
  margin-bottom: 12px;
  animation: float 5s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-9px) rotate(3deg); }
}

/* ---- Pastille d'état sur les onglets ---- */

.nav-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.nav-dot-done { background: var(--success); }
.nav-dot-warning { background: var(--warning); }
.nav-dot-error {
  background: var(--danger);
  animation: pulseDot 1.8s ease-in-out infinite;
  --warning-glow: var(--danger-line);
}

/* ---- Champ de filtre au-dessus d'une liste ---- */

.list-filter {
  width: 100%;
  padding: 7px 11px;
  margin-bottom: 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-input);
  background: var(--surface-input);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}

.list-filter:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.list-filter-empty {
  margin: 8px 0 0;
  font-style: italic;
}

/* Bouton qui masque un vrai <input type="file"> */
.file-btn {
  position: relative;
  overflow: hidden;
}

.file-btn input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}

/* Interrupteur principal d'un module, plus visible qu'une case de liste */
.toggle-row {
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-raised);
  align-items: flex-start;
  line-height: 1.5;
}

.toggle-row:hover {
  padding-left: 12px;
  border-color: var(--accent-line);
}

.toggle-row input[type="checkbox"] {
  margin-top: 2px;
}

/* ---- Journal de modération ---- */

.log-toolbar {
  margin-bottom: 14px;
}

.chip-btn.is-active {
  border-color: var(--accent);
  background: var(--accent-fill);
  color: var(--accent-tint);
  font-weight: 600;
}

.chip-count {
  opacity: 0.65;
  font-variant-numeric: tabular-nums;
}

.log-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 620px;
  overflow-y: auto;
  margin: 0 -6px;
  padding: 0 6px;
}

.log-row {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 10px;
  border-radius: var(--radius-xs);
  border-bottom: 1px solid var(--border);
}

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

.log-row:hover {
  background: var(--surface-hover);
}

.log-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 50%;
  font-size: 14px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
}

.log-icon.log-danger { background: var(--danger-soft); border-color: var(--danger-line); }
.log-icon.log-warning { background: var(--accent-soft); border-color: var(--accent-line); }
.log-icon.log-success { background: var(--success-soft); border-color: var(--success-line); }

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

.log-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13.5px;
}

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

.log-detail {
  font-size: 11.5px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.log-reason {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 3px;
  word-break: break-word;
}

.log-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}

/* ---- Classement des niveaux ---- */

.rank-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.rank-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 6px;
  border-radius: var(--radius-xs);
  font-size: 12.5px;
}

.rank-row:hover {
  background: var(--surface-hover);
}

.rank-pos {
  font-weight: 700;
  color: var(--text-muted);
}

.rank-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-level {
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

.rank-xp {
  grid-column: 2 / -1;
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ---- Cotes des boîtes ---- */

.odds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.odds-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.odds-field input {
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-input);
  background: var(--surface-input);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
}

.odds-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.odds-total {
  margin: 8px 0 0;
  font-variant-numeric: tabular-nums;
}

/* ---- Catalogue de cartes ---- */

.cat-group + .cat-group {
  margin-top: 14px;
}

.cat-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 7px;
}

.cat-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cat-card {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  font-size: 12px;
  cursor: default;
}

.cat-card em {
  font-size: 10.5px;
  opacity: 0.7;
  font-style: normal;
}

.cat-commune    { border-color: rgba(168, 152, 128, 0.5); }
.cat-peuCommune { border-color: rgba(111, 156, 90, 0.55); }
.cat-rare       { border-color: rgba(74, 156, 184, 0.6); }
.cat-epique     { border-color: rgba(143, 92, 196, 0.6); }
.cat-legendaire {
  border-color: rgba(217, 164, 65, 0.75);
  background: var(--accent-fill);
  font-weight: 600;
}

/* ---- Messages programmés ---- */

.sched-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sched-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-raised);
}

.sched-row.is-done { opacity: 0.55; }
.sched-row.is-paused { border-style: dashed; }

.sched-main {
  flex: 1;
  min-width: 0;
}

.sched-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 5px;
}

.sched-when {
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.sched-content {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  word-break: break-word;
}

.sched-error {
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--danger);
}

.sched-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* ---- Simulation de la carte de bienvenue ---- */

.welcome-card-mock {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 150px;
  margin: 8px 0 2px;
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.5)),
    var(--wallpaper) center / cover no-repeat;
}

.welcome-card-avatar {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  border: 3px solid #fff;
  font-size: 26px;
}

.welcome-card-caption {
  width: 100%;
  padding: 8px 12px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  word-break: break-word;
}

.preview-heading {
  font-size: 17px;
  font-weight: 700;
  color: #f2f3f5;
}

.preview-button-success {
  background: #248046;
  color: #fff;
}

/* ==========================================================================
   Vue d'ensemble
   ========================================================================== */

.setup-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.setup-score {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
}

.setup-score-value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.setup-score-total {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
}

.setup-score-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 4px;
}

.progress {
  height: 6px;
  border-radius: 999px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  overflow: hidden;
  margin: 4px 0 18px;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  transition: width 0.5s var(--ease);
}

/* ---- Liste de mise en route ---- */

.check-list,
.issue-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: var(--radius-xs);
  transition: background 0.14s var(--ease);
}

.check-row:hover {
  background: var(--surface-hover);
}

.check-mark {
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  border: 1.5px solid var(--border-strong);
  color: transparent;
}

.check-row.is-done .check-mark {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.check-row.is-todo .check-mark {
  border-style: dashed;
}

.check-label {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
}

.check-row.is-todo .check-label {
  color: var(--text-secondary);
}

.check-state {
  font-size: 12px;
  color: var(--success);
  font-weight: 550;
}

/* ---- Diagnostics ---- */

.issue-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13px;
  line-height: 1.5;
}

.issue-error {
  background: var(--danger-soft);
  border-color: var(--danger-line);
}

.issue-warning {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.issue-icon {
  flex-shrink: 0;
  font-size: 14px;
}

.issue-text {
  flex: 1;
  min-width: 0;
}

.issue-row .btn {
  flex-shrink: 0;
}

.issues-clear {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--success-soft);
  border: 1px solid var(--success-line);
  color: var(--success);
  font-size: 13.5px;
  font-weight: 550;
}

/* ---- Tuiles de contenu ---- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s var(--ease), transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.stat-tile:hover {
  border-color: var(--accent-line);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

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

.stat-note {
  font-size: 11px;
  color: var(--text-muted);
}

@media (max-width: 560px) {
  .issue-row {
    flex-wrap: wrap;
  }

  .issue-row .btn {
    width: 100%;
  }
}

/* ==========================================================================
   Import d'image
   ========================================================================== */

.image-drop-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.image-drop {
  width: 100px;
  height: 100px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-strong);
  background: var(--surface-raised);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease),
              transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.image-drop:hover,
.image-drop.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.03);
  box-shadow: 0 0 20px var(--accent-ring);
}

.image-drop img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s var(--ease);
}

.image-drop:hover img {
  transform: scale(1.06);
}

.image-drop .image-drop-placeholder {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  padding: 6px;
  line-height: 1.4;
}

.image-drop input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.image-drop-info {
  flex: 1;
  min-width: 180px;
}

.image-drop-info .hint {
  margin-bottom: 6px;
}

.image-drop-status {
  font-size: 12.5px;
  color: var(--text-muted);
}

.image-preview {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  display: block;
  border: 1px solid var(--border);
}

.no-image {
  color: var(--text-muted);
  margin-bottom: 12px;
  font-size: 13.5px;
}

.image-form {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.image-form input[type="file"] {
  color: var(--text-secondary);
  font-size: 13px;
}

/* ==========================================================================
   Toasts
   ========================================================================== */

.toast-stack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
  max-width: 360px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  animation: toastIn 0.3s var(--ease);
}

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

.toast.toast-out {
  animation: toastOut 0.2s ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(24px) scale(0.96); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(20px); }
}

.toast-icon {
  font-size: 14px;
  line-height: 1.4;
}

.toast-body {
  flex: 1;
  line-height: 1.45;
  color: var(--text);
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 0 0 0 4px;
  line-height: 1.4;
}

.toast-close:hover {
  color: var(--text);
}

/* ==========================================================================
   Alertes
   ========================================================================== */

.alert {
  padding: 11px 13px;
  border-radius: var(--radius-xs);
  margin-bottom: 16px;
  font-size: 13px;
  text-align: left;
  border: 1px solid transparent;
  animation: fadeIn 0.3s var(--ease);
}

.alert-success {
  background: var(--success-soft);
  color: var(--success);
  border-color: var(--success-line);
}

.alert-error {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger-line);
}

/* ==========================================================================
   Module Messages
   ========================================================================== */

.messages-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(260px, 1fr);
  gap: 16px;
  align-items: start;
}

.messages-editor,
.messages-sidebar {
  min-width: 0;
}

.messages-sidebar {
  position: sticky;
  top: calc(var(--topbar-h) + 20px);
}

.drafts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 10px;
}

.drafts-header h2 {
  margin-bottom: 0;
}

.draft-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  transition: background 0.14s var(--ease), padding-left 0.18s var(--ease);
}

.draft-row:hover {
  background: var(--surface-hover);
  padding-left: 12px;
}

.draft-row.active {
  background: var(--accent-fill);
}

.draft-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.draft-link:hover {
  color: var(--text);
  text-decoration: none;
}

.draft-row.active .draft-link {
  color: var(--accent-tint);
  font-weight: 600;
}

/* ---- Éditeur de blocs ---- */

.block-item {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px;
  margin-bottom: 8px;
  transition: border-color 0.18s var(--ease);
  animation: riseIn 0.3s var(--ease);
}

.block-item:hover {
  border-color: var(--border-strong);
}

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

.block-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.block-controls {
  display: flex;
  gap: 2px;
}

.block-controls .icon-btn {
  height: 24px;
  min-width: 24px;
  font-size: 11.5px;
}

.block-controls .icon-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.block-controls .icon-btn:last-child:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.block-body textarea,
.block-body input,
.block-body select {
  width: 100%;
  padding: 8px 11px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-input);
  background: var(--surface-input);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
}

.block-body textarea:focus,
.block-body input:focus,
.block-body select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.container-children {
  padding: 10px;
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  background: var(--accent-soft);
}

.add-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chip-btn {
  padding: 0 12px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color 0.14s var(--ease), color 0.14s var(--ease),
              background 0.14s var(--ease), transform 0.14s var(--ease);
}

.chip-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

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

.button-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.button-row input {
  flex: 1;
}

/* ---- Réactions / streamers ---- */

.reaction-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
  animation: riseIn 0.28s var(--ease);
}

.reaction-row .emoji-input {
  flex: 0 0 84px;
  text-align: center;
}

.reaction-row select,
.reaction-row .streamer-input {
  flex: 1;
  min-width: 0;
}

.live-badge {
  flex: 0 0 22px;
  text-align: center;
  font-size: 13px;
  opacity: 0.4;
}

.live-badge.is-live {
  opacity: 1;
  filter: drop-shadow(0 0 5px var(--danger-line));
  animation: livePulse 1.8s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}

/* ---- Aperçu Discord : garde les couleurs de Discord, c'est une simulation ---- */

.discord-preview {
  background: #313338;
  border: 1px solid #26282c;
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 13.5px;
  color: #dbdee1;
  min-height: 80px;
}

.preview-author {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #f2f3f5;
  display: flex;
  align-items: center;
  gap: 6px;
}

.preview-tag {
  background: #5865f2;
  color: #fff;
  font-size: 9px;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 3px;
  vertical-align: middle;
}

.preview-text {
  white-space: pre-wrap;
  margin-bottom: 6px;
  line-height: 1.45;
  word-break: break-word;
}

.preview-separator {
  border: none;
  border-top: 1px solid #3f4147;
  margin: 10px 0;
}

.preview-image {
  max-width: 100%;
  border-radius: 6px;
  margin: 6px 0;
  display: block;
}

.preview-image-placeholder {
  background: #232428;
  border: 1px dashed #4e5058;
  border-radius: 6px;
  padding: 20px;
  text-align: center;
  color: #6d6f78;
  margin: 6px 0;
  font-size: 12px;
}

.preview-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 6px 0;
}

.preview-button {
  background: #4e5058;
  color: #dbdee1;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
}

.preview-container {
  border: 1px solid #3f4147;
  border-left: 3px solid #5865f2;
  border-radius: 6px;
  padding: 10px;
  margin: 8px 0;
  background: rgba(255, 255, 255, 0.02);
}

/* ==========================================================================
   Connexion & mot de passe
   ========================================================================== */

.login-page {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  position: relative;
  overflow: hidden;
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(1.3);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
  box-shadow: var(--shadow-lg), var(--inset-hi);
  max-width: 430px;
  width: 100%;
  animation: cardIn 0.65s var(--ease);
}

/* Liseré dégradé qui tourne lentement autour de la carte */
.login-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from var(--angle),
    transparent 45%,
    var(--blossom) 62%,
    var(--accent) 74%,
    transparent 88%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: 0.55;
  animation: rotateBorder 9s linear infinite;
  pointer-events: none;
  z-index: 2;
}

@keyframes rotateBorder {
  to { --angle: 360deg; }
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Bandeau photo en haut de la carte */
.login-hero {
  position: relative;
  height: 190px;
  overflow: hidden;
}

.login-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 38%;
  display: block;
  animation: heroZoom 22s ease-in-out infinite alternate;
}

@keyframes heroZoom {
  from { transform: scale(1); }
  to { transform: scale(1.07); }
}

/* Fondu de la photo vers le corps de la carte */
.login-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 40%, var(--glass) 96%);
}

.login-body {
  position: relative;
  padding: 0 34px 30px;
}

.mascot {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 72px;
  height: 72px;
  font-size: 36px;
  line-height: 1;
  margin: -36px 0 16px;
  border-radius: 22px;
  background: var(--surface);
  border: 1px solid var(--accent-line);
  box-shadow: var(--shadow), 0 0 26px var(--accent-ring);
  animation: float 5.5s ease-in-out infinite;
  z-index: 1;
}

.login-card h1 {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 8px;
}

.login-body > p {
  color: var(--text-secondary);
  margin-bottom: 22px;
  font-size: 13.5px;
  line-height: 1.6;
}

.login-card .btn {
  width: 100%;
}

.password-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.feature-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease), transform 0.18s var(--ease);
  animation: riseIn 0.5s var(--ease) backwards;
}

.feature-pills .pill:nth-child(1) { animation-delay: 0.35s; }
.feature-pills .pill:nth-child(2) { animation-delay: 0.42s; }
.feature-pills .pill:nth-child(3) { animation-delay: 0.49s; }
.feature-pills .pill:nth-child(4) { animation-delay: 0.56s; }
.feature-pills .pill:nth-child(5) { animation-delay: 0.63s; }
.feature-pills .pill:nth-child(6) { animation-delay: 0.70s; }

.pill:hover {
  border-color: var(--accent-line);
  color: var(--accent);
  transform: translateY(-2px);
}

.login-footer {
  margin: 18px 0 0;
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1000px) {
  .messages-layout {
    grid-template-columns: 1fr;
  }

  .messages-sidebar {
    position: static;
  }
}

@media (max-width: 860px) {
  .app {
    flex-direction: column;
  }

  .app-sidebar {
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
  }

  .sidebar-spacer,
  .sidebar-section {
    display: none;
  }

  .sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 4px;
    margin-bottom: 4px;
  }

  .nav-item {
    width: auto;
    flex-shrink: 0;
    border: 1px solid var(--border);
    background: var(--surface);
  }

  .nav-item:hover,
  .checkbox-row:hover,
  .draft-row:hover {
    padding-left: 10px;
  }

  .nav-item.active {
    border-color: var(--accent-line);
  }

  .nav-item.active::before {
    display: none;
  }

  .sidebar-footer {
    padding-top: 8px;
  }

  .topbar {
    padding: 0 18px;
  }

  .app-content {
    padding: 20px 18px;
  }

  .card {
    padding: 18px;
  }
}

@media (max-width: 560px) {
  .social-field {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .social-toggle {
    width: auto;
  }

  .guild-grid {
    grid-template-columns: 1fr;
  }

  .action-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .action-bar .btn {
    width: 100%;
  }

  .action-bar-spacer {
    display: none;
  }

  .login-hero {
    height: 150px;
  }

  .login-body {
    padding: 0 22px 24px;
  }
}

/* Coupe les animations si l'utilisateur les a désactivées au niveau système. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .petals {
    display: none;
  }
}
