/* ═══════════════ Future Dashboard ═══════════════ */
:root {
  --bg: #0a0c11;
  --bg-2: #0e1117;
  --sidebar: #0d1016;
  --surface: #131720;
  --surface-2: #181d28;
  --surface-3: #1e2431;
  --input: #0f131b;
  --border: #222938;
  --border-2: #2c3446;
  --text: #e8ebf3;
  --text-2: #b4bccd;
  --muted: #7d869b;
  --accent: #7c6cff;
  --accent-2: #9d90ff;
  --accent-soft: rgba(124, 108, 255, .14);
  --accent-glow: rgba(124, 108, 255, .35);
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, .14);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, .14);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, .14);
  --info: #38bdf8;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, .55);
  --shadow-lg: 0 24px 60px -18px rgba(0, 0, 0, .7);
  --sidebar-w: 272px;
  --topbar-h: 64px;
  --font: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
img { max-width: 100%; }
code, .mono { font-family: var(--mono); font-size: .9em; }
::selection { background: var(--accent-glow); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #262d3c; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #333c50; background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }

.svg-icon { width: 18px; height: 18px; flex-shrink: 0; stroke-width: 2; }
.svg-icon.sm { width: 15px; height: 15px; }
.svg-icon.lg { width: 22px; height: 22px; }

/* ═══════════════ Layout ═══════════════ */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--sidebar-w);
  background: var(--sidebar); border-inline-end: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 40;
  transition: transform .25s ease;
}
.main { flex: 1; margin-inline-start: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px; padding: 0 28px;
  background: rgba(10, 12, 17, .78); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.content { padding: 28px; max-width: 1180px; width: 100%; margin: 0 auto; flex: 1; padding-bottom: 120px; }

.brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px; }
.brand img { width: 40px; height: 40px; border-radius: 50%; box-shadow: 0 0 0 2px var(--border-2), 0 6px 18px -6px var(--accent-glow); }
.brand .name { font-weight: 700; font-size: 18px; letter-spacing: .3px; }
.brand .name small { display: block; font-size: 11px; color: var(--muted); font-weight: 500; letter-spacing: 0; margin-top: -3px; }

