:root {
  --bg: #1e1f22;
  --panel: #2b2d31;
  --panel-2: #313338;
  --border: #3f4147;
  --text: #f2f3f5;
  --muted: #a5a9b1;
  --accent: #5865f2;
  --accent-soft: rgba(88, 101, 242, 0.2);
  --green: #3ba55d;
  --red: #ed4245;
  --yellow: #f0b232;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: #00a8fc; text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 1rem; }
h2 { font-size: 1.05rem; margin: 0 0 0.75rem; }
.muted { color: var(--muted); font-size: 0.9em; }

.topbar {
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
  padding: 0.75rem 1.5rem; background: var(--panel); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; color: var(--text); font-size: 1.1rem; }
.tabs { display: flex; gap: 0.25rem; }
.tabs a { color: var(--muted); padding: 0.35rem 0.8rem; border-radius: 6px; }
.tabs a.active, .tabs a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.user { margin-left: auto; display: flex; align-items: center; gap: 0.6rem; }
.user img { border-radius: 50%; }
.user form { margin: 0; }

main { max-width: 1200px; margin: 0 auto; padding: 1.5rem 16px 4rem; }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 1.1rem 1.25rem; margin-bottom: 1rem; min-width: 0; }
.grid { display: grid; gap: 1rem; }
.grid > .card { margin-bottom: 0; }
.grid + .card, .grid + .grid { margin-top: 1rem; }
.grid.stats { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.grid.guilds { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

.stat { display: flex; flex-direction: column; gap: 0.15rem; }
.stat .label { color: var(--muted); font-size: 0.85rem; }
.stat .value { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .sub { color: var(--muted); font-size: 0.8rem; }

.guild { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; text-align: center; }
.guild img, .noicon { border-radius: 50%; width: 64px; height: 64px; }
.noicon { background: var(--panel-2); display: grid; place-items: center; font-weight: 700; }
.round { border-radius: 50%; }
.page-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }

canvas { width: 100% !important; height: 240px !important; }

.lockdown { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-left: 4px solid var(--green); }
.lockdown.on { border-left-color: var(--red); }
.lockdown div { display: flex; flex-direction: column; }
.lockdown form { margin: 0; }

table { width: 100%; border-collapse: collapse; }
td, th { padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 0.85rem; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.card:has(table.list) { overflow-x: auto; }
.tag { display: inline-block; padding: 0.05rem 0.5rem; border-radius: 999px; font-size: 0.8rem; background: var(--panel-2); }
.tag.ban, .tag.kick { background: rgba(237, 66, 69, 0.2); color: #ff8a8c; }
.tag.timeout, .tag.warn { background: rgba(240, 178, 50, 0.2); color: #ffd27a; }
.tag.verify, .tag.unban, .tag.untimeout { background: rgba(59, 165, 93, 0.2); color: #7ee2a0; }

.btn {
  display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 6px;
  padding: 0.55rem 1.1rem; font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { filter: brightness(1.1); text-decoration: none; }
.btn.small { padding: 0.3rem 0.75rem; font-size: 0.9rem; }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn.danger { background: var(--red); }

.flash { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.flash.ok { background: rgba(59, 165, 93, 0.15); border: 1px solid var(--green); }
.flash.error { background: rgba(237, 66, 69, 0.15); border: 1px solid var(--red); }
.flash.warn { background: rgba(240, 178, 50, 0.12); border: 1px solid var(--yellow); }

.jump { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.jump a { background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: 0.2rem 0.8rem; font-size: 0.9rem; }

.settings { scroll-margin-top: 70px; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 0.9rem 1.25rem; margin: 1rem 0; }
.fields label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; color: var(--muted); }
.fields label.check { flex-direction: row; align-items: center; gap: 0.5rem; color: var(--text); }
.fields label.wide, .inline-action { grid-column: 1 / -1; }
.inline-action { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
small { color: var(--muted); font-size: 0.8rem; }
input[type=number], select, textarea {
  background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px;
  padding: 0.45rem 0.6rem; font: inherit; width: 100%;
}
input[type=checkbox] { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }
textarea { resize: vertical; font-family: ui-monospace, monospace; font-size: 0.9rem; }
.filter { display: flex; gap: 0.5rem; margin-bottom: 1rem; max-width: 400px; }

.hero { text-align: center; padding: 5rem 1rem; }
.hero h1 { font-size: 2.2rem; }
.hero p { color: var(--muted); max-width: 520px; margin: 0 auto 1.5rem; }

@media (max-width: 640px) {
  .topbar { padding: 0.6rem 16px; gap: 0.75rem; }
  .user span { display: none; }
}

/* Tickets */
.jump a.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.ticket-head { justify-content: space-between; }
.chat { max-height: 60vh; overflow-y: auto; display: flex; flex-direction: column; gap: 0.75rem; }
.msg { background: var(--panel-2); border-radius: 10px; padding: 0.6rem 0.85rem; max-width: 85%; align-self: flex-start; }
.msg.staff { align-self: flex-end; background: rgba(88, 101, 242, 0.18); }
.msg .meta { font-size: 0.85rem; margin-bottom: 0.2rem; }
.msg .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .files { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.35rem; font-size: 0.9rem; }
.reply label, label.stack { display: flex; flex-direction: column; gap: 0.35rem; color: var(--muted); font-size: 0.9rem; margin-bottom: 0.75rem; }
input[type=text] {
  background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px;
  padding: 0.45rem 0.6rem; font: inherit; width: 100%;
}

/* Vouches */
.stars { color: #f1c40f; letter-spacing: 1px; }
.stat .value.small { font-size: 1.1rem; }
.mt { margin-top: 1rem; }
.bar-cell { width: 60%; }
progress.bar { width: 100%; height: 10px; border: 0; border-radius: 999px; overflow: hidden; background: var(--panel-2); appearance: none; }
progress.bar::-webkit-progress-bar { background: var(--panel-2); }
progress.bar::-webkit-progress-value { background: #f1c40f; }
progress.bar::-moz-progress-bar { background: #f1c40f; }
form.inline { margin: 0; }
