/* ───────────────────────── Sentra — design system ───────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #ffffff;
  --bg-soft: #f7f8fb;
  --bg-sunken: #f1f3f8;
  --border: #e8eaf1;
  --border-strong: #d9dce7;
  --text: #0f1222;
  --muted: #5b6178;
  --faint: #8d93a8;
  --brand: #6366f1;
  --brand-2: #7c3aed;
  --brand-ink: #4f46e5;
  --brand-soft: #eef0ff;
  --brand-grad: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
  --success: #16a34a;
  --success-soft: #ebfbf1;
  --danger: #e11d48;
  --danger-soft: #fff1f3;
  --warning: #d97706;
  --warning-soft: #fff7e8;
  --info: #2563eb;
  --info-soft: #eff5ff;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow: 0 4px 16px -4px rgba(16, 24, 40, .08), 0 2px 4px -2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 24px 48px -16px rgba(16, 24, 40, .18);
  --ring: 0 0 0 4px rgba(99, 102, 241, .16);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.55; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; font-feature-settings: 'cv11', 'ss01';
}
img { max-width: 100%; display: block; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.02em; line-height: 1.2; }
p { margin: 0; }
code, kbd { font-family: var(--mono); font-size: .88em; background: var(--bg-sunken); padding: .12em .4em; border-radius: 6px; }
::selection { background: rgba(99, 102, 241, .18); }
:focus-visible { outline: none; box-shadow: var(--ring); }

/* ───────── Boutons ───────── */
.btn {
  --h: 38px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--h); padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text);
  font-weight: 600; font-size: 14px; white-space: nowrap; text-decoration: none !important;
  transition: transform .15s var(--ease), box-shadow .2s var(--ease), background .2s, border-color .2s, color .2s;
  box-shadow: var(--shadow-xs);
}
.btn:hover { border-color: var(--border-strong); background: var(--bg-soft); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-primary { background: var(--brand-grad); color: #fff; border-color: transparent; box-shadow: 0 6px 18px -6px rgba(99, 102, 241, .6), inset 0 1px 0 rgba(255, 255, 255, .18); }
.btn-primary:hover { background: var(--brand-grad); filter: brightness(1.06); box-shadow: 0 10px 24px -8px rgba(99, 102, 241, .65); }
.btn-dark { background: var(--text); color: #fff; border-color: var(--text); }
.btn-dark:hover { background: #22263a; }
.btn-danger { color: var(--danger); border-color: #fbd0da; background: #fff; }
.btn-danger:hover { background: var(--danger-soft); border-color: #f6a8b9; }
.btn-danger-solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn-ghost:hover { background: var(--bg-sunken); color: var(--text); }
.btn-sm { --h: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-lg { --h: 48px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn-icon { width: var(--h); padding: 0; }
.btn .spin { width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-discord { background: #5865f2; color: #fff; border-color: #5865f2; }
.btn-discord:hover { background: #4752c4; }

/* ───────── Formulaires ───────── */
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff;
  color: var(--text); font: inherit; font-size: 14px; transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input-sm { height: 34px; font-size: 13px; }
.label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--text); }
.hint { font-size: 12.5px; color: var(--faint); margin-top: 6px; }
.field { display: flex; flex-direction: column; min-width: 0; }
.input-group { display: flex; gap: 8px; align-items: center; }
.input-group .input { flex: 1; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238d93a8' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }

/* Interrupteur */
.switch { position: relative; width: 40px; height: 23px; flex: none; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: #d7dae5; transition: background .25s var(--ease); cursor: pointer; }
.switch span::after {
  content: ''; position: absolute; top: 2.5px; left: 2.5px; width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .25); transition: transform .3s var(--ease);
}
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(17px); }
.switch input:focus-visible + span { box-shadow: var(--ring); }

/* Case à cocher */
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; user-select: none; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); }

.lang-select { height: 32px; border: 1px solid var(--border); border-radius: 9px; background: #fff; padding: 0 8px; font: inherit; font-size: 13px; color: var(--text); cursor: pointer; }

/* ───────── Cartes ───────── */
.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 14px; }
.card-head h3 { font-size: 15.5px; font-weight: 700; }
.card-head p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.card-body { padding: 4px 20px 20px; }
.card-body.flush { padding: 0; }
.card + .card { margin-top: 16px; }
.divider { height: 1px; background: var(--border); margin: 0; border: 0; }

/* Ligne de réglage */
.row-setting { display: flex; align-items: center; gap: 16px; padding: 14px 20px; border-top: 1px solid var(--border); transition: background .15s; }
.row-setting:hover { background: #fcfcfe; }
.row-setting .grow { flex: 1; min-width: 0; }
.row-setting .title { font-weight: 600; font-size: 14px; }
.row-setting .desc { color: var(--muted); font-size: 13px; margin-top: 1px; }
.row-setting.off .title, .row-setting.off .desc { opacity: .55; }
.row-setting .extra { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.row-setting .extra .input { width: 76px; height: 32px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--bg-sunken); color: var(--muted); white-space: nowrap; }
.badge-brand { background: var(--brand-soft); color: var(--brand-ink); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dot-success { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .18); }
.dot-danger { background: #f43f5e; box-shadow: 0 0 0 3px rgba(244, 63, 94, .16); }
.dot-warning { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .18); }
.pulse { animation: pulse 2s ease-in-out infinite; }

/* Grilles */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.hstack { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.bold { font-weight: 700; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.center { text-align: center; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.hidden { display: none !important; }

/* Statistique */
.stat { padding: 18px 20px; }
.stat .k { font-size: 13px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 8px; }
.stat .v { font-size: 28px; font-weight: 800; letter-spacing: -.03em; margin-top: 6px; line-height: 1.1; }
.stat .s { font-size: 12.5px; color: var(--faint); margin-top: 4px; }
.stat .ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); }

/* Puces (tags) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 6px 0 6px; border: 1px solid var(--border);
  border-radius: 99px; background: #fff; font-size: 13px; font-weight: 500; animation: pop .25s var(--ease);
}
.chip img { width: 22px; height: 22px; border-radius: 50%; }
.chip .x { width: 22px; height: 22px; border-radius: 50%; border: 0; background: transparent; color: var(--faint); display: grid; place-items: center; }
.chip .x:hover { background: var(--danger-soft); color: var(--danger); }
.chip .swatch { width: 10px; height: 10px; border-radius: 50%; margin-left: 6px; }
.chip.cmd { padding: 0 12px; font-family: var(--mono); font-size: 12.5px; background: var(--bg-soft); }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 600; color: var(--faint); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--bg-soft); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr { transition: background .15s; }
.table tbody tr:hover { background: #fafbfd; }
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--bg-sunken); flex: none; }
.avatar-lg { width: 48px; height: 48px; border-radius: 14px; }

/* Liste vide */
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty .ico { width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 12px; display: grid; place-items: center; background: var(--bg-sunken); color: var(--faint); }
.empty b { display: block; color: var(--text); margin-bottom: 2px; }

/* Squelettes de chargement */
.skeleton { background: linear-gradient(90deg, #f0f2f7 25%, #f8f9fc 37%, #f0f2f7 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 8px; }

/* Alertes */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; border: 1px solid; font-size: 13.5px; }
.alert b { display: block; margin-bottom: 2px; }
.alert-warning { background: var(--warning-soft); border-color: #fde3b0; color: #7a4a06; }
.alert-danger { background: var(--danger-soft); border-color: #fecdd6; color: #8a1230; }
.alert-info { background: var(--brand-soft); border-color: #dcdfff; color: #3730a3; }
.alert-success { background: var(--success-soft); border-color: #c6f0d5; color: #14532d; }

/* Toasts */
#toasts { position: fixed; bottom: 22px; right: 22px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  pointer-events: auto; min-width: 260px; max-width: 380px; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px;
  background: #0f1222; color: #fff; box-shadow: var(--shadow-lg); font-size: 13.5px; animation: toastIn .35s var(--ease);
}
.toast.out { animation: toastOut .3s var(--ease) forwards; }
.toast .ti { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: #22c55e; }
.toast.error .ti { background: #f43f5e; }

/* Modale */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 18, 34, .38); backdrop-filter: blur(4px); z-index: 900; display: grid; place-items: center; padding: 20px; animation: fade .2s ease; }
.modal { width: 100%; max-width: 480px; background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg); animation: modalIn .3s var(--ease); max-height: 90vh; overflow: auto; }
.modal-head { padding: 20px 22px 6px; }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 12px 22px; color: var(--muted); }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 20px; }

/* Barre "modifications non enregistrées" */
.savebar {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 220%); z-index: 800; display: flex; align-items: center; gap: 16px;
  padding: 10px 10px 10px 18px; background: #0f1222; color: #fff; border-radius: 14px; box-shadow: var(--shadow-lg);
  transition: transform .45s var(--ease), opacity .3s, visibility .3s; font-size: 14px; font-weight: 500; opacity: 0; visibility: hidden;
}
.savebar.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.savebar.shake { animation: shake .4s; }
.savebar .btn-ghost { color: #c9cce0; }
.savebar .btn-ghost:hover { background: rgba(255, 255, 255, .08); color: #fff; }

/* Menu déroulant / sélecteur */
.picker { position: relative; }
.picker-btn {
  width: 100%; min-height: 40px; display: flex; align-items: center; gap: 8px; padding: 6px 34px 6px 12px; text-align: left;
  border: 1px solid var(--border); border-radius: 10px; background: #fff; color: var(--text); font-size: 14px; position: relative; flex-wrap: wrap;
}
.picker-btn::after { content: ''; position: absolute; right: 13px; top: 50%; width: 7px; height: 7px; border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint); transform: translateY(-70%) rotate(45deg); }
.picker-btn:hover { border-color: var(--border-strong); }
.picker-btn.placeholder { color: var(--faint); }
.picker-pop {
  position: absolute; z-index: 600; top: calc(100% + 6px); left: 0; right: 0; min-width: 240px; background: #fff; border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; animation: popIn .18s var(--ease); transform-origin: top;
}
.picker-pop .input { height: 36px; margin-bottom: 6px; }
.picker-list { max-height: 280px; overflow: auto; }
.picker-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 700; padding: 8px 10px 4px; }
.picker-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; cursor: pointer; font-size: 13.5px; }
.picker-item:hover, .picker-item.active { background: var(--bg-soft); }
.picker-item.selected { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.picker-item.disabled { opacity: .45; cursor: not-allowed; }
.picker-item .tag { margin-left: auto; font-size: 11px; color: var(--warning); font-weight: 600; }
.ch-ico { width: 16px; color: var(--faint); text-align: center; font-weight: 700; flex: none; }
.role-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* Onglets */
.tabs { display: inline-flex; padding: 3px; background: var(--bg-sunken); border-radius: 11px; gap: 2px; }
.tab { border: 0; background: transparent; padding: 6px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); transition: all .2s var(--ease); }
.tab.active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }

/* Aperçu façon Discord (Components V2) */
.dc { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; display: flex; gap: 12px; font-size: 14px; }
.dc-avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; background: var(--brand-grad); }
.dc-name { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.dc-app { background: #5865f2; color: #fff; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 4px; }
.dc-time { color: var(--faint); font-size: 12px; font-weight: 400; }
.dc-container { margin-top: 6px; border: 1px solid #e3e5ec; border-left: 4px solid var(--accent, #6366f1); background: #f8f9fb; border-radius: 8px; padding: 12px 14px; max-width: 520px; }
.dc-container h4 { font-size: 16px; margin-bottom: 4px; }
.dc-container .sep { height: 1px; background: #e3e5ec; margin: 10px 0; }
.dc-container ul { margin: 4px 0 0; padding-left: 18px; }
.dc-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; margin-top: 10px; border-radius: 8px; background: #e7e9f0; font-weight: 600; font-size: 13px; color: var(--text); }
.dc-thumb { width: 64px; height: 64px; border-radius: 10px; float: right; margin-left: 12px; object-fit: cover; }
.dc-small { color: var(--faint); font-size: 12px; }

/* ───────── Animations ───────── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes shake { 10%, 90% { transform: translate(calc(-50% - 1px), 0); } 20%, 80% { transform: translate(calc(-50% + 2px), 0); } 30%, 50%, 70% { transform: translate(calc(-50% - 4px), 0); } 40%, 60% { transform: translate(calc(-50% + 4px), 0); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes blob { 0%, 100% { transform: translate(0, 0) scale(1); } 33% { transform: translate(30px, -40px) scale(1.08); } 66% { transform: translate(-30px, 20px) scale(.95); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes caret { 50% { opacity: 0; } }

.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.anim-in { animation: fadeUp .5s var(--ease) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
}

@media (max-width: 900px) {
  .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
}
