:root {
  --bg: #0b0918;
  --bg2: #110e24;
  --panel: #15122c;
  --panel2: #1c1838;
  --border: #29244f;
  --text: #ece9ff;
  --muted: #9a93c7;
  --yellow: #f7c948;
  --purple: #8b5cf6;
  --indigo: #5b5bd6;
  --green: #3ddc84;
  --red: #ff5d6c;
  --orange: #ffa94d;
  --radius: 14px;
  --font: 'Inter', system-ui, sans-serif;
  --display: 'Outfit', 'Inter', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); }
a { color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -0.01em; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- Connexion ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px 60px; overflow: hidden; }
.login-glow { position: fixed; inset: -30% -10% auto; height: 80vh; background: radial-gradient(closest-side, rgba(139, 92, 246, .35), transparent), radial-gradient(closest-side at 70% 60%, rgba(247, 201, 72, .18), transparent); pointer-events: none; }
.login-card { position: relative; width: 100%; max-width: 400px; background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--border); border-radius: 20px; padding: 36px 28px; text-align: center; box-shadow: 0 30px 80px rgba(0, 0, 0, .45); }
.login-logo { width: 64px; height: 64px; margin-bottom: 18px; }
.login-card h1 { font-size: 26px; }
.login-card > p { margin: 6px 0 24px; }
.btn-discord { display: flex; align-items: center; justify-content: center; gap: 10px; background: #5865f2; color: #fff; text-decoration: none; font-weight: 600; padding: 13px; border-radius: 12px; transition: transform .15s, background .15s; }
.btn-discord:hover { background: #4752c4; transform: translateY(-1px); }
.login-note { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); display: grid; gap: 2px; font-size: 13px; color: var(--muted); }
.login-note strong { color: var(--yellow); font-weight: 600; }
.login-footer { position: fixed; bottom: 16px; left: 0; right: 0; text-align: center; font-size: 12px; color: var(--muted); }
.alert { background: rgba(255, 93, 108, .12); border: 1px solid rgba(255, 93, 108, .4); color: #ffb3bb; padding: 10px 12px; border-radius: 10px; margin-bottom: 16px; font-size: 13px; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar { background: var(--bg2); border-right: 1px solid var(--border); padding: 18px 14px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px; }
.brand img { width: 38px; height: 38px; }
.brand b { font-family: var(--display); font-size: 17px; display: block; line-height: 1.1; }
.brand span { color: var(--yellow); font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.server-card { background: linear-gradient(135deg, rgba(139, 92, 246, .18), rgba(247, 201, 72, .08)); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.server-top { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.server-big { font-family: var(--display); font-size: 30px; font-weight: 700; margin-top: 6px; line-height: 1; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(61, 220, 132, .2); }
.dot.off { background: var(--red); }
nav { display: grid; gap: 2px; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: 12px 10px 6px; }
nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; text-decoration: none; color: #cfcaf0; font-weight: 500; }
nav a i { font-style: normal; width: 20px; text-align: center; }
nav a:hover { background: var(--panel); }
nav a.active { background: var(--panel2); color: #fff; box-shadow: inset 3px 0 0 var(--yellow); }
.badge { margin-left: auto; background: var(--yellow); color: #1a1400; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 0 7px; }
.badge:empty { display: none; }
.bot-card { margin-top: auto; display: flex; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; }
.bot-card img { width: 36px; height: 36px; border-radius: 50%; }
.bot-card b { display: block; font-size: 13px; }

.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 18px 28px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: rgba(11, 9, 24, .85); backdrop-filter: blur(10px); z-index: 5; }
.topbar h1 { font-size: 22px; }
.burger { display: none; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; width: 40px; height: 40px; cursor: pointer; }
.user { margin-left: auto; display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--border); padding: 5px 6px 5px 5px; border-radius: 99px; }
.user img { width: 30px; height: 30px; border-radius: 50%; }
.user span { font-weight: 500; font-size: 13px; }
.logout { text-decoration: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); }
.logout:hover { background: var(--panel2); color: var(--red); }
.view { padding: 24px 28px 60px; display: grid; gap: 20px; }

/* ---------- Cartes ---------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h2 { font-size: 16px; }
.grid { display: grid; gap: 20px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stat .label { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.stat .value { font-family: var(--display); font-size: 32px; font-weight: 700; margin: 6px 0 2px; line-height: 1.1; }
.stat .sub { font-size: 12px; color: var(--muted); }
.stat .ico { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: var(--panel2); }
.up { color: var(--green); } .down { color: var(--red); }
.accent-y { border-top: 3px solid var(--yellow); }
.accent-p { border-top: 3px solid var(--purple); }
.accent-g { border-top: 3px solid var(--green); }
.accent-i { border-top: 3px solid var(--indigo); }

.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--c); }
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }

.bars { display: grid; gap: 12px; }
.bar-row .top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.bar { height: 8px; background: var(--panel2); border-radius: 99px; overflow: hidden; }
.bar > div { height: 100%; background: linear-gradient(90deg, var(--purple), var(--yellow)); border-radius: 99px; }

.feed { display: grid; gap: 2px; }
.feed-row { display: flex; gap: 12px; align-items: flex-start; padding: 9px 4px; border-bottom: 1px solid rgba(41, 36, 79, .6); }
.feed-row:last-child { border-bottom: 0; }
.feed-ico { width: 30px; height: 30px; flex: none; border-radius: 9px; background: var(--panel2); display: grid; place-items: center; }
.feed-row .msg { flex: 1; min-width: 0; }
.feed-row .msg b { font-weight: 600; }
.feed-row time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 500; }

/* ---------- Tableaux ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.tabs { display: inline-flex; background: var(--panel2); border: 1px solid var(--border); border-radius: 11px; padding: 3px; }
.tabs button { background: none; border: 0; padding: 7px 14px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 500; }
.tabs button.on { background: var(--panel); color: #fff; box-shadow: 0 1px 0 var(--border); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid rgba(41, 36, 79, .6); white-space: nowrap; }
tr:hover td { background: rgba(28, 24, 56, .5); }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.open { background: rgba(61, 220, 132, .12); color: var(--green); }
.pill.closed { background: rgba(154, 147, 199, .12); color: var(--muted); }
.pill.deleted { background: rgba(255, 93, 108, .1); color: var(--red); }

/* ---------- Formulaires ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--panel2); padding: 9px 14px; border-radius: 10px; cursor: pointer; font-weight: 500; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #3b3470; }
.btn.primary { background: var(--yellow); color: #1a1400; border-color: var(--yellow); font-weight: 600; }
.btn.primary:hover { background: #ffd666; }
.btn.purple { background: var(--purple); border-color: var(--purple); color: #fff; }
.btn.danger { color: var(--red); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 500; }
.field small { color: var(--muted); font-size: 12px; }
.input, select, textarea { width: 100%; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; outline: none; }
.input:focus, select:focus, textarea:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(139, 92, 246, .2); }
textarea { resize: vertical; min-height: 90px; }
select option { background: var(--bg2); }
input[type=color] { width: 46px; height: 40px; padding: 3px; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.form { display: grid; gap: 16px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.switch input { display: none; }
.switch .knob { width: 40px; height: 22px; border-radius: 99px; background: var(--border); position: relative; flex: none; transition: background .15s; }
.switch .knob::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .knob { background: var(--green); }
.switch input:checked + .knob::after { transform: translateX(18px); }
.roles { display: flex; flex-wrap: wrap; gap: 6px; max-height: 200px; overflow-y: auto; padding: 8px; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; }
.role { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 99px; cursor: pointer; font-size: 12px; user-select: none; }
.role input { display: none; }
.role i { width: 9px; height: 9px; border-radius: 50%; background: var(--c, #99aab5); }
.role:has(input:checked) { background: rgba(139, 92, 246, .2); border-color: var(--purple); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--panel2); border: 1px solid var(--border); }
.hint { background: rgba(247, 201, 72, .08); border: 1px solid rgba(247, 201, 72, .25); color: #f3dc96; padding: 10px 12px; border-radius: 10px; font-size: 13px; }
.save-bar { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Catégories ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.cat { display: grid; gap: 10px; }
.cat-top { display: flex; gap: 12px; align-items: center; }
.cat-emoji { width: 44px; height: 44px; border-radius: 12px; background: var(--panel2); display: grid; place-items: center; font-size: 22px; flex: none; }
.cat-top h3 { font-size: 16px; }
.cat .off { opacity: .55; }
.cat-actions { display: flex; gap: 8px; margin-top: 4px; }

/* ---------- Aperçu Discord ---------- */
.discord { background: #313338; border-radius: 12px; padding: 16px; color: #dbdee1; font-family: 'gg sans', 'Segoe UI', Roboto, sans-serif; }
.d-msg { display: flex; gap: 14px; }
.d-msg > img { width: 40px; height: 40px; border-radius: 50%; }
.d-name { font-weight: 600; color: #fff; }
.d-bot { background: #5865f2; color: #fff; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 4px; margin-left: 6px; vertical-align: 2px; }
.d-time { color: #949ba4; font-size: 12px; margin-left: 6px; }
.d-embed { background: #2b2d31; border-left: 4px solid var(--c); border-radius: 4px; padding: 12px 16px; margin-top: 6px; max-width: 460px; }
.d-embed h4 { margin: 0 0 6px; color: #fff; font-size: 15px; }
.d-embed p { margin: 0; font-size: 14px; white-space: pre-wrap; word-wrap: break-word; }
.d-embed img { max-width: 100%; border-radius: 4px; margin-top: 10px; }
.d-footer { font-size: 12px; color: #b5bac1; margin-top: 10px; }
.d-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; max-width: 470px; }
.d-btn { font-size: 14px; font-weight: 500; padding: 6px 14px; border-radius: 4px; color: #fff; }
.d-btn.Primary { background: #5865f2; } .d-btn.Secondary { background: #4e5058; } .d-btn.Success { background: #248046; } .d-btn.Danger { background: #da373c; }
.d-select { margin-top: 8px; max-width: 420px; background: #1e1f22; border-radius: 4px; padding: 10px 12px; color: #949ba4; display: flex; justify-content: space-between; }

/* ---------- Modale & toasts ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(5, 4, 12, .7); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; z-index: 20; }
.modal-bg[hidden] { display: none; }
.modal { width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 22px; }
.modal h2 { font-size: 18px; margin-bottom: 16px; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 30; }
.toast { background: var(--panel2); border: 1px solid var(--border); border-left: 4px solid var(--green); padding: 11px 14px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); max-width: 340px; animation: in .2s ease-out; }
.toast.err { border-left-color: var(--red); }
@keyframes in { from { transform: translateY(8px); opacity: 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main, .g2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 15; width: 270px; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: 20px 0 60px rgba(0, 0, 0, .5); }
  .burger { display: grid; place-items: center; }
  .topbar { padding: 14px 16px; }
  .topbar h1 { font-size: 18px; }
  .user span { display: none; }
  .view { padding: 16px 16px 50px; }
  .row2 { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .g4 { grid-template-columns: 1fr; }
}

/* ---------- Aperçu Components V2 ---------- */
.d-v2 { background: #393a41; border-left: 4px solid var(--c); border-radius: 8px; padding: 14px 16px; margin-top: 6px; max-width: 460px; font-size: 14px; display: grid; gap: 8px; }
.d-v2 hr { border: 0; border-top: 1px solid #4e5058; margin: 4px 0; width: 100%; }
.d-h { font-size: 19px; font-weight: 700; color: #fff; }
.d-quote { border-left: 4px solid #4e5058; padding-left: 10px; display: grid; gap: 2px; }
.d-section { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.d-sub { font-size: 12px; color: #949ba4; }
.d-v2 code, .discord code { background: #2b2d31; padding: 0 4px; border-radius: 4px; font-size: 12px; }
.d-options { margin-top: 4px; max-width: 420px; background: #2b2d31; border: 1px solid #1e1f22; border-radius: 4px; max-height: 210px; overflow-y: auto; }
.d-options div { padding: 7px 12px; display: grid; }
.d-options div + div { border-top: 1px solid #1e1f22; }
.d-options b { color: #fff; font-weight: 600; font-size: 14px; }
.d-options span { color: #949ba4; font-size: 12px; }
.d-eph { font-size: 12px; color: #949ba4; margin-top: 6px; }
.d-eph u { color: #00a8fc; text-decoration: none; }

/* ---------- Mise en route ---------- */
.setup { border-color: rgba(167, 139, 250, .5); background: linear-gradient(135deg, rgba(167, 139, 250, .12), var(--panel)); }
.steps { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.step { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--border); text-decoration: none; }
.step:hover { border-color: #3b3470; }
.step b { display: block; font-weight: 500; font-size: 13px; }
.step small { color: var(--muted); font-size: 12px; }
.step .check { width: 20px; height: 20px; flex: none; border-radius: 50%; border: 2px solid var(--border); display: grid; place-items: center; font-size: 12px; font-weight: 700; margin-top: 1px; }
.step.done { opacity: .6; }
.step.done .check { background: var(--green); border-color: var(--green); color: #0b0918; }
