:root {
  color-scheme: dark;
  --bg: #06142f;
  --bg2: #0b1f4d;
  --panel: rgba(15, 42, 102, 0.84);
  --panel-soft: rgba(8, 27, 68, 0.92);
  --line: rgba(255, 255, 255, 0.15);
  --line-strong: rgba(147, 197, 253, 0.5);
  --text: #f8fbff;
  --muted: #b7cdfb;
  --blue: #3b82f6;
  --blue2: #2563eb;
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.18), transparent 24%),
    linear-gradient(135deg, var(--bg), var(--bg2));
  color: var(--text);
}

button, input, select, textarea { font: inherit; letter-spacing: 0; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p, span, strong, small { overflow-wrap: anywhere; }

.toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 999;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 28px));
}

.toast {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
  font-weight: 800;
}

.toast.success { background: rgba(20, 83, 45, 0.95); border-color: rgba(34, 197, 94, 0.55); }
.toast.error { background: rgba(127, 29, 29, 0.96); border-color: rgba(239, 68, 68, 0.55); }
.toast.info { background: rgba(14, 55, 133, 0.96); border-color: rgba(96, 165, 250, 0.55); }

.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: rgba(6, 20, 47, 0.9);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  font-weight: 900;
}

.brand-mark {
  width: 48px;
  height: 48px;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid rgba(147, 197, 253, 0.28);
  background: linear-gradient(180deg, rgba(16, 41, 94, 0.98), rgba(8, 27, 68, 0.94));
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.28);
  flex: 0 0 auto;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.brand-copy strong {
  display: block;
  font-size: 16px;
  line-height: 1.15;
}

.brand-copy small {
  color: #93c5fd;
  font-size: 12px;
  font-weight: 800;
}

.nav {
  display: grid;
  gap: 8px;
  margin-top: 28px;
}

.nav a,
.invite,
.site-link {
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.nav a:hover,
.invite:hover,
.site-link:hover {
  transform: translateY(-1px);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.95fr);
  align-items: stretch;
  gap: 18px;
  padding: 24px;
}

.hero-copy {
  display: grid;
  align-content: center;
  gap: 14px;
}

.hero-copy .actions {
  margin-top: 6px;
}

.hero-visual {
  border-radius: 8px;
  border: 1px solid rgba(147, 197, 253, 0.24);
  background: linear-gradient(180deg, rgba(11, 31, 77, 0.98), rgba(7, 22, 58, 0.94));
  padding: 20px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 16px;
}

.hero-logo {
  width: 86px;
  height: 86px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid rgba(147, 197, 253, 0.24);
  background: rgba(37, 99, 235, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.hero-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.hero-visual-copy {
  display: grid;
  gap: 10px;
}

.hero-visual-copy h2 {
  font-size: 28px;
  line-height: 1.15;
}

.hero-visual-copy .lead {
  margin: 0;
}

.nav a,
.invite,
.site-link {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--muted);
  border: 1px solid transparent;
}

.nav a:hover,
.nav a.active {
  color: white;
  background: rgba(59, 130, 246, 0.22);
  border-color: var(--line);
}

.invite {
  margin-top: 28px;
  justify-content: center;
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--blue2));
  font-weight: 800;
}

.site-link {
  margin-top: 10px;
  justify-content: center;
  border-color: var(--line);
  background: rgba(9, 31, 75, 0.9);
  color: #dbeafe;
  font-weight: 800;
}

.invite:hover,
.site-link:hover,
.button:hover {
  border-color: var(--line-strong);
}

.main {
  width: min(1360px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.hero,
.api-card,
.panel,
.stats article,
.detail-card,
.feature-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.24);
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: #93c5fd;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

h1 { margin: 0; font-size: 36px; line-height: 1.05; }
h2 { margin: 0; font-size: 24px; }
h3 { margin: 0; font-size: 19px; }

.lead,
.status-copy,
.home-copy p,
.api-card p,
.user-box {
  color: var(--muted);
  line-height: 1.6;
}

.actions,
.button-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: white;
  background: rgba(18, 58, 144, 0.88);
  cursor: pointer;
}

