:root {
  --bg: #0f1412;
  --bg-elev: #171e1b;
  --bg-soft: #1e2723;
  --line: #2c3832;
  --text: #e8eee9;
  --muted: #9aaba1;
  --accent: #c4a35a;
  --accent-2: #6f9e7a;
  --danger: #c45c5c;
  --ok: #6f9e7a;
  --radius: 10px;
  --font: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 10% -10%, #1c2a22 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #2a2418 0%, transparent 50%),
    var(--bg);
  color: var(--text);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }

.shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: rgba(12, 16, 14, 0.92);
  border-right: 1px solid var(--line);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.brand { display: flex; flex-direction: column; gap: 0.15rem; padding: 0 0.5rem; }
.brand-mark {
  font-weight: 600;
  letter-spacing: 0.12em;
  font-size: 1.1rem;
  color: var(--accent);
}
.brand-sub { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; }

.sidebar nav { display: flex; flex-direction: column; gap: 0.25rem; }
.sidebar nav a {
  color: var(--muted);
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  text-decoration: none;
}
.sidebar nav a:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.sidebar nav a.active { background: var(--bg-soft); color: var(--text); border-left: 3px solid var(--accent); }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 0.5rem; padding: 0 0.5rem; }
.user-chip { color: var(--muted); font-size: 0.85rem; word-break: break-all; }
.logout { font-size: 0.85rem; }

.main { padding: 2rem; max-width: 1100px; }

.page-head { margin-bottom: 1.5rem; }
.page-head h1 { margin: 0 0 0.35rem; font-size: 1.75rem; font-weight: 600; }
.page-head p { margin: 0; color: var(--muted); }

.panel, .card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.panel h2, .card h2, .card h3 { margin: 0 0 0.85rem; font-size: 1rem; font-weight: 600; color: var(--accent); }

.grid.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.grid.two {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.stat { font-size: 1.35rem; font-weight: 600; margin: 0; }
.stat.muted { color: var(--muted); font-size: 1rem; font-weight: 500; }

.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.65rem; }
.checklist li { display: grid; grid-template-columns: 48px 100px 1fr; gap: 0.75rem; align-items: start; }
.checklist .ok, .checklist .bad {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  text-align: center;
}
.checklist .ok { background: rgba(111, 158, 122, 0.2); color: var(--ok); }
.checklist .bad { background: rgba(196, 92, 92, 0.2); color: var(--danger); }
.checklist code { color: var(--muted); word-break: break-all; }

.pill-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pill-list li {
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
  border: 1px solid var(--line);
}
.pill-list li.on { background: rgba(111, 158, 122, 0.15); color: var(--ok); }
.pill-list li.off { color: var(--muted); }

.stack { display: flex; flex-direction: column; gap: 0.85rem; }
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field span { color: var(--muted); font-size: 0.85rem; }
.field input, .field select {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  font: inherit;
}
.field input:focus, .field select:focus {
  outline: 2px solid rgba(196, 163, 90, 0.35);
  border-color: var(--accent);
}

.toggles { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; }
.toggle { display: flex; align-items: center; gap: 0.45rem; color: var(--text); }

.inline-form { display: flex; gap: 0.75rem; align-items: end; flex-wrap: wrap; margin-bottom: 1rem; }
.inline-form .grow { flex: 1; min-width: 220px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  padding: 0.7rem 1.1rem;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(1.05); }
.btn.primary { background: var(--accent); color: #1a1510; }
.btn.success { background: var(--accent-2); color: #0d1510; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.discord { background: #5865f2; color: #fff; width: 100%; }

.flash {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
}
.flash.ok { background: rgba(111, 158, 122, 0.15); color: #c6e0cc; }
.flash.err { background: rgba(196, 92, 92, 0.15); color: #efc1c1; }

.balance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}
.balance-grid .meta { grid-column: 1 / -1; color: var(--muted); margin: 0 0 0.25rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.65rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}
.login-panel {
  width: min(420px, 100%);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 2rem;
}
.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--accent);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 600;
}
.login-panel h1 { margin: 0 0 0.5rem; font-size: 1.8rem; }
.lede { color: var(--muted); margin: 0 0 1.5rem; }

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .checklist li { grid-template-columns: 48px 1fr; }
  .checklist li code { grid-column: 1 / -1; }
}
