/* =====================================================
   Kawaii Admin Dashboard — Dark Theme
   ===================================================== */

:root {
  --bg: #313338;
  --surface: #2b2d31;
  --surface-hover: #35373c;
  --border: #1e1f22;
  --accent: #5865f2;
  --accent-hover: #7289da;
  --accent-soft: rgba(88, 101, 242, 0.22);
  --text-primary: #e8e6f0;
  --text-secondary: #a0aec0;
  --text-muted: #6b7280;
  --green: #48bb78;
  --red: #fc8181;
  --orange: #ed8936;
  --yellow: #ecc94b;
  --blue: #63b3ed;
  --purple: #b794f4;
  --pink: #f687b3;
  /* Layout & motion */
  --content-max: min(1240px, 100%);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.18);
  --shadow-elevated: 0 8px 28px rgba(0, 0, 0, 0.28);
  --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}

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

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* =====================================================
   Layout
   ===================================================== */

.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* One scroll on .sidebar-scroll only — do not max-height nested navs or labels collapse */
.sidebar-nav-setup {
  overflow: visible;
}

.sidebar-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  padding: 12px 12px 6px;
  flex-shrink: 0;
}

.sidebar-guild-meta {
  font-size: 11px;
  color: var(--text-muted);
}

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

.sidebar-guild img,
.sidebar-guild-icon-ph {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.sidebar-guild-icon-ph {
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
}

.sidebar-guild-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-guild-count { font-size: 12px; color: var(--text-muted); }

/* flex: 1 on every .sidebar-nav was splitting height across groups and hiding link text */
.sidebar-nav {
  flex: 0 0 auto;
  padding: 8px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
}

.nav-item:hover { background: var(--surface-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-hover); }
.nav-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0;
}

.nav-icon { width: 22px; text-align: center; flex-shrink: 0; font-size: 15px; line-height: 1; }
.nav-label {
  flex: 1;
  min-width: 0;
  text-align: left;
  overflow: visible;
  white-space: normal;
  line-height: 1.35;
}
.sidebar-footer { padding: 8px 8px 16px; border-top: 1px solid var(--border); }

/* Main content */
.main-content {
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding: clamp(16px, 3.5vw, 32px) clamp(14px, 3vw, 28px) 40px;
  overflow-y: auto;
}

/* Topbar (used on index page) */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-logo { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-secondary); }
.user-chip img { width: 28px; height: 28px; border-radius: 50%; }
.btn-logout { font-size: 13px; color: var(--text-muted); text-decoration: none; }
.btn-logout:hover { color: var(--red); }

/* =====================================================
   Page headers
   ===================================================== */

.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-size: clamp(1.2rem, 2.2vw, 1.45rem);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.page-subtitle { font-size: 14px; color: var(--text-muted); margin-top: 4px; line-height: 1.45; }

.header-actions { display: flex; align-items: center; gap: 10px; }

/* =====================================================
   Cards
   ===================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.18s var(--ease-out), box-shadow 0.22s var(--ease-out);
}
.card:hover {
  border-color: rgba(255, 255, 255, 0.07);
}

.card-header {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* =====================================================
   Stat cards
   ===================================================== */

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

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 16px;
  text-align: center;
  transition: border-color 0.15s;
}

.stat-card:hover { border-color: var(--accent); }
.stat-card.clickable { cursor: pointer; }

.stat-icon { font-size: 24px; margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text-primary); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.stat-delta { font-size: 13px; margin-top: 6px; }
.stat-delta.positive { color: var(--green); }
.stat-delta.negative { color: var(--red); }

/* =====================================================
   Status bar
   ===================================================== */

.status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 24px;
  font-size: 13px;
}

