:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #1c2128;
  --bg-card: #1c2128;
  --bg-hover: #262c36;
  --bg-input: #0d1117;
  --bg-input-border: #30363d;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-dim: #484f58;
  --accent: #7c5cfc;
  --accent-hover: #6848e8;
  --accent-subtle: rgba(124,92,252,.12);
  --green: #3fb950;
  --green-subtle: rgba(63,185,80,.12);
  --yellow: #d29922;
  --yellow-subtle: rgba(210,153,34,.12);
  --red: #f85149;
  --red-subtle: rgba(248,81,73,.12);
  --blue: #58a6ff;
  --blue-subtle: rgba(88,166,255,.12);
  --border: #30363d;
  --border-subtle: #21262d;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow: 0 8px 24px rgba(0,0,0,.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.3);
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "Cascadia Code", "Fira Code", "JetBrains Mono", Consolas, monospace;
  --sidebar-w: 260px;
  --topbar-h: 60px;
  --transition: .15s ease;
  color-scheme: dark;
}

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

html, body { height: 100%; overflow: hidden; }

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--blue);
}

/* ============================================================ LOGIN */
.login-wrap {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(124,92,252,.08), transparent 60%),
    var(--bg-primary);
}

.login-card {
  width: 420px;
  max-width: 94vw;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 36px 36px;
  box-shadow: var(--shadow);
  text-align: center;
}

.login-logo {
  width: 64px; height: 64px;
  margin: 0 auto 20px;
  background: var(--accent-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--accent);
}

.login-card h1 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.login-sub { color: var(--text-secondary); font-size: 13px; margin-bottom: 24px; line-height: 1.5; }
.login-card form { text-align: left; }

/* ============================================================ LAYOUT */
#app { display: flex; height: 100%; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width var(--transition), flex var(--transition);
  z-index: 20;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.sidebar-brand i { color: var(--accent); font-size: 20px; }

.brand-badge {
  font-size: 9px;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: .06em;
  margin-left: 2px;
  vertical-align: super;
}

.sidebar-nav {
  flex: 1;
  padding: 4px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
  cursor: pointer;
}

.nav-item i { width: 18px; text-align: center; font-size: 15px; }
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); text-decoration: none; }
.nav-item.active { background: var(--accent-subtle); color: var(--accent); font-weight: 600; }
.nav-item.active i { color: var(--accent); }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-tertiary);
}

.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  flex: 0 0 auto;
  overflow: hidden;
}

.user-avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { color: var(--text-dim); font-size: 11px; }

/* Main */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-h);
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  flex: 0 0 auto;
}

.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-left h2 { font-size: 18px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.sidebar-toggle { display: none; }

.content {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

/* ============================================================ BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn:disabled { opacity: .5; cursor: default; }
.btn i { font-size: 12px; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-primary); border-color: var(--text-dim); }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #da3633; }

.btn-success { background: var(--green); color: #fff; }
.btn-success:hover:not(:disabled) { background: #2ea043; }

.btn-block { width: 100%; margin-top: 16px; padding: 11px 18px; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 15px;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ============================================================ FORMS */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

input:not([type="color"]):not([type="checkbox"]):not([type="radio"]),
select, textarea, .input {
  width: 100%;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--bg-input-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color var(--transition);
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--text-dim); }
textarea { resize: vertical; min-height: 80px; }

select { cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b949e' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 14px 0 6px;
}

.form-error {
  background: var(--red-subtle);
  color: var(--red);
  border: 1px solid rgba(248,81,73,.25);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 14px;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text-primary);
  -webkit-box-shadow: 0 0 0 1000px var(--bg-input) inset;
  box-shadow: 0 0 0 1000px var(--bg-input) inset;
  transition: background-color 99999999s ease-in-out 0s;
}

/* ============================================================ CARDS */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.card-header h3 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 20px; }

/* Stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.stat-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex: 0 0 auto;
}

.stat-icon.purple { background: var(--accent-subtle); color: var(--accent); }
.stat-icon.green { background: var(--green-subtle); color: var(--green); }
.stat-icon.yellow { background: var(--yellow-subtle); color: var(--yellow); }
.stat-icon.blue { background: var(--blue-subtle); color: var(--blue); }
.stat-icon.red { background: var(--red-subtle); color: var(--red); }

.stat-value { font-size: 28px; font-weight: 800; line-height: 1.1; }
.stat-label { color: var(--text-secondary); font-size: 12px; margin-top: 2px; }

/* ============================================================ BOT CARDS */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-tertiary);
  padding: 4px;
  border-radius: var(--radius-md);
  width: fit-content;
  margin-bottom: 20px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tab-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.tab-btn:hover:not(.active) { color: var(--text-primary); }

.bot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.bot-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition);
}

.bot-card:hover { border-color: var(--text-dim); }

