/* ── Reset & Variables ─────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0d0d0f;
  --surface: #161618;
  --surface2: #1e1e22;
  --border: #2a2a30;
  --border2: #3a3a42;
  --text: #f0f0f2;
  --text2: #8888a0;
  --accent: #7c3aed;
  --accent-light: #a78bfa;
  --accent-bg: rgba(124,58,237,0.12);
  --green: #22c55e;
  --green-bg: rgba(34,197,94,0.1);
  --red: #ef4444;
  --red-bg: rgba(239,68,68,0.1);
  --yellow: #f59e0b;
  --yellow-bg: rgba(245,158,11,0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --nav-h: 54px;
  --sidebar-w: 210px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5; min-height: 100vh; }

/* ── Navbar ─────────────────────────────────── */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--nav-h);
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; z-index: 100;
}
.nav-left  { display: flex; align-items: center; gap: 12px; }
.nav-right { display: flex; align-items: center; gap: 10px; }
.nav-logo  { display: flex; align-items: center; gap: 8px; }
.logo-text { font-weight: 700; font-size: 15px; }
.breadcrumb { display: flex; align-items: center; gap: 8px; color: var(--text2); font-size: 13px; }
.breadcrumb-sep { color: var(--border2); }

.live-badge { display: flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 700; letter-spacing: .08em; color: var(--text2); text-transform: uppercase; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text2); animation: livePulse 2s infinite; transition: background .3s, box-shadow .3s; }
@keyframes livePulse { 0%,100%{opacity:1} 50%{opacity:.35} }

.bot-status-pill { display: flex; align-items: center; gap: 7px; background: var(--surface2); border: 1px solid var(--border); border-radius: 20px; padding: 5px 12px; font-size: 12px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text2); transition: background .3s; }
.status-dot.online  { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.offline { background: var(--red); }

/* ── Layout ─────────────────────────────────── */
.layout { display: flex; margin-top: var(--nav-h); min-height: calc(100vh - var(--nav-h)); }

/* ── Sidebar ────────────────────────────────── */
.sidebar { width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border); position: fixed; top: var(--nav-h); bottom: 0; left: 0; overflow-y: auto; padding: 14px 10px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); border: none; background: transparent; color: var(--text2); font-size: 13px; cursor: pointer; width: 100%; text-align: left; transition: all .15s; }
.nav-item:hover  { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--accent-bg); color: var(--accent-light); }
.nav-item svg    { flex-shrink: 0; }

/* ── Main ───────────────────────────────────── */
.main-content { margin-left: var(--sidebar-w); flex: 1; padding: 26px 30px; max-width: 1080px; }

/* ── Pages ──────────────────────────────────── */
.page { display: none; }
.page.active { display: block; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.page-title  { font-size: 24px; font-weight: 700; line-height: 1.2; }
.page-sub    { color: var(--text2); font-size: 13px; margin-top: 3px; }

/* ── Stats ──────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px,1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.stat-label { display: flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 700; letter-spacing: .08em; color: var(--text2); text-transform: uppercase; margin-bottom: 10px; }
.stat-value { font-size: 30px; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.stat-sub   { font-size: 11px; color: var(--text2); }
@keyframes statFlash { 0%{color:var(--accent-light);transform:scale(1.08)} 100%{transform:scale(1)} }
.stat-updated { animation: statFlash .5s ease-out; }

/* ── Chart ──────────────────────────────────── */
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; }
.chart-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.chart-header h3 { font-size: 14px; font-weight: 600; }
.chart-sub  { color: var(--text2); font-size: 12px; margin-top: 2px; }
.chart-total { text-align: right; }
.chart-total span { font-size: 26px; font-weight: 800; }
.chart-total small { display: block; color: var(--text2); font-size: 11px; }

/* ── Verify link bar ────────────────────────── */
.verify-link-bar { display: flex; align-items: center; gap: 10px; background: var(--accent-bg); border: 1px solid rgba(124,58,237,.4); border-radius: var(--radius-sm); padding: 9px 14px; margin-bottom: 18px; flex-wrap: wrap; font-size: 13px; }
.verify-link-bar svg { flex-shrink: 0; color: var(--accent-light); }
.verify-link-bar code { flex: 1; background: rgba(0,0,0,.3); padding: 2px 8px; border-radius: 4px; color: var(--accent-light); font-size: 11px; word-break: break-all; }