.status-indicator { display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot.green { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot.red { background: var(--red); }
.dot.yellow { background: var(--yellow); }

.latency-pill {
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 12px;
  color: var(--text-muted);
}

/* =====================================================
   Funnel
   ===================================================== */

.funnel-step { margin-bottom: 14px; }
.funnel-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.funnel-count { color: var(--text-muted); }
.funnel-bar-track {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.funnel-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* =====================================================
   Tables
   ===================================================== */

.table-scroll { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  background: var(--surface-hover);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  vertical-align: middle;
  color: var(--text-secondary);
}

.data-table tr:hover td { background: var(--surface-hover); }
.data-table tr.row-muted td { opacity: 0.5; }

.table-footer {
  padding: 12px 16px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.member-table .member-cell { display: flex; align-items: center; gap: 10px; }
.member-avatar, .lb-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.member-avatar-ph, .lb-avatar-placeholder {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.member-name { font-weight: 500; color: var(--text-primary); font-size: 14px; }
.member-id { font-size: 11px; color: var(--text-muted); }
.cell-date { font-size: 13px; white-space: nowrap; }
.cell-num { font-size: 13px; text-align: right; }
.text-red { color: var(--red); }
.reason-cell { max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }

/* =====================================================
   Tags / badges
   ===================================================== */

.tag {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 4px;
  font-size: 12px; font-weight: 600;
}
.tag-green { background: rgba(72,187,120,0.15); color: var(--green); }
.tag-red { background: rgba(252,129,129,0.15); color: var(--red); }
.tag-orange { background: rgba(237,137,54,0.15); color: var(--orange); }
.tag-purple { background: rgba(183,148,246,0.15); color: var(--purple); }
.tag-muted { background: var(--surface-hover); color: var(--text-muted); }

.badge {
  display: inline-block;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.badge-muted { font-size: 12px; color: var(--text-muted); font-weight: 400; }

/* Tier badges */
.tier-badge {
  padding: 3px 8px; border-radius: 6px;
  font-size: 12px; font-weight: 600; text-transform: capitalize;
}
.tier-ghost { background: rgba(252,129,129,0.15); color: var(--red); }
.tier-dormant { background: rgba(237,137,54,0.15); color: var(--orange); }
.tier-lurker { background: rgba(236,201,75,0.12); color: var(--yellow); }

/* Action badge */
.action-badge {
  padding: 3px 8px; border-radius: 6px;
  font-size: 12px; font-weight: 600; text-transform: capitalize;
  background: var(--surface-hover); color: var(--text-secondary);
}
.action-ban { background: rgba(252,129,129,0.15); color: var(--red); }
.action-kick, .action-purge_kick { background: rgba(237,137,54,0.15); color: var(--orange); }
.action-timeout { background: rgba(236,201,75,0.12); color: var(--yellow); }
.action-warn { background: rgba(99,179,237,0.12); color: var(--blue); }

/* Warn count */
.warn-count { font-weight: 700; color: var(--text-primary); }
.warn-count.high { color: var(--red); }

/* =====================================================
   Leaderboard
   ===================================================== */

.lb-list { display: flex; flex-direction: column; gap: 10px; }
.lb-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: var(--surface-hover);
  border-radius: 8px;
}
.lb-rank { width: 24px; text-align: center; color: var(--text-muted); font-size: 13px; font-weight: 600; }
.lb-name { flex: 1; font-size: 14px; font-weight: 500; }
.lb-stat { font-size: 14px; font-weight: 600; color: var(--accent-hover); white-space: nowrap; }
.lb-bar-wrap { width: 80px; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.lb-bar { height: 100%; background: linear-gradient(90deg, var(--accent), var(--purple)); border-radius: 3px; }

/* =====================================================
   Retention grid
   ===================================================== */

.retention-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 700px) { .retention-grid { grid-template-columns: repeat(2, 1fr); } }
.retention-item { text-align: center; padding: 16px; background: var(--surface-hover); border-radius: 8px; }
.retention-value { font-size: 28px; font-weight: 700; color: var(--text-primary); }
.retention-value.green { color: var(--green); }
.retention-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* =====================================================
   Cogs
   ===================================================== */

.cogs-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.cog-pill {
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* =====================================================
   Filter tabs
   ===================================================== */

.filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-tab {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.12s;
}
.filter-tab:hover { border-color: var(--accent); color: var(--text-primary); }
.filter-tab.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-hover); }
.filter-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* =====================================================
   Buttons
   ===================================================== */

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, transform 0.1s;
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary:focus-visible {
  outline: 2px solid var(--accent-hover);
  outline-offset: 2px;
}

.btn-secondary {
  background: var(--surface-hover);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.12s;
}
.btn-secondary:hover { background: var(--border); }
.btn-secondary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-tiny {
  background: var(--surface-hover);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
}
.btn-tiny:hover { color: var(--text-primary); }
.btn-tiny.btn-del { color: var(--red); border-color: transparent; background: none; }

/* =====================================================
   Form inputs
   ===================================================== */

.select-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
}
.select-input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }

.search-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  color: var(--text-primary);
  font-size: 14px;
  width: 240px;
}
.search-input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.search-input:focus-visible { box-shadow: var(--focus-ring); }

.text-input, .num-input {
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 14px;
}
.num-input { width: 80px; }
.text-input { width: 100%; }
.text-input:focus, .num-input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.text-input:focus-visible, .num-input:focus-visible { border-color: var(--accent); box-shadow: var(--focus-ring); }

.toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--border); border-radius: 24px;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  height: 18px; width: 18px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%;
  transition: transform 0.2s;
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* =====================================================
   Purge page
   ===================================================== */

