:root {
    --bg: #0e0f13;
    --bg-2: #15171d;
    --card: #1b1e26;
    --card-2: #232733;
    --border: #2b303d;
    --text: #e8eaf0;
    --muted: #9aa1b2;
    --faint: #6b7285;
    --accent: #7c5cff;
    --accent-2: #5b8cff;
    --accent-soft: rgba(124, 92, 255, 0.14);
    --ok: #3ecf8e;
    --warn: #f5a524;
    --err: #f2555a;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
img { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: 10px; border: 1px solid var(--border);
    background: var(--card-2); cursor: pointer; font-weight: 600; font-size: 14px;
    transition: transform .12s ease, background .15s ease, border-color .15s ease;
    white-space: nowrap;
}
.btn:hover { background: #2b3040; border-color: #3a4052; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; }
.btn-primary:hover { filter: brightness(1.08); background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.btn-ghost { background: transparent; }
.btn-lg { padding: 14px 24px; font-size: 16px; border-radius: 12px; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn svg { width: 18px; height: 18px; flex: none; }

/* ---------- Barre du haut ---------- */
.topbar {
    position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 14px clamp(16px, 4vw, 40px); background: rgba(14, 15, 19, 0.82); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: -0.01em; }
.brand img { width: 34px; height: 34px; border-radius: 10px; background: var(--card-2); }
.topbar nav { display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--card); border: 1px solid var(--border); font-weight: 600; font-size: 14px; }
.user-chip img { width: 28px; height: 28px; border-radius: 50%; }

/* ---------- Accueil ---------- */
.hero { position: relative; overflow: hidden; padding: clamp(56px, 10vw, 110px) clamp(16px, 4vw, 40px) 60px; text-align: center; }
.hero::before {
    content: ''; position: absolute; inset: -40% -10% auto; height: 520px; z-index: -1;
    background: radial-gradient(closest-side, rgba(124, 92, 255, 0.35), transparent), radial-gradient(closest-side at 70% 40%, rgba(91, 140, 255, 0.25), transparent);
    filter: blur(20px);
}
.hero .avatar { width: 96px; height: 96px; border-radius: 28px; margin: 0 auto 22px; box-shadow: var(--shadow); background: var(--card-2); }
.hero h1 { font-size: clamp(32px, 6vw, 58px); line-height: 1.05; margin: 0 0 16px; letter-spacing: -0.03em; font-weight: 800; }
.hero h1 .grad { background: linear-gradient(135deg, #b9a8ff, #7cb3ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { color: var(--muted); font-size: clamp(16px, 2.2vw, 19px); max-width: 640px; margin: 0 auto 30px; }
.hero .cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.stats-row { display: flex; justify-content: center; gap: clamp(20px, 6vw, 64px); margin-top: 44px; flex-wrap: wrap; }
.stats-row div { text-align: center; }
.stats-row b { display: block; font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.stats-row span { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }

.section { padding: 40px clamp(16px, 4vw, 40px) 70px; max-width: 1180px; margin: 0 auto; }
.section h2 { font-size: 28px; letter-spacing: -0.02em; margin: 0 0 6px; text-align: center; }
.section .sub { color: var(--muted); text-align: center; margin: 0 0 32px; }
.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.feature { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 18px 16px; transition: border-color .15s, transform .15s; }
.feature:hover { border-color: #3d3570; transform: translateY(-2px); }
.feature h3 { margin: 0 0 6px; font-size: 16px; }
.feature p { margin: 0; color: var(--muted); font-size: 14px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; counter-reset: step; }
.step { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.step::before { counter-increment: step; content: counter(step); display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--accent-soft); color: #b9a8ff; font-weight: 800; margin-bottom: 12px; }
.step h3 { margin: 0 0 4px; font-size: 16px; }
.step p { margin: 0; color: var(--muted); font-size: 14px; }
footer { text-align: center; color: var(--faint); font-size: 13px; padding: 30px 16px 40px; border-top: 1px solid var(--border); }

/* ---------- Liste des serveurs ---------- */
.page { max-width: 1180px; margin: 0 auto; padding: 34px clamp(16px, 4vw, 40px) 60px; }
.page h1 { font-size: 28px; margin: 0 0 4px; letter-spacing: -0.02em; }
.page .sub { color: var(--muted); margin: 0 0 26px; }
.guild-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.guild-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; transition: border-color .15s, transform .15s; }
.guild-card:hover { border-color: #3a4052; transform: translateY(-2px); }
.guild-card .g-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.guild-card .g-meta { color: var(--muted); font-size: 13px; margin-top: -8px; }
.guild-card .btn { width: 100%; }
.guild-card.off { opacity: .85; }
.g-icon { width: 72px; height: 72px; border-radius: 22px; background: var(--card-2); display: grid; place-items: center; font-weight: 800; font-size: 22px; color: var(--muted); overflow: hidden; flex: none; }
.g-icon img { width: 100%; height: 100%; object-fit: cover; }
.g-icon.sm { width: 40px; height: 40px; border-radius: 12px; font-size: 15px; }

/* ---------- Page serveur ---------- */
.layout { display: grid; grid-template-columns: 270px 1fr; min-height: calc(100vh - 63px); }
.sidebar { border-right: 1px solid var(--border); background: var(--bg-2); padding: 18px 12px; position: sticky; top: 63px; height: calc(100vh - 63px); overflow-y: auto; }
.side-guild { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.side-guild b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 170px; }
.side-guild span { color: var(--muted); font-size: 12px; }
.side-title { color: var(--faint); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; padding: 14px 10px 6px; }
.side-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--muted); font-weight: 500; font-size: 14px; cursor: pointer; }
.side-link:hover { background: var(--card); color: var(--text); }
.side-link.active { background: var(--accent-soft); color: #d6ccff; }
.side-link .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-left: auto; flex: none; }
.side-link .dot.off { background: var(--faint); }
.content { padding: 30px clamp(16px, 3vw, 40px) 80px; min-width: 0; max-width: 1060px; }
.content h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -0.02em; }
.content > .sub { color: var(--muted); margin: 0 0 24px; }
.menu-toggle { display: none; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat span { color: var(--muted); font-size: 13px; }
.stat b { display: block; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin-top: 2px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.panel h2 { font-size: 16px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.panel h2 .muted { font-weight: 500; }
.muted { color: var(--muted); }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); font-size: 14px; }
.list-row:first-of-type { border-top: 0; }
.list-row .l { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--card-2); color: var(--muted); flex: none; }
.badge.ok { background: rgba(62, 207, 142, .12); color: var(--ok); }
.badge.warn { background: rgba(245, 165, 36, .12); color: var(--warn); }
.badge.err { background: rgba(242, 85, 90, .12); color: var(--err); }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; font-size: 14px; }
.check .ic { flex: none; width: 20px; text-align: center; }
.check a { color: #b9a8ff; cursor: pointer; }

/* Modules */
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.mod { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; gap: 14px; align-items: flex-start; }
.mod .txt { flex: 1; min-width: 0; }
.mod h3 { margin: 0 0 4px; font-size: 15px; }
.mod p { margin: 0; color: var(--muted); font-size: 13px; }
.mod .link { color: #b9a8ff; font-size: 13px; cursor: pointer; display: inline-block; margin-top: 8px; font-weight: 600; }

/* Champs */
.field { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 340px); gap: 16px; align-items: center; padding: 14px 0; border-top: 1px solid var(--border); }
.field:first-of-type { border-top: 0; }
.field.block { grid-template-columns: 1fr; gap: 8px; }
.field label { font-weight: 600; font-size: 14px; }
.field .hint { display: block; color: var(--faint); font-size: 12px; font-weight: 500; margin-top: 2px; }
.field .ctrl { display: flex; align-items: center; gap: 8px; justify-content: flex-end; min-width: 0; }
.field.block .ctrl { justify-content: stretch; }
.reset { color: var(--faint); font-size: 12px; cursor: pointer; background: none; border: 0; padding: 4px; flex: none; }
.reset:hover { color: var(--text); }
.input, select.input, textarea.input {
    width: 100%; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; outline: none; font-size: 14px;
    transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { min-height: 88px; resize: vertical; line-height: 1.45; }
input[type=color].input { padding: 4px; height: 40px; cursor: pointer; }
select.input { cursor: pointer; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: #3a3f4d; border-radius: 999px; cursor: pointer; transition: background .15s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 8px; background: var(--card-2); font-size: 13px; border: 1px solid var(--border); }
.chip button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; }
.chip button:hover { color: var(--err); }
.chip i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.multi { width: 100%; }

/* Toasts & états */
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--card-2); border: 1px solid var(--border); border-left: 4px solid var(--ok); border-radius: 10px; padding: 10px 14px; font-size: 14px; box-shadow: var(--shadow); animation: slide .2s ease; max-width: 340px; }
.toast.err { border-left-color: var(--err); }
@keyframes slide { from { transform: translateY(8px); opacity: 0; } }
.center { display: grid; place-items: center; min-height: 60vh; text-align: center; padding: 20px; }
.center p { color: var(--muted); max-width: 440px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 0 auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }
.alert { background: rgba(245, 165, 36, .08); border: 1px solid rgba(245, 165, 36, .35); color: #f7c873; padding: 12px 14px; border-radius: 12px; font-size: 14px; margin-bottom: 16px; }
.empty { color: var(--faint); font-size: 14px; padding: 6px 0; }
.search { max-width: 320px; margin-bottom: 16px; }

@media (max-width: 860px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar { position: fixed; inset: 63px 0 0 0; height: auto; z-index: 30; transform: translateX(-100%); transition: transform .2s; width: 280px; box-shadow: var(--shadow); }
    .sidebar.open { transform: none; }
    .menu-toggle { display: inline-flex; }
    .field { grid-template-columns: 1fr; gap: 8px; }
    .field .ctrl { justify-content: flex-start; }
    .topbar .hide-sm { display: none; }
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
