/* ==========================================================================
   Sora — tableau de bord v6
   Système de design : jetons (couleurs, rayons, ombres, typographie) en
   variables, thème sombre par défaut, thème clair sur [data-theme="light"].
   ========================================================================== */

:root {
  color-scheme: dark;
  --bg: #0a0c12;
  --bg-elev: #0f121a;
  --surface: #141823;
  --surface-2: #1a1f2c;
  --surface-3: #222839;
  --border: #262c3d;
  --border-strong: #353d54;
  --text: #e8eaf2;
  --text-soft: #a3a9bd;
  --text-faint: #8a91a8;
  --accent: #8b6cff;
  --accent-strong: #a48cff;
  --accent-soft: rgba(139, 108, 255, 0.14);
  --accent-ring: rgba(139, 108, 255, 0.45);
  --brand-grad: linear-gradient(120deg, #38bdf8 0%, #8b5cf6 55%, #ec4899 100%);
  --ok: #3ccf91;
  --ok-soft: rgba(60, 207, 145, 0.13);
  --warn: #f2b84b;
  --warn-soft: rgba(242, 184, 75, 0.13);
  --danger: #f2707a;
  --danger-soft: rgba(242, 112, 122, 0.13);
  --info: #5ab8f5;
  --info-soft: rgba(90, 184, 245, 0.13);
  --radius-lg: 16px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-pop: 0 18px 50px rgba(0, 0, 0, 0.55);
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  --sidebar-w: 268px;
  --topbar-h: 60px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f5fa;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #f6f7fb;
  --surface-3: #eceef6;
  --border: #e1e4ee;
  --border-strong: #cfd3e1;
  --text: #151826;
  --text-soft: #4d5470;
  --text-faint: #6b7290;
  --accent: #6d4aff;
  --accent-strong: #5a36f0;
  --accent-soft: rgba(109, 74, 255, 0.1);
  --accent-ring: rgba(109, 74, 255, 0.35);
  --ok: #128a5a;
  --ok-soft: rgba(18, 138, 90, 0.1);
  --warn: #a86a00;
  --warn-soft: rgba(168, 106, 0, 0.1);
  --danger: #c93a47;
  --danger-soft: rgba(201, 58, 71, 0.09);
  --info: #1f78b4;
  --info-soft: rgba(31, 120, 180, 0.1);
  --shadow: 0 1px 2px rgba(20, 25, 50, 0.05), 0 6px 20px rgba(20, 25, 50, 0.06);
  --shadow-pop: 0 18px 50px rgba(20, 25, 50, 0.18);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; letter-spacing: -0.015em; line-height: 1.25; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Taille par défaut des icônes (les composants la précisent au besoin). */
svg[aria-hidden="true"] { width: 18px; height: 18px; flex: none; }
.list-item > svg { color: var(--text-faint); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft); }

/* ── Structure ─────────────────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px;
  padding: 16px 14px 14px;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
}
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  height: var(--topbar-h); padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.content { width: 100%; max-width: 1120px; margin: 0 auto; padding: 28px 24px 96px; outline: none; }

/* Marque */
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--brand-grad); display: grid; place-items: center; box-shadow: 0 6px 18px rgba(139, 92, 246, 0.35); flex: none; }
.brand-mark svg { width: 20px; height: 20px; }
.brand-name { font-weight: 800; letter-spacing: 0.14em; font-size: 14px; }
.brand-sub { font-size: 11px; color: var(--text-faint); letter-spacing: 0.04em; }

/* Sélecteur de serveur */
.guild-switch { position: relative; }
.guild-btn {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  font: inherit; text-align: left; cursor: pointer;
}
.guild-btn:hover { border-color: var(--border-strong); }
.guild-btn .chev { margin-left: auto; color: var(--text-faint); }
.guild-meta { min-width: 0; }
.guild-name { display: block; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guild-hint { display: block; font-size: 11.5px; color: var(--text-faint); }
.avatar {
  width: 36px; height: 36px; border-radius: 10px; flex: none; overflow: hidden;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff;
  background: var(--brand-grad);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 28px; height: 28px; border-radius: 8px; font-size: 11px; }
.avatar.lg { width: 56px; height: 56px; border-radius: 16px; font-size: 18px; }

.menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 40;
  max-height: 320px; overflow-y: auto; padding: 6px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
}
.menu[hidden] { display: none; }
.menu-item {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 8px 9px; border-radius: var(--radius-sm); border: 0; background: none;
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.menu-item:hover, .menu-item[aria-current="true"] { background: var(--surface-3); }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--border); }