.alert-warn {
  background: rgba(237,137,54,0.12);
  border: 1px solid rgba(237,137,54,0.3);
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 14px;
  color: var(--orange);
  margin-top: 8px;
}
.alert-warn code { background: rgba(0,0,0,0.3); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

.criteria-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  align-items: end;
}
.criteria-item label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.input-row { display: flex; align-items: center; gap: 8px; }

.cmd-block { background: var(--surface-hover); border-radius: 8px; padding: 12px 14px; }
.cmd-label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.cmd-block code {
  display: block; font-size: 13px; color: var(--text-primary);
  background: var(--bg); padding: 8px 12px; border-radius: 6px;
  word-break: break-all; font-family: 'SF Mono', 'Consolas', monospace;
}

/* =====================================================
   Settings page
   ===================================================== */

.actions-grid { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-action {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-hover); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 16px;
  cursor: pointer; color: var(--text-secondary); font-size: 14px;
  transition: border-color 0.12s;
}
.btn-action:hover { border-color: var(--accent); color: var(--text-primary); }
.btn-action:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.action-icon { font-size: 20px; }
.action-label { font-size: 13px; }

.cog-reload-form { display: flex; gap: 10px; align-items: center; }

.config-display { display: flex; flex-direction: column; gap: 6px; }
.config-row { display: flex; gap: 12px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.03); }
.config-key { min-width: 200px; font-size: 13px; color: var(--text-muted); font-family: monospace; }
.config-value { font-size: 13px; color: var(--text-secondary); word-break: break-all; }

.raw-pair { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.raw-key { width: 200px; }
.raw-val { flex: 1; }

.save-status {
  padding: 10px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 16px;
}
.save-status.saving { background: rgba(99,179,237,0.12); color: var(--blue); }
.save-status.success { background: rgba(72,187,120,0.12); color: var(--green); }
.save-status.error { background: rgba(252,129,129,0.12); color: var(--red); }

/* =====================================================
   Pagination
   ===================================================== */

.pagination { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.page-btn {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 5px 12px; font-size: 13px;
  color: var(--text-muted); cursor: pointer;
}
.page-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.page-btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-hover); }
.page-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* =====================================================
   Skeleton loading
   ===================================================== */

.skeleton {
  background: linear-gradient(90deg, var(--surface-hover) 25%, var(--border) 50%, var(--surface-hover) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
  min-height: 20px;
}
.stat-card.loading .skeleton { height: 80px; }

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* =====================================================
   Misc
   ===================================================== */

.empty-inline { padding: 20px; text-align: center; color: var(--text-muted); font-size: 13px; }
.empty-state { color: var(--text-muted); text-align: center; padding: 40px; }

code {
  background: var(--surface-hover);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'SF Mono', 'Consolas', monospace;
}

a { color: inherit; }

/* =====================================================
   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-muted); }

/* =====================================================
   Server picker (index) — Discord-inspired
   ===================================================== */

.dash-index {
  min-height: 100vh;
  background: linear-gradient(180deg, #1e1f22 0%, var(--bg) 120px);
}

.dash-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.dash-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dash-brand-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
}
.dash-brand-text { font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.dash-brand-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
}

.dash-topbar-right { display: flex; align-items: center; gap: 14px; }

.dash-main {
  max-width: min(1100px, 100%);
  margin: 0 auto;
  padding: clamp(20px, 4vw, 32px) clamp(16px, 3vw, 28px) 48px;
}

.dash-hero h1 {
  font-size: clamp(1.35rem, 3vw, 1.65rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
  line-height: 1.2;
}
.dash-hero p { color: var(--text-muted); font-size: 14px; }

.guilds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.guild-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
}
.guild-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  transform: translateY(-1px);
}
.guild-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}
.guild-card .guild-icon { flex-shrink: 0; }
.guild-icon-img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}
.guild-icon-ph {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
}
.guild-info { flex: 1; min-width: 0; }
.guild-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guild-members { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.guild-arrow { color: var(--text-muted); font-size: 18px; opacity: 0.7; }

.empty-state .empty-title { font-weight: 600; color: var(--text-primary); margin-bottom: 8px; }
.empty-state .empty-body { max-width: 520px; margin: 0 auto; line-height: 1.55; }

.bot-status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3ba55d;
}
.status-dot.offline { background: #ed4245; }
.latency-pill { margin-left: auto; color: var(--text-muted); font-size: 12px; }

/* =====================================================
   Discord-like embed preview (chat message mock)
   ===================================================== */

.embed-preview-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.discord-chat-preview {
  background: #313338;
  border-radius: 8px;
  border: 1px solid #1e1f22;
  padding: 14px 12px;
  min-height: 100px;
}

.embed-preview-host {
  min-height: 0;
}

.discord-message-preview {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  max-width: 100%;
}

.discord-message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  margin-top: 2px;
  background: #1e1f22;
}