/* ── Buttons ────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius-sm); border: none; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s; white-space: nowrap; font-family: var(--font); }
.btn svg { flex-shrink: 0; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #6d28d9; }
.btn-ghost   { background: var(--surface2); color: var(--text); border: 1px solid var(--border2); }
.btn-ghost:hover { background: var(--border); }
.btn-danger  { background: var(--red-bg); color: var(--red); border: 1px solid rgba(239,68,68,.3); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-full { width: 100%; }
.btn-sm   { padding: 7px 12px; font-size: 12px; }
.btn-xs   { padding: 4px 9px;  font-size: 11px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Inputs ─────────────────────────────────── */
.input-field { width: 100%; background: var(--surface2); border: 1px solid var(--border2); border-radius: var(--radius-sm); padding: 8px 12px; color: var(--text); font-size: 13px; font-family: var(--font); transition: border .15s; outline: none; }
.input-field:focus { border-color: var(--accent); }
.input-field::placeholder { color: var(--text2); }
.input-sm { width: 230px; }
textarea.input-field { resize: vertical; }
select.input-field { cursor: pointer; }

.form-group { margin-bottom: 13px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 5px; color: var(--text2); }
.form-group small { display: block; margin-top: 4px; font-size: 11px; color: var(--text2); }
.form-group small a { color: var(--accent-light); }

.search-wrap { position: relative; display: flex; align-items: center; }
.search-wrap svg { position: absolute; left: 10px; color: var(--text2); pointer-events: none; }
.search-wrap .input-field { padding-left: 32px; }

/* ── Banners ────────────────────────────────── */
.warning-inline { display: flex; align-items: center; gap: 7px; background: var(--yellow-bg); border: 1px solid rgba(245,158,11,.3); border-radius: var(--radius-sm); padding: 8px 12px; font-size: 12px; color: var(--yellow); margin-bottom: 12px; }
.warning-inline.danger { background: var(--red-bg); border-color: rgba(239,68,68,.3); color: var(--red); }
.warning-inline svg { flex-shrink: 0; }

.info-banner { display: flex; align-items: center; gap: 8px; background: var(--surface2); border: 1px solid var(--border2); border-radius: var(--radius-sm); padding: 9px 13px; font-size: 12px; color: var(--text2); margin-bottom: 14px; }
.info-banner svg { flex-shrink: 0; }

.warning-banner { display: flex; align-items: flex-start; gap: 10px; background: var(--yellow-bg); border: 1px solid rgba(245,158,11,.3); border-radius: var(--radius); padding: 13px 16px; font-size: 13px; color: var(--yellow); margin-bottom: 18px; line-height: 1.6; }
.warning-banner svg { flex-shrink: 0; margin-top: 2px; }

/* ── Cards ──────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; }
.card h3  { font-size: 14px; font-weight: 700; margin-bottom: 3px; }
.card-sub { font-size: 12px; color: var(--text2); }

/* ── Table ──────────────────────────────────── */
.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 11px 14px; text-align: left; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text2); background: var(--surface2); border-bottom: 1px solid var(--border); }
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface2); }
.table-empty { text-align: center; color: var(--text2); padding: 32px !important; font-size: 13px; }

.user-cell { display: flex; align-items: center; gap: 9px; }
.user-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-bg); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--accent-light); overflow: hidden; flex-shrink: 0; }
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red   { background: var(--red-bg);   color: var(--red); }