.guild-switch {
  margin: 0 14px 10px; padding: 9px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); display: flex; align-items: center; gap: 10px; cursor: pointer; transition: .15s;
}
.guild-switch:hover { border-color: var(--border-2); background: var(--surface-2); }
.guild-switch .gname { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guild-icon {
  width: 32px; height: 32px; border-radius: 10px; background: linear-gradient(135deg, #2a2f45, #1c2030);
  display: grid; place-items: center; font-weight: 700; font-size: 13px; color: var(--text-2); flex-shrink: 0; overflow: hidden;
}
.guild-icon img { width: 100%; height: 100%; object-fit: cover; }

.nav { flex: 1; overflow-y: auto; padding: 4px 10px 16px; }
.nav-section { margin-top: 12px; }
.nav-section-title {
  display: flex; align-items: center; gap: 6px; padding: 6px 10px; color: var(--muted);
  font-size: 11.5px; font-weight: 600; letter-spacing: .4px; cursor: pointer; user-select: none;
}
.nav-section-title .svg-icon { width: 13px; height: 13px; transition: transform .2s; }
.nav-section.collapsed .nav-section-title .svg-icon { transform: rotate(90deg); }
.nav-section.collapsed .nav-items { display: none; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 8px 11px; border-radius: 9px; color: var(--text-2);
  font-weight: 500; cursor: pointer; position: relative; transition: background .12s, color .12s; text-decoration: none !important;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: #fff; }
.nav-item.active::before {
  content: ''; position: absolute; inset-inline-start: -10px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 3px; background: var(--accent);
}
.nav-item.active .svg-icon:first-child { color: var(--accent-2); }
.nav-item .label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-dot { width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.status-dot.on { background: var(--success); color: #062b14; }
.status-dot.on .svg-icon { width: 11px; height: 11px; stroke-width: 3.2; }
.status-dot.off { border: 1.5px solid #3a4256; }

.sidebar-foot { border-top: 1px solid var(--border); padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--surface-3); flex-shrink: 0; }
.avatar.sm { width: 28px; height: 28px; }
.avatar.xs { width: 22px; height: 22px; }
.user-meta { flex: 1; min-width: 0; line-height: 1.3; }
.user-meta b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta span { font-size: 12px; color: var(--muted); }

.topbar .title { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.topbar .title b { color: var(--text); }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }
.bot-pill {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); font-size: 12.5px; color: var(--text-2);
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); animation: pulse 2s infinite; }
.pulse.off { background: var(--danger); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .5); } 70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }

.demo-banner {
  background: linear-gradient(90deg, rgba(124, 108, 255, .18), rgba(56, 189, 248, .12)); border-bottom: 1px solid var(--border);
  padding: 8px 28px; font-size: 13px; color: var(--text-2); display: flex; gap: 8px; align-items: center;
}

/* ═══════════════ Page header ═══════════════ */
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 24px; }
.page-icon {
  width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; flex-shrink: 0;
  background: linear-gradient(140deg, var(--accent), #5b4bd6); color: #fff; box-shadow: 0 10px 26px -10px var(--accent-glow);
}
.page-icon .svg-icon { width: 25px; height: 25px; }
.page-head h1 { margin: 0; font-size: 23px; font-weight: 700; line-height: 1.35; }
.page-head p { margin: 3px 0 0; color: var(--muted); }
.page-head .grow { flex: 1; min-width: 0; }
.page-head .head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ═══════════════ Cards ═══════════════ */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 18px; position: relative;
}
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { margin: 0; font-size: 15.5px; font-weight: 600; flex: 1; }
.card-head .sub { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.card-body { padding: 20px; }
.card.disabled-module .card-body { opacity: .55; }
.card.flat { background: var(--bg-2); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

/* ═══════════════ Fields ═══════════════ */
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field.hidden { display: none !important; }
.field > label, .field-label { font-weight: 600; font-size: 13.5px; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.help { font-size: 12.5px; color: var(--muted); margin-top: -2px; }
.field.row { flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--bg-2); border: 1px solid var(--border); }
.field.row > div { min-width: 0; }
.field.row label { color: var(--text); }

.input, .textarea, .select {
  width: 100%; background: var(--input); border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  padding: 10px 13px; outline: none; transition: border-color .15s, box-shadow .15s; color: var(--text);
}
.input:hover, .textarea:hover, .select:hover { border-color: #39425a; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder, .textarea::placeholder { color: #5b6378; }
.textarea { min-height: 96px; resize: vertical; line-height: 1.65; }
.select { appearance: none; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%237d869b' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 12px center; padding-left: 36px; }
.input[type=number] { direction: ltr; text-align: right; }
.input-group { display: flex; gap: 8px; align-items: stretch; }
.input-group > .input { flex: 1; }
.counter { font-size: 11.5px; color: var(--muted); text-align: left; margin-top: -4px; }

.vars { display: flex; flex-wrap: wrap; gap: 6px; }
.var-chip {
  font-family: var(--mono); font-size: 11.5px; padding: 3px 8px; border-radius: 6px; cursor: pointer;
  background: var(--surface-3); border: 1px solid var(--border-2); color: var(--accent-2); direction: ltr; transition: .12s;
}
.var-chip:hover { background: var(--accent-soft); border-color: var(--accent); }

/* Switch */
.switch { position: relative; width: 44px; height: 24px; flex-shrink: 0; cursor: pointer; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .track { position: absolute; inset: 0; background: #2b3244; border-radius: 99px; transition: .2s; }
.switch .track::after {
  content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: .2s cubic-bezier(.4, 1.4, .6, 1); box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}
.switch input:checked + .track { background: var(--success); }
.switch input:checked + .track::after { inset-inline-start: 23px; }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--accent-soft); }
.switch.lg { width: 52px; height: 28px; }
.switch.lg .track::after { width: 22px; height: 22px; }
.switch.lg input:checked + .track::after { inset-inline-start: 27px; }

/* Color */
.color-input { display: flex; gap: 8px; align-items: center; }
.color-swatch { width: 42px; height: 42px; border-radius: var(--radius-sm); border: 1px solid var(--border-2); padding: 0; overflow: hidden; cursor: pointer; position: relative; flex-shrink: 0; }
.color-swatch input { position: absolute; inset: -8px; width: 60px; height: 60px; border: 0; cursor: pointer; }
.color-input .input { direction: ltr; font-family: var(--mono); }

/* Chips & tags */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 8px;
  background: var(--surface-3); border: 1px solid var(--border-2); font-size: 13px; max-width: 100%;
}
.chip .x { width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.chip .x:hover { background: var(--danger-soft); color: var(--danger); }
.chip .x .svg-icon { width: 12px; height: 12px; }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.tags-box {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 7px; min-height: 44px; align-items: center;
  background: var(--input); border: 1px solid var(--border-2); border-radius: var(--radius-sm); cursor: text;
}
.tags-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tags-box input { flex: 1; min-width: 120px; background: none; border: 0; outline: none; padding: 4px 6px; }

.toggle-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.toggle-chip {
  padding: 7px 14px; border-radius: 9px; border: 1px solid var(--border-2); background: var(--input);
  cursor: pointer; user-select: none; transition: .12s; font-weight: 500; color: var(--text-2);
}
.toggle-chip:hover { border-color: #3d4660; }
.toggle-chip.on { background: var(--accent-soft); border-color: var(--accent); color: #fff; }

/* Color presets */
.preset-row { display: flex; flex-wrap: wrap; gap: 8px; }
.preset-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border-radius: 10px; cursor: pointer;
  background: var(--input); border: 1px solid var(--border-2); color: var(--text-2); font-weight: 500; transition: .12s;
}
.preset-chip:hover { border-color: #3d4660; color: var(--text); }
.preset-chip.on { border-color: var(--accent); background: var(--accent-soft); color: #fff; }
.preset-swatch { width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); flex-shrink: 0; }
.card-preview-wait { opacity: .55; transition: opacity .15s; }

/* Picker (channels / roles) */
.picker { position: relative; }
.picker-btn {
  width: 100%; display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 7px 12px; text-align: start;
  background: var(--input); border: 1px solid var(--border-2); border-radius: var(--radius-sm); cursor: pointer; transition: .15s;
}
.picker-btn:hover { border-color: #39425a; }
.picker.open .picker-btn { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.picker-btn .ph { color: #5b6378; flex: 1; }
.picker-btn .val { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.picker-btn .caret { color: var(--muted); }
.picker-pop {
  position: absolute; z-index: 60; inset-inline: 0; top: calc(100% + 6px); background: var(--surface-2);
  border: 1px solid var(--border-2); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); overflow: hidden;
  animation: pop .14s ease;
}
.picker-pop.up { top: auto; bottom: calc(100% + 6px); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.picker-search { padding: 8px; border-bottom: 1px solid var(--border); }
.picker-search .input { padding: 8px 11px; }
.picker-list { max-height: 280px; overflow-y: auto; padding: 6px; }
.picker-group { font-size: 11px; font-weight: 700; color: var(--muted); padding: 8px 10px 4px; letter-spacing: .3px; }
.picker-opt { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 7px; cursor: pointer; color: var(--text-2); }
.picker-opt:hover, .picker-opt.hl { background: var(--surface-3); color: var(--text); }
.picker-opt.sel { color: #fff; }
.picker-opt.sel .check { opacity: 1; }
.picker-opt.dis { opacity: .4; cursor: not-allowed; }
.picker-opt .check { margin-inline-start: auto; opacity: 0; color: var(--accent-2); }
.picker-opt .svg-icon { color: var(--muted); }
.picker-empty { padding: 18px; text-align: center; color: var(--muted); font-size: 13px; }
.ch-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Image */
.image-field { display: flex; gap: 12px; align-items: stretch; }
.image-preview {
  width: 92px; height: 70px; border-radius: var(--radius-sm); border: 1px dashed var(--border-2); background: var(--input) center/cover no-repeat;
  display: grid; place-items: center; color: var(--muted); flex-shrink: 0; overflow: hidden;
}
.image-preview.has { border-style: solid; }
.image-field .stack { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.image-field .input { direction: ltr; }

/* ═══════════════ Buttons ═══════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text); font-weight: 600; cursor: pointer;
  transition: .15s; white-space: nowrap; text-decoration: none !important; line-height: 1.4;
}
.btn:hover { background: var(--surface-3); border-color: #39425a; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: linear-gradient(135deg, var(--accent), #6152e8); border-color: transparent; color: #fff; box-shadow: 0 8px 20px -10px var(--accent-glow); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.success { background: var(--success); border-color: transparent; color: #04210f; }
.btn.danger { background: var(--danger-soft); border-color: rgba(239, 68, 68, .35); color: #fca5a5; }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.icon { padding: 8px; width: 38px; height: 38px; }
.btn.icon.sm { width: 32px; height: 32px; padding: 6px; }
.btn.block { width: 100%; }
.btn .spin { width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge.success { background: var(--success-soft); color: #4ade80; }
.badge.danger { background: var(--danger-soft); color: #f87171; }
.badge.warn { background: var(--warn-soft); color: #fbbf24; }
.badge.accent { background: var(--accent-soft); color: var(--accent-2); }
.badge.info { background: rgba(56, 189, 248, .14); color: #7dd3fc; }

/* ═══════════════ List (repeatable items) ═══════════════ */
.list { display: flex; flex-direction: column; gap: 12px; }
.list-item { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-2); overflow: visible; }
.list-item.open { border-color: var(--border-2); }
.list-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px; cursor: pointer; user-select: none; }
.list-head .num { width: 28px; height: 28px; border-radius: 8px; background: var(--surface-3); display: grid; place-items: center; font-size: 12.5px; font-weight: 700; color: var(--muted); flex-shrink: 0; }
.list-head .t { flex: 1; font-weight: 600; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-head .chev { transition: transform .2s; color: var(--muted); }
.list-item.open > .list-head .chev { transform: rotate(180deg); }
.list-body { display: none; padding: 4px 16px 16px; border-top: 1px solid var(--border); }
.list-item.open > .list-body { display: block; padding-top: 16px; }
.list-tools { display: flex; gap: 4px; }
.list-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border-2); }
.list-empty { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--border-2); border-radius: var(--radius); }
.list-empty .svg-icon { width: 30px; height: 30px; margin-bottom: 6px; opacity: .6; }
.list-add { margin-top: 12px; }
.list .list .list-item { background: var(--surface); }

/* ═══════════════ Commands ═══════════════ */
.cmd-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cmd { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--bg-2); border: 1px solid var(--border); }
.cmd .meta { flex: 1; min-width: 0; }
.cmd .meta b { font-family: var(--mono); font-size: 13.5px; direction: ltr; display: inline-block; }
.cmd .meta p { margin: 1px 0 0; font-size: 12.5px; color: var(--muted); }
.cmd .alias { font-size: 11.5px; color: #5f6880; margin-top: 2px; }

.info-box { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm); background: rgba(56, 189, 248, .08); border: 1px solid rgba(56, 189, 248, .22); color: #bae6fd; font-size: 13.5px; grid-column: 1 / -1; }
.info-box .svg-icon { color: var(--info); margin-top: 2px; }
.warn-box { background: var(--warn-soft); border-color: rgba(245, 158, 11, .3); color: #fde68a; }
.warn-box .svg-icon { color: var(--warn); }

/* ═══════════════ Embed builder ═══════════════ */
.embed-builder { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.embed-form { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: var(--radius); background: var(--bg-2); border: 1px solid var(--border); border-inline-start: 4px solid var(--ec, var(--accent)); }
.embed-form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.embed-form .mini-label { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 4px; display: block; }
.embed-fields-list { display: flex; flex-direction: column; gap: 8px; }
.embed-field-row { display: grid; grid-template-columns: 1fr 1.4fr auto auto; gap: 8px; align-items: center; }
.embed-preview-wrap { position: sticky; top: calc(var(--topbar-h) + 16px); }
.preview-label { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }

.dc-msg { background: #313338; border-radius: var(--radius); padding: 14px 16px; display: flex; gap: 14px; direction: ltr; font-family: 'gg sans', 'IBM Plex Sans Arabic', 'Segoe UI', sans-serif; color: #dbdee1; }
.dc-msg .dc-av { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; background: #5865f2 center/cover; }
.dc-msg .dc-main { flex: 1; min-width: 0; }
.dc-name { font-weight: 600; color: #f2f3f5; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.dc-bot { background: #5865f2; color: #fff; font-size: 10px; padding: 1px 5px; border-radius: 4px; font-weight: 600; display: inline-flex; align-items: center; gap: 2px; }
.dc-time { font-size: 11.5px; color: #949ba4; font-weight: 400; }
.dc-content { font-size: 15px; line-height: 1.4; white-space: pre-wrap; word-wrap: break-word; margin-top: 2px; unicode-bidi: plaintext; text-align: start; }
.dc-embed { margin-top: 6px; background: #2b2d31; border-radius: 4px; border-inline-start: 4px solid #6d5dfc; max-width: 520px; display: grid; grid-template-columns: auto; padding: 8px 16px 16px 12px; position: relative; }
.dc-embed.has-thumb { padding-right: 96px; }
.dc-embed .e-author { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: #f2f3f5; margin-top: 8px; }
.dc-embed .e-author img { width: 24px; height: 24px; border-radius: 50%; }
.dc-embed .e-title { font-weight: 600; font-size: 16px; color: #f2f3f5; margin-top: 8px; }
.dc-embed .e-title.link { color: #00a8fc; }
.dc-embed .e-desc { font-size: 14px; line-height: 1.45; margin-top: 8px; white-space: pre-wrap; word-wrap: break-word; color: #dbdee1; }
.dc-embed .e-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.dc-embed .e-field { grid-column: 1 / -1; font-size: 14px; }
.dc-embed .e-field.inline { grid-column: auto; }
.dc-embed .e-field b { display: block; color: #f2f3f5; font-weight: 600; margin-bottom: 2px; }
.dc-embed .e-image { margin-top: 16px; border-radius: 4px; max-width: 100%; max-height: 300px; object-fit: cover; }
.dc-embed .e-thumb { position: absolute; top: 16px; right: 16px; width: 80px; height: 80px; border-radius: 4px; object-fit: cover; }
.dc-embed .e-footer { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #b5bac1; margin-top: 8px; }
.dc-embed .e-footer img { width: 20px; height: 20px; border-radius: 50%; }
.dc-embed :is(.e-author, .e-title, .e-desc, .e-field, .e-footer) { unicode-bidi: plaintext; text-align: start; }
.dc-mention { background: rgba(88, 101, 242, .3); color: #c9cdfb; border-radius: 3px; padding: 0 2px; font-weight: 500; direction: ltr; unicode-bidi: isolate; }
.dc-code { background: #1e1f22; border-radius: 4px; padding: 0 4px; font-family: var(--mono); font-size: 85%; }
.dc-quote { border-left: 4px solid #4e5058; padding-left: 10px; display: block; }
.dc-h1 { font-size: 1.4em; font-weight: 700; display: block; margin: 4px 0; }
.dc-h2 { font-size: 1.2em; font-weight: 700; display: block; margin: 4px 0; }
.dc-h3 { font-size: 1.05em; font-weight: 700; display: block; margin: 4px 0; }
.dc-attach { margin-top: 8px; max-width: min(520px, 100%); max-height: 360px; border-radius: 8px; object-fit: contain; display: block; }
.dc-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.dc-btn { padding: 6px 14px; border-radius: 4px; font-size: 14px; font-weight: 500; color: #fff; background: #4e5058; }
.dc-btn.Primary { background: #5865f2; } .dc-btn.Success { background: #248046; } .dc-btn.Danger { background: #da373c; }

/* ═══════════════ Stats & tables ═══════════════ */
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px;
  display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden;
}
.stat .k { color: var(--muted); font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.stat .k .svg-icon { width: 16px; height: 16px; color: var(--accent-2); }
.stat .v { font-size: 25px; font-weight: 700; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.stat .d { font-size: 12px; color: var(--muted); }
.stat::after { content: ''; position: absolute; inset-inline: 0; top: 0; height: 2px; background: linear-gradient(90deg, transparent, rgba(124, 108, 255, .45), transparent); opacity: .7; }

.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 200px; }

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: start; font-weight: 600; color: var(--muted); font-size: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--bg-2); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: rgba(255, 255, 255, .015); }
.table .who { display: flex; align-items: center; gap: 9px; }
.table .reason { max-width: 280px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty .svg-icon { width: 40px; height: 40px; opacity: .45; margin-bottom: 8px; }
.empty h4 { margin: 0 0 4px; color: var(--text-2); font-size: 15px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .input { max-width: 280px; }
.seg { display: inline-flex; background: var(--input); border: 1px solid var(--border-2); border-radius: var(--radius-sm); padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; cursor: pointer; color: var(--text-2); font-weight: 500; display: inline-flex; gap: 6px; align-items: center; }
.seg button.on { background: var(--surface-3); color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset; }
.seg button .n { font-size: 11px; color: var(--muted); }
.pager { display: flex; gap: 8px; justify-content: center; align-items: center; padding: 14px; color: var(--muted); }

.stars { color: #fbbf24; letter-spacing: 1px; white-space: nowrap; }
.stars .off { color: #3a4256; }

.ov-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1100px) { .ov-grid { grid-template-columns: 1fr; } }

/* Module grid (overview) */
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.mod-tile { display: flex; align-items: center; gap: 11px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--bg-2); border: 1px solid var(--border); transition: .15s; }
.mod-tile:hover { border-color: var(--border-2); }
.mod-tile .ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--accent-2); flex-shrink: 0; }
.mod-tile a { flex: 1; color: var(--text); font-weight: 600; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-guild { display: flex; align-items: center; gap: 18px; padding: 22px; background: linear-gradient(120deg, rgba(124, 108, 255, .16), rgba(19, 23, 32, 0) 60%), var(--surface); }
.hero-guild .guild-icon { width: 68px; height: 68px; border-radius: 20px; font-size: 22px; }
.hero-guild h2 { margin: 0; font-size: 21px; }
.hero-guild .meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-top: 4px; }
.hero-guild .meta span { display: inline-flex; gap: 5px; align-items: center; }

/* Timeline (audit) */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.tl-item:last-child { border-bottom: 0; }
.tl-main { flex: 1; min-width: 0; }
.tl-main .top { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tl-main .when { color: var(--muted); font-size: 12px; margin-inline-start: auto; }
.tl-changes { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.tl-change { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; color: var(--text-2); }
.tl-change .from { color: #f87171; text-decoration: line-through; text-decoration-color: rgba(248, 113, 113, .4); }
.tl-change .to { color: #4ade80; }
.tl-change .lbl { color: var(--muted); }

/* Leaderboard */
.lb-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.lb-row:last-child { border-bottom: 0; }
.lb-rank { width: 30px; text-align: center; font-weight: 700; color: var(--muted); }
.lb-rank.r1 { color: #fbbf24; } .lb-rank.r2 { color: #cbd5e1; } .lb-rank.r3 { color: #d97706; }
.lb-row .name { flex: 1; font-weight: 600; }
.lb-bar { width: 140px; height: 6px; background: var(--surface-3); border-radius: 9px; overflow: hidden; }
.lb-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 9px; }

/* ═══════════════ Save bar ═══════════════ */
.savebar {
  position: fixed; bottom: 22px; inset-inline-start: calc(var(--sidebar-w) + 28px); inset-inline-end: 28px; max-width: 900px; margin-inline: auto;
  display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 18px; border-radius: var(--radius);
  background: rgba(24, 29, 40, .92); backdrop-filter: blur(12px); border: 1px solid var(--border-2); box-shadow: var(--shadow-lg);
  z-index: 50; transform: translateY(140%); transition: transform .3s cubic-bezier(.3, 1.3, .5, 1);
}
.savebar.show { transform: translateY(0); }
.savebar.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.savebar .msg { flex: 1; font-weight: 600; display: flex; align-items: center; gap: 9px; }
.savebar .msg .svg-icon { color: var(--warn); }

/* ═══════════════ Toasts & modal ═══════════════ */
.toasts { position: fixed; top: 18px; left: 18px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 36px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2);
  border: 1px solid var(--border-2); box-shadow: var(--shadow-lg); animation: toastIn .25s ease; font-weight: 500;
}
.toast.success .svg-icon { color: var(--success); } .toast.error .svg-icon { color: var(--danger); } .toast.info .svg-icon { color: var(--accent-2); }
.toast.out { animation: toastOut .2s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(-20px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(-20px); } }

.modal-bg { position: fixed; inset: 0; background: rgba(3, 4, 8, .7); backdrop-filter: blur(4px); z-index: 90; display: grid; place-items: center; padding: 20px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(460px, 100%); background: var(--surface); border: 1px solid var(--border-2); border-radius: 18px; box-shadow: var(--shadow-lg); animation: pop .18s ease; overflow: hidden; }
.modal-body { padding: 24px; }
.modal-body h3 { margin: 0 0 6px; font-size: 18px; }
.modal-body p { margin: 0; color: var(--text-2); }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 24px; background: var(--bg-2); border-top: 1px solid var(--border); }
.modal.wide { width: min(760px, 100%); }

/* ═══════════════ Server picker ═══════════════ */
.picker-page { max-width: 1080px; margin: 0 auto; padding: 48px 24px; }
.picker-page h1 { font-size: 28px; margin: 0 0 6px; }
.picker-page > p { color: var(--muted); margin: 0 0 30px; }
.guild-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.guild-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 22px; display: flex; flex-direction: column; align-items: center;
  gap: 12px; text-align: center; transition: .2s; position: relative; overflow: hidden;
}
.guild-card::before { content: ''; position: absolute; inset: 0 0 auto; height: 70px; background: linear-gradient(135deg, rgba(124, 108, 255, .25), rgba(56, 189, 248, .08)); }
.guild-card:hover { transform: translateY(-3px); border-color: var(--border-2); box-shadow: var(--shadow); }
.guild-card .guild-icon { width: 76px; height: 76px; border-radius: 22px; font-size: 24px; position: relative; box-shadow: 0 0 0 5px var(--surface); }
.guild-card h3 { margin: 4px 0 0; font-size: 16px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guild-card .sub { color: var(--muted); font-size: 12.5px; margin-top: -8px; }
.guild-card .btn { width: 100%; margin-top: 4px; }

/* Skeleton / loading */
.loading { display: grid; place-items: center; padding: 80px; color: var(--muted); }
.loader { width: 34px; height: 34px; border: 3px solid var(--surface-3); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: var(--radius); }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.muted { color: var(--muted); }
.ltr { direction: ltr; unicode-bidi: isolate; }
.nowrap { white-space: nowrap; }
.flex { display: flex; gap: 10px; align-items: center; }
.flex.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.mt { margin-top: 16px; }
.hide { display: none !important; }
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 35; display: none; }

/* ═══════════════ Responsive ═══════════════ */
@media (max-width: 1100px) {
  .embed-builder { grid-template-columns: 1fr; }
  .embed-preview-wrap { position: static; }
  .grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1000px) {
  .sidebar { transform: translateX(100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .sidebar.open ~ .overlay { display: block; }
  .main { margin-inline-start: 0; }
  .menu-btn { display: inline-flex; }
  .savebar { inset-inline-start: 16px; inset-inline-end: 16px; bottom: 14px; }
}
@media (max-width: 720px) {
  .content { padding: 18px 16px 120px; }
  .topbar { padding: 0 16px; }
  .fields, .grid-2, .grid-3, .cmd-grid { grid-template-columns: 1fr; }
  .grid-6, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-head { flex-wrap: wrap; }
  .page-head h1 { font-size: 20px; }
  .bot-pill .txt { display: none; }
  .embed-form .row2, .embed-field-row { grid-template-columns: 1fr; }
  .savebar .msg span { display: none; }
  .demo-banner { padding: 8px 16px; }
  .lb-bar { display: none; }
  .hero-guild { flex-wrap: wrap; padding: 18px; }
  .hero-guild > .btn { width: 100%; }
  .hero-guild .guild-icon { width: 56px; height: 56px; }
  .hero-guild .meta { gap: 6px 12px; }
  .toolbar .input { max-width: none; }
  .table td, .table th { padding: 10px; }
}