.discord-message-stack {
  flex: 1;
  min-width: 0;
  max-width: 432px;
}

.discord-message-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
  line-height: 1.2;
}

.discord-message-author {
  font-size: 15px;
  font-weight: 600;
  color: #f2f3f5;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.discord-message-bot {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  background: #5865f2;
  color: #fff;
  vertical-align: middle;
}

.discord-message-time {
  font-size: 12px;
  color: #949ba4;
  font-weight: 400;
}

.discord-message-content {
  font-size: 16px;
  line-height: 1.375;
  color: #dbdee1;
  margin-bottom: 8px;
  word-wrap: break-word;
}

.discord-embed-wrap {
  background: transparent;
  border: none;
  padding: 0;
}

.discord-embed {
  position: relative;
  max-width: 432px;
  margin-top: 2px;
  border-radius: 4px;
  background: #2b2d31;
  border-left: 4px solid var(--embed-accent, #5865f2);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

.discord-embed--empty {
  opacity: 0.85;
}

.discord-embed-inner {
  padding: 0.5rem 1rem 1rem 0.75rem;
  font-size: 14px;
  line-height: 1.375;
  color: #dbdee1;
}

.discord-embed-inner::after {
  content: '';
  display: table;
  clear: both;
}

.discord-embed-thumb {
  float: right;
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  margin: 0 0 8px 12px;
}

.discord-embed-author {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  min-height: 20px;
}

.discord-embed-author-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.discord-embed-author-name {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.discord-embed-author-name:hover {
  text-decoration: underline;
}

.discord-embed-title {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 8px;
  line-height: 1.3;
}

.discord-embed-title a {
  color: #00a8fc;
  text-decoration: none;
}

.discord-embed-title a:hover {
  text-decoration: underline;
}

.discord-embed-desc {
  color: #dbdee1;
  font-size: 14px;
  line-height: 1.375;
  margin-bottom: 8px;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.discord-embed-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
  margin-bottom: 4px;
}

.discord-embed-field {
  grid-column: 1 / -1;
  min-width: 0;
}

.discord-embed-field--inline {
  grid-column: span 1;
}

.discord-embed-field-name {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
  line-height: 1.3;
}

.discord-embed-field-value {
  font-size: 14px;
  color: #dbdee1;
  line-height: 1.375;
  word-wrap: break-word;
}

.discord-embed-image-link {
  display: block;
  margin-top: 12px;
  max-width: 100%;
}

.discord-embed-image {
  max-width: 100%;
  max-height: 300px;
  border-radius: 4px;
  display: block;
  object-fit: contain;
}

.discord-embed-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  min-height: 18px;
  font-size: 12px;
  line-height: 1.33;
  color: #949ba4;
}

.discord-embed-footer-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
}

.discord-embed-footer-text {
  font-weight: 500;
}

.discord-embed-ts::before {
  content: '•';
  margin: 0 4px;
  opacity: 0.7;
}

/* Markdown in preview */
.discord-md-link {
  color: #00a8fc;
  text-decoration: none;
}

.discord-md-link:hover {
  text-decoration: underline;
}

.discord-md-code {
  background: #1e1f22;
  padding: 0.1em 0.25em;
  border-radius: 3px;
  font-family: 'Consolas', 'SF Mono', monospace;
  font-size: 0.9em;
}

.discord-md-pre {
  background: #1e1f22;
  border: 1px solid #1e1f22;
  border-radius: 4px;
  padding: 8px;
  margin: 6px 0;
  overflow-x: auto;
  font-family: 'Consolas', 'SF Mono', monospace;
  font-size: 13px;
  white-space: pre-wrap;
}

.discord-md-quote {
  border-left: 3px solid #4e5058;
  padding-left: 8px;
  color: #b5bac1;
  margin: 2px 0;
}

.discord-md-li {
  padding-left: 4px;
}

.discord-md-emoji {
  display: inline;
  background: rgba(88, 101, 242, 0.2);
  padding: 0 4px;
  border-radius: 4px;
  font-size: 0.95em;
}

.discord-custom-emoji {
  width: 1.375em;
  height: 1.375em;
  vertical-align: -0.3em;
  object-fit: contain;
  display: inline;
  margin: 0 1px;
}

.discord-mention {
  background: rgba(88, 101, 242, 0.35);
  color: #dee0fc;
  padding: 0 2px;
  border-radius: 3px;
  font-weight: 500;
  cursor: default;
}

.embed-preview-err {
  color: #f23f43;
  font-size: 14px;
  padding: 8px;
}

.embed-preview-empty {
  color: #949ba4;
  font-size: 14px;
}

.embed-editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.embed-json-area {
  width: 100%;
  font-family: 'SF Mono', 'Consolas', 'Menlo', monospace;
  font-size: 12px;
  line-height: 1.45;
  background: #1e1f22;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  color: #dcddde;
  resize: vertical;
}

.embed-editor-actions { margin-top: 10px; display: flex; gap: 8px; }

.emoji-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 36px;
  margin-bottom: 8px;
}
.emoji-strip-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 2px;
  cursor: pointer;
}
.emoji-strip-btn:hover { background: var(--surface-hover); border-color: var(--border); }