/* ── Pagination ─────────────────────────────── */
.pagination { display: flex; gap: 5px; margin-top: 12px; justify-content: center; }
.pagination button { background: var(--surface2); border: 1px solid var(--border2); color: var(--text); border-radius: var(--radius-sm); padding: 5px 11px; cursor: pointer; font-size: 13px; }
.pagination button.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Pull page ──────────────────────────────── */
.pull-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.pull-empty { color: var(--text2); font-size: 13px; padding: 24px 0; }
.pull-stat  { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.pull-stat:last-child { border-bottom: none; }
.radio-group  { display: flex; flex-direction: column; gap: 8px; }
.radio-option { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.radio-option input { accent-color: var(--accent); }

/* ── Guilds ─────────────────────────────────── */
.guilds-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 14px; }
.guild-card  { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.guild-icon  { width: 52px; height: 52px; border-radius: 14px; background: var(--accent-bg); display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700; color: var(--accent-light); overflow: hidden; }
.guild-icon img { width: 100%; height: 100%; object-fit: cover; border-radius: 14px; }
.guild-name    { font-weight: 700; font-size: 13px; }
.guild-members { font-size: 12px; color: var(--text2); }

/* ── Settings ───────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px,1fr)); gap: 16px; margin-bottom: 16px; }
.danger-zone { border-color: rgba(239,68,68,.3); margin-top: 0; }
.danger-zone h3 { color: var(--red); margin-bottom: 6px; }
.danger-zone p  { color: var(--text2); font-size: 13px; margin-bottom: 14px; }

/* ── Modals ─────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.78); display: flex; align-items: center; justify-content: center; z-index: 1000; backdrop-filter: blur(5px); padding: 20px; }
.modal-box { background: var(--surface); border: 1px solid var(--border2); border-radius: 16px; padding: 30px; width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; }
.modal-box h2   { font-size: 18px; font-weight: 700; margin-bottom: 5px; }
.modal-sub      { color: var(--text2); font-size: 13px; margin-bottom: 18px; }
.modal-logo     { display: flex; align-items: center; gap: 9px; margin-bottom: 22px; }

/* Legal modal */
.legal-modal { max-width: 580px; }
.legal-icon  { margin-bottom: 10px; }
.legal-modal h2 { font-size: 20px; margin-bottom: 14px; }
.legal-content  { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.legal-item { border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px; line-height: 1.6; }
.legal-item strong { display: block; margin-bottom: 4px; font-size: 13px; }
.legal-item p      { color: var(--text2); }
.legal-item.danger  { background: var(--red-bg);    border: 1px solid rgba(239,68,68,.3); }
.legal-item.danger strong  { color: var(--red); }
.legal-item.warning { background: var(--yellow-bg); border: 1px solid rgba(245,158,11,.3); }
.legal-item.warning strong { color: var(--yellow); }
.legal-item.info    { background: var(--green-bg);  border: 1px solid rgba(34,197,94,.3); }
.legal-item.info strong    { color: var(--green); }

.checkbox-label { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; cursor: pointer; margin-bottom: 14px; line-height: 1.5; }
.checkbox-label input { accent-color: var(--accent); margin-top: 2px; flex-shrink: 0; }

/* ── Toast ──────────────────────────────────── */
.toast { position: fixed; bottom: 22px; right: 22px; background: var(--surface2); border: 1px solid var(--border2); border-radius: var(--radius-sm); padding: 11px 18px; font-size: 13px; z-index: 9999; opacity: 0; transform: translateY(8px); transition: all .22s; pointer-events: none; max-width: 320px; }
.toast.show    { opacity: 1; transform: translateY(0); }
.toast.success { border-color: var(--green); color: var(--green); }
.toast.error   { border-color: var(--red);   color: var(--red); }
.toast.info    { border-color: var(--accent); color: var(--accent-light); }

/* ── Code ───────────────────────────────────── */
code { background: rgba(0,0,0,.3); padding: 2px 6px; border-radius: 4px; font-size: 12px; color: var(--accent-light); font-family: monospace; }

/* ── Scrollbar ──────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ── Responsive ─────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 18px 14px; }
  .pull-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .input-sm { width: 100%; }
  .page-header { flex-direction: column; align-items: flex-start; }
}

/* ── Setup steps ────────────────────────────── */
.setup-steps { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.setup-step  { display: flex; align-items: flex-start; gap: 10px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; line-height: 1.5; }
.step-num    { background: var(--accent); color: #fff; border-radius: 50%; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; margin-top: 1px; }
.setup-step code { font-size: 11px; }

/* ── Config status card ─────────────────────── */
.config-status-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 18px; }
.config-row         { display: flex; flex-wrap: wrap; gap: 16px; }
.config-item        { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text2); }
.config-item svg    { flex-shrink: 0; }
.config-warning     { margin-top: 12px; background: var(--red-bg); border: 1px solid rgba(239,68,68,.3); border-radius: var(--radius-sm); padding: 10px 13px; font-size: 12px; color: var(--red); line-height: 1.6; }

/* ── Pill Radio Buttons (style Discord) ─────── */
.pill-radio-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill-radio {
  cursor: pointer;
  user-select: none;
}

.pill-radio input[type="radio"] {
  display: none;
}

.pill-radio span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border2);
  background: var(--surface2);
  color: var(--text2);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.pill-radio span svg {
  flex-shrink: 0;
  transition: stroke 0.15s;
}

.pill-radio:hover span {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-bg);
}

.pill-radio input[type="radio"]:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.35);
}