/* Recherche */
.search-btn {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-faint);
  font: inherit; cursor: pointer;
}
.search-btn:hover { color: var(--text-soft); border-color: var(--border-strong); }
.kbd { white-space: nowrap; margin-left: auto; font-family: var(--mono); font-size: 11px; padding: 1px 6px; border: 1px solid var(--border-strong); border-radius: 5px; color: var(--text-faint); }

/* Navigation */
.nav { display: flex; flex-direction: column; gap: 14px; flex: 1; }
.nav-group-title { padding: 0 8px 4px; font-size: 11px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); }
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 9px; border-radius: var(--radius-sm);
  color: var(--text-soft); font-weight: 500; text-decoration: none;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.nav-link[aria-current="page"] .nav-ic { color: var(--accent-strong); }
.nav-ic { width: 18px; height: 18px; flex: none; display: grid; place-items: center; color: var(--text-faint); }
.nav-ic svg { width: 17px; height: 17px; }
.nav-dot { margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.nav-dot.off { background: transparent; border: 1px solid var(--border-strong); }

.sidebar-foot { display: flex; align-items: center; gap: 10px; padding: 10px 6px 0; border-top: 1px solid var(--border); }
.user-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11.5px; color: var(--text-faint); }

/* Barre supérieure */
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--text-faint); font-size: 13px; }
.crumbs b { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grow { flex: 1; }
.icon-btn {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface);
  color: var(--text-soft); cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-btn svg { width: 18px; height: 18px; }
.menu-toggle { display: none; }

/* ── Composants ────────────────────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .titles { flex: 1; min-width: 240px; }
.page-head .lead { margin-top: 6px; color: var(--text-soft); max-width: 68ch; }
.page-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); flex: none; }
.page-icon svg { width: 22px; height: 22px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px;
}
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { flex: 1; min-width: 160px; }
.card-sub { color: var(--text-faint); font-size: 12.5px; margin-top: -8px; margin-bottom: 14px; }
.card.flat { box-shadow: none; }
.card.danger { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.muted { color: var(--text-soft); }
.faint { color: var(--text-faint); font-size: 12.5px; }

/* Statistiques */
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; }
.stat-label { font-size: 12px; color: var(--text-faint); font-weight: 600; }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 14px; color: var(--text-faint); font-weight: 600; }
.stat-note { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

/* Badges et pastilles */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-3); color: var(--text-soft); white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.accent { background: var(--accent-soft); color: var(--accent-strong); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.dot.pulse { box-shadow: 0 0 0 0 currentColor; animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 60%, transparent); } 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 8px 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.danger { background: transparent; border-color: color-mix(in srgb, var(--danger) 50%, var(--border)); color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-soft); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { min-height: 30px; padding: 4px 10px; font-size: 12.5px; }
.btn[disabled], .btn[aria-busy="true"] { opacity: .55; cursor: not-allowed; }
.btn[aria-busy="true"]::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Champs */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field:last-child { margin-bottom: 0; }
.field > label, .field-label { font-weight: 600; font-size: 13px; color: var(--text); }
.field .help { font-size: 12.5px; color: var(--text-faint); }
.field .error-text { font-size: 12.5px; color: var(--danger); font-weight: 500; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); }
.req { color: var(--danger); margin-left: 2px; }
input[type="text"], input[type="url"], input[type="number"], input[type="search"], input[type="datetime-local"], select, textarea {
  width: 100%; min-height: 40px; padding: 9px 12px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font: inherit; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input[type="color"] { width: 48px; height: 40px; padding: 3px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface-2); cursor: pointer; }
select:disabled, input:disabled, textarea:disabled { opacity: .6; cursor: not-allowed; }
.input-row { display: flex; gap: 8px; align-items: center; }
.input-row > input, .input-row > select { flex: 1; }
.counter { font-size: 11.5px; color: var(--text-faint); text-align: right; }
.counter.over { color: var(--danger); font-weight: 600; }