.emoji-picker-mount { position: relative; min-height: 0; }

.emoji-card-wrap { position: relative; }

/* Popover built in JS (no Tailwind — must match dashboard tokens) */
.emoji-picker-popover {
  position: absolute;
  z-index: 50;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  width: min(100%, 340px);
  max-height: min(70vh, 420px);
  display: flex;
  flex-direction: column;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.emoji-picker-search {
  width: 100%;
  margin-bottom: 10px;
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #1e1f22;
  color: var(--text-primary);
  outline: none;
}
.emoji-picker-search:focus {
  border-color: var(--accent);
}

.emoji-picker-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0 10px;
}

.emoji-picker-server-grid,
.emoji-picker-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
  padding: 2px;
}

.emoji-picker-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
}
.emoji-picker-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border);
}

.emoji-picker-btn-img img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  display: block;
}

.emoji-picker-loading,
.emoji-picker-empty {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  width: 100%;
}

/* Embeds page: editor + sticky preview */
.embed-page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 20px;
  align-items: start;
  margin-top: 4px;
}

.embed-page-main {
  min-width: 0;
}

.embed-page-aside {
  position: sticky;
  top: 16px;
  align-self: start;
}

.embed-preview-card {
  margin: 0;
}

@media (max-width: 1024px) {
  .embed-page-layout {
    grid-template-columns: 1fr;
  }
  .embed-page-aside {
    position: static;
  }
}

.cog-intro-card {
  padding: 14px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  background: rgba(88, 101, 242, 0.08);
  border: 1px solid rgba(88, 101, 242, 0.25);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-secondary);
}
.cog-intro-card strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Self roles — three Discord embeds + emoji preview */
.selfrole-panel-block {
  margin-top: 18px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}
.selfrole-panel-block:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.selfrole-panel-title {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}
.selfrole-panel-sub {
  margin: 0 0 10px;
  font-size: 13px;
}
.selfrole-extra-group {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface, rgba(0, 0, 0, 0.15));
}
.selfrole-extra-group:first-of-type {
  margin-top: 8px;
}
.selfrole-extra-group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.selfrole-extra-group-head .sr-group-title {
  flex: 1;
  min-width: 160px;
  max-width: 420px;
}
.selfrole-table-wrap {
  overflow-x: auto;
  overflow-y: visible;
}
.sr-emoji-cell {
  position: relative;
  vertical-align: middle;
  min-width: 240px;
}
.sr-emoji-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sr-emoji-meta {
  flex: 1;
  min-width: 0;
  max-width: 140px;
}
.sr-emoji-meta .sr-emoji-name {
  display: block;
  font-size: 12px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sr-emoji-preview {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #1e1f22;
  border: 1px solid var(--border);
}
.sr-emoji-preview-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
}
.sr-emoji-preview-placeholder {
  color: var(--text-muted);
  font-size: 14px;
}
.sr-emoji-picker-mount {
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  z-index: 60;
  min-width: 280px;
}

