: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; }

/* ---------- Generator ---------- */
.tag.free { background: rgba(88, 101, 242, 0.2); color: #a8b0ff; }
.tag.premium { background: rgba(241, 196, 15, 0.2); color: #ffd966; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.danger-zone { border-color: rgba(237, 66, 69, 0.5); }
code.item { font-size: 0.85rem; word-break: break-all; white-space: pre-wrap; }
details summary { cursor: pointer; }
input[type=color] { width: 100%; height: 2.3rem; padding: 0.15rem; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.file-btn { cursor: pointer; }
.stock-add textarea { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }

.builder-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; margin: 1rem 0; align-items: start; }
.builder-grid .fields { margin-top: 0; }
@media (max-width: 900px) { .builder-grid { grid-template-columns: minmax(0, 1fr); } }
.placeholders { display: flex; flex-direction: column; gap: 0.4rem; }
.placeholders div { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.ph { background: var(--accent-soft); color: #c9cdfb; border: 0; border-radius: 4px; padding: 0.2rem 0.5rem; font: inherit; font-size: 0.8rem; cursor: pointer; font-family: ui-monospace, monospace; }
.ph:hover { background: var(--accent); color: #fff; }
.preview-col { position: sticky; top: 1rem; display: flex; flex-direction: column; gap: 0.4rem; }

.discord-msg { display: flex; gap: 0.9rem; background: #313338; border-radius: 8px; padding: 1rem; }
.discord-msg .avatar { border-radius: 50%; flex: none; }
.msg-body { min-width: 0; flex: 1; }
.msg-head { margin-bottom: 0.3rem; font-size: 0.95rem; }
.msg-head .muted { font-size: 0.75rem; }
.bot-tag { background: var(--accent); color: #fff; font-size: 0.65rem; font-weight: 700; padding: 0.05rem 0.3rem; border-radius: 3px; vertical-align: middle; }
.embed-preview {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; max-width: 520px;
  background: #2b2d31; border-left: 4px solid var(--accent); border-radius: 4px; padding: 0.6rem 1rem 0.9rem 0.75rem;
  font-size: 0.9rem; line-height: 1.375;
}
.e-main { min-width: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.e-main > :empty { display: none; }
.e-title { font-weight: 700; font-size: 1rem; }
.e-desc { overflow-wrap: anywhere; }
.e-desc code, .e-title code { background: #1e1f22; padding: 0 0.2rem; border-radius: 3px; font-size: 0.85em; }
.embed-preview pre { background: #1e1f22; border: 1px solid #1a1b1e; border-radius: 4px; padding: 0.5rem; margin: 0.25rem 0 0; white-space: pre-wrap; word-break: break-all; font-size: 0.8rem; }
.e-desc .quote { display: block; border-left: 4px solid #4e5058; padding-left: 0.6rem; }
.e-field strong { font-size: 0.85rem; }
.e-image { max-width: 100%; border-radius: 4px; }
.e-thumb { width: 80px; height: 80px; object-fit: cover; border-radius: 4px; }
.e-footer { font-size: 0.75rem; color: var(--muted); }
[hidden] { display: none !important; }
.account-only { margin-bottom: 1rem; }
.field-list { display: flex; flex-direction: column; gap: 0.4rem; max-width: 420px; margin-bottom: 0.6rem; }
.field-row { display: flex; gap: 0.4rem; }
.inline-action label.sep { display: flex; align-items: center; gap: 0.4rem; color: var(--muted); font-size: 0.9rem; }
.inline-action label.sep input { width: 4.5rem; }
.e-fields.inline { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.5rem; }
input.short { width: 12rem; }
.store-table input[type=text], .store-table input[type=number] { width: 100%; min-width: 4rem; }
.store-table input.emoji { width: 4rem; min-width: 0; }
.store-table input.price { min-width: 6rem; }
.store-table input.stock { width: 6rem; }
.store-table td.center { text-align: center; }
.store-table tr.out input[name=stock] { border-color: var(--red); }
.store-table tr.new-row td { padding-top: 1rem; color: var(--muted); }
.store-table .btn.small + .btn.small { margin-left: 0.25rem; }
.btn:disabled { opacity: 0.4; cursor: default; }
.checklist { display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.9rem; color: var(--muted); }
.checklist input[type=search] { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 0.4rem 0.6rem; font: inherit; max-width: 320px; }
.checklist-items {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.25rem 1rem;
  max-height: 220px; overflow-y: auto; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 0.5rem 0.75rem;
}
.checklist-items label.check { display: flex; align-items: center; gap: 0.45rem; color: var(--text); padding: 0.15rem 0; cursor: pointer; }
.up { color: #7ee2a0; }
.down { color: #ff8a8c; }