.bot-card-banner {
  height: 80px;
  background: var(--bg-tertiary);
  overflow: hidden;
}

.bot-card-banner img { width: 100%; height: 100%; object-fit: cover; display: block; }

.bot-card-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; }

.bot-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: -32px;
  position: relative;
}

.bot-card.no-banner .bot-card-top { margin-top: 0; }

.bot-avatar-wrap {
  position: relative;
  cursor: pointer;
}

.bot-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 3px solid var(--bg-card);
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--text-dim);
  overflow: hidden;
}

.bot-avatar img { width: 100%; height: 100%; object-fit: cover; }

.bot-avatar-edit {
  position: absolute;
  bottom: 0; right: 0;
  width: 20px; height: 20px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: #fff;
  border: 2px solid var(--bg-card);
  opacity: 0;
  transition: opacity var(--transition);
}

.bot-avatar-wrap:hover .bot-avatar-edit { opacity: 1; }

.bot-card-info { flex: 1; min-width: 0; }
.bot-card-name { font-weight: 700; font-size: 15px; }
.bot-card-meta { color: var(--text-secondary); font-size: 12px; margin-top: 2px; display: flex; align-items: center; gap: 6px; }

.bot-card-bio { color: var(--text-secondary); font-size: 13px; min-height: 18px; line-height: 1.4; }

.bot-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 4px;
}

/* Edit modal */
.edit-banner {
  position: relative;
  height: 112px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-tertiary);
  margin: 0 0 18px;
}

.edit-banner-img { width: 100%; height: 100%; object-fit: cover; display: block; }

.edit-banner-ph {
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-dim);
  font-size: 12px;
}

.edit-id-head {
  position: absolute;
  left: 0; right: 0;
  top: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
}

.edit-id-head .bot-avatar { box-shadow: 0 4px 14px rgba(0, 0, 0, .45); }

.edit-id-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.edit-id-name { font-weight: 700; font-size: 16px; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }

.edit-id-head .text-dim { text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }

.edit-uploads {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.upload-box {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--bg-tertiary);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.upload-box .form-label { margin: 0; }

.upload-box input[type="file"] { font-size: 12px; color: var(--text-secondary); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}

.badge-online { background: var(--green-subtle); color: var(--green); }
.badge-offline { background: rgba(139,148,158,.12); color: var(--text-secondary); }
.badge-idle { background: var(--yellow-subtle); color: var(--yellow); }
.badge-dnd { background: var(--red-subtle); color: var(--red); }

.presence-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* ============================================================ TOKEN BOX */
.token-box {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  word-break: break-all;
  position: relative;
  line-height: 1.5;
}

.token-copy {
  position: absolute;
  top: 8px; right: 8px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-secondary);
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
  font-family: var(--font);
}
.token-copy:hover { color: var(--text-primary); background: var(--bg-tertiary); }

/* ============================================================ MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
  animation: fadeIn .12s ease;
}

@keyframes fadeIn { from { opacity: 0; } }

.modal {
  width: 520px;
  max-width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-head h3 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }

.modal-body { padding: 20px 24px; }

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ============================================================ TOAST */
#toast-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}

.toast {
  min-width: 300px;
  max-width: 420px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow);
  font-size: 13px;
  animation: slideIn .18s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }

@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } }

/* ============================================================ EMPTY STATE */
.empty {
  text-align: center;
  color: var(--text-dim);
  padding: 60px 20px;
}

.empty i { font-size: 42px; margin-bottom: 16px; opacity: .5; color: var(--text-dim); }
.empty .et { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty .es { font-size: 13px; line-height: 1.5; }

/* ============================================================ DOWNLOAD CARDS */
.download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.download-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color var(--transition);
}

.download-card:hover { border-color: var(--text-dim); }

.download-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.download-icon.csharp { background: var(--accent-subtle); color: var(--accent); }
.download-icon.php { background: rgba(119,130,161,.12); color: #7782a1; }
.download-icon.js { background: rgba(232,201,72,.12); color: #e8c948; }
.download-icon.cpp { background: rgba(94,191,107,.12); color: #5ebf6b; }
.download-icon.java { background: rgba(248,152,32,.12); color: #f89820; }

.download-name { font-weight: 700; font-size: 16px; }
.download-desc { color: var(--text-secondary); font-size: 13px; line-height: 1.5; }
.download-meta { color: var(--text-dim); font-size: 12px; display: flex; align-items: center; gap: 12px; }
.download-meta i { margin-right: 4px; }

/* ============================================================ DOCS */
.docs-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 28px;
  min-height: calc(100vh - var(--topbar-h) - 56px);
}

.docs-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.docs-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-dim);
  padding: 12px 12px 6px;
}

.docs-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  text-decoration: none;
  transition: all var(--transition);
  cursor: pointer;
}