.cog-emoji-picker-field {
  position: relative;
  margin-top: 4px;
}
.cog-emoji-picker-field .sr-emoji-picker-mount {
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  z-index: 80;
}
.cog-emoji-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding: 8px;
  max-height: 140px;
  overflow-y: auto;
  background: #1e1f22;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.cog-emoji-strip-btn {
  width: 36px;
  height: 36px;
  padding: 3px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #2b2d31;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s;
}
.cog-emoji-strip-btn:hover {
  background: #35373c;
  border-color: var(--accent, #5865f2);
}
.cog-emoji-strip-btn.is-selected {
  border-color: var(--accent-hover, #7289da);
  background: rgba(88, 101, 242, 0.2);
}
.cog-emoji-strip-btn img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.embed-editors-mount {
  margin-bottom: 16px;
}

.embed-gallery-page {
  margin-top: 4px;
}

.embed-block-section {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
  background: rgba(0, 0, 0, 0.12);
}

.embed-block-section:last-child {
  margin-bottom: 0;
}

.cog-feature-details.is-collapsed {
  display: none;
}

.cog-feature-section--off .cog-feature-details.is-collapsed {
  display: none;
}

.embed-block-section.is-collapsed .embed-block-grid,
.embed-block-section.is-collapsed .embed-block-hint {
  display: none;
}

.embed-block-section.is-collapsed {
  opacity: 0.85;
}

.cog-feature-master {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.cog-feature-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.cog-feature-switch-text strong {
  display: block;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.cog-bool-row-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cog-bool-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.embed-feature-head-toggle {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.embed-feature-head-toggle .hint-text {
  font-size: 12px;
  margin: 0;
}

body[data-dashboard-dev="0"] .dashboard-dev-only {
  display: none !important;
}

.cog-tools-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.cog-tools-actions .btn-primary,
.cog-tools-actions .btn-secondary {
  text-decoration: none;
}

.cog-send-message-panel .form-actions {
  align-items: center;
  gap: 12px;
}

.setup-guide-page .setup-guide-card {
  margin-bottom: 16px;
}

.setup-guide-page .setup-guide-card .card-header {
  display: none;
}

.setup-guide-panel {
  margin-top: 4px;
}

.setup-guide-bodies {
  margin-top: 14px;
}

.setup-guide-section {
  padding-top: 4px;
}

.setup-guide-h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 8px;
}

.setup-guide-h4 {
  font-size: 0.92rem;
  font-weight: 600;
  margin: 16px 0 8px;
  color: var(--text);
}

.setup-guide-lead {
  margin-bottom: 12px;
}

.setup-guide-steps,
.setup-guide-list {
  margin: 0 0 12px 1.15rem;
  padding: 0;
  line-height: 1.55;
}

.setup-guide-steps li,
.setup-guide-list li {
  margin-bottom: 6px;
}

.setup-guide-dash-row {
  margin: 12px 0;
  font-size: 0.9rem;
  line-height: 1.6;
}

.setup-guide-dash-link {
  color: var(--accent);
  text-decoration: none;
}

.setup-guide-dash-link:hover {
  text-decoration: underline;
}

.setup-guide-notes {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius, 8px);
  background: var(--surface-2, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border);
  font-size: 0.88rem;
}

.setup-guide-notes ul {
  margin: 8px 0 0 1.1rem;
  padding: 0;
}

body[data-cog-slug="welcome"] .cog-page-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
}

body[data-cog-slug="welcome"] #cogFormCard {
  order: 1;
}

body[data-cog-slug="welcome"] #embedEditorsMount {
  order: 2;
}


.embed-block-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 6px;
}

.embed-block-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.embed-block-key {
  font-size: 12px;
  color: var(--text-muted);
}

.embed-block-hint {
  margin-bottom: 10px !important;
}

.embed-block-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 460px);
  gap: 20px;
  align-items: start;
}

