:root {
  --bg: #0b1020;
  --bg-card: #121a31;
  --border: #1e2b4f;
  --text: #ecf2ff;
  --muted: #99a6c6;
  --primary: #4f7cff;
  --primary-hover: #3f68df;
  --secondary: #1f2e59;
  --danger: #ef4444;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(circle at top, #131d3b, var(--bg) 48%);
  color: var(--text);
  font-family: Inter, Arial, sans-serif;
  min-height: 100vh;
}

.container {
  width: min(1060px, 92vw);
  margin: 40px auto;
  display: grid;
  gap: 18px;
}

.card {
  background: linear-gradient(180deg, #152042 0%, var(--bg-card) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}

.hero h1 { margin: 0 0 10px; font-size: clamp(28px, 5vw, 40px); }
h1,h2,h3 { margin: 0 0 12px; }
p { margin: 0 0 10px; }

.badge {
  display: inline-block;
  background: #1c2850;
  border: 1px solid #2e4180;
  color: #c7d6ff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  margin-bottom: 10px;
}

.muted { color: var(--muted); }

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0;
  margin: 0 0 14px;
  background: transparent;
  border: none;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.section-toggle-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid #40558f;
  color: #cfe0ff;
  flex-shrink: 0;
}

label {
  display: block;
  margin: 10px 0 6px;
  color: #c9d6f7;
  font-size: 14px;
}

input, textarea, select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #314374;
  background: #0e1730;
  color: var(--text);
  padding: 11px 12px;
}

textarea { resize: vertical; min-height: 100px; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border: none;
  border-radius: 12px;
  padding: 11px 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease;
  color: #fff;
  margin-top: 10px;
}

.btn.primary { background: var(--primary); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.secondary { background: var(--secondary); }
.btn.ghost { border: 1px solid #40558f; background: transparent; color: #cfe0ff; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.bot-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

.bot-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #0e1730;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 8px;
}

.guild-card {
  align-items: center;
}

.guild-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: #0a1226;
}

.guild-icon-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #cfe0ff;
  font-weight: 700;
}

.bot-card-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bot-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.online { background: #22c55e; box-shadow: 0 0 6px #22c55e80; }
.status-dot.offline { background: #6b7280; }

.btn.full { width: 100%; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #dc2626; }
.btn.danger-sm {
  background: var(--danger);
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 8px;
  margin-top: 0;
}
.btn.secondary-sm {
  background: var(--secondary);
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 8px;
  margin-top: 0;
}
.btn.ghost-sm {
  border: 1px solid #40558f;
  background: transparent;
  color: #cfe0ff;
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 8px;
  margin-top: 0;
}
.btn.danger-sm:hover { background: #dc2626; }
.btn.primary-sm {
  background: var(--primary);
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 8px;
  margin-top: 0;
}
.btn.primary-sm:hover { background: var(--primary-hover); }
.small { font-size: 13px; }

.inline-spinner {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 999px;
  display: inline-block;
  margin-right: 8px;
  animation: spin .75s linear infinite;
  vertical-align: -2px;
}

.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.action-row.compact {
  margin-top: 0;
  justify-content: flex-end;
}

.setup-box {
  margin-top: 10px;
  padding: 12px;
  border: 1px dashed #40558f;
  border-radius: 12px;
  background: rgba(79, 124, 255, 0.08);
}

.setup-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.setup-empty {
  padding: 16px;
  border: 1px dashed #40558f;
  border-radius: 12px;
  color: var(--muted);
  background: rgba(79, 124, 255, 0.04);
}

.setup-guild-list,
.setup-sections {
  display: grid;
  gap: 14px;
}

.setup-sections {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 12px;
}

.setup-card {
  background: #0e1730;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}

.setup-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.setup-card-head h3 {
  margin-bottom: 6px;
}

.setup-grid {
  display: grid;
  gap: 12px;
}

.setup-grid.two-cols {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.setup-grid.compact-grid {
  margin-top: 12px;
}

.span-2 {
  grid-column: 1 / -1;
}

.setup-state {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  border: 1px solid transparent;
}

.setup-state.is-on {
  background: rgba(34, 197, 94, 0.12);
  color: #bbf7d0;
  border-color: rgba(34, 197, 94, 0.28);
}

.setup-state.is-off {
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.28);
}

.notice-success { border-color: #14532d; background: #0d2a1a; color: #d1fae5; }
.notice-error { border-color: #7f1d1d; background: #3b0f15; color: #fecaca; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 820px) {
  .grid-2 { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .bot-card { flex-direction: column; align-items: flex-start; }
  .action-row.compact { width: 100%; justify-content: stretch; }
  .setup-header { flex-direction: column; }
  .setup-sections,
  .setup-grid.two-cols { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
}
