*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-0: #111214;
  --bg-1: #1e1f22;
  --bg-2: #2b2d31;
  --bg-3: #313338;
  --accent: #5865f2;
  --accent-hover: #4752c4;
  --success: #2ecc71;
  --danger: #e74c3c;
  --warn: #f39c12;
  --text-1: #f2f3f5;
  --text-2: #b5bac1;
  --text-3: #80848e;
  --border: #3c3f45;
}

body { font-family: 'Inter', sans-serif; background: var(--bg-0); color: var(--text-1); display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar { width: 240px; background: var(--bg-1); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; overflow-y: auto; }
.sidebar-header { display: flex; align-items: center; gap: 10px; padding: 20px 16px; border-bottom: 1px solid var(--border); }
.bot-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; flex-shrink: 0; }
.bot-name { font-weight: 600; font-size: 14px; color: var(--text-1); }
.bot-status { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.dnd { background: var(--danger); }
.status-dot.online { background: var(--success); }

nav { padding: 12px 8px; flex: 1; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--text-2); text-decoration: none; transition: all 0.15s; margin-bottom: 2px; }
.nav-item:hover { background: var(--bg-2); color: var(--text-1); }
.nav-item.active { background: var(--accent); color: #fff; }

/* ── Main ────────────────────────────────────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; background: var(--bg-1); border-bottom: 1px solid var(--border); gap: 12px; flex-wrap: wrap; }
.topbar-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.page-title { font-size: 20px; font-weight: 700; }
.breadcrumb { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* Tabs */
.tab-content { display: none; padding: 24px; overflow-y: auto; flex: 1; }
.tab-content.active { display: block; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card { background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.card h2 { font-size: 16px; font-weight: 600; margin-bottom: 16px; color: var(--text-1); }

.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { text-align: center; padding: 20px 12px !important; }
.stat-icon { font-size: 28px; margin-bottom: 8px; }
.stat-label { font-size: 12px; color: var(--text-3); font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--text-1); }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-row label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.input-field { background: var(--bg-3); border: 1px solid var(--border); border-radius: 6px; color: var(--text-1); padding: 9px 12px; font-size: 14px; font-family: inherit; outline: none; transition: border-color 0.15s; width: 100%; }
.input-field:focus { border-color: var(--accent); }
textarea.input-field { resize: vertical; min-height: 70px; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn { padding: 9px 18px; border-radius: 6px; border: none; font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.15s; font-family: inherit; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-3); color: var(--text-1); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c0392b; }

/* ── Toggle ──────────────────────────────────────────────────────────────── */
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.toggle-row:last-of-type { border-bottom: none; }
.toggle-label { font-size: 14px; font-weight: 500; }
.toggle-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: var(--bg-3); border-radius: 24px; transition: .3s; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background: var(--text-3); border-radius: 50%; transition: .3s; }
input:checked + .slider { background: var(--accent); }
input:checked + .slider:before { transform: translateX(20px); background: #fff; }

/* ── Commands Grid ───────────────────────────────────────────────────────── */
.commands-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.command-card { background: var(--bg-3); border: 1px solid var(--border); border-radius: 8px; padding: 12px; display: flex; align-items: center; justify-content: space-between; }
.command-name { font-size: 13px; font-weight: 500; font-family: 'Courier New', monospace; color: var(--accent); }
.command-card.disabled .command-name { color: var(--text-3); text-decoration: line-through; }

/* ── Data Table ──────────────────────────────────────────────────────────── */
.data-table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; padding: 10px 12px; background: var(--bg-3); color: var(--text-2); font-weight: 500; border-bottom: 1px solid var(--border); }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--text-1); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-3); }

/* ── Info grid ───────────────────────────────────────────────────────────── */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.info-grid > div { background: var(--bg-3); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.label { font-size: 11px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }

/* ── Info box ────────────────────────────────────────────────────────────── */
.info-box { background: var(--bg-3); border-left: 3px solid var(--accent); border-radius: 6px; padding: 14px; font-size: 13px; color: var(--text-2); line-height: 1.6; }
.info-box code { background: var(--bg-0); padding: 1px 5px; border-radius: 3px; font-family: monospace; color: var(--accent); }

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--bg-2); border: 1px solid var(--border); color: var(--text-1); padding: 12px 20px; border-radius: 8px; font-size: 14px; opacity: 0; transform: translateY(10px); transition: all 0.25s; pointer-events: none; z-index: 9999; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; }
.badge-red { background: rgba(231,76,60,.2); color: var(--danger); }
.badge-green { background: rgba(46,204,113,.2); color: var(--success); }
.badge-blue { background: rgba(88,101,242,.2); color: var(--accent); }
.badge-yellow { background: rgba(243,156,18,.2); color: var(--warn); }

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ── Login Screen ────────────────────────────────────────────────────────── */
.login-screen { position: fixed; inset: 0; background: var(--bg-0); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.login-card { background: var(--bg-1); border: 1px solid var(--border); border-radius: 16px; padding: 48px 40px; text-align: center; max-width: 380px; width: 90%; }
.login-logo { width: 72px; height: 72px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700; margin: 0 auto 20px; }
.login-title { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.login-sub { font-size: 14px; color: var(--text-3); margin-bottom: 28px; }
.btn-discord { background: #5865f2; color: #fff; font-size: 15px; padding: 12px 28px; border-radius: 8px; display: inline-flex; align-items: center; width: 100%; justify-content: center; }
.btn-discord:hover { background: #4752c4; }

/* ── Guild List ───────────────────────────────────────────────────────────── */
.guild-list { display: flex; flex-direction: column; gap: 8px; max-height: 400px; overflow-y: auto; }
.guild-item { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; transition: all 0.15s; text-align: left; width: 100%; }
.guild-item:hover { border-color: var(--accent); background: var(--bg-3); }
.guild-icon { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.guild-initial { width: 40px; height: 40px; border-radius: 8px; background: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; flex-shrink: 0; }
.guild-name { font-weight: 600; font-size: 14px; }

/* ── Dashboard App ───────────────────────────────────────────────────────── */
#dashboardApp { display: flex !important; }

@media (max-width: 700px) {
  .sidebar { width: 64px; }
  .sidebar-header > div:last-child, .nav-item > span { display: none; }
  .bot-avatar { margin: 0 auto; }
  .nav-item { justify-content: center; }
}