.docs-link:hover { background: var(--bg-hover); color: var(--text-primary); text-decoration: none; }
.docs-link.active { background: var(--accent-subtle); color: var(--accent); font-weight: 600; }

.docs-content { min-width: 0; }
.docs-content h1 { font-size: 26px; font-weight: 800; margin-bottom: 8px; }
.docs-content h2 { font-size: 20px; font-weight: 700; margin: 28px 0 12px; padding-top: 20px; border-top: 1px solid var(--border); }
.docs-content h2:first-of-type { border-top: none; padding-top: 0; }
.docs-content h3 { font-size: 16px; font-weight: 700; margin: 20px 0 8px; }
.docs-content p { color: var(--text-secondary); line-height: 1.6; margin-bottom: 12px; }
.docs-content ul { color: var(--text-secondary); padding-left: 20px; margin-bottom: 12px; }
.docs-content li { margin-bottom: 6px; line-height: 1.5; }

.docs-endpoint {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin: 12px 0;
}

.docs-endpoint-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.method {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.method-get { background: var(--blue-subtle); color: var(--blue); }
.method-post { background: var(--green-subtle); color: var(--green); }
.method-patch { background: var(--yellow-subtle); color: var(--yellow); }
.method-delete { background: var(--red-subtle); color: var(--red); }

.endpoint-path {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-primary);
}

.docs-endpoint-desc {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

/* ============================================================ CODE EDITOR */
.code-editor {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 16px 0;
}

.code-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.code-editor-tabs {
  display: flex;
  gap: 2px;
}

.code-editor-tab {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all var(--transition);
}

.code-editor-tab.active { background: var(--bg-tertiary); color: var(--text-primary); }
.code-editor-tab:hover:not(.active) { color: var(--text-primary); }

.code-editor-lang {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.code-editor-body {
  position: relative;
  max-height: 500px;
  overflow: auto;
}

.code-editor-body pre {
  margin: 0;
  padding: 16px 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre;
  overflow-x: auto;
}

/* Syntax highlighting */
.hl-keyword { color: #ff7b72; }
.hl-string { color: #a5d6ff; }
.hl-number { color: #79c0ff; }
.hl-comment { color: #8b949e; font-style: italic; }
.hl-function { color: #d2a8ff; }
.hl-type { color: #ffa657; }
.hl-property { color: #79c0ff; }
.hl-operator { color: #ff7b72; }
.hl-variable { color: #ffa657; }
.hl-tag { color: #7ee787; }
.hl-attr { color: #79c0ff; }
.hl-punctuation { color: #8b949e; }

/* ============================================================ EXAMPLES */
.example-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  overflow: hidden;
}

.example-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.example-card-header i {
  font-size: 20px;
  color: var(--accent);
}

.example-card-header h3 { font-size: 15px; font-weight: 700; }
.example-card-header p { font-size: 13px; color: var(--text-secondary); margin-left: auto; }

.example-card-body { padding: 0; }

/* ============================================================ JOIN ROW */
.join-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.join-row:last-child { border-bottom: none; }

.join-row img {
  width: 30px; height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-tertiary);
}

/* ============================================================ WIDGET BUILDER */
.widget-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
  align-items: start;
}

.widget-config { padding: 16px; }

.widget-config .field { margin-bottom: 12px; }
.widget-config .field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 5px;
}

.wg-color-row { display: flex; gap: 8px; align-items: center; }
.wg-color-row input[type="color"] {
  width: 38px; height: 32px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-tertiary);
  cursor: pointer;
  flex: 0 0 auto;
}
.wg-color-row input.input { flex: 1; text-transform: uppercase; }

.widget-preview { padding: 16px; }
.widget-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 600;
}

.widget-frame-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 16px;
  min-height: 260px;
  overflow: auto;
}

.widget-frame {
  border: none;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
  display: block;
  background: #181822;
}

/* ============================================================ RESPONSIVE */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: -260px;
    top: 0; bottom: 0;
    z-index: 30;
    transition: left .2s ease;
  }
  .sidebar.open { left: 0; }
  .sidebar-toggle { display: flex; }
  .docs-layout { grid-template-columns: 1fr; }
  .docs-sidebar { display: none; }
  .widget-layout { grid-template-columns: 1fr; }
}

/* ============================================================ SCROLLBAR */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ============================================================ RPC ASSETS */
.asset-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.asset-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
}

.asset-row img {
  width: 46px; height: 46px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-input);
}

.asset-info { flex: 1; min-width: 0; }
.asset-name { font-weight: 600; font-size: 13px; }
.asset-file { color: var(--text-dim); font-size: 12px; }

/* ============================================================ HELPERS */
.text-muted { color: var(--text-secondary); }
.text-dim { color: var(--text-dim); }
.text-sm { font-size: 12px; }
.mono { font-family: var(--font-mono); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.gap-row { display: flex; gap: 10px; flex-wrap: wrap; }
