:root {
  color-scheme: dark;
  --bg: #101113;
  --panel: #17191d;
  --panel-soft: #1d2026;
  --text: #f2f4f8;
  --muted: #9aa3b2;
  --line: #2a2f38;
  --accent: #65d6ad;
  --accent-strong: #31b889;
  --danger: #ff7b7b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100svh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100svh;
  border-right: 1px solid var(--line);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  background: #0d0e10;
}

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

.brand-mark,
.guild-icon {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #07120e;
  font-weight: 800;
  overflow: hidden;
}

.brand small,
.guild-row small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.sidebar nav {
  display: grid;
  gap: 8px;
}

.sidebar nav a {
  padding: 10px 0;
  color: var(--muted);
}

.sidebar nav a:hover {
  color: var(--text);
}

.sidebar-note {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 18px rgba(101, 214, 173, 0.7);
}

.content {
  padding: 48px;
  max-width: 1120px;
  width: 100%;
}

.page-heading {
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 12px;
  font-weight: 800;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: 44px;
  line-height: 1.05;
  margin-bottom: 12px;
}

h2 {
  font-size: 18px;
  margin-bottom: 6px;
}

.muted,
.section-heading p {
  color: var(--muted);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  margin-bottom: 28px;
}

.metrics div {
  background: var(--panel);
  padding: 18px;
}

.metrics span {
  display: block;
  color: var(--accent);
  font-weight: 800;
  margin-bottom: 8px;
}

.metrics strong {
  font-size: 14px;
  color: var(--muted);
}

.guild-list {
  border-top: 1px solid var(--line);
}

.guild-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.guild-row:hover .row-arrow,
.back-link:hover {
  color: var(--accent);
}

.primary-link {
  display: inline-block;
  margin-top: 12px;
  border-radius: 8px;
  background: var(--accent);
  color: #07120e;
  font-weight: 800;
  padding: 10px 14px;
}

.primary-link:hover {
  background: var(--accent-strong);
}

.guild-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.guild-icon.large {
  width: 64px;
  height: 64px;
  font-size: 24px;
}

.row-arrow,
.back-link {
  color: var(--muted);
  font-size: 14px;
}

.guild-title {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 18px;
}

.config-grid {
  display: grid;
  gap: 18px;
}

.panel-section,
.login-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 24px;
}

.panel-section {
  display: grid;
  gap: 16px;
}

.section-heading {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.field-label {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.field-help {
  margin: -4px 0 10px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  padding: 12px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(101, 214, 173, 0.15);
}

.toggle {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  color: var(--text);
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.inline-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 16px;
  max-height: 260px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.ai-status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.command-catalog {
  margin-top: 22px;
}

.command-group {
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.command-group:last-child {
  border-bottom: 0;
}

.command-group summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
}

.command-group summary span {
  color: var(--accent);
  font-size: 13px;
}

.command-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 18px;
  padding: 14px 0 6px;
}

.command-list div {
  display: grid;
  gap: 4px;
}

.command-list small {
  color: var(--muted);
  line-height: 1.4;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #07120e;
  font-weight: 800;
  padding: 12px 16px;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.login-panel {
  max-width: 560px;
  margin: 10svh auto 0;
  display: grid;
  gap: 24px;
}

.stack {
  display: grid;
  gap: 16px;
}

.flash,
.form-error,
.empty {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px 16px;
}

.flash {
  border-color: rgba(101, 214, 173, 0.5);
  margin-bottom: 20px;
}

.form-error {
  color: var(--danger);
}

code {
  color: var(--accent);
}

@media (max-width: 820px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 18px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar nav {
    display: flex;
    gap: 18px;
  }

  .sidebar-note {
    display: none;
  }

  .content {
    padding: 28px 18px;
  }

  h1 {
    font-size: 34px;
  }

  .metrics {
    grid-template-columns: 1fr;
  }
}