/* Interrupteur accessible (button role="switch") */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.switch-row:last-child { border-bottom: 0; padding-bottom: 0; }
.switch-row:first-child { padding-top: 0; }
.switch-text { min-width: 0; }
.switch-text .help { margin-top: 2px; font-size: 12.5px; color: var(--text-faint); }
.switch-title { font-weight: 600; }
.tg {
  position: relative; flex: none; width: 44px; height: 24px; padding: 0;
  border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface-3);
  cursor: pointer; transition: background .18s, border-color .18s;
}
.tg::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--text-faint); transition: transform .18s, background .18s; }
.tg.on, .tg[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.tg.on::after, .tg[aria-checked="true"]::after { transform: translateX(20px); background: #fff; }
.tg.busy, .tg[aria-busy="true"] { opacity: .5; pointer-events: none; }
.tg[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }

/* Segments / onglets */
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); flex-wrap: wrap; }
.tab { border: 0; background: none; color: var(--text-soft); font: inherit; font-weight: 600; padding: 7px 13px; border-radius: var(--radius-sm); cursor: pointer; }
.tab[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* Cartes de modules */
.module-card {
  display: flex; flex-direction: column; gap: 10px; padding: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  transition: border-color .15s, transform .15s;
}
.module-card:hover { border-color: var(--border-strong); }
.module-card .mc-head { display: flex; align-items: center; gap: 10px; }
.mc-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-soft); flex: none; }
.mc-icon svg { width: 18px; height: 18px; }
.module-card.on .mc-icon { background: var(--accent-soft); color: var(--accent-strong); }
.mc-name { font-weight: 650; }
.mc-desc { color: var(--text-faint); font-size: 12.5px; flex: 1; }
.mc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mc-link { font-weight: 600; font-size: 13px; }

/* Listes */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .li-title.wrap { white-space: normal; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.list-item .li-sub { font-size: 12.5px; color: var(--text-faint); }

/* Tableaux */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; color: var(--text-faint); font-weight: 650; background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }

/* Puces (listes de salons/rôles/mots) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 999px; background: var(--surface-3); font-size: 12.5px; }
.chip button { border: 0; background: none; color: var(--text-faint); cursor: pointer; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; }
.chip button:hover { color: var(--danger); background: var(--danger-soft); }

/* Alertes et états */
.alert { display: flex; gap: 12px; padding: 13px 15px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); margin-bottom: 16px; }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.alert .alert-body { flex: 1; min-width: 0; }
.alert .alert-title { font-weight: 650; }
.alert.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.alert.ok svg { color: var(--ok); }
.alert.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.alert.warn svg { color: var(--warn); }
.alert.danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.alert.danger svg { color: var(--danger); }
.alert.info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 35%, transparent); }
.alert.info svg { color: var(--info); }

.empty { text-align: center; padding: 34px 20px; color: var(--text-faint); }
.empty svg { width: 34px; height: 34px; color: var(--text-faint); margin-bottom: 8px; }
.empty .empty-title { color: var(--text); font-weight: 650; margin-bottom: 4px; }

.skeleton { position: relative; overflow: hidden; background: var(--surface-2); border-radius: var(--radius-sm); min-height: 14px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 6%, transparent), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.skeleton-block { height: 120px; border-radius: var(--radius-lg); margin-bottom: 16px; }

/* Barre d'enregistrement */
.savebar {
  position: sticky; bottom: 16px; z-index: 15; margin-top: 20px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop);
}
.savebar .sb-text { flex: 1; min-width: 180px; font-size: 13px; color: var(--text-soft); display: flex; align-items: center; gap: 8px; }
.savebar.dirty { border-color: color-mix(in srgb, var(--warn) 55%, var(--border)); }
.savebar.dirty .sb-text { color: var(--warn); font-weight: 600; }

/* Section repliable (paramètres avancés) */
details.advanced { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 12px; }
details.advanced > summary { cursor: pointer; list-style: none; font-weight: 600; color: var(--text-soft); display: flex; align-items: center; gap: 8px; }
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced > summary::before { content: "›"; display: inline-block; transition: transform .15s; font-size: 16px; }
details.advanced[open] > summary::before { transform: rotate(90deg); }
details.advanced > .adv-body { padding-top: 14px; }