.button.primary { background: linear-gradient(135deg, var(--blue), var(--blue2)); font-weight: 800; }
.button.secondary { background: rgba(9, 31, 75, 0.9); }
.button.ghost { background: transparent; }
.button.danger { background: linear-gradient(135deg, var(--red), #b91c1c); }
.button.warning { background: linear-gradient(135deg, var(--amber), #b45309); }
.button:disabled { opacity: 0.55; cursor: not-allowed; }
.hidden { display: none !important; }

.api-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 520px);
  gap: 16px;
  align-items: center;
  margin-top: 14px;
  padding: 18px;
}

.api-note {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(6, 20, 47, 0.74);
  color: #dbeafe;
  text-align: center;
  font-weight: 800;
}

input, select, textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(6, 20, 47, 0.92);
  color: white;
}

input, select { min-height: 42px; padding: 0 11px; }
textarea { padding: 11px; resize: vertical; }
select[multiple] {
  min-height: 150px;
  padding: 10px;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(147, 197, 253, 0.45);
  outline-offset: 1px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.stats article {
  min-height: 86px;
  padding: 16px;
}

.stats span, label { color: var(--muted); }
.stats strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.owner-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 14px 0;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid rgba(147, 197, 253, 0.45);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.42), rgba(37, 99, 235, 0.24));
  color: #dbeafe;
}

.owner-banner strong { color: white; white-space: nowrap; }

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 370px) minmax(0, 1fr);
  gap: 14px;
}

.panel { padding: 18px; margin-top: 14px; }
.workspace .panel { margin-top: 0; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-head.compact { margin-bottom: 10px; }

.user-box {
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(6, 20, 47, 0.7);
}

.user-box.sync-warning {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(120, 53, 15, 0.28);
  color: #fde68a;
}

.guild-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  max-height: 560px;
  overflow: auto;
}