.pill-radio input[type="radio"]:checked + span svg {
  stroke: #fff;
}

/* ── Page Loader ────────────────────────────── */
#pageLoader {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  transition: opacity 0.3s ease;
}
#pageLoader.hidden {
  opacity: 0;
  pointer-events: none;
}
.loader-inner {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.loader-text {
  font-size: 20px; font-weight: 700; color: var(--text); letter-spacing: 0.02em;
}
.loader-spinner {
  width: 28px; height: 28px;
  border: 2.5px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loader-sub {
  font-size: 12px;
  color: var(--text2);
  animation: loaderSubAnim 2s ease-in-out infinite;
}
@keyframes loaderSubAnim {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 1; }
}

/* ── Login Screen ───────────────────────────────── */
.login-bg {
  min-height: 100vh; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background-image: radial-gradient(ellipse at 60% 0%, rgba(124,58,237,0.18) 0%, transparent 60%),
                    radial-gradient(ellipse at 0% 80%, rgba(124,58,237,0.08) 0%, transparent 50%);
}
.login-card {
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: 20px; padding: 38px 36px; width: 100%; max-width: 400px;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
.login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.login-brand { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.login-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.login-sub   { color: var(--text2); font-size: 13px; margin-bottom: 24px; }
.login-error {
  background: var(--red-bg); border: 1px solid rgba(239,68,68,.3);
  color: var(--red); border-radius: var(--radius-sm);
  padding: 9px 13px; font-size: 13px; margin-bottom: 14px;
}
.login-footer { margin-top: 18px; text-align: center; }
.login-about-link {
  background: none; border: none; color: var(--text2); font-size: 12px;
  cursor: pointer; text-decoration: underline; font-family: var(--font);
  transition: color .15s;
}
.login-about-link:hover { color: var(--accent-light); }

/* ── About / Présentation ──────────────────────── */
.about-bg { min-height: 100vh; background: var(--bg); }
.about-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 32px; border-bottom: 1px solid var(--border);
  background: var(--surface); position: sticky; top: 0; z-index: 10;
}
.about-content { max-width: 900px; margin: 0 auto; padding: 60px 24px 80px; }

.about-hero { text-align: center; margin-bottom: 64px; }
.about-hero-badge {
  display: inline-block; background: var(--accent-bg);
  color: var(--accent-light); border: 1px solid rgba(124,58,237,.4);
  border-radius: 20px; padding: 4px 14px; font-size: 11px;
  font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  margin-bottom: 16px;
}
.about-hero-title {
  font-size: 56px; font-weight: 900; line-height: 1;
  letter-spacing: -.03em; margin-bottom: 18px;
  background: linear-gradient(135deg, #f0f0f2 30%, #a78bfa);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.about-hero-desc {
  color: var(--text2); font-size: 16px; max-width: 560px;
  margin: 0 auto; line-height: 1.7;
}

.about-features {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr));
  gap: 16px; margin-bottom: 60px;
}
.about-feature-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px 22px;
  transition: border-color .2s, transform .2s;
}
.about-feature-card:hover { border-color: var(--border2); transform: translateY(-2px); }
.about-feature-icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; margin-bottom: 14px;
}
.about-feature-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 7px; }
.about-feature-card p  { font-size: 13px; color: var(--text2); line-height: 1.6; }

.about-stack { margin-bottom: 50px; }
.about-stack h2 { font-size: 20px; font-weight: 700; margin-bottom: 18px; }
.about-stack-grid {
  display: flex; flex-wrap: wrap; gap: 10px;
}
.about-stack-item {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 7px 16px; font-size: 13px; font-weight: 600;
}
.stack-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.about-cta {
  background: var(--accent-bg); border: 1px solid rgba(124,58,237,.3);
  border-radius: var(--radius); padding: 30px 28px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
}
.about-cta p { color: var(--text2); font-size: 14px; margin: 0; }