/* Aperçu de message Discord */
.discord-preview { background: #313338; color: #dbdee1; border-radius: var(--radius); padding: 14px 16px; font-size: 14px; }
:root[data-theme="light"] .discord-preview { background: #ffffff; color: #313338; border: 1px solid var(--border); }
.dp-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.dp-bot { font-weight: 600; color: #fff; }
:root[data-theme="light"] .dp-bot { color: #060607; }
.dp-tag { font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 3px; background: #5865f2; color: #fff; }
.dp-time { font-size: 12px; color: #949ba4; }
.dp-embed { margin-top: 6px; border-left: 4px solid var(--accent); background: #2b2d31; border-radius: 4px; padding: 10px 14px; max-width: 520px; }
:root[data-theme="light"] .dp-embed { background: #f2f3f5; }
.dp-embed-title { font-weight: 700; margin-bottom: 4px; color: #f2f3f5; }
:root[data-theme="light"] .dp-embed-title { color: #060607; }
.dp-text { white-space: pre-wrap; word-break: break-word; }
.dp-reactions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.dp-reaction { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 8px; background: #2b2d31; border: 1px solid #3f4147; font-size: 13px; }
:root[data-theme="light"] .dp-reaction { background: #f2f3f5; border-color: #e3e5e8; }
.dp-mention { background: rgba(88, 101, 242, .3); color: #c9cdfb; border-radius: 3px; padding: 0 2px; }
:root[data-theme="light"] .dp-mention { background: rgba(88, 101, 242, .15); color: #4752c4; }
.dp-components { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.dp-button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 16px; min-height: 32px; border-radius: 4px; background: #5865f2; color: #fff; font-weight: 500; font-size: 14px; }

/* Barres de progression (résultats) */
.meter { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }

/* Notifications */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 40px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-pop); animation: toastin .2s ease;
}
.toast svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.toast.ok svg { color: var(--ok); }
.toast.error { border-color: color-mix(in srgb, var(--danger) 50%, var(--border)); }
.toast.error svg { color: var(--danger); }
.toast.warn svg { color: var(--warn); }
.toast .t-msg { flex: 1; }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Dialogues */
dialog { border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop); padding: 0; width: min(560px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(5, 7, 12, 0.6); backdrop-filter: blur(3px); }
.dialog-body { padding: 20px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }

/* Palette de recherche */
.palette-input { border: 0 !important; border-bottom: 1px solid var(--border) !important; border-radius: 0 !important; box-shadow: none !important; min-height: 52px !important; font-size: 15px !important; padding: 0 18px !important; background: transparent !important; }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: 360px; overflow-y: auto; }
.palette-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); cursor: pointer; }
.palette-item[aria-selected="true"] { background: var(--accent-soft); }
.palette-item .pi-cat { margin-left: auto; font-size: 12px; color: var(--text-faint); }
.palette-empty { padding: 20px; text-align: center; color: var(--text-faint); }

/* Connexion */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(420px, 100%); text-align: center; padding: 36px 30px; }
.login-card .brand-mark { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 18px; }
.login-card .brand-mark svg { width: 30px; height: 30px; }
.btn.discord { background: #5865f2; border-color: #5865f2; color: #fff; min-height: 44px; padding: 10px 22px; }
.btn.discord:hover { background: #4752c4; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 60; width: min(86vw, 300px);
    transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow-pop);
  }
  .app.nav-open .sidebar { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 55; background: rgba(5, 7, 12, .55); }
  .scrim[hidden] { display: none; }
  .menu-toggle { display: grid; }
  .topbar { padding: 0 16px; }
  .content { padding: 20px 16px 96px; }
}
@media (max-width: 640px) {
  .grid.cols-2, .grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-value { font-size: 22px; }
  h1 { font-size: 21px; }
  .card { padding: 16px; }
  .page-icon { display: none; }
  .savebar { bottom: 10px; }
  .savebar .btn { flex: 1; }
  .hide-sm { display: none !important; }
  th, td { padding: 9px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Tuiles de chiffres */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.content pre { max-width: 100%; }

/* Soundboard : zone de dépôt */
.sb-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px 16px; text-align: center; border: 2px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s; }
.sb-drop svg { width: 26px; height: 26px; color: var(--accent-strong); }
.sb-drop:hover, .sb-drop.over { border-color: var(--accent); background: var(--accent-soft); }


/* Vérification : étapes du parcours */
.vf-steps { display: grid; gap: 10px; }
.vf-step { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.vf-step.on { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.vf-step-num { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 999px; font-weight: 700; background: var(--surface-3); color: var(--text-faint); }
.vf-step.on .vf-step-num { background: var(--accent); color: #fff; }
.vf-step-body { flex: 1; min-width: 0; }
.vf-step-title { font-weight: 600; }
.vf-step-text { font-size: 12.5px; color: var(--text-faint); }
.card.vf-danger { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }

/* Rôles par réaction */
.rr-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.rr-add input[type="text"] { width: 84px; text-align: center; font-size: 16px; }
.rr-add select { flex: 1 1 160px; min-width: 0; }
.rr-emoji { width: 22px; height: 22px; object-fit: contain; vertical-align: middle; flex: none; }
.rr-emoji-txt { font-size: 20px; line-height: 1; flex: none; width: 24px; text-align: center; }

/* Alertes live */
.la-providers { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.la-prov { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.la-prov strong { flex: 1; }
.la-dot { display: inline-block; width: 10px; height: 10px; border-radius: 999px; flex: none; margin-right: 6px; }
.la-add { border-top: 1px solid var(--border); padding-top: 14px; }

/* Actualités : catégories */
.nw-cats { display: flex; flex-wrap: wrap; gap: 8px; }
.nw-cat { border: 1px solid var(--border); background: var(--surface-2); color: var(--text-soft); font: inherit; font-weight: 600; font-size: 13px; padding: 7px 12px; border-radius: 999px; cursor: pointer; }
.nw-cat.on { background: color-mix(in srgb, var(--accent) 18%, var(--surface-2)); border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); color: var(--text); }
.nw-cat:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Statistiques du serveur */
.ss-voice { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--surface-3); color: var(--text-faint); flex: none; }
.ss-voice svg { width: 16px; height: 16px; }
.ss-preview { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius); background: #2b2d31; color: #dbdee1; font-weight: 600; }
:root[data-theme="light"] .ss-preview { background: #f2f3f5; color: #313338; }

/* Messages enrichis */
.eb-sticky { position: sticky; top: 76px; }
@media (max-width: 900px) { .eb-sticky { position: static; } }
.eb-color, .input-row .eb-color { width: 52px; min-width: 52px; height: 40px; padding: 3px; cursor: pointer; flex: 0 0 52px; }
.eb-field { display: grid; gap: 6px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; background: var(--surface-2); }
.eb-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-soft); }
.eb-embed { display: flex; gap: 12px; max-width: 520px; }
.eb-main { flex: 1; min-width: 0; }
.eb-author { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.eb-pfields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.eb-pf { grid-column: 1 / -1; min-width: 0; }
.eb-pf.inline { grid-column: auto; }
.eb-pf-name { font-weight: 700; font-size: 13px; }
.eb-pf-value { font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.eb-img { display: block; max-width: 100%; border-radius: 4px; margin-top: 10px; }
.eb-thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 4px; flex: none; }
.eb-footer { font-size: 12px; color: #949ba4; margin-top: 8px; }
.dp-link { color: #00a8fc; }
.dp-text code { background: rgba(0,0,0,.25); border-radius: 3px; padding: 0 3px; font-size: 12.5px; }
:root[data-theme="light"] .dp-text code { background: #e3e5e8; }

/* Système : journaux */
.sy-logs { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; font-family: var(--mono, ui-monospace, monospace); font-size: 11.5px; line-height: 1.55; max-height: 460px; overflow: auto; white-space: pre-wrap; word-break: break-word; margin: 0; color: var(--text-soft); }

/* Assetto : état en direct */
.as-live { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.as-srv { padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); min-width: 0; }
.as-srv-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.as-srv-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-dot { width: 9px; height: 9px; border-radius: 999px; background: var(--danger); flex: none; }
.as-dot.up { background: var(--ok); }

/* Sélecteurs de couleur : une pastille, pas une barre pleine largeur */
input[type="color"] { width: 64px; max-width: 64px; min-width: 64px; height: 40px; padding: 3px; cursor: pointer; flex: 0 0 64px; }