@media (max-width: 1024px) {
  .embed-block-grid {
    grid-template-columns: 1fr;
  }
}

.embed-block-editor {
  min-width: 0;
}

.embed-block-strip {
  margin-bottom: 8px;
}

.embed-block-preview-col {
  position: sticky;
  top: 12px;
}

@media (max-width: 1024px) {
  .embed-block-preview-col {
    position: static;
  }
}

.hint-text { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

.save-banner {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 13px;
}
.save-banner-ok { background: rgba(59, 165, 93, 0.2); border: 1px solid #3ba55d; color: #b4f0c8; }
.save-banner-err { background: rgba(237, 66, 69, 0.15); border: 1px solid #ed4245; color: #fca5a5; }

.page-title-emoji { margin-right: 8px; }
.cog-status-pill {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
}
.cog-status-pill.cog-loaded { background: rgba(59, 165, 93, 0.2); color: #3ba55d; }
.cog-status-pill.cog-unloaded { background: rgba(237, 66, 69, 0.15); color: #ed4245; }

.reaction-rules-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 6px;
}

.code-inline {
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 12px;
  background: #1e1f22;
  padding: 2px 6px;
  border-radius: 4px;
}
.card-text-muted { color: var(--text-muted); font-size: 14px; line-height: 1.55; }

/* Overview — vanity & rep forms */
.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px 20px;
  margin-top: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.form-hint { font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.vanity-display-box {
  padding: 14px 16px;
  border-radius: 10px;
  background: #1e1f22;
  border: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.5;
}
.vanity-code-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.vanity-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.vanity-code-pill {
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--surface-hover);
  color: var(--accent-hover);
}
.vanity-link {
  color: var(--accent-hover);
  word-break: break-all;
  text-decoration: none;
}
.vanity-link:hover { text-decoration: underline; }

.settings-link-list {
  margin: 0;
  padding-left: 20px;
  color: var(--text-secondary);
  line-height: 1.75;
}
.settings-link-list a { color: var(--accent-hover); text-decoration: none; }
.settings-link-list a:hover { text-decoration: underline; }

.cog-form-section {
  margin-bottom: 22px;
}
.cog-form-section:last-child { margin-bottom: 0; }
.cog-form-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.cog-textarea {
  min-height: 80px;
  resize: vertical;
  font-family: inherit;
}
.cog-json-textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.45;
}
.cog-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
}
.cog-check input { margin-top: 3px; flex-shrink: 0; }

.analytics-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-top: 8px;
  margin-bottom: 0;
  letter-spacing: 0.02em;
}
.analytics-table-wrap { overflow-x: auto; max-height: 360px; overflow-y: auto; }
.analytics-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.analytics-user .lb-avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }

/* =====================================================
   Toasts (guild pages — no Tailwind; used by app.js toast())
   ===================================================== */

.toast {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 10000;
  max-width: min(22rem, calc(100vw - 1.5rem));
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  box-shadow: var(--shadow-elevated);
  animation: toast-in 0.22s var(--ease-out);
  transition: opacity 0.28s ease;
}
.toast--info {
  background: var(--surface);
  color: var(--text-primary);
}
.toast--success {
  background: rgba(59, 165, 93, 0.18);
  border-color: rgba(59, 165, 93, 0.45);
  color: #b4f0c8;
}
.toast--error {
  background: rgba(237, 66, 69, 0.18);
  border-color: rgba(237, 66, 69, 0.45);
  color: #fca5a5;
}
.toast--warn {
  background: rgba(237, 137, 54, 0.15);
  border-color: rgba(237, 137, 54, 0.4);
  color: #fcd9a5;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =====================================================
   Responsive: narrow / tablet — sidebar stacks
   ===================================================== */

@media (max-width: 900px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    max-height: min(42vh, 320px);
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-scroll {
    max-height: min(38vh, 280px);
  }

  .main-content {
    padding-top: 20px;
  }

  .page-header-row {
    flex-direction: column;
    align-items: stretch;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .search-input {
    width: 100%;
    max-width: 100%;
  }
}

/* =====================================================
   Reduced motion
   ===================================================== */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .skeleton {
    animation: none;
    background: var(--surface-hover);
  }

  .toast {
    animation: none;
  }

  .guild-card:hover {
    transform: none;
  }

  .btn-primary:hover {
    transform: none;
  }

  .funnel-bar-fill {
    transition: none;
  }
}