.guild-section { display: grid; gap: 10px; }
.guild-section-title {
  color: #dbeafe;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.guild-grid { display: grid; gap: 10px; }

.guild-btn {
  width: 100%;
  min-height: 96px;
  padding: 12px;
  display: grid;
  gap: 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(6, 20, 47, 0.76);
  color: white;
  text-align: left;
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.guild-btn.active,
.guild-btn:hover { border-color: var(--line-strong); }
.guild-btn.active,
.guild-btn:hover {
  transform: translateY(-1px);
  background: rgba(8, 28, 71, 0.92);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.24);
}
.guild-btn.locked { opacity: 0.72; cursor: not-allowed; }
.guild-btn.locked:hover {
  transform: none;
  box-shadow: none;
}

.guild-top {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.server-avatar {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: rgba(37, 99, 235, 0.3);
}

.server-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.server-avatar.fallback { color: white; font-weight: 900; font-size: 18px; }

.guild-info { min-width: 0; display: grid; gap: 4px; }
.guild-id { color: var(--muted); font-size: 12px; }

.guild-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.guild-count { color: #dbeafe; }
.server-state, .owner-pill { color: #93c5fd; font-weight: 800; }
.guild-btn.locked .server-state { color: #fca5a5; }

.overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.overview-grid div,
.mini-stat {
  min-height: 76px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(6, 20, 47, 0.7);
  border: 1px solid var(--line);
}

.overview-grid span,
.mini-stat span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.home-copy {
  margin: 16px 0 6px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.feature-card,
.detail-card {
  padding: 16px;
  background: linear-gradient(180deg, rgba(10, 30, 79, 0.96), rgba(7, 22, 58, 0.92));
  transition: border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.feature-card:hover,
.detail-card:hover,
.panel:hover {
  border-color: var(--line-strong);
  box-shadow: 0 20px 68px rgba(0, 0, 0, 0.28);
}

.feature-card:hover,
.detail-card:hover {
  transform: translateY(-1px);
}

.feature-card h3,
.detail-card h3 {
  margin-bottom: 8px;
}

.feature-card p,
.detail-card p {
  margin: 0 0 12px;
}

.detail-card {
  position: relative;
}

.feature-card .button {
  width: 100%;
}

.stack-list {
  display: grid;
  gap: 10px;
}

.stack-item {
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(6, 20, 47, 0.62);
}

.stack-item h4 {
  margin: 0 0 8px;
  font-size: 16px;
}

.stack-item p {
  margin: 0 0 10px;
}

.stack-item .button-row {
  margin-top: 10px;
}

.empty-state {
  padding: 14px;
  border-radius: 8px;
  border: 1px dashed var(--line);
  color: var(--muted);
  background: rgba(6, 20, 47, 0.45);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(6, 20, 47, 0.7);
  font-size: 13px;
  font-weight: 900;
}

.status-badge.enabled { color: #bbf7d0; border-color: rgba(34, 197, 94, 0.45); background: rgba(20, 83, 45, 0.65); }
.status-badge.disabled { color: #fecaca; border-color: rgba(239, 68, 68, 0.45); background: rgba(127, 29, 29, 0.55); }
.status-badge.setup { color: #fde68a; border-color: rgba(245, 158, 11, 0.45); background: rgba(120, 53, 15, 0.55); }
.status-badge.premium { color: #bfdbfe; border-color: rgba(96, 165, 250, 0.45); background: rgba(30, 64, 175, 0.55); }
.status-badge.neutral { color: #dbeafe; }

pre {
  min-height: 170px;
  max-height: 360px;
  overflow: auto;
  margin: 16px 0 0;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #06142f;
  color: #dbeafe;
  white-space: pre-wrap;
  font-family: Consolas, monospace;
  font-size: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.single-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
label { display: grid; gap: 7px; font-size: 14px; }
.full { grid-column: 1 / -1; }
.field-help {
  color: #93c5fd;
  font-size: 12px;
  line-height: 1.4;
}

.asset-group {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(6, 20, 47, 0.52);
}

.asset-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.asset-copy {
  min-width: 220px;
  display: grid;
  gap: 6px;
}

.asset-copy strong {
  color: #eff6ff;
  font-size: 14px;
}

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

.asset-actions input[type="file"] {
  width: min(100%, 280px);
  min-height: auto;
  padding: 9px 10px;
}

.asset-preview {
  overflow: hidden;
  border: 1px solid rgba(96, 165, 250, 0.28);
  border-radius: 8px;
  background: rgba(4, 14, 34, 0.94);
}

.asset-preview img {
  width: 100%;
  max-height: 220px;
  display: block;
  object-fit: contain;
  background: rgba(2, 6, 23, 0.9);
}

.toggle-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.toggle-grid label,
.toggle-line,
.check-card {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(6, 20, 47, 0.7);
}

.toggle-grid input,
.toggle-line input,
.check-card input {
  width: auto;
  min-height: auto;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.backup-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 1180px) {
  .feature-grid,
  .backup-grid,
  .check-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .hero {
    grid-template-columns: 1fr;
  }
  .nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .api-card,
  .workspace,
  .feature-grid,
  .backup-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .main { padding: 14px; }
  .hero, .panel-head, .owner-banner {
    align-items: flex-start;
    flex-direction: column;
  }
  .hero-visual {
    width: 100%;
  }
  .stats,
  .form-grid,
  .toggle-grid,
  .overview-grid,
  .nav,
  .check-grid,
  .single-grid {
    grid-template-columns: 1fr;
  }
  .button,
  .actions,
  .button-row,
  .site-link,
  .invite {
    width: 100%;
  }
  .toast-stack {
    top: 12px;
    right: 12px;
    width: min(360px, calc(100vw - 24px));
  }
}
